lmi-commits
[Top][All Lists]
Advanced

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

[lmi-commits] [6117] Refactor for reuse


From: Greg Chicares
Subject: [lmi-commits] [6117] Refactor for reuse
Date: Sun, 01 Mar 2015 23:30:17 +0000

Revision: 6117
          http://svn.sv.gnu.org/viewvc/?view=rev&root=lmi&revision=6117
Author:   chicares
Date:     2015-03-01 23:30:16 +0000 (Sun, 01 Mar 2015)
Log Message:
-----------
Refactor for reuse

Modified Paths:
--------------
    lmi/trunk/ChangeLog
    lmi/trunk/wx_test_validate_output.cpp

Modified: lmi/trunk/ChangeLog
===================================================================
--- lmi/trunk/ChangeLog 2015-03-01 23:25:16 UTC (rev 6116)
+++ lmi/trunk/ChangeLog 2015-03-01 23:30:16 UTC (rev 6117)
@@ -35716,3 +35716,9 @@
 Refactor for reuse. See:
   http://lists.nongnu.org/archive/html/lmi/2015-02/msg00012.html
 
+20150301T2330Z <address@hidden> [516]
+
+  wx_test_validate_output.cpp
+Refactor for reuse. See:
+  http://lists.nongnu.org/archive/html/lmi/2015-02/msg00012.html
+

Modified: lmi/trunk/wx_test_validate_output.cpp
===================================================================
--- lmi/trunk/wx_test_validate_output.cpp       2015-03-01 23:25:16 UTC (rev 
6116)
+++ lmi/trunk/wx_test_validate_output.cpp       2015-03-01 23:30:16 UTC (rev 
6117)
@@ -63,6 +63,39 @@
     return serial_suffix(n) + ".monthly_trace" + tsv_ext();
 }
 
+// An expectation class expecting an MvcController dialog shown by the
+// "Census|Edit case defaults" menu item and filling in its "Comments" field
+// with the given string.
+struct enter_comments_in_case_defaults_dialog
+    :public wxExpectModalBase<MvcController>
+{
+    enter_comments_in_case_defaults_dialog(std::string const& comments)
+        :comments_(comments)
+        {
+        }
+
+    virtual int OnInvoked(MvcController* dialog) const
+        {
+        dialog->Show();
+        wxYield();
+
+        wx_test_focus_controller_child(*dialog, "Comments");
+
+        wxUIActionSimulator ui;
+        ui.Text(comments_.c_str());
+        wxYield();
+
+        return wxID_OK;
+        }
+
+    virtual wxString GetDefaultDescription() const
+        {
+        return "case defaults dialog";
+        }
+
+    std::string const comments_;
+};
+
 // Prepare the census for testing using the given corporation and insured 
names.
 void init_test_census
         (std::string const& corp_name
@@ -71,39 +104,31 @@
 {
     wxUIActionSimulator ui;
 
-    // Change the case defaults.
+    // Enter the special comment as well as the corporation name into the "case
+    // defaults" dialog.
     struct change_corp_in_case_defaults_dialog
-        :public wxExpectModalBase<MvcController>
+        :public enter_comments_in_case_defaults_dialog
     {
         change_corp_in_case_defaults_dialog(std::string const& corp_name)
-            :corp_name(corp_name)
+            :enter_comments_in_case_defaults_dialog("idiosyncrasyZ")
+            ,corp_name_(corp_name)
             {
             }
 
         virtual int OnInvoked(MvcController* dialog) const
             {
-            dialog->Show();
-            wxYield();
+            enter_comments_in_case_defaults_dialog::OnInvoked(dialog);
 
-            wx_test_focus_controller_child(*dialog, "Comments");
+            wx_test_focus_controller_child(*dialog, "CorporationName");
 
             wxUIActionSimulator ui;
-            ui.Text("idiosyncrasyZ");
+            ui.Text((corp_name_ + " Inc.").c_str());
             wxYield();
 
-            wx_test_focus_controller_child(*dialog, "CorporationName");
-            ui.Text((corp_name + " Inc.").c_str());
-            wxYield();
-
             return wxID_OK;
             }
 
-        virtual wxString GetDefaultDescription() const
-            {
-            return "case defaults dialog";
-            }
-
-        std::string const& corp_name;
+        std::string const corp_name_;
     };
 
     ui.Char('e', wxMOD_CONTROL | wxMOD_SHIFT); // "Census|Edit case defaults"




reply via email to

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