>From 932beaa2dcd6ffa7e6472ef473b1b3f7924fce09 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sat, 24 Jan 2015 17:28:42 +0100 Subject: [PATCH] Add descriptions of the expected modal dialogs in the GUI test. Provide unique descriptions for the dialogs we expect to be shown, as this makes it much more clear what happens if some expected dialog doesn't actually appear. Notice that the description of the expected dialog may be defined either when declaring the class handling its appearance or when actually waiting for it to appear. We choose to do it in the class if such class is used for simplicity and also because the description seems to be a logical property of this class in this case, and when waiting for the dialog otherwise. --- wx_test_about_version.cpp | 10 ++++++++++ wx_test_calculation_summary.cpp | 5 +++++ wx_test_create_open.cpp | 12 +++++++----- wx_test_default_update.cpp | 5 +++++ wx_test_new.hpp | 9 +++++++-- wx_test_paste_census.cpp | 19 ++++++++++++++++--- wx_test_validate_output.cpp | 29 ++++++++++++++++++++++------- 7 files changed, 72 insertions(+), 17 deletions(-) diff --git a/wx_test_about_version.cpp b/wx_test_about_version.cpp index 0223b43..7b11787 100644 --- a/wx_test_about_version.cpp +++ b/wx_test_about_version.cpp @@ -232,6 +232,11 @@ wxHtmlWindow* find_html_window(wxWindow* parent, std::string const& dialog_name) return wxID_OK; } + + virtual wxString GetDefaultDescription() const + { + return "license dialog"; + } }; wxUIActionSimulator z; @@ -243,6 +248,11 @@ wxHtmlWindow* find_html_window(wxWindow* parent, std::string const& dialog_name) return wxID_OK; } + + virtual wxString GetDefaultDescription() const + { + return "about dialog"; + } }; wxUIActionSimulator z; diff --git a/wx_test_calculation_summary.cpp b/wx_test_calculation_summary.cpp index 13fadf5..cc6beb4 100644 --- a/wx_test_calculation_summary.cpp +++ b/wx_test_calculation_summary.cpp @@ -150,6 +150,11 @@ void use_builtin_calculation_summary(bool b) return wxID_OK; } + virtual wxString GetDefaultDescription() const + { + return "preferences dialog"; + } + private: bool const use_builtin_summary_; }; diff --git a/wx_test_create_open.cpp b/wx_test_create_open.cpp index cf0888a..0432ce9 100644 --- a/wx_test_create_open.cpp +++ b/wx_test_create_open.cpp @@ -64,7 +64,8 @@ { wxTEST_DIALOG (wxYield() - ,wxExpectDismissableModal(wxID_OK) + ,wxExpectDismissableModal(wxID_OK). + Describe("new file properties") ); } wxYield(); @@ -72,7 +73,7 @@ z.Char(uses_dialog ? 'a' : 's', wxMOD_CONTROL); // save or save as wxTEST_DIALOG (wxYield() - ,wxExpectModal(file) + ,wxExpectModal(file).Describe("save file dialog") ); wxYield(); @@ -88,15 +89,16 @@ { wxTEST_DIALOG (wxYield() - ,wxExpectModal(file) - ,wxExpectDismissableModal(wxID_OK) + ,wxExpectModal(file).Describe("open file dialog") + ,wxExpectDismissableModal(wxID_OK). + Describe("existing file properties") ); } else { wxTEST_DIALOG (wxYield() - ,wxExpectModal(file) + ,wxExpectModal(file).Describe("open file dialog") ); } wxYield(); diff --git a/wx_test_default_update.cpp b/wx_test_default_update.cpp index a831f21..8c6210d 100644 --- a/wx_test_default_update.cpp +++ b/wx_test_default_update.cpp @@ -83,6 +83,11 @@ return wxID_OK; } + + virtual wxString GetDefaultDescription() const + { + return "defaults dialog"; + } }; wxTEST_DIALOG diff --git a/wx_test_new.hpp b/wx_test_new.hpp index c4d6611..39013ac 100644 --- a/wx_test_new.hpp +++ b/wx_test_new.hpp @@ -100,7 +100,10 @@ class wx_test_new_document_base { do_close(); - wxTEST_DIALOG(wxYield(), wxExpectModal(wxNO)); + wxTEST_DIALOG(wxYield() + ,wxExpectModal(wxNO). + Describe("message box confirming closing modified file") + ); } protected: @@ -137,7 +140,9 @@ class wx_test_new_illustration // Default constructor creates an illustration with the default parameters. wx_test_new_illustration() { - do_new_illustration(wxExpectDismissableModal(wxID_OK)); + do_new_illustration(wxExpectDismissableModal(wxID_OK). + Describe("new illustration properties") + ); } // This constructor takes a class responsible for handling the illustration diff --git a/wx_test_paste_census.cpp b/wx_test_paste_census.cpp index 9fe9793..d4331d1 100644 --- a/wx_test_paste_census.cpp +++ b/wx_test_paste_census.cpp @@ -323,6 +323,11 @@ std::string build_not_found_message(std::set const& remaining) return wxID_OK; } + + virtual wxString GetDefaultDescription() const + { + return "class defaults dialog"; + } }; // The menu command above should have opened the "Class defaults" dialog and @@ -332,7 +337,8 @@ std::string build_not_found_message(std::set const& remaining) wxTEST_DIALOG (wxYield() ,change_gender_in_class_defaults_dialog() - ,wxExpectModal(wxYES) + ,wxExpectModal(wxYES). + Describe("message box asking whether to apply gender changes to all") ); // Check that all columns, including the "Gender" one, are still shown. @@ -401,6 +407,11 @@ std::string build_not_found_message(std::set const& remaining) return wxID_OK; } + + virtual wxString GetDefaultDescription() const + { + return "case defaults dialog"; + } }; // The menu command above should have opened the "Case defaults" dialog and @@ -410,7 +421,8 @@ std::string build_not_found_message(std::set const& remaining) wxTEST_DIALOG (wxYield() ,change_class_in_case_defaults_dialog() - ,wxExpectModal(wxYES) + ,wxExpectModal(wxYES). + Describe("message box asking whether to apply class changes to all") ); // Check that we still have the same cells but that now the underwriting @@ -432,7 +444,8 @@ std::string build_not_found_message(std::set const& remaining) ui.Char('a', wxMOD_CONTROL); // "File|Save as" wxTEST_DIALOG (wxYield() - ,wxExpectModal(census_file_name) + ,wxExpectModal(census_file_name). + Describe("census save file dialog") ); LMI_ASSERT(output_cns.exists()); diff --git a/wx_test_validate_output.cpp b/wx_test_validate_output.cpp index 5f77d96..e014f8f 100644 --- a/wx_test_validate_output.cpp +++ b/wx_test_validate_output.cpp @@ -107,6 +107,11 @@ return wxID_OK; } + + virtual wxString GetDefaultDescription() const + { + return "illustration properties dialog"; + } }; // Create a new illustration with the special comment. @@ -127,13 +132,20 @@ ui.Char('o', wxMOD_CONTROL); // "File|Open" wxTEST_DIALOG (wxYield() - ,wxExpectModal(get_test_file_path_for("MonthlyTrace.ill")) - ,wxExpectModal(wxID_OK) // Ignore warning. - ,wxExpectDismissableModal(wxID_OK) // Accept defaults. + ,wxExpectModal(get_test_file_path_for("MonthlyTrace.ill")). + Describe("illustration open file dialog") + ,wxExpectModal(wxID_OK). + Describe("warning message box after opening the illustration") + ,wxExpectDismissableModal(wxID_OK). + Describe("illustration parameters dialog") ); ui.Char('l', wxMOD_CONTROL); // "File|Close" - wxTEST_DIALOG(wxYield(), wxExpectModal(wxNO)); + wxTEST_DIALOG + (wxYield() + ,wxExpectModal(wxNO). + Describe("message box confirming closing modified illustration") + ); LMI_ASSERT(existing_trace.exists()); } @@ -154,7 +166,8 @@ wxTEST_DIALOG (wxYield() - ,wxExpectDismissableModal(wxID_OK) + ,wxExpectDismissableModal(wxID_OK). + Describe("new MEC parameters dialog") ); ui.Char('l', wxMOD_CONTROL); // "File|Close" @@ -168,8 +181,10 @@ ui.Char('o', wxMOD_CONTROL); // "File|Open" wxTEST_DIALOG (wxYield() - ,wxExpectModal(get_test_file_path_for("MecTesting.mec")) - ,wxExpectDismissableModal(wxID_OK) // Accept defaults. + ,wxExpectModal(get_test_file_path_for("MecTesting.mec")). + Describe("MEC open file dialog") + ,wxExpectDismissableModal(wxID_OK). + Describe("MEC parameters dialog") ); ui.Char('l', wxMOD_CONTROL); // "File|Close" -- 2.1.0