This will be used elsewhere too in the upcoming commit.
No changes so far except that IsRunningUnderXVFB() is now only declared
and defined when wxUSE_GUI=1.
wxUIActionSimulator injects X11 events via XTest, which can never
reach a native Wayland GTK3 client (as opposed to one running under
XWayland) since such a window has no corresponding X11 window. This
was causing large numbers of spurious test failures rather than the
tests being skipped as intended. WX_UI_TESTS=1 still forces them on.
The IPC tests were excluded from wxQt because wxIPC worker threads
marshal their socket I/O to the main thread via CallAfter(), and a
cross-thread CallAfter() was not reliably processed by the wxQt event
loop, stalling the tests. Now that the previous commit makes WakeUp()
post a real Qt event, the whole suite runs on wxQt: remove the
__WXQT__ exclusions from the test guards (including the one in
tests/test.cpp that compiled out the re-exec'd server mode) and the
comments explaining them.
All 10 [ipc] cases pass repeatedly on wxQt in both test and test_gui,
with both a real X server and QT_QPA_PLATFORM=offscreen. Notably the
offscreen runs are meaningful for the previous commit's fix: with an X
server connected, X-connection traffic keeps rescheduling the idle
timer and can mask a missing WakeUp() event, while offscreen the
event loop goes truly idle.
Now that none of the tests use the CppUnit compatibility macros any more,
this header can be removed entirely.
Move the pieces still needed by the tests, i.e. wxINFO_FMT(),
WX_ASSERT_MESSAGE(), WX_ASSERT_EQUAL_MESSAGE() and the Catch::StringMaker
specializations for wxString and wxUniChar[Ref], to tests/testprec.h.
wxGetCurrentTestName() is now implemented using Catch itself instead of the
strings set by the CppUnit macros, which means that it finally returns the
correct name for all the tests and not just the CppUnit-style ones.
Assisted-by: Claude Opus 5
Let wx_add() accept a NO_CTEST flag and use it for test_base, so the
target can still be built normally without registering the old single
aggregate CTest entry.
Use Catch's catch_discover_tests() to register the base test binary as
individual CTest tests. Split normal tests from IPC tests so the IPC
subset can carry a shared resource lock and a longer timeout.
Suppress the wxWidgets test-environment banner when Catch is listing test
names or reporters. This keeps discovery output machine-readable while
preserving the banner for real test runs.
Don't duplicate the complex preprocessor check multiple times, just
define wxHAS_TEST_IPC_SERVER once and check for it.
Also define the helper ShouldRunTestIPCServer() function which is more
clear than using wxGetEnv() explicitly.
No real changes.
Add a test exercising the IPC-over-sockets implementation from a single
thread and from multiple threads concurrently (Execute, Request, Poke,
Advise, combined Advise+Request, and concurrent main-thread and
worker-thread Request()s).
Each test starts its own server by re-executing the test program with
WX_IPC_TEST_SERVER set and shuts it down again in the fixture teardown, so
no server process outlives a test (or disturbs the unrelated GUI tests in
test_gui). The client runs in the main Catch2 process and queries the server
for state to verify it (Catch2 macros cannot run in the server process). The
wait loops are wall-clock bounded so they behave under a GUI event loop, and
a per-fixture watchdog aborts with a diagnostic if a test ever hangs rather
than letting CI time out.
The test runs in both the console "test" and the GUI "test_gui" programs. It
is excluded from one configuration: wxQt, whose event loop does not reliably
process a cross-thread CallAfter() (a wxQt bug fixed separately).
Using "argc" and "argv" for parameter names triggers C4458 with MSVS
2022, warning about hiding class members with the same names.
As we can't rename the latter, rename the parameters to avoid this.
We're going to need to do it in a couple of places, so extend the
existing function for testing for Wine presence to also return its
version, if requested.
Use it to show the version of Wine being used when running the tests.
Use Catch2 public header instead of using internal Catch v1 headers: we
can do this now because Catch2 supports (albeit in a rather ugly way)
being used with PCH.
This is a combination of running clang-tidy with modernize-use-nullptr
check for some ports (GTK, X11, OSX) and manual changes to the ports for
which it couldn't be used easily (MSW, DFB) and also manually updating
the docs.
Also replace NULL with null or nullptr in the comments as this is more
consistent with the use of nullptr in the code and makes it simpler to
grep for the remaining occurrences of NULL itself.
And also use null in the assert messages.
Only a few occurrences of "NULL" are still left in non-C files, mostly
corresponding to unclear comments or string output which it might not be
safe to change.
Remove the port files and references to it from the common headers and
elsewhere.
Also remove GPE (GNOME PDA Environment) support as libgpewidget is
unmaintained since 2006 or so and has never been really used.
Use __WXGTK__ to test for any version of wxGTK now. Still define
__WXGTK20__ for compatibility, but always define it now and don't test
for it in the library code.
Unlike direct tests of __cplusplus, using this macro also works with
(recent enough, i.e. MSVS 2015.3 or later) MSVC versions, even if
/Zc:__cplusplus is not used.
This simplifies some checks and makes some other ones (notably the check
for C++20 used before wxALLOW_COMBINING_ENUMS macro definition) work
with MSVC versions with C++20 support as intended.
The name resolves to Cloudflare proxy which redirects all HTTP URLs to
HTTPS, which breaks the existing tests using HTTP, so prevent this from
happening by using the actual IP address instead.
When using Cloudflare, as we do for www.wxwidgets.org, the connection
succeeds as long as Cloudflare itself works, but reading later fails if
the real server behind Cloudflare proxy does not, so check if we can
read something from it.
Using LogEnabler in wxFileSystemWatcher test case still didn't show
anything even in case of unexpected failures because debug messages
didn't appear in the test output.
Fix this by using a custom log target which shows the debug (and trace)
messages on stderr, instead of using the debug output for them, even
under MSW.
Also make LogEnabler public, and rename it to a more unique name, as it
could be useful in the other tests too.
Although the compiler is already shown as part of the build signature,
it doesn't always show the exact compiler version used, which can be
useful as well, so add it here.
buildbot is not used since a long time, so don't bother checking for it
in IsAutomaticTest().
This commit is best viewed ignoring whitespace-only changes.
Make wxAppTraitsBase::GetAssertStackTrace() and reuse it in the assert
handler defined in the test to show more information about the asserts,
especially those failing in worker threads, if possible.
Don't use the current locale format which doesn't provide all the
information (e.g. never includes milliseconds) and explicitly set the
format providing it instead when showing wxLogTrace() messages.
Show the condition which failed for wxASSERT() (as opposed to
wxASSERT_MSG()), as otherwise the error message didn't show any
information at all, making diagnosing the problem impossible.
Also show the assert location, as this can be useful too and there
doesn't seem to be any reason not to do it.
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.