lmi
[Top][All Lists]
Advanced

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

[lmi] wx_test_focus_controller_child() assertion not firing


From: Greg Chicares
Subject: [lmi] wx_test_focus_controller_child() assertion not firing
Date: Fri, 23 Mar 2018 00:53:20 +0000
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0

I just pushed a change that sets two input fields in a GUI test.
At first, I made the mistake of specifying the fields by label
rather than by name, e.g.:

---------8<--------8<--------8<--------8<--------8<--------8<--------8<-------
diff --git a/wx_test_pdf_create.cpp b/wx_test_pdf_create.cpp
index 03293302..8a476850 100644
--- a/wx_test_pdf_create.cpp
+++ b/wx_test_pdf_create.cpp
@@ -73,7 +73,7 @@ LMI_WX_TEST_CASE(pdf_illustration)
             dialog->Show();
             wxYield();
 
-            wx_test_focus_controller_child(*dialog, "SpecifiedAmount");
+            wx_test_focus_controller_child(*dialog, "Specified amount");
 
             wxUIActionSimulator ui;
             ui.Text("1000000000");
--------->8-------->8-------->8-------->8-------->8-------->8-------->8-------

That didn't have the desired effect: instead of changing the contents
of the field to the string specified, it changed the "Salary multiple"
field, which is the first control on the page where "SpecifiedAmount"
is found. And it changed it in a way I hadn't expected: I thought it
would replace any existing contents with the new string, but instead
it prepended the new string to the old contents. (I observed that by
calling wxMilliSleep(3000) after each field change.)

There was no indication of any problem on the console:

/opt/lmi/bin[0]$wine ./wx_test --ash_nazg --data_path=/opt/lmi/data 
--pyx=only_new_pdf -t pdf_illustration
NOTE: starting the test suite
pdf_illustration: started
time=5090ms (for pdf_illustration)
pdf_illustration: ok
time=5091ms (for all tests)
SUCCESS: 1 test successfully completed.

I figured that I should add a test for argument validity to
wx_test_focus_controller_child()...but there's one already:

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);
    LMI_ASSERT_WITH_MSG(w, "window named \"" << name << "\" not found");

What happened? wxWindow::FindWindowByName() did find and focus the
correct tab, but not the intended field. And, when I initially
make the same mistake for another field:
-            wx_test_focus_controller_child(*dialog, "Payment");
+            wx_test_focus_controller_child(*dialog, "Individual payment");
and added wxMilliSleep(3000) so I could see the effect, the test
navigated to the correct tab for that field as well--and, I guess,
tried to modify the first control on that tab, without effect
because that field is a combobox that allows only enumerated
values.



reply via email to

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