QEventDispatcher: test with glib disabled too

Change-Id: I05f09e720170c77a567ffea31dfe06a658f1df2b
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
Ahmad Samir 2023-08-02 03:28:29 +03:00
parent a4394b7241
commit 47bc742c48
3 changed files with 53 additions and 10 deletions

View File

@ -11,7 +11,23 @@ if(NOT QT_BUILD_STANDALONE_TESTS AND NOT QT_BUILDING_QT)
find_package(Qt6BuildInternals REQUIRED COMPONENTS STANDALONE_TEST)
endif()
qt_internal_add_test(tst_qeventdispatcher
set(test_names "tst_qeventdispatcher")
if(QT_FEATURE_glib AND UNIX)
list(APPEND test_names "tst_qeventdispatcher_no_glib")
endif()
foreach(test ${test_names})
qt_internal_add_test(${test}
NO_BATCH
SOURCES
tst_qeventdispatcher.cpp
)
endforeach()
if (TARGET tst_qeventdispatcher_no_glib)
qt_internal_extend_target(tst_qeventdispatcher_no_glib
DEFINES
DISABLE_GLIB
tst_QEventDispatcher=tst_QEventDispatcher_no_glib
)
endif()

View File

@ -3,7 +3,6 @@
#ifdef QT_GUI_LIB
# include <QtGui/QGuiApplication>
# define tst_QEventDispatcher tst_QGuiEventDispatcher
#else
# include <QtCore/QCoreApplication>
#endif
@ -12,6 +11,13 @@
#include <QTimer>
#include <QThreadPool>
#ifdef DISABLE_GLIB
static bool glibDisabled = []() {
qputenv("QT_NO_GLIB", "1");
return true;
}();
#endif
enum {
PreciseTimerInterval = 10,
CoarseTimerInterval = 200,

View File

@ -11,9 +11,30 @@ if(NOT QT_BUILD_STANDALONE_TESTS AND NOT QT_BUILDING_QT)
find_package(Qt6BuildInternals REQUIRED COMPONENTS STANDALONE_TEST)
endif()
qt_internal_add_test(tst_qguieventdispatcher
set(test_names "tst_qguieventdispatcher")
if(QT_FEATURE_glib AND UNIX)
list(APPEND test_names "tst_qguieventdispatcher_no_glib")
endif()
foreach(test ${test_names})
qt_internal_add_test(${test}
NO_BATCH
SOURCES
../../../corelib/kernel/qeventdispatcher/tst_qeventdispatcher.cpp
LIBRARIES
Qt::Gui
)
endforeach()
qt_internal_extend_target(tst_qguieventdispatcher
DEFINES
tst_QEventDispatcher=tst_qguieventdispatcher
)
if (TARGET tst_qeventdispatcher_no_glib)
qt_internal_extend_target(tst_qguieventdispatcher_no_glib
DEFINES
DISABLE_GLIB
tst_QEventDispatcher=tst_qguieventdispatcher_no_glib
)
endif()