lmi-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[lmi-commits] [lmi] master e4d4ecf 4/4: Avoid accidentally focusing wron


From: Greg Chicares
Subject: [lmi-commits] [lmi] master e4d4ecf 4/4: Avoid accidentally focusing wrong window in GUI tests
Date: Sat, 24 Mar 2018 08:21:47 -0400 (EDT)

branch: master
commit e4d4ecfc35b3bac9f2b266947778bcd3cbf5f1f1
Author: Vadim Zeitlin <address@hidden>
Commit: Gregory W. Chicares <address@hidden>

    Avoid accidentally focusing wrong window in GUI tests
    
    Use wxWindow::FindWindow(), which considers only the name of the window,
    instead of FindWindowByName(), which falls back to the window label if
    no window with the given name is found. This behaviour was unhelpful as
    the function could find a wrong window (e.g. the static label preceding
    the control instead of the control itself) if a label, instead of name,
    was accidentally used as its argument.
---
 main_wx_test.cpp            | 2 +-
 wx_test_input_sequences.cpp | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/main_wx_test.cpp b/main_wx_test.cpp
index 31b35a0..5fa6d22 100644
--- a/main_wx_test.cpp
+++ b/main_wx_test.cpp
@@ -566,7 +566,7 @@ void wx_base_test_case::skip_if_not_distribution()
 wxWindow* wx_test_focus_controller_child(MvcController& dialog, char const* 
name)
 {
     // First find the window anywhere inside the dialog.
-    wxWindow* const w = wxWindow::FindWindowByName(name, &dialog);
+    wxWindow* const w = dialog.FindWindow(name);
     LMI_ASSERT_WITH_MSG(w, "window named \"" << name << "\" not found");
 
     // Then find the book control containing it by walking up the window chain
diff --git a/wx_test_input_sequences.cpp b/wx_test_input_sequences.cpp
index ab0e64e..eb41a97 100644
--- a/wx_test_input_sequences.cpp
+++ b/wx_test_input_sequences.cpp
@@ -97,7 +97,7 @@ LMI_WX_TEST_CASE(input_sequences)
             wxYield();
 
             char const* const field_name = test_data_.field;
-            if(!wxWindow::FindWindowByName(field_name, dialog))
+            if(!dialog->FindWindow(field_name))
                 {
                 // Check whether the field name is valid at all. If it
                 // isn't, then the input model must have changed, so



reply via email to

[Prev in Thread] Current Thread [Next in Thread]