CMake: Add missing test files

Run GUI resource tests on WXMSW only.
Fix mouse enter/leave events test in wxQt by yielding longer.
This commit is contained in:
Maarten Bent
2026-01-25 19:54:32 +01:00
parent 99abe09211
commit c9798cada1
5 changed files with 25 additions and 19 deletions

View File

@@ -16,6 +16,7 @@ set(TEST_SRC
arrays/arrays.cpp
base64/base64.cpp
cmdline/cmdlinetest.cpp
config/config.cpp
config/fileconf.cpp
config/regconf.cpp
datetime/datetimetest.cpp
@@ -92,6 +93,7 @@ set(TEST_SRC
weakref/evtconnection.cpp
weakref/weakref.cpp
xlocale/xlocale.cpp
xml/xmltest.cpp
testprec.h
testableframe.h

View File

@@ -16,6 +16,7 @@ set(TEST_GUI_SRC
geometry/point.cpp
geometry/region.cpp
graphics/bitmap.cpp
graphics/bmpbundle.cpp
graphics/colour.cpp
graphics/ellipsization.cpp
graphics/measuring.cpp
@@ -70,6 +71,7 @@ set(TEST_GUI_SRC
controls/slidertest.cpp
controls/spinctrldbltest.cpp
controls/spinctrltest.cpp
controls/statbmptest.cpp
controls/styledtextctrltest.cpp
controls/textctrltest.cpp
controls/textentrytest.cpp
@@ -83,6 +85,7 @@ set(TEST_GUI_SRC
controls/windowtest.cpp
controls/dialogtest.cpp
events/clone.cpp
events/enterleave.cpp
# Duplicate this file here to test GUI event loops too.
events/evtlooptest.cpp
events/propagation.cpp
@@ -104,6 +107,7 @@ set(TEST_GUI_SRC
misc/garbage.cpp
misc/safearrayconverttest.cpp
misc/settings.cpp
misc/textwrap.cpp
# This one is intentionally duplicated here (it is also part of
# non-GUI test) as sockets behave differently in console and GUI
# applications.

View File

@@ -18,9 +18,9 @@
#include "wx/dcmemory.h"
#ifdef __WINDOWS__
#ifdef __WXMSW__
#include "wx/msw/private/resource_usage.h"
#endif // __WINDOWS__
#endif // __WXMSW__
static void TestStaticBitmap(wxWindow* window, double scale)
{
@@ -60,7 +60,7 @@ TEST_CASE("wxStaticBitmap::Set", "[wxStaticBitmap][bitmap]")
TestStaticBitmap(window, window->GetDPIScaleFactor());
}
#ifdef __WINDOWS__
#ifdef __WXMSW__
TEST_CASE("wxStaticBitmap::ResourceLeak", "[wxStaticBitmap]")
{
@@ -84,6 +84,6 @@ TEST_CASE("wxStaticBitmap::ResourceLeak", "[wxStaticBitmap]")
CHECK( usageAfter.numGDI == usageBefore.numGDI );
}
#endif // __WINDOWS__
#endif // __WXMSW__
#endif // wxUSE_STATBMP

View File

@@ -60,7 +60,7 @@ TEST_CASE("EnterLeaveEvents", "[wxEvent][enter-leave]")
SECTION("Without mouse capture")
{
sim.MouseMove(panel->GetScreenPosition() + wxPoint(5, 5));
wxYield();
YieldForAWhile();
CHECK( enter.GetCount() == 1 );
CHECK( leave.GetCount() == 0 );
@@ -68,7 +68,7 @@ TEST_CASE("EnterLeaveEvents", "[wxEvent][enter-leave]")
enter.Clear();
sim.MouseMove(button->GetScreenPosition() + wxPoint(5, 5));
wxYield();
YieldForAWhile();
// The parent window (panel) should receive wxEVT_LEAVE_WINDOW event
// when mouse enters the child window (button)
@@ -78,7 +78,7 @@ TEST_CASE("EnterLeaveEvents", "[wxEvent][enter-leave]")
leave.Clear();
sim.MouseMove(panel->GetScreenPosition() + wxPoint(5, 5));
wxYield();
YieldForAWhile();
// Now it (panel) should receive wxEVT_ENTER_WINDOW event when
// the mouse leaves the button and enters the panel again.
@@ -92,10 +92,10 @@ TEST_CASE("EnterLeaveEvents", "[wxEvent][enter-leave]")
EventCounter clicked(button, wxEVT_BUTTON);
sim.MouseMove(button->GetScreenPosition() + wxPoint(5, 5));
wxYield();
YieldForAWhile();
sim.MouseClick();
wxYield();
YieldForAWhile();
CHECK( clicked.GetCount() == 1 );
@@ -103,7 +103,7 @@ TEST_CASE("EnterLeaveEvents", "[wxEvent][enter-leave]")
leave.Clear();
sim.MouseDown();
wxYield();
YieldForAWhile();
#if defined(__WXGTK__) && !defined(__WXGTK3__)
if ( IsAutomaticTest() )
@@ -113,7 +113,7 @@ TEST_CASE("EnterLeaveEvents", "[wxEvent][enter-leave]")
}
#endif
sim.MouseMove(button->GetScreenPosition() + wxPoint(10, 5));
wxYield();
YieldForAWhile();
// Holding the mouse button down (initiated on the button) and then
// hovering over the panel should not generate any events (enter/leave)
@@ -121,25 +121,25 @@ TEST_CASE("EnterLeaveEvents", "[wxEvent][enter-leave]")
// mouse is still held down should also not generate any events.
sim.MouseMove(panel->GetScreenPosition() + wxPoint(5, 5));
wxYield();
YieldForAWhile();
CHECK( enter.GetCount() == 0 );
CHECK( leave.GetCount() == 0 );
sim.MouseMove(textctrl->GetScreenPosition() + wxPoint(5, 5));
wxYield();
YieldForAWhile();
CHECK( enter.GetCount() == 0 );
CHECK( leave.GetCount() == 0 );
sim.MouseMove(panel->GetScreenPosition() + wxPoint(5, 5));
wxYield();
YieldForAWhile();
CHECK( enter.GetCount() == 0 );
CHECK( leave.GetCount() == 0 );
sim.MouseUp();
wxYield();
YieldForAWhile();
// wxGTK behaves differently here, as it does not generate a
// wxEVT_ENTER_WINDOW event when we release the mouse button.

View File

@@ -18,9 +18,9 @@
#include "wx/dcmemory.h"
#include "wx/imaglist.h"
#ifdef __WINDOWS__
#ifdef __WXMSW__
#include "wx/msw/private/resource_usage.h"
#endif // __WINDOWS__
#endif // __WXMSW__
#include "asserthelper.h"
@@ -77,7 +77,7 @@ TEST_CASE("BitmapBundle::GetBitmap", "[bmpbundle]")
CHECK( b.GetBitmap(wxSize(48, 48)).GetSize() == wxSize(48, 48) );
}
#ifdef __WINDOWS__
#ifdef __WXMSW__
namespace
{
@@ -134,7 +134,7 @@ TEST_CASE("BitmapBundle::ResourceLeak", "[bmpbundle]")
CHECK( usageAfter.numGDI - usageBefore.numGDI < 10 );
}
#endif // __WINDOWS__
#endif // __WXMSW__
// Helper functions for the test below.
namespace