[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lmi-commits] [6048] Don't send wxEVT_UPDATE_UI events manually in GUI t
From: |
Greg Chicares |
Subject: |
[lmi-commits] [6048] Don't send wxEVT_UPDATE_UI events manually in GUI tests |
Date: |
Sat, 06 Dec 2014 18:11:33 +0000 |
Revision: 6048
http://svn.sv.gnu.org/viewvc/?view=rev&root=lmi&revision=6048
Author: chicares
Date: 2014-12-06 18:11:32 +0000 (Sat, 06 Dec 2014)
Log Message:
-----------
Don't send wxEVT_UPDATE_UI events manually in GUI tests
Modified Paths:
--------------
lmi/trunk/ChangeLog
lmi/trunk/wx_test_calculation_summary.cpp
lmi/trunk/wx_test_default_update.cpp
lmi/trunk/wx_test_paste_census.cpp
lmi/trunk/wx_test_validate_output.cpp
Removed Paths:
-------------
lmi/trunk/wx_test_mvc_dialog.hpp
Modified: lmi/trunk/ChangeLog
===================================================================
--- lmi/trunk/ChangeLog 2014-12-06 14:53:22 UTC (rev 6047)
+++ lmi/trunk/ChangeLog 2014-12-06 18:11:32 UTC (rev 6048)
@@ -34720,3 +34720,23 @@
Write all test output to stdout, not stderr. See:
http://lists.nongnu.org/archive/html/lmi/2014-12/msg00004.html
+20141206T1140Z <address@hidden> [516]
+
+ wx_test_about_version.cpp
+Rectify test specification.
+
+20141206T1453Z <address@hidden> [516]
+
+ wx_test_expiry_dates.cpp
+Rectify test specification.
+
+20141206T1811Z <address@hidden> [516]
+
+ wx_test_calculation_summary.cpp
+ wx_test_default_update.cpp
+ wx_test_mvc_dialog.hpp [expunged]
+ wx_test_paste_census.cpp
+ wx_test_validate_output.cpp
+Don't send wxEVT_UPDATE_UI events manually in GUI tests. See:
+ http://lists.nongnu.org/archive/html/lmi/2014-12/msg00014.html
+
Modified: lmi/trunk/wx_test_calculation_summary.cpp
===================================================================
--- lmi/trunk/wx_test_calculation_summary.cpp 2014-12-06 14:53:22 UTC (rev
6047)
+++ lmi/trunk/wx_test_calculation_summary.cpp 2014-12-06 18:11:32 UTC (rev
6048)
@@ -28,8 +28,8 @@
#include "assert_lmi.hpp"
#include "configurable_settings.hpp"
+#include "mvc_controller.hpp"
#include "wx_test_case.hpp"
-#include "wx_test_mvc_dialog.hpp"
#include "wx_test_new.hpp"
#include "wx_utility.hpp"
@@ -93,7 +93,7 @@
ui.Char('f', wxMOD_CONTROL); // "File|Preferences"
class ChangeCalculationSummaryInPreferencesDialog
- :public ExpectMvcDialog
+ :public wxExpectModalBase<MvcController>
{
public:
ChangeCalculationSummaryInPreferencesDialog
@@ -102,8 +102,11 @@
{
}
- virtual void DoRunDialog(MvcController* dialog) const
+ virtual int OnInvoked(MvcController* dialog) const
{
+ dialog->Show();
+ wxYield();
+
wxUIActionSimulator ui;
// Go to the "Use built-in calculation summary" checkbox.
@@ -115,8 +118,6 @@
ui.Char('-');
wxYield();
- DoUpdateDialogUI(dialog);
-
// Update the columns controls when using them.
for(std::size_t n = 0; n < number_of_custom_columns; ++n)
{
@@ -131,7 +132,7 @@
LMI_ASSERT(ui.Select(column_name));
- DoUpdateDialogUI(dialog);
+ wxYield();
}
// Finally return to the initial checkbox.
@@ -145,6 +146,8 @@
// And set it to the desired value.
ui.Char(use_builtin_summary_ ? '+' : '-');
wxYield();
+
+ return wxID_OK;
}
private:
Modified: lmi/trunk/wx_test_default_update.cpp
===================================================================
--- lmi/trunk/wx_test_default_update.cpp 2014-12-06 14:53:22 UTC (rev
6047)
+++ lmi/trunk/wx_test_default_update.cpp 2014-12-06 18:11:32 UTC (rev
6048)
@@ -28,8 +28,8 @@
#include "assert_lmi.hpp"
#include "configurable_settings.hpp"
+#include "mvc_controller.hpp"
#include "wx_test_case.hpp"
-#include "wx_test_mvc_dialog.hpp"
#include "wx_test_statusbar.hpp"
#include <wx/testing.h>
@@ -64,10 +64,13 @@
ui.Char('t', wxMOD_CONTROL); // "File|Default"
struct change_mac_in_defaults_dialog
- :public ExpectMvcDialog
+ :public wxExpectModalBase<MvcController>
{
- virtual void DoRunDialog(MvcController* dialog) const
+ virtual int OnInvoked(MvcController* dialog) const
{
+ dialog->Show();
+ wxYield();
+
wxUIActionSimulator ui;
// Go to the first page: as the dialog remembers its last opened
@@ -85,6 +88,8 @@
// radio box with two buttons.
ui.Char(WXK_DOWN);
wxYield();
+
+ return wxID_OK;
}
};
Deleted: lmi/trunk/wx_test_mvc_dialog.hpp
===================================================================
--- lmi/trunk/wx_test_mvc_dialog.hpp 2014-12-06 14:53:22 UTC (rev 6047)
+++ lmi/trunk/wx_test_mvc_dialog.hpp 2014-12-06 18:11:32 UTC (rev 6048)
@@ -1,82 +0,0 @@
-// Helper for testing MvcController dialogs.
-//
-// Copyright (C) 2014 Gregory W. Chicares.
-//
-// This program is free software; you can redistribute it and/or modify
-// it under the terms of the GNU General Public License version 2 as
-// published by the Free Software Foundation.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software Foundation,
-// Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
-//
-// http://savannah.nongnu.org/projects/lmi
-// email: <address@hidden>
-// snail: Chicares, 186 Belle Woods Drive, Glastonbury CT 06033, USA
-
-// $Id$
-
-#ifndef wx_test_mvc_dialog_hpp
-#define wx_test_mvc_dialog_hpp
-
-#include "config.hpp"
-
-#include "mvc_controller.hpp"
-
-#include <wx/scopeguard.h>
-#include <wx/testing.h>
-
-/// Abstract base class for the concrete expectations defining the actions to
-/// perform when a given MvcController-derived dialog is shown.
-///
-/// The main reason for this class existence is the unusual reliance of
-/// MvcController on wxEVT_UPDATE_UI events for its functionality. As these
-/// events are not sent from inside wxYield(), which is used throughout the
-/// automatic tests, the dialog is not updated (i.e. the controls inside it
-/// are not enabled when they should be, the corresponding program variables
-/// are not updated when GUI controls change, and so on) unless we send these
-/// events ourselves and this class helps with doing it.
-
-class ExpectMvcDialog
- :public wxExpectModalBase<MvcController>
-{
- public:
- virtual int OnInvoked(MvcController* dialog) const
- {
- // Bring the dialog up.
- dialog->Show();
- wxYield();
-
- // Perform whichever actions are needed.
- DoRunDialog(dialog);
-
- // And ensure that the model data is updated at the end.
- DoUpdateDialogUI(dialog);
-
- return wxID_OK;
- }
-
- protected:
- // The method to be implemented in the derived classes for simulating the
- // user actions that need to be performed in this dialog.
- //
- // DoUpdateDialogUI() should be used after simulating any action updating
- // the state of the dialog.
- virtual void DoRunDialog(MvcController* dialog) const = 0;
-
- // Ensure that the dialog state takes into account all the events simulated
- // so far by explicitly letting it process a wxUpdateUIEvent.
- void DoUpdateDialogUI(MvcController* dialog) const
- {
- wxUpdateUIEvent event(dialog->GetId());
- event.SetEventObject(dialog);
- dialog->ProcessWindowEvent(event);
- }
-};
-
-#endif // wx_test_mvc_dialog_hpp
Modified: lmi/trunk/wx_test_paste_census.cpp
===================================================================
--- lmi/trunk/wx_test_paste_census.cpp 2014-12-06 14:53:22 UTC (rev 6047)
+++ lmi/trunk/wx_test_paste_census.cpp 2014-12-06 18:11:32 UTC (rev 6048)
@@ -28,8 +28,8 @@
#include "assert_lmi.hpp"
#include "data_directory.hpp"
+#include "mvc_controller.hpp"
#include "wx_test_case.hpp"
-#include "wx_test_mvc_dialog.hpp"
#include "wx_test_new.hpp"
#include "wx_utility.hpp"
@@ -211,10 +211,13 @@
ui.Char('e', wxMOD_CONTROL | wxMOD_SHIFT); // "Census|Edit case defaults"
struct change_class_in_case_defaults_dialog
- :public ExpectMvcDialog
+ :public wxExpectModalBase<MvcController>
{
- virtual void DoRunDialog(MvcController* dialog) const
+ virtual int OnInvoked(MvcController* dialog) const
{
+ dialog->Show();
+ wxYield();
+
wxUIActionSimulator ui;
// Go to the third page: as the dialog remembers its last opened
@@ -249,6 +252,8 @@
wxYield();
LMI_ASSERT_EQUAL(class_radiobox->GetSelection(), 0);
+
+ return wxID_OK;
}
};
Modified: lmi/trunk/wx_test_validate_output.cpp
===================================================================
--- lmi/trunk/wx_test_validate_output.cpp 2014-12-06 14:53:22 UTC (rev
6047)
+++ lmi/trunk/wx_test_validate_output.cpp 2014-12-06 18:11:32 UTC (rev
6048)
@@ -31,7 +31,6 @@
#include "mvc_controller.hpp"
#include "uncopyable_lmi.hpp"
#include "wx_test_case.hpp"
-#include "wx_test_mvc_dialog.hpp"
#include "wx_test_new.hpp"
#include <wx/filename.h>
@@ -120,10 +119,13 @@
output_file_existence_checker unnamed_trace("unnamed.monthly_trace" + ext);
struct enter_comment_in_illustration_dialog
- :public ExpectMvcDialog
+ :public wxExpectModalBase<MvcController>
{
- virtual void DoRunDialog(MvcController* dialog) const
+ virtual int OnInvoked(MvcController* dialog) const
{
+ dialog->Show();
+ wxYield();
+
wxUIActionSimulator ui;
// Go to the first page: as the dialog remembers its last opened
@@ -145,6 +147,8 @@
ui.Text("idiosyncrasyZ");
wxYield();
+
+ return wxID_OK;
}
};
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [lmi-commits] [6048] Don't send wxEVT_UPDATE_UI events manually in GUI tests,
Greg Chicares <=