summaryrefslogtreecommitdiffstats
path: root/tests/auto/corelib
diff options
context:
space:
mode:
authorMikolaj Boc <mikolaj.boc@qt.io>2022-08-26 21:13:59 +0200
committerMikolaj Boc <mikolaj.boc@qt.io>2022-09-11 19:36:49 +0200
commit1d401e34ac3c8e3cd1ad6f6d92bcd0fd896c9ec9 (patch)
tree82bc9d341f72a38f32628586639575bd71143872 /tests/auto/corelib
parentf3512ada092111a787d5d067551451fc91b8491d (diff)
Compile guard tests in corelib/kernel that need threading support
Some tests in corelib/kernel need threading support, but they are not guarded against compilation if Qt is built without threading. Such tests have been disabled in this case. Change-Id: I2f5dc9582f2a59b6af2a9e56638b045dca06193d Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
Diffstat (limited to 'tests/auto/corelib')
-rw-r--r--tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp2
-rw-r--r--tests/auto/corelib/kernel/qmetatype/tst_qmetatype.h2
-rw-r--r--tests/auto/corelib/kernel/qpointer/CMakeLists.txt4
-rw-r--r--tests/auto/corelib/kernel/qproperty/tst_qproperty.cpp4
-rw-r--r--tests/auto/corelib/kernel/qtimer/CMakeLists.txt4
-rw-r--r--tests/auto/corelib/kernel/qtranslator/CMakeLists.txt4
6 files changed, 20 insertions, 0 deletions
diff --git a/tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp b/tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp
index 90dd9fe3e6..a1b17539e7 100644
--- a/tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp
+++ b/tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp
@@ -376,6 +376,7 @@ public:
int Bar::failureCount = 0;
+#if QT_CONFIG(thread)
class MetaTypeTorturer: public QThread
{
Q_OBJECT
@@ -485,6 +486,7 @@ void tst_QMetaType::threadSafety()
QCOMPARE(t3.failureCount, 0);
QCOMPARE(Bar::failureCount, 0);
}
+#endif
namespace TestSpace
{
diff --git a/tests/auto/corelib/kernel/qmetatype/tst_qmetatype.h b/tests/auto/corelib/kernel/qmetatype/tst_qmetatype.h
index 9fb5b63262..77feff806f 100644
--- a/tests/auto/corelib/kernel/qmetatype/tst_qmetatype.h
+++ b/tests/auto/corelib/kernel/qmetatype/tst_qmetatype.h
@@ -45,7 +45,9 @@ private:
private slots:
void defined();
+#if QT_CONFIG(thread)
void threadSafety();
+#endif
void namespaces();
void id();
void qMetaTypeId();
diff --git a/tests/auto/corelib/kernel/qpointer/CMakeLists.txt b/tests/auto/corelib/kernel/qpointer/CMakeLists.txt
index 4b023b7033..e94730ba90 100644
--- a/tests/auto/corelib/kernel/qpointer/CMakeLists.txt
+++ b/tests/auto/corelib/kernel/qpointer/CMakeLists.txt
@@ -7,6 +7,10 @@
## tst_qpointer Test:
#####################################################################
+if (NOT QT_FEATURE_thread)
+ return()
+endif()
+
qt_internal_add_test(tst_qpointer
SOURCES
tst_qpointer.cpp
diff --git a/tests/auto/corelib/kernel/qproperty/tst_qproperty.cpp b/tests/auto/corelib/kernel/qproperty/tst_qproperty.cpp
index 93d2ac9783..f796e6d790 100644
--- a/tests/auto/corelib/kernel/qproperty/tst_qproperty.cpp
+++ b/tests/auto/corelib/kernel/qproperty/tst_qproperty.cpp
@@ -78,8 +78,10 @@ private slots:
void compatPropertySignals();
void noFakeDependencies();
+#if QT_CONFIG(thread)
void threadSafety();
void threadSafety2();
+#endif // QT_CONFIG(thread)
void bindablePropertyWithInitialization();
void noDoubleNotification();
@@ -1661,6 +1663,7 @@ void tst_QProperty::noFakeDependencies()
QCOMPARE(old, bindingFunctionCalled);
}
+#if QT_CONFIG(thread)
struct ThreadSafetyTester : public QObject
{
Q_OBJECT
@@ -1780,6 +1783,7 @@ void tst_QProperty::threadSafety2()
QCOMPARE(movedObj->objectName(), "test");
QCOMPARE(movedObj->children().first()->objectName(), "child");
}
+#endif // QT_CONFIG(thread)
struct CustomType
{
diff --git a/tests/auto/corelib/kernel/qtimer/CMakeLists.txt b/tests/auto/corelib/kernel/qtimer/CMakeLists.txt
index 1eed69e979..ef7cb92a23 100644
--- a/tests/auto/corelib/kernel/qtimer/CMakeLists.txt
+++ b/tests/auto/corelib/kernel/qtimer/CMakeLists.txt
@@ -7,6 +7,10 @@
## tst_qtimer Test:
#####################################################################
+if (NOT QT_FEATURE_thread)
+ return()
+endif()
+
qt_internal_add_test(tst_qtimer
SOURCES
tst_qtimer.cpp
diff --git a/tests/auto/corelib/kernel/qtranslator/CMakeLists.txt b/tests/auto/corelib/kernel/qtranslator/CMakeLists.txt
index ca64f08869..dcf977c739 100644
--- a/tests/auto/corelib/kernel/qtranslator/CMakeLists.txt
+++ b/tests/auto/corelib/kernel/qtranslator/CMakeLists.txt
@@ -7,6 +7,10 @@
## tst_qtranslator Test:
#####################################################################
+if (NOT QT_CONFIG_thread)
+ return()
+endif()
+
qt_internal_add_test(tst_qtranslator
SOURCES
tst_qtranslator.cpp