[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lmi-commits] [6125] Implement rectified test specification
From: |
Greg Chicares |
Subject: |
[lmi-commits] [6125] Implement rectified test specification |
Date: |
Sun, 08 Mar 2015 23:01:13 +0000 |
Revision: 6125
http://svn.sv.gnu.org/viewvc/?view=rev&root=lmi&revision=6125
Author: chicares
Date: 2015-03-08 23:01:12 +0000 (Sun, 08 Mar 2015)
Log Message:
-----------
Implement rectified test specification
Modified Paths:
--------------
lmi/trunk/ChangeLog
lmi/trunk/wx_test_input_sequences.cpp
Modified: lmi/trunk/ChangeLog
===================================================================
--- lmi/trunk/ChangeLog 2015-03-08 19:18:16 UTC (rev 6124)
+++ lmi/trunk/ChangeLog 2015-03-08 23:01:12 UTC (rev 6125)
@@ -35761,3 +35761,9 @@
Run only with '--distribution' flag. See:
http://lists.nongnu.org/archive/html/lmi/2015-03/msg00007.html
+20150308T2301Z <address@hidden> [516]
+
+ wx_test_input_sequences.cpp
+Implement rectified test specification. See:
+ http://lists.nongnu.org/archive/html/lmi/2015-03/msg00009.html
+
Modified: lmi/trunk/wx_test_input_sequences.cpp
===================================================================
--- lmi/trunk/wx_test_input_sequences.cpp 2015-03-08 19:18:16 UTC (rev
6124)
+++ lmi/trunk/wx_test_input_sequences.cpp 2015-03-08 23:01:12 UTC (rev
6125)
@@ -29,22 +29,16 @@
#include "assert_lmi.hpp"
#include "configurable_settings.hpp"
#include "wx_test_case.hpp"
+#include "wx_test_new.hpp"
#include <wx/testing.h>
#include <wx/uiaction.h>
-// ERASE THIS BLOCK COMMENT WHEN IMPLEMENTATION COMPLETE. The block
-// comment below changes the original specification, and does not
-// yet describe the present code. Desired changes:
-// - Hard code the sequences; get rid of 'InputSequences.cns'.
-// - Paste each test sequence into a temporary input dialog.
-// - Validate with ellipsis button and then with OK.
-
/// Validate a variety of input sequences in the GUI input dialog.
///
/// Test a broad variety of input sequences. For now, use the set in
/// the user manual:
-/// file:///C:/lmi/src/web/lmi/sequence_input.html
+/// http://www.nongnu.org/lmi/sequence_input.html
/// but hard code them here--later they might differ, e.g. if we
/// decide to add extra tests here.
///
@@ -58,25 +52,107 @@
/// Reopen the tabbed dialog for each subsequent test. When done,
/// close the illustration without saving it.
+namespace
+{
+
+// Combine the input sequence itself with the field it should be entered into.
+struct input_sequence_test_data
+{
+ char const* field;
+ char const* sequence;
+};
+
+input_sequence_test_data const test_cases[] =
+{
+ // These sequences correspond to the examples from the manual.
+ { "SpecifiedAmount" ,"sevenpay 7; 250000 retirement; 100000 #10; 75000
@95; 50000" },
+ { "SpecifiedAmount" ,"100000; 110000; 120000; 130000; 140000; 150000"
},
+ { "PaymentMode" ,"annual; monthly"
},
+ { "Payment" ,"10000 20; 0"
},
+ { "Payment" ,"10000 10; 5000 15; 0"
},
+ { "Payment" ,"10000 @70; 0"
},
+ { "Payment" ,"10000 retirement; 0"
},
+ { "Payment" ,"0 retirement; 5000"
},
+ { "Payment" ,"0 retirement; 5000 maturity"
},
+ { "Withdrawal" ,"0 retirement; 5000 #10; 0"
},
+ { "Withdrawal" ,"0,[0,retirement);10000,[retirement,#10);0"
},
+
+ // This is an additional sequence used solely for testing.
+ { "ProjectedSalary" ,"100000; 105000; 110000 retirement; 0"
},
+};
+
+} // anonymous namespace
+
LMI_WX_TEST_CASE(input_sequences)
{
- wxUIActionSimulator ui;
+ wx_test_new_illustration ill;
- ui.Char('o', wxMOD_CONTROL); // "File|Open"
- wxTEST_DIALOG
- (wxYield()
-
,wxExpectModal<wxFileDialog>(get_test_file_path_for("InputSequences.cns"))
- );
+ struct test_sequence_dialog : public wxExpectModalBase<MvcController>
+ {
+ explicit test_sequence_dialog(input_sequence_test_data const&
test_data)
+ :test_data_(test_data)
+ {}
- ui.Char('r', wxMOD_CONTROL | wxMOD_SHIFT); // "Census|Run case"
- wxYield();
+ virtual int OnInvoked(MvcController* dialog) const
+ {
+ dialog->Show();
+ wxYield();
- // Close the illustration opened by "Run case".
- ui.Char('l', wxMOD_CONTROL); // "File|Close"
- wxYield();
+ if(!wxWindow::FindWindowByName(test_data_.field, dialog))
+ {
+ // If the field for this input sequence doesn't exist in the
+ // currently used skin at all, skip this particular sequence
+ // silently -- but continue testing the other ones.
+ return wxID_CANCEL;
+ }
- // And the census itself as well.
- ui.Char('l', wxMOD_CONTROL); // "File|Close"
- wxYield();
+ // Focus the field in which the sequence should be entered.
+ wx_test_focus_controller_child(*dialog, test_data_.field);
+
+ // Type the sequence into it.
+ wxUIActionSimulator ui;
+ ui.Text(test_data_.sequence);
+ wxYield();
+
+ // Switch to the ellipsis button which should be next to it.
+ ui.Char(WXK_TAB);
+ wxYield();
+
+ // Show the dialog for sequence entry and dismiss it immediately.
+ ui.Char(WXK_SPACE);
+ wxTEST_DIALOG
+ (wxYield()
+ ,wxExpectDismissableModal<wxDialog>(wxOK).
+ Describe("sequence entry dialog" + sequence_describe())
+ );
+
+ return wxID_OK;
+ }
+
+ virtual wxString GetDefaultDescription() const
+ {
+ return "cell properties dialog" + sequence_describe();
+ }
+
+ // Helper providing the description of the sequence tested by this
+ // particular dialog, including it in the various descriptions should
+ // make it easier to find the exact failing test if anything goes
+ // wrong.
+ wxString sequence_describe() const
+ {
+ return wxString::Format(" for sequence \"%s\""
,test_data_.sequence);
+ }
+
+ input_sequence_test_data const& test_data_;
+ };
+
+ wxUIActionSimulator ui;
+ for(std::size_t n = 0; n < sizeof test_cases / sizeof(test_cases[0]); n++)
+ {
+ ui.Char('e', wxMOD_CONTROL); // "Illustration|Edit Cell"
+ wxTEST_DIALOG(wxYield(), test_sequence_dialog(test_cases[n]));
+ }
+
+ ill.close_discard_changes();
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [lmi-commits] [6125] Implement rectified test specification,
Greg Chicares <=