Commit Graph

20 Commits

Author SHA1 Message Date
Maarten Bent
7c1ab06ea5 Add more wxOVERRIDE 2018-09-22 14:44:07 +02:00
Vadim Zeitlin
0eca25d395 Clarify wxExpectModal<> use and implementation.
The only change in this commit is the omission of the primary wxExpectModal<>
template as it's not needed and it's enough to just forward declare it,
otherwise the changes are to the comments only and try to better explain how
this class should be used, i.e. that it's not required, although it may be
convenient, to specialize it, and also how it is implemented, notably the need
for the CRTP in wxExpectModalBase<>.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@78416 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2015-01-24 22:09:04 +00:00
Vadim Zeitlin
9ae625518d Use C++ RTTI in dialog testing code if wxRTTI is not available.
This allows to get the best possible description of the dialog: if its class
uses wxRTTI macros, its user-readable name will be used, but otherwise we now
fall back on possibly unreadable but still informative mangled C++ class name
rather than showing just "wxDialog" which is not useful at all.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@78415 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2015-01-24 22:09:00 +00:00
Vadim Zeitlin
826320ca7b Cosmetic change to wxTestingModalHook error message.
Don't include the word "dialog" in it, by default the description is just the
class name and so typically already includes "dialog" in it, e.g. we could
have "Expected wxFileDialog dialog" which was redundant.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@78414 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2015-01-24 22:08:57 +00:00
Vadim Zeitlin
677eb37619 Provide better description of the expected message boxes.
While the example in the previous commit message, with two identical
expectations, still requires a custom description to be have unambiguous
failure messages, in other cases it's enough to show the expected message box
buttons in the error to make it possible to immediately see which expectation
failed, so include the information deduced from the expected button into the
description.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@78413 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2015-01-24 22:08:54 +00:00
Vadim Zeitlin
9099ae2ded Allow providing descriptions for dialog tests expectations.
This makes test failure errors much more intelligible, e.g. in the following
case

	... some code ...
	wxTEST_DIALOG(wxYield, wxExpectModal<wxMessageDialog>(wxID_OK));
	... some more code ...
	wxTEST_DIALOG(wxYield, wxExpectModal<wxMessageDialog>(wxID_OK));

it was previously impossible to distinguish the first test failure from the
second one from just the failure description (it could be done by looking at
the line numbers since the recent change however), but with

	...
	wxTEST_DIALOG(wxYield, wxExpectModal<wxMessageDialog>(wxID_OK).
		Describe("first warning message box"));
	...
	wxTEST_DIALOG(wxYield, wxExpectModal<wxMessageDialog>(wxID_OK).
		Describe("successful completion message box"));

the failure becomes immediately clear.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@78412 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2015-01-24 22:08:51 +00:00
Vadim Zeitlin
95177f3876 Allow predefining wxTEST_DIALOG_HOOK_CLASS before wx/testing.h inclusion.
Although it already was (and remains) possible to #undef and re-#define
wxTEST_DIALOG_HOOK_CLASS after including wx/testing.h, it should also be
possible to just define it globally in the testing code before including
anything else and not have to bother with the #undef part.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@78411 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2015-01-24 22:08:48 +00:00
Vadim Zeitlin
7231f2fdf5 Improve error reporting from wxTEST_DIALOG() macro.
Give the location (i.e. file name, line number and the name of the function)
at which this macro itself appears instead of the location of ReportFailure()
method inside wxTestingModalHook which was quite useless as it was the same
for all the tests.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@78410 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2015-01-24 22:08:44 +00:00
Vadim Zeitlin
4944c44676 Show the message of unexpected message boxes in wxTestingModalHook.
This is more informative than showing just the title and we can do it for the
message boxes and it's worth handling them specially just because they are so
common.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@77744 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2014-09-20 22:07:34 +00:00
Vadim Zeitlin
66640e67d6 Allow customizing unexpected dialogs description in wxTestingModalHook.
Extract creation of the message describing an unexpected dialog in a separate
virtual method in order to allow customizing it, notably in order to add more
useful description of custom application dialogs.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@77743 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2014-09-20 22:07:31 +00:00
Vadim Zeitlin
6cf30c433c Mention the title of the unexpected dialog in wxTestingModalHook.
It's not very helpful to just say that an unexpected dialog was shown, using
its title provides at least some hint as to what dialog it was.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@77742 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2014-09-20 22:07:29 +00:00
Vadim Zeitlin
91b7aab4c2 Fix build with g++ 3.4 with -pedantic[-errors] option.
The use of variadic macros results in a warning/error if -pedantic[-errors]
is used when compiling C++98 code as they are only formally part of C99 (or
C++11). With g++ 4 and later, this can be avoided by using -Wno-variadic-macros
option, but it doesn't exist in g++ 3, so a nasty workaround in the header
itself is required: mark it as system header in order to fix compilation.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@77664 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2014-09-10 16:52:08 +00:00
Vadim Zeitlin
c5f557cd3a Add a generic wxExpectAny helper class for GUI testing.
This is similar to the existing wxExpectModal<wxMessageDialog>, but can be
used to dismiss any dialog for which it's just enough to press some button,
not just wxMessageDialog.

It's convenient to use it as

	wxTEST_DIALOG(wxYield(), wxExpectAny(wxID_OK));

if some custom dialog which can be safely dismissed is expected.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@77656 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2014-09-10 16:51:30 +00:00
Vadim Zeitlin
3f66f6a5b3 Remove all lines containing cvs/svn "$Id$" keyword.
This keyword is not expanded by Git which means it's not replaced with the
correct revision value in the releases made using git-based scripts and it's
confusing to have lines with unexpanded "$Id$" in the released files. As
expanding them with Git is not that simple (it could be done with git archive
and export-subst attribute) and there are not many benefits in having them in
the first place, just remove all these lines.

If nothing else, this will make an eventual transition to Git simpler.

Closes #14487.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@74602 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2013-07-26 16:02:46 +00:00
Vadim Zeitlin
168d1f65c1 Reconcile HAVE_VARIADIC_MACROS and wxHAS_VARIADIC_MACROS definitions.
The main user-visible effect of this change is that giving configure
--disable-vararg-macros argument now really disables the use of variadic
macros whereas it didn't disable them in wx/cpp.h before.

It is, of course, also less confusing to not have two very similar but
different symbols.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@74489 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2013-07-11 22:40:47 +00:00
Vadim Zeitlin
691745ab41 Add a public wxModalDialogHook class for intercepting modal dialogs.
Extract wxModalDialogHook from wx/testing.h into its own wx/modalhook.h,
extend it to allow to be notified not only about showing modal dialogs but
also about dismissing them and document it and show its use in the dialogs
sample.

Also replace all the WX_TESTING_SHOW_MODAL_HOOK macros occurrences with
WX_HOOK_MODAL_DIALOG.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@74037 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2013-05-20 13:15:41 +00:00
Vadim Zeitlin
e4f3b467b8 Bracket vararg macro definition with wxHAS_VARIADIC_MACROS.
This should fix tests compilation with VC6.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@73024 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2012-11-26 15:50:37 +00:00
Stefan Csomor
0b7a7b8cd6 fixing compile for ios
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@72903 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2012-11-06 06:35:29 +00:00
Václav Slavík
9e0959cda4 Compilation fix for PCH-less build.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@72849 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2012-11-01 18:25:00 +00:00
Václav Slavík
643e9cf9f6 Add wxTEST_DIALOG for testing of modal dialogs.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@72837 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2012-11-01 16:45:11 +00:00