summaryrefslogtreecommitdiffstats
path: root/tests/auto/corelib/kernel/qeventdispatcher
diff options
context:
space:
mode:
authorAhmad Samir <a.samirh78@gmail.com>2023-08-02 03:28:29 +0300
committerAhmad Samir <a.samirh78@gmail.com>2023-08-11 16:45:40 +0300
commit47bc742c484ce4439a77b35de099d7296079a026 (patch)
treeefb529420acc8783287a7c54cf791e303b278196 /tests/auto/corelib/kernel/qeventdispatcher
parenta4394b7241a9fb38f210d9b933c075ef18771a66 (diff)
QEventDispatcher: test with glib disabled too
Change-Id: I05f09e720170c77a567ffea31dfe06a658f1df2b Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'tests/auto/corelib/kernel/qeventdispatcher')
-rw-r--r--tests/auto/corelib/kernel/qeventdispatcher/CMakeLists.txt24
-rw-r--r--tests/auto/corelib/kernel/qeventdispatcher/tst_qeventdispatcher.cpp8
2 files changed, 27 insertions, 5 deletions
diff --git a/tests/auto/corelib/kernel/qeventdispatcher/CMakeLists.txt b/tests/auto/corelib/kernel/qeventdispatcher/CMakeLists.txt
index fed7f447d0..1f9cfb9449 100644
--- a/tests/auto/corelib/kernel/qeventdispatcher/CMakeLists.txt
+++ b/tests/auto/corelib/kernel/qeventdispatcher/CMakeLists.txt
@@ -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
- SOURCES
- tst_qeventdispatcher.cpp
-)
+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()
diff --git a/tests/auto/corelib/kernel/qeventdispatcher/tst_qeventdispatcher.cpp b/tests/auto/corelib/kernel/qeventdispatcher/tst_qeventdispatcher.cpp
index fe78d0002f..a14cd7141d 100644
--- a/tests/auto/corelib/kernel/qeventdispatcher/tst_qeventdispatcher.cpp
+++ b/tests/auto/corelib/kernel/qeventdispatcher/tst_qeventdispatcher.cpp
@@ -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,