Add wxXSync class which adds delays between the synthesized events
sufficient for them to be processed by the higher layers (X, GTK).
This makes it possible to run the UI tests by default with wxGTK.
Closes https://github.com/wxWidgets/wxWidgets/pull/1845
This seems unnecessary as the default log handler already outputs a new
line at the end of the message anyhow and at least some messages (e.g.
debug ones in GdkPixbuf) also contain an extra new line in them, so
adding another one here resulted in having at least one and sometimes
two extra blank lines.
Don't output "*** GTK log message while running" messages for every
g_debug() call when we the debug messages themselves will not be
displayed because G_MESSAGES_DEBUG is not set or its value doesn't
include the domain used by the message.
This results in much more reasonable output from the test suite.
See #17400.
This will allow disabling some tests which fail when running only under
Xvfb.
The new function doesn't work automatically because there doesn't seem
to be any way to distinguish it from the usual server, so it just checks
whether wxUSE_XVFB=1 is set in the environment, as is done by Travis CI
build script.
Avoid showing message boxes even if we don't have the associated console
as this prevents the test from completing on its own if an unknown
exception happens.
wxUIActionSimulator is just too unreliable to be used there, so while
fixing it should really be a priority, for now at least prevent these
spurious failures from masking any other ones, which indicate real
problems that need to be fixed.
Notice that these tests can still be enabled by setting the environment
variable WX_UI_TESTS to 1 (or disabled by setting it to 0 under MSW).
Drop the legacy CppUnit testing framework used for the unit tests.
Replacing it with Catch has the advantage of not requiring CppUnit
libraries to be installed on the system in order to be able to run
tests (Catch is header-only and a copy of it is now included in the
main repository itself) and, in the future, of being able to write
the tests in a much more natural way.
For now, however, avoid changing the existing tests code as much as
[reasonably] possible to avoid introducing bugs in them and provide
the CppUnit compatibility macros in the new wx/catch_cppunit.h header
which allow to preserve the 99% of the existing code unchanged. Some
of the required changes are:
- Decompose asserts using "a && b" conditions into multiple asserts
checking "a" and "b" independently. This would have been better
even with CppUnit (to know which part of condition exactly failed)
and is required with Catch.
- Use extra parentheses around such conditions when they can't be
easily decomposed in the arrays test, due to the use of macros.
This is not ideal from the point of view of messages given when
the tests fail but will do for now.
- Rewrite asserts using "a || b" as a combination of condition
checks and assert macros. Again, this is better anyhow, and is
required with Catch. Incidentally, this allowed to fix a bug in
the "exec" unit test which didn't leave enough time for the new
process to be launched before trying to kill it.
- Remove multiple CPPUNIT_TEST_SUITE_NAMED_REGISTRATION() macros,
our emulation of this macro can be used only once.
- Provide string conversions using Catch-specific StringMaker for
a couple of types.
- Replace custom wxImage comparison with a Catch-specific matcher
class.
- Remove most of test running logic from test.cpp, in particular don't
parse command line ourselves any longer but use Catch built-in
command line parser. This is a source of a minor regression:
previously, both "Foo" and "FooTestCase" could be used as the name of
the test to run, but now only the latter is accepted.
Avoid running time-sensitive tests such as StopWatchTestCase under Travis as
they can result in spurious failures if the machine running the test is under
too much load.
Try to make it possible to understand where exactly do the GTK+ errors
appearing in the buildbot slaves output originate from by installing a custom
Glib log handler and prefixing the normal log messages with the name of the
test running when they're generated.
This required a small refactoring of DetailListener which is now always
installed, in order to always have access to the current test name, but still
needs to be explicitly enabled to produce output.
Destroying a window with mouse capture results in an assert, which is
translated into an exception when running the test suite. As this exception is
thrown from wxWindowBase dtor, it results in an immediate program termination
when using C++11 and can also have the same effect even when using C++98 if
this exception is thrown while already handling another exception due to a
test failure.
Try to avoid this by using a "safe" DeleteTestWindow() function instead of
deleting the window directly. Currently this function ensures that the window
doesn't have mouse capture before deleting it, but it could also be used to
check for other things later. Also, this commit only uses this function for
the two controls which do happen to be destroyed with mouse capture currently
(at least when using wxGTK), but it should probably be generalized to all
controls in the future.
No real changes, just always show the frame as we need it to be shown for the
tests to run anyhow.
Also update the nonsensical comment about creating a hidden window just before
showing it.
Commit 3e67b1ef68 broke the test suite in
non-GUI case, we still need to override OnRun() then to run the tests.
Also make it more clear that m_exitcode is only used in the GUI case.
Return the program exit code from the (overridden) OnRun(), not OnExit(),
doing it from the latter didn't work since many years.
The failures in the GUI tests will be detected by buildbot now.
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
Don't create an event loop manually, let the port-specific code do it and run
it as usual in the GUI unit tests.
This has several advantages:
- No need to manage the event loop manually in the test.
- No need for Mac-specific code in the test itself.
- Code being tested runs in the same context as in a normal GUI program,
which is especially important for event-loop related tests under wxOSX as
the main event loop is special there.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@74334 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
The buildbot slaves actually use "sandbox" as the user name, not "buildbot",
so test for the former instead for the latter, see r73963.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@73965 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
Some build slaves apparently run under "buildbot" user and not "buildslave",
recognize them as running automatic tests too.
Also show the name of the current system and user on startup to avoid such
guess work in the future.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@73963 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
Don't use LOCALE_USER_DEFAULT when the locale hadn't been changed because the
user default locale often (and maybe even always) is different from "C" locale
used by the CRT resulting in mismatch between the conventions used by
wxDateTime::Format(), which uses the CRT locale, and wxDateTime::Parse(),
which uses Windows format. Instead use the hard-coded values corresponding to
the "C" locale to ensure we use the same values as the CRT in this case.
This also reverts r73244 which was applies to make the unit tests pass before
this fix as it's not necessary any longer.
Closes#14918.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@73320 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
Call SetCLocale() on tests startup to avoid problems with wxDateTime parsing
that happen when the user locale is different from "C" one under Windows.
See #14918.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@73244 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
For now just show the system description and the locale, this should already
be helpful for diagnosing some test failures.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@72759 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This allows to easily test if we're running on a buildbot slave and disable
some difficult to debug test failures there.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@71634 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
Wide char output from wxPrintf() didn't appear at all under Linux because
stdout was switched into narrow stream mode by GNU libc due to initial use of
cout in the test.
Use printf() instead of wxPrintf() as we are only printing ASCII strings
anyhow. Of course, this is not a real fix but at least we can see the tests
results like this.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@71633 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
If an assert occurred while handling an exception generated by a previous
assert handler, the information about the original assert was lost even if
though it was more important than the secondary assert. Do preserve and show
the original assert message in this case now.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@71318 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
Don't throw when already handling an exception as it would result in a call to
terminate() and no useful information about the test failure would be given.
Abort ourselves instead to at least give the message about the assert failure.
This should help debug the mysterious ListCtrlTestCase failures in buildbot
wxGTK builds.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@65760 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775