summaryrefslogtreecommitdiffstats
path: root/tests/auto/other
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/other')
-rw-r--r--tests/auto/other/CMakeLists.txt17
-rw-r--r--tests/auto/other/android_deployment_settings/CMakeLists.txt87
-rw-r--r--tests/auto/other/android_deployment_settings/noop.cpp7
-rw-r--r--tests/auto/other/android_deployment_settings/tst_android_deployment_settings.cpp114
-rw-r--r--tests/auto/other/gestures/BLACKLIST61
-rw-r--r--tests/auto/other/gestures/CMakeLists.txt8
-rw-r--r--tests/auto/other/gestures/tst_gestures.cpp86
-rw-r--r--tests/auto/other/languagechange/CMakeLists.txt14
-rw-r--r--tests/auto/other/languagechange/tst_languagechange.cpp2
-rw-r--r--tests/auto/other/macgui/BLACKLIST3
-rw-r--r--tests/auto/other/macgui/CMakeLists.txt13
-rw-r--r--tests/auto/other/macgui/guitest.cpp3
-rw-r--r--tests/auto/other/macgui/guitest.h2
-rw-r--r--tests/auto/other/macgui/tst_macgui.cpp63
-rw-r--r--tests/auto/other/macnativeevents/CMakeLists.txt9
-rw-r--r--tests/auto/other/macnativeevents/expectedeventlist.cpp2
-rw-r--r--tests/auto/other/macnativeevents/expectedeventlist.h2
-rw-r--r--tests/auto/other/macnativeevents/nativeeventlist.cpp2
-rw-r--r--tests/auto/other/macnativeevents/nativeeventlist.h2
-rw-r--r--tests/auto/other/macnativeevents/qnativeevents.cpp2
-rw-r--r--tests/auto/other/macnativeevents/qnativeevents.h2
-rw-r--r--tests/auto/other/macnativeevents/qnativeevents_mac.cpp2
-rw-r--r--tests/auto/other/macnativeevents/tst_macnativeevents.cpp2
-rw-r--r--tests/auto/other/macplist/CMakeLists.txt8
-rw-r--r--tests/auto/other/macplist/app/CMakeLists.txt4
-rw-r--r--tests/auto/other/macplist/app/main.cpp2
-rw-r--r--tests/auto/other/macplist/test/CMakeLists.txt2
-rw-r--r--tests/auto/other/macplist/tst_macplist.cpp2
-rw-r--r--tests/auto/other/networkselftest/BLACKLIST1
-rw-r--r--tests/auto/other/networkselftest/CMakeLists.txt13
-rw-r--r--tests/auto/other/networkselftest/tst_networkselftest.cpp5
-rw-r--r--tests/auto/other/qabstractitemmodelutils/dynamictreemodel.cpp14
-rw-r--r--tests/auto/other/qabstractitemmodelutils/dynamictreemodel.h2
-rw-r--r--tests/auto/other/qaccessibility/CMakeLists.txt9
-rw-r--r--tests/auto/other/qaccessibility/accessiblewidgets.h2
-rw-r--r--tests/auto/other/qaccessibility/tst_qaccessibility.cpp290
-rw-r--r--tests/auto/other/qaccessibilitylinux/CMakeLists.txt11
-rw-r--r--tests/auto/other/qaccessibilitylinux/tst_qaccessibilitylinux.cpp4
-rw-r--r--tests/auto/other/qaccessibilitymac/CMakeLists.txt6
-rw-r--r--tests/auto/other/qaccessibilitymac/tst_qaccessibilitymac.mm102
-rw-r--r--tests/auto/other/qcomplextext/CMakeLists.txt8
-rw-r--r--tests/auto/other/qcomplextext/bidireorderstring.h2
-rw-r--r--tests/auto/other/qcomplextext/tst_qcomplextext.cpp10
-rw-r--r--tests/auto/other/qfocusevent/CMakeLists.txt8
-rw-r--r--tests/auto/other/qfocusevent/tst_qfocusevent.cpp8
-rw-r--r--tests/auto/other/qnetworkaccessmanager_and_qprogressdialog/CMakeLists.txt8
-rw-r--r--tests/auto/other/qnetworkaccessmanager_and_qprogressdialog/tst_qnetworkaccessmanager_and_qprogressdialog.cpp2
-rw-r--r--tests/auto/other/qobjectrace/CMakeLists.txt8
-rw-r--r--tests/auto/other/qobjectrace/tst_qobjectrace.cpp6
-rw-r--r--tests/auto/other/qprocess_and_guieventloop/CMakeLists.txt9
-rw-r--r--tests/auto/other/qprocess_and_guieventloop/tst_qprocess_and_guieventloop.cpp2
-rw-r--r--tests/auto/other/qprocess_and_guieventloop/write-read-write/CMakeLists.txt6
-rw-r--r--tests/auto/other/qprocess_and_guieventloop/write-read-write/main.cpp2
-rw-r--r--tests/auto/other/qsharedpointer_and_qwidget/CMakeLists.txt8
-rw-r--r--tests/auto/other/qsharedpointer_and_qwidget/tst_qsharedpointer_and_qwidget.cpp2
-rw-r--r--tests/auto/other/qvariant_common/tst_qvariant_common.h11
-rw-r--r--tests/auto/other/sessionmanagement_macos/tst_sessionmanagement_macos.mm2
-rw-r--r--tests/auto/other/toolsupport/CMakeLists.txt8
-rw-r--r--tests/auto/other/toolsupport/tst_toolsupport.cpp7
-rw-r--r--tests/auto/other/xkbkeyboard/CMakeLists.txt8
-rw-r--r--tests/auto/other/xkbkeyboard/tst_xkbkeyboard.cpp2
61 files changed, 820 insertions, 289 deletions
diff --git a/tests/auto/other/CMakeLists.txt b/tests/auto/other/CMakeLists.txt
index 0094a016a7..e261ea234d 100644
--- a/tests/auto/other/CMakeLists.txt
+++ b/tests/auto/other/CMakeLists.txt
@@ -1,17 +1,12 @@
# Copyright (C) 2022 The Qt Company Ltd.
# SPDX-License-Identifier: BSD-3-Clause
-# Generated from other.pro.
-
-if(NOT CMAKE_CROSSCOMPILING)
- # add_subdirectory(atwrapper) <- does not exist # special case
-endif()
if(TARGET Qt::Widgets)
add_subdirectory(gestures)
add_subdirectory(languagechange)
add_subdirectory(qfocusevent)
add_subdirectory(qsharedpointer_and_qwidget)
- # add_subdirectory(windowsmobile) <- does not exist # special case
+ # add_subdirectory(windowsmobile) <- does not exist
endif()
if(TARGET Qt::Network AND TARGET Qt::Widgets)
add_subdirectory(qnetworkaccessmanager_and_qprogressdialog)
@@ -32,15 +27,15 @@ if(TARGET Qt::Gui)
endif()
add_subdirectory(qobjectrace)
add_subdirectory(toolsupport)
-# QTBUG-87670 # special case
+# QTBUG-87670
if(QT_FEATURE_process AND TARGET Qt::Gui AND NOT ANDROID)
add_subdirectory(qprocess_and_guieventloop)
endif()
if(QT_FEATURE_accessibility_atspi_bridge AND TARGET Qt::Gui AND TARGET Qt::Widgets)
- #add_subdirectory(qaccessibilitylinux) # special case # This test is broken
+ #add_subdirectory(qaccessibilitylinux) # TODO: This test is broken
endif()
if(MACOS AND TARGET Qt::Gui)
- # add_subdirectory(macnativeevents) # special case it's disabled in qmake too
+ # add_subdirectory(macnativeevents) # TODO: it's disabled in qmake too
endif()
if(embedded)
add_subdirectory(qdirectpainter)
@@ -48,3 +43,7 @@ endif()
if(QT_FEATURE_xkbcommon AND TARGET Qt::Gui)
add_subdirectory(xkbkeyboard)
endif()
+
+if(ANDROID AND QT_BUILD_STANDALONE_TESTS)
+ add_subdirectory(android_deployment_settings)
+endif()
diff --git a/tests/auto/other/android_deployment_settings/CMakeLists.txt b/tests/auto/other/android_deployment_settings/CMakeLists.txt
new file mode 100644
index 0000000000..9ef457189a
--- /dev/null
+++ b/tests/auto/other/android_deployment_settings/CMakeLists.txt
@@ -0,0 +1,87 @@
+# Copyright (C) 2023 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
+if(NOT QT_BUILD_STANDALONE_TESTS AND NOT QT_BUILDING_QT)
+ cmake_minimum_required(VERSION 3.16)
+ project(tst_android_deployment_settings LANGUAGES CXX)
+ find_package(Qt6BuildInternals REQUIRED COMPONENTS STANDALONE_TEST)
+endif()
+
+function(tst_generate_android_deployment_setting target)
+ # Qt build always use new property format that supports generator expressions. In this test we
+ # want to test user scenario so disable all Qt specific options to make sure that
+ # qt6_android_generate_deployment_settings behave like in user projects.
+ set(QT_BUILD_STANDALONE_TESTS FALSE)
+ set(QT_BUILDING_QT FALSE)
+ set(QT_INTERNAL_IS_STANDALONE_TEST FALSE)
+
+ qt6_android_generate_deployment_settings(${target})
+endfunction()
+
+qt6_policy(SET QTP0002 NEW)
+
+set(target tst_android_deployment_settings_new)
+qt6_add_executable(${target} MANUAL_FINALIZATION EXCLUDE_FROM_ALL noop.cpp)
+set_target_properties(${target} PROPERTIES
+ my_package_source_dir "path/to/source/dir"
+ my_libs_property "some/path/to/lib2.so;some/path/to/lib3.so"
+ my_plugins_property "some/path/to/plugin2.so;some/path/to/plugin3.so"
+
+ QT_ANDROID_SDK_BUILD_TOOLS_REVISION "23.0.2"
+ QT_ANDROID_MIN_SDK_VERSION "1"
+ QT_ANDROID_TARGET_SDK_VERSION "2"
+ QT_ANDROID_PACKAGE_NAME "org.qtproject.android_deployment_settings_test"
+ QT_ANDROID_DEPLOYMENT_DEPENDENCIES "dep1.so;dep2.so;dep3.so"
+ QT_ANDROID_DEPLOYMENT_SETTINGS_FILE "attempt_to_rewrite.json"
+ QT_ANDROID_EXTRA_LIBS
+ "some/path/to/lib1.so;$<TARGET_PROPERTY:${target},my_libs_property>;some/path/to/lib4.so"
+ QT_ANDROID_EXTRA_PLUGINS
+ "some/path/to/plugin1.so;$<TARGET_PROPERTY:${target},my_plugins_property>"
+ QT_ANDROID_PACKAGE_SOURCE_DIR "$<TARGET_PROPERTY:${target},my_package_source_dir>"
+ QT_ANDROID_SYSTEM_LIBS_PREFIX "myLibPrefix"
+
+ # Make sure that this property is overwritten by
+ # qt6_android_generate_deployment_settings
+ QT_ANDROID_DEPLOYMENT_SETTINGS_FILE "custom_deployment_settings.json"
+)
+tst_generate_android_deployment_setting(${target})
+
+qt6_policy(SET QTP0002 OLD)
+
+set(target tst_android_deployment_settings_old)
+qt6_add_executable(${target} MANUAL_FINALIZATION EXCLUDE_FROM_ALL noop.cpp)
+set_target_properties(${target} PROPERTIES
+ QT_ANDROID_SDK_BUILD_TOOLS_REVISION "23.0.2"
+ QT_ANDROID_MIN_SDK_VERSION "1"
+ QT_ANDROID_TARGET_SDK_VERSION "2"
+ QT_ANDROID_PACKAGE_NAME "org.qtproject.android_deployment_settings_test"
+ QT_ANDROID_DEPLOYMENT_DEPENDENCIES "dep1.so;dep2.so;dep3.so"
+ QT_ANDROID_EXTRA_LIBS
+ "some/path/to/lib1.so;some/path\\to/lib2.so;some\\path\\to\\lib3.so;some/path/to/lib4.so"
+ QT_ANDROID_EXTRA_PLUGINS
+ "some\\path\\to\\plugin1.so;some/path\\to/plugin2.so;some/path/to/plugin3.so"
+ QT_ANDROID_PACKAGE_SOURCE_DIR "path\\to/source\\dir"
+ QT_ANDROID_SYSTEM_LIBS_PREFIX "myLibPrefix"
+)
+tst_generate_android_deployment_setting(${target})
+
+get_target_property(new_settings
+ tst_android_deployment_settings_new QT_ANDROID_DEPLOYMENT_SETTINGS_FILE)
+get_target_property(old_settings
+ tst_android_deployment_settings_old QT_ANDROID_DEPLOYMENT_SETTINGS_FILE)
+set_source_files_properties("${new_settings}" PROPERTIES QT_RESOURCE_ALIAS "new_settings.json")
+set_source_files_properties("${old_settings}" PROPERTIES QT_RESOURCE_ALIAS "old_settings.json")
+qt_internal_add_test(tst_android_deployment_settings
+ SOURCES
+ tst_android_deployment_settings.cpp
+ DEFINES
+ DEFAULT_ABI="${CMAKE_ANDROID_ARCH_ABI}"
+)
+qt6_add_resources(tst_android_deployment_settings
+ "deployment_settings_res"
+ PREFIX
+ "/"
+ FILES
+ "${new_settings}"
+ "${old_settings}"
+)
diff --git a/tests/auto/other/android_deployment_settings/noop.cpp b/tests/auto/other/android_deployment_settings/noop.cpp
new file mode 100644
index 0000000000..6f2ee31826
--- /dev/null
+++ b/tests/auto/other/android_deployment_settings/noop.cpp
@@ -0,0 +1,7 @@
+// Copyright (C) 2023 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+int main(int, char *[])
+{
+ return 0;
+}
diff --git a/tests/auto/other/android_deployment_settings/tst_android_deployment_settings.cpp b/tests/auto/other/android_deployment_settings/tst_android_deployment_settings.cpp
new file mode 100644
index 0000000000..f8428aaf43
--- /dev/null
+++ b/tests/auto/other/android_deployment_settings/tst_android_deployment_settings.cpp
@@ -0,0 +1,114 @@
+// Copyright (C) 2023 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+#include <QJsonDocument>
+#include <QJsonObject>
+#include <QFile>
+#include <QTest>
+#include <QLibraryInfo>
+#include <QDir>
+
+class tst_android_deployment_settings : public QObject
+{
+ Q_OBJECT
+
+private slots:
+ void initTestCase_data();
+ void init();
+
+ void DeploymentSettings_data();
+ void DeploymentSettings();
+
+ void QtPaths_data();
+ void QtPaths();
+
+private:
+ static QString makePath(QLibraryInfo::LibraryLocation loc);
+ QJsonDocument jsonDoc;
+};
+
+QString tst_android_deployment_settings::makePath(QLibraryInfo::LibraryLocation loc)
+{
+ const auto prefix = QLibraryInfo::path(QLibraryInfo::PrefixPath);
+ auto path = QLibraryInfo::path(loc);
+ path.remove(0, prefix.size() + 1);
+ if (path.isEmpty()) // Assume that if path is empty it's '.'
+ path = ".";
+ return path;
+}
+
+void tst_android_deployment_settings::initTestCase_data()
+{
+ QTest::addColumn<QString>("file");
+ QTest::newRow("old") << ":/old_settings.json";
+ QTest::newRow("new") << ":/new_settings.json";
+}
+
+void tst_android_deployment_settings::init()
+{
+ QFETCH_GLOBAL(QString, file);
+ QFile settings(file);
+ QVERIFY(settings.open(QIODeviceBase::ReadOnly));
+ jsonDoc = QJsonDocument::fromJson(settings.readAll());
+ QVERIFY(!jsonDoc.isNull());
+}
+
+void tst_android_deployment_settings::DeploymentSettings_data()
+{
+ QTest::addColumn<QString>("key");
+ QTest::addColumn<QString>("value");
+
+ QTest::newRow("sdkBuildToolsRevision") << "sdkBuildToolsRevision"
+ << "23.0.2";
+ QTest::newRow("deployment-dependencies") << "deployment-dependencies"
+ << "dep1.so,dep2.so,dep3.so";
+ QTest::newRow("android-extra-plugins")
+ << "android-extra-plugins"
+ << "some/path/to/plugin1.so,some/path/to/plugin2.so,some/path/to/plugin3.so";
+ QTest::newRow("android-extra-libs") << "android-extra-libs"
+ << "some/path/to/lib1.so,some/path/to/lib2.so,some/path/to/"
+ "lib3.so,some/path/to/lib4.so";
+ QTest::newRow("android-system-libs-prefix") << "android-system-libs-prefix"
+ << "myLibPrefix";
+ QTest::newRow("android-package-source-directory") << "android-package-source-directory"
+ << "path/to/source/dir";
+ QTest::newRow("android-min-sdk-version") << "android-min-sdk-version"
+ << "1";
+ QTest::newRow("android-target-sdk-version") << "android-target-sdk-version"
+ << "2";
+ QTest::newRow("android-package-name") << "android-package-name"
+ << "org.qtproject.android_deployment_settings_test";
+}
+
+void tst_android_deployment_settings::DeploymentSettings()
+{
+ QFETCH(QString, key);
+ QFETCH(QString, value);
+ QCOMPARE(jsonDoc[key].toString(), value);
+}
+
+void tst_android_deployment_settings::QtPaths_data()
+{
+ QTest::addColumn<QString>("key");
+ QTest::addColumn<QString>("value");
+
+ QTest::newRow("qtDataDirectory") << "qtDataDirectory" << makePath(QLibraryInfo::DataPath);
+ QTest::newRow("qtLibExecsDirectory")
+ << "qtLibExecsDirectory" << makePath(QLibraryInfo::LibraryExecutablesPath);
+ QTest::newRow("qtLibsDirectory") << "qtLibsDirectory" << makePath(QLibraryInfo::LibrariesPath);
+ QTest::newRow("qtPluginsDirectory")
+ << "qtPluginsDirectory" << makePath(QLibraryInfo::PluginsPath);
+ QTest::newRow("qtQmlDirectory") << "qtQmlDirectory" << makePath(QLibraryInfo::QmlImportsPath);
+}
+
+void tst_android_deployment_settings::QtPaths()
+{
+ QFETCH(QString, key);
+ QFETCH(QString, value);
+ QCOMPARE(QDir::cleanPath(jsonDoc[key].toObject()[DEFAULT_ABI].toString()),
+ QDir::cleanPath(value));
+}
+
+QTEST_MAIN(tst_android_deployment_settings)
+
+#include "tst_android_deployment_settings.moc"
diff --git a/tests/auto/other/gestures/BLACKLIST b/tests/auto/other/gestures/BLACKLIST
index 8a52754048..8e96992e4d 100644
--- a/tests/auto/other/gestures/BLACKLIST
+++ b/tests/auto/other/gestures/BLACKLIST
@@ -1,65 +1,4 @@
-# Temporary fix for QTBUG-106244, QTBUG-104496
-opensuse-leap
-
[panelPropagation]
-ubuntu-20.04
ubuntu-22.04 ci
[panelStacksBehindParent]
-ubuntu-20.04
ubuntu-22.04 ci
-
-# QTBUG-108402
-[gestureOverChildGraphicsItem]
-macOS arm
-
-# QTBUG-108402
-[conflictingGesturesInGraphicsView]
-macOS arm
-
-# QTBUG-108402
-[graphicsItemGesture]
-macOS arm
-
-# QTBUG-108402
-[graphicsView]
-macOS arm
-
-# QTBUG-108402
-[graphicsItemTreeGesture]
-macOS arm
-
-# QTBUG-108402
-[explicitGraphicsObjectTarget]
-macOS arm
-
-# QTBUG-108402
-[gestureOverChildGraphicsItem]
-macOS arm
-
-# QTBUG-108402
-[autoCancelGestures2]
-macOS arm
-
-# QTBUG-108402
-[graphicsViewParentPropagation]
-macOS arm
-
-# QTBUG-108402
-[panelPropagation]
-macOS arm
-
-# QTBUG-108402
-[panelStacksBehindParent]
-macOS arm
-
-# QTBUG-108402
-[viewportCoordinates]
-macOS arm
-
-# QTBUG-108402
-[partialGesturePropagation]
-macOS arm
-
-# QTBUG-108402
-[testReuseCanceledGestures]
-macOS arm
diff --git a/tests/auto/other/gestures/CMakeLists.txt b/tests/auto/other/gestures/CMakeLists.txt
index faf8dd9f0f..815846305a 100644
--- a/tests/auto/other/gestures/CMakeLists.txt
+++ b/tests/auto/other/gestures/CMakeLists.txt
@@ -1,12 +1,16 @@
# Copyright (C) 2022 The Qt Company Ltd.
# SPDX-License-Identifier: BSD-3-Clause
-# Generated from gestures.pro.
-
#####################################################################
## tst_gestures Test:
#####################################################################
+if(NOT QT_BUILD_STANDALONE_TESTS AND NOT QT_BUILDING_QT)
+ cmake_minimum_required(VERSION 3.16)
+ project(tst_gestures LANGUAGES CXX)
+ find_package(Qt6BuildInternals REQUIRED COMPONENTS STANDALONE_TEST)
+endif()
+
qt_internal_add_test(tst_gestures
SOURCES
tst_gestures.cpp
diff --git a/tests/auto/other/gestures/tst_gestures.cpp b/tests/auto/other/gestures/tst_gestures.cpp
index f8828da71a..a413268321 100644
--- a/tests/auto/other/gestures/tst_gestures.cpp
+++ b/tests/auto/other/gestures/tst_gestures.cpp
@@ -1,6 +1,5 @@
// Copyright (C) 2016 The Qt Company Ltd.
-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
-
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include <QTest>
#include <QtTest/qtesttouch.h>
@@ -209,7 +208,7 @@ protected:
QGestureEvent *e = static_cast<QGestureEvent*>(event);
++gestureEventsReceived;
eventsPtr = &events;
- foreach(Qt::GestureType type, ignoredGestures)
+ for (Qt::GestureType type : std::as_const(ignoredGestures))
e->ignore(e->gesture(type));
} else if (event->type() == QEvent::GestureOverride) {
++gestureOverrideEventsReceived;
@@ -219,8 +218,8 @@ protected:
}
if (eventsPtr) {
QGestureEvent *e = static_cast<QGestureEvent*>(event);
- QList<QGesture*> gestures = e->gestures();
- foreach(QGesture *g, gestures) {
+ const QList<QGesture*> gestures = e->gestures();
+ for (QGesture *g : gestures) {
eventsPtr->all << g->gestureType();
switch(g->state()) {
case Qt::GestureStarted:
@@ -282,6 +281,10 @@ Q_OBJECT
private slots:
void initTestCase();
void cleanupTestCase();
+
+ void init();
+ void cleanup();
+
void customGesture();
void autoCancelingGestures();
void gestureOverChild();
@@ -324,15 +327,23 @@ private:
void tst_Gestures::initTestCase()
{
- CustomGesture::GestureType = QGestureRecognizer::registerRecognizer(new CustomGestureRecognizer);
- QVERIFY(CustomGesture::GestureType != Qt::GestureType(0));
- QVERIFY(CustomGesture::GestureType != Qt::CustomGesture);
const QScreen *screen = QGuiApplication::primaryScreen();
m_availableTopLeft = screen->availableGeometry().topLeft();
}
void tst_Gestures::cleanupTestCase()
{
+}
+
+void tst_Gestures::init()
+{
+ CustomGesture::GestureType = QGestureRecognizer::registerRecognizer(new CustomGestureRecognizer);
+ QVERIFY(CustomGesture::GestureType != Qt::GestureType(0));
+ QVERIFY(CustomGesture::GestureType != Qt::CustomGesture);
+}
+
+void tst_Gestures::cleanup()
+{
QGestureRecognizer::unregisterRecognizer(CustomGesture::GestureType);
}
@@ -588,6 +599,9 @@ void tst_Gestures::conflictingGestures()
child->reset();
Qt::GestureType ContinuousGesture = QGestureRecognizer::registerRecognizer(new CustomContinuousGestureRecognizer);
+ auto unregisterRecognizer = qScopeGuard([ContinuousGesture]{
+ QGestureRecognizer::unregisterRecognizer(ContinuousGesture);
+ });
static const int ContinuousGestureEventsCount = CustomGesture::SerialFinishedThreshold - CustomGesture::SerialMaybeThreshold + 1;
child->grabGesture(ContinuousGesture);
// child accepts override. And it also receives another custom gesture.
@@ -600,8 +614,6 @@ void tst_Gestures::conflictingGestures()
QCOMPARE(child->events.all.size(), TotalGestureEventsCount + ContinuousGestureEventsCount);
QCOMPARE(parent.gestureOverrideEventsReceived, 0);
QCOMPARE(parent.gestureEventsReceived, 0);
-
- QGestureRecognizer::unregisterRecognizer(ContinuousGesture);
}
void tst_Gestures::finishedWithoutStarted()
@@ -730,9 +742,10 @@ public:
++gestureEventsReceived;
eventsPtr = &events;
QGestureEvent *e = static_cast<QGestureEvent *>(event);
- foreach(Qt::GestureType type, ignoredGestures)
+ for (Qt::GestureType type : std::as_const(ignoredGestures))
e->ignore(e->gesture(type));
- foreach(QGesture *g, e->gestures()) {
+ const auto gestures = e->gestures();
+ for (QGesture *g : gestures) {
switch (g->state()) {
case Qt::GestureStarted:
if (ignoredStartedGestures.contains(g->gestureType()))
@@ -758,8 +771,8 @@ public:
}
if (eventsPtr) {
QGestureEvent *e = static_cast<QGestureEvent*>(event);
- QList<QGesture*> gestures = e->gestures();
- foreach(QGesture *g, gestures) {
+ const QList<QGesture*> gestures = e->gestures();
+ for (QGesture *g : gestures) {
eventsPtr->all << g->gestureType();
switch(g->state()) {
case Qt::GestureStarted:
@@ -1159,6 +1172,9 @@ void tst_Gestures::twoGesturesOnDifferentLevel()
l->addWidget(child);
Qt::GestureType SecondGesture = QGestureRecognizer::registerRecognizer(new CustomGestureRecognizer);
+ auto unregisterRecognizer = qScopeGuard([SecondGesture]{
+ QGestureRecognizer::unregisterRecognizer(SecondGesture);
+ });
parent.grabGesture(CustomGesture::GestureType);
child->grabGesture(SecondGesture);
@@ -1185,8 +1201,6 @@ void tst_Gestures::twoGesturesOnDifferentLevel()
QCOMPARE(parent.gestureOverrideEventsReceived, 0);
for(int i = 0; i < child->events.all.size(); ++i)
QCOMPARE(parent.events.all.at(i), CustomGesture::GestureType);
-
- QGestureRecognizer::unregisterRecognizer(SecondGesture);
}
void tst_Gestures::multipleGesturesInTree()
@@ -1200,6 +1214,10 @@ void tst_Gestures::multipleGesturesInTree()
Qt::GestureType FirstGesture = CustomGesture::GestureType;
Qt::GestureType SecondGesture = QGestureRecognizer::registerRecognizer(new CustomGestureRecognizer);
Qt::GestureType ThirdGesture = QGestureRecognizer::registerRecognizer(new CustomGestureRecognizer);
+ auto unregisterRecognizer = qScopeGuard([SecondGesture, ThirdGesture]{
+ QGestureRecognizer::unregisterRecognizer(SecondGesture);
+ QGestureRecognizer::unregisterRecognizer(ThirdGesture);
+ });
Qt::GestureFlags flags = Qt::ReceivePartialGestures;
A->grabGesture(FirstGesture, flags); // A [1 3]
@@ -1256,9 +1274,6 @@ void tst_Gestures::multipleGesturesInTree()
QCOMPARE(A->events.all.count(FirstGesture), TotalGestureEventsCount);
QCOMPARE(A->events.all.count(SecondGesture), 0);
QCOMPARE(A->events.all.count(ThirdGesture), TotalGestureEventsCount);
-
- QGestureRecognizer::unregisterRecognizer(SecondGesture);
- QGestureRecognizer::unregisterRecognizer(ThirdGesture);
}
void tst_Gestures::multipleGesturesInComplexTree()
@@ -1276,6 +1291,14 @@ void tst_Gestures::multipleGesturesInComplexTree()
Qt::GestureType FifthGesture = QGestureRecognizer::registerRecognizer(new CustomGestureRecognizer);
Qt::GestureType SixthGesture = QGestureRecognizer::registerRecognizer(new CustomGestureRecognizer);
Qt::GestureType SeventhGesture = QGestureRecognizer::registerRecognizer(new CustomGestureRecognizer);
+ auto unregisterRecognizer = qScopeGuard([=]{
+ QGestureRecognizer::unregisterRecognizer(SecondGesture);
+ QGestureRecognizer::unregisterRecognizer(ThirdGesture);
+ QGestureRecognizer::unregisterRecognizer(FourthGesture);
+ QGestureRecognizer::unregisterRecognizer(FifthGesture);
+ QGestureRecognizer::unregisterRecognizer(SixthGesture);
+ QGestureRecognizer::unregisterRecognizer(SeventhGesture);
+ });
Qt::GestureFlags flags = Qt::ReceivePartialGestures;
A->grabGesture(FirstGesture, flags); // A [1,3,4]
@@ -1353,13 +1376,6 @@ void tst_Gestures::multipleGesturesInComplexTree()
QCOMPARE(A->events.all.count(FifthGesture), 0);
QCOMPARE(A->events.all.count(SixthGesture), 0);
QCOMPARE(A->events.all.count(SeventhGesture), 0);
-
- QGestureRecognizer::unregisterRecognizer(SecondGesture);
- QGestureRecognizer::unregisterRecognizer(ThirdGesture);
- QGestureRecognizer::unregisterRecognizer(FourthGesture);
- QGestureRecognizer::unregisterRecognizer(FifthGesture);
- QGestureRecognizer::unregisterRecognizer(SixthGesture);
- QGestureRecognizer::unregisterRecognizer(SeventhGesture);
}
void tst_Gestures::testMapToScene()
@@ -1495,6 +1511,9 @@ void tst_Gestures::autoCancelGestures()
};
const Qt::GestureType secondGesture = QGestureRecognizer::registerRecognizer(new CustomGestureRecognizer);
+ auto unregisterRecognizer = qScopeGuard([secondGesture]{
+ QGestureRecognizer::unregisterRecognizer(secondGesture);
+ });
MockWidget parent("parent"); // this one sets the cancel policy to CancelAllInContext
parent.resize(300, 100);
@@ -1550,6 +1569,9 @@ void tst_Gestures::autoCancelGestures2()
};
const Qt::GestureType secondGesture = QGestureRecognizer ::registerRecognizer(new CustomGestureRecognizer);
+ auto unregisterRecognizer = qScopeGuard([secondGesture]{
+ QGestureRecognizer::unregisterRecognizer(secondGesture);
+ });
QGraphicsScene scene;
QGraphicsView view(&scene);
@@ -2057,10 +2079,14 @@ void tst_Gestures::testQGestureRecognizerCleanup()
// Mimic QGestureManager: register both default and "platform" recognizers
// (this is done in windows when QT_NO_NATIVE_GESTURES is not defined)
PanRecognizer *def = new PanRecognizer(PanRecognizer::Default);
- QGestureRecognizer::registerRecognizer(def);
+ auto defRecognizer = QGestureRecognizer::registerRecognizer(def);
PanRecognizer *plt = new PanRecognizer(PanRecognizer::Platform);
- QGestureRecognizer::registerRecognizer(plt);
+ auto pltRecognizer = QGestureRecognizer::registerRecognizer(plt);
qDebug () << "register: default =" << def << "; platform =" << plt;
+ auto unregisterRecognizer = qScopeGuard([defRecognizer, pltRecognizer]{
+ QGestureRecognizer::unregisterRecognizer(defRecognizer);
+ QGestureRecognizer::unregisterRecognizer(pltRecognizer);
+ });
// ^-- Qt singleton QGManager initialization
@@ -2174,6 +2200,10 @@ void tst_Gestures::testReuseCanceledGestures()
new ReuseCanceledGesturesRecognizer(ReuseCanceledGesturesRecognizer::RmbAndCancelAllType));
Qt::GestureType tapGestureTypeId = QGestureRecognizer::registerRecognizer(
new ReuseCanceledGesturesRecognizer(ReuseCanceledGesturesRecognizer::LmbType));
+ auto unregisterRecognizer = qScopeGuard([=]{
+ QGestureRecognizer::unregisterRecognizer(cancellingGestureTypeId);
+ QGestureRecognizer::unregisterRecognizer(tapGestureTypeId);
+ });
QMainWindow mw;
mw.setWindowFlags(Qt::X11BypassWindowManagerHint);
diff --git a/tests/auto/other/languagechange/CMakeLists.txt b/tests/auto/other/languagechange/CMakeLists.txt
index 8d7760ea9a..07f3547d58 100644
--- a/tests/auto/other/languagechange/CMakeLists.txt
+++ b/tests/auto/other/languagechange/CMakeLists.txt
@@ -1,12 +1,16 @@
# Copyright (C) 2022 The Qt Company Ltd.
# SPDX-License-Identifier: BSD-3-Clause
-# Generated from languagechange.pro.
-
#####################################################################
## tst_languagechange Test:
#####################################################################
+if(NOT QT_BUILD_STANDALONE_TESTS AND NOT QT_BUILDING_QT)
+ cmake_minimum_required(VERSION 3.16)
+ project(tst_languagechange LANGUAGES CXX)
+ find_package(Qt6BuildInternals REQUIRED COMPONENTS STANDALONE_TEST)
+endif()
+
qt_internal_add_test(tst_languagechange
SOURCES
tst_languagechange.cpp
@@ -16,9 +20,3 @@ qt_internal_add_test(tst_languagechange
Qt::GuiPrivate
Qt::Widgets
)
-
-## Scopes:
-#####################################################################
-
-#### Keys ignored in scope 2:.:.:languagechange.pro:WIN32:
-# testcase.timeout = "1800"
diff --git a/tests/auto/other/languagechange/tst_languagechange.cpp b/tests/auto/other/languagechange/tst_languagechange.cpp
index f5ae7c0717..8f99730a19 100644
--- a/tests/auto/other/languagechange/tst_languagechange.cpp
+++ b/tests/auto/other/languagechange/tst_languagechange.cpp
@@ -1,5 +1,5 @@
// Copyright (C) 2016 The Qt Company Ltd.
-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include <QTest>
diff --git a/tests/auto/other/macgui/BLACKLIST b/tests/auto/other/macgui/BLACKLIST
index 05e529e519..a6dc56611b 100644
--- a/tests/auto/other/macgui/BLACKLIST
+++ b/tests/auto/other/macgui/BLACKLIST
@@ -1,5 +1,2 @@
-[nonModalOrder]
-osx
-
[scrollbarPainting]
macos
diff --git a/tests/auto/other/macgui/CMakeLists.txt b/tests/auto/other/macgui/CMakeLists.txt
index a8451810c6..afa3f0b8df 100644
--- a/tests/auto/other/macgui/CMakeLists.txt
+++ b/tests/auto/other/macgui/CMakeLists.txt
@@ -1,12 +1,16 @@
# Copyright (C) 2022 The Qt Company Ltd.
# SPDX-License-Identifier: BSD-3-Clause
-# Generated from macgui.pro.
+if(NOT QT_BUILD_STANDALONE_TESTS AND NOT QT_BUILDING_QT)
+ cmake_minimum_required(VERSION 3.16)
+ project(tst_macgui LANGUAGES CXX)
+ find_package(Qt6BuildInternals REQUIRED COMPONENTS STANDALONE_TEST)
+endif()
if(NOT APPLE)
return()
endif()
-if(NOT TARGET Qt::Widgets) # special case
+if(NOT TARGET Qt::Widgets)
return()
endif()
@@ -18,14 +22,13 @@ qt_internal_add_test(tst_macgui
SOURCES
guitest.cpp guitest.h
tst_macgui.cpp
+ NO_PCH_SOURCES
+ guitest.cpp # undef QT_NO_FOREACH
LIBRARIES
Qt::CorePrivate
Qt::WidgetsPrivate
)
-#### Keys ignored in scope 1:.:.:macgui.pro:<TRUE>:
-# _REQUIREMENTS = "mac" "widgets"
-
## Scopes:
#####################################################################
diff --git a/tests/auto/other/macgui/guitest.cpp b/tests/auto/other/macgui/guitest.cpp
index 1f9ca0efcc..fbae891065 100644
--- a/tests/auto/other/macgui/guitest.cpp
+++ b/tests/auto/other/macgui/guitest.cpp
@@ -1,6 +1,7 @@
// Copyright (C) 2016 The Qt Company Ltd.
-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+#undef QT_NO_FOREACH // this file contains unported legacy Q_FOREACH uses
#include "guitest.h"
#include <QDebug>
diff --git a/tests/auto/other/macgui/guitest.h b/tests/auto/other/macgui/guitest.h
index 69f2ba4be5..80a2103fc9 100644
--- a/tests/auto/other/macgui/guitest.h
+++ b/tests/auto/other/macgui/guitest.h
@@ -1,5 +1,5 @@
// Copyright (C) 2016 The Qt Company Ltd.
-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef GUITEST_H
#define GUITEST_H
diff --git a/tests/auto/other/macgui/tst_macgui.cpp b/tests/auto/other/macgui/tst_macgui.cpp
index 4d09db9b7f..efcecef9ad 100644
--- a/tests/auto/other/macgui/tst_macgui.cpp
+++ b/tests/auto/other/macgui/tst_macgui.cpp
@@ -1,5 +1,5 @@
// Copyright (C) 2016 The Qt Company Ltd.
-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include <QApplication>
@@ -126,40 +126,6 @@ void tst_MacGui::splashScreenModality()
QVERIFY(!QTestEventLoop::instance().timeout());
}
-class PrimaryWindowDialog : public QDialog
-{
-Q_OBJECT
-public:
- PrimaryWindowDialog();
- QWidget *secondaryWindow;
- QWidget *frontWidget;
-public slots:
- void showSecondaryWindow();
- void test();
-};
-
-PrimaryWindowDialog::PrimaryWindowDialog() : QDialog(0)
-{
- frontWidget = 0;
- secondaryWindow = new ColorWidget(this);
- secondaryWindow->setWindowFlags(Qt::Window);
- secondaryWindow->resize(400, 400);
- secondaryWindow->move(100, 100);
- QTimer::singleShot(1000, this, SLOT(showSecondaryWindow()));
- QTimer::singleShot(2000, this, SLOT(test()));
- QTimer::singleShot(3000, this, SLOT(close()));
-}
-
-void PrimaryWindowDialog::showSecondaryWindow()
-{
- secondaryWindow->show();
-}
-
-void PrimaryWindowDialog::test()
-{
- frontWidget = QApplication::widgetAt(secondaryWindow->mapToGlobal(QPoint(100, 100)));
-}
-
/*
Test that a non-modal child window of a modal dialog is shown in front
of the dialog even if the dialog becomes modal after the child window
@@ -168,11 +134,28 @@ void PrimaryWindowDialog::test()
void tst_MacGui::nonModalOrder()
{
clearSequence();
- PrimaryWindowDialog primary;
- primary.resize(400, 400);
- primary.move(100, 100);
- primary.exec();
- QCOMPARE(primary.frontWidget, primary.secondaryWindow);
+
+ QDialog dialog;
+ dialog.resize(400, 400);
+ dialog.move(100, 100);
+
+ ColorWidget child(&dialog);
+ // The child window needs to be a dialog, as only subclasses of NSPanel
+ // are allowed to override worksWhenModal, which is needed to mark the
+ // transient child as working within the modal session of the parent.
+ child.setWindowFlags(Qt::Window | Qt::Dialog);
+ child.resize(400, 400);
+ child.move(100, 100);
+
+ QTimer::singleShot(0, [&]{
+ QVERIFY(QTest::qWaitForWindowExposed(&dialog));
+ child.show();
+ QVERIFY(QTest::qWaitForWindowExposed(&child));
+ QCOMPARE(QApplication::widgetAt(child.mapToGlobal(QPoint(100, 100))), &child);
+ dialog.close();
+ });
+
+ dialog.exec();
}
/*
diff --git a/tests/auto/other/macnativeevents/CMakeLists.txt b/tests/auto/other/macnativeevents/CMakeLists.txt
index 75ca45313f..c44cf61920 100644
--- a/tests/auto/other/macnativeevents/CMakeLists.txt
+++ b/tests/auto/other/macnativeevents/CMakeLists.txt
@@ -1,7 +1,11 @@
# Copyright (C) 2022 The Qt Company Ltd.
# SPDX-License-Identifier: BSD-3-Clause
-# Generated from macnativeevents.pro.
+if(NOT QT_BUILD_STANDALONE_TESTS AND NOT QT_BUILDING_QT)
+ cmake_minimum_required(VERSION 3.16)
+ project(tst_macnativeevents LANGUAGES CXX)
+ find_package(Qt6BuildInternals REQUIRED COMPONENTS STANDALONE_TEST)
+endif()
if(NOT APPLE)
return()
@@ -23,6 +27,3 @@ qt_internal_add_test(tst_macnativeevents
Qt::Gui
Qt::Widgets
)
-
-#### Keys ignored in scope 1:.:.:macnativeevents.pro:<TRUE>:
-# _REQUIREMENTS = "mac"
diff --git a/tests/auto/other/macnativeevents/expectedeventlist.cpp b/tests/auto/other/macnativeevents/expectedeventlist.cpp
index 51437da05d..a8c662ad93 100644
--- a/tests/auto/other/macnativeevents/expectedeventlist.cpp
+++ b/tests/auto/other/macnativeevents/expectedeventlist.cpp
@@ -1,5 +1,5 @@
// Copyright (C) 2016 The Qt Company Ltd.
-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include "expectedeventlist.h"
#include <QDebug>
diff --git a/tests/auto/other/macnativeevents/expectedeventlist.h b/tests/auto/other/macnativeevents/expectedeventlist.h
index b8f9758050..f21b56c9b2 100644
--- a/tests/auto/other/macnativeevents/expectedeventlist.h
+++ b/tests/auto/other/macnativeevents/expectedeventlist.h
@@ -1,5 +1,5 @@
// Copyright (C) 2016 The Qt Company Ltd.
-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef EVENTFILTER
#define EVENTFILTER
diff --git a/tests/auto/other/macnativeevents/nativeeventlist.cpp b/tests/auto/other/macnativeevents/nativeeventlist.cpp
index 7266ec2fca..6216c9682f 100644
--- a/tests/auto/other/macnativeevents/nativeeventlist.cpp
+++ b/tests/auto/other/macnativeevents/nativeeventlist.cpp
@@ -1,5 +1,5 @@
// Copyright (C) 2016 The Qt Company Ltd.
-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include "nativeeventlist.h"
diff --git a/tests/auto/other/macnativeevents/nativeeventlist.h b/tests/auto/other/macnativeevents/nativeeventlist.h
index de1b8da13b..20e91a689a 100644
--- a/tests/auto/other/macnativeevents/nativeeventlist.h
+++ b/tests/auto/other/macnativeevents/nativeeventlist.h
@@ -1,5 +1,5 @@
// Copyright (C) 2016 The Qt Company Ltd.
-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef Q_NATIVE_PLAYBACK
#define Q_NATIVE_PLAYBACK
diff --git a/tests/auto/other/macnativeevents/qnativeevents.cpp b/tests/auto/other/macnativeevents/qnativeevents.cpp
index d4784ff6cd..a516fc28d6 100644
--- a/tests/auto/other/macnativeevents/qnativeevents.cpp
+++ b/tests/auto/other/macnativeevents/qnativeevents.cpp
@@ -1,5 +1,5 @@
// Copyright (C) 2016 The Qt Company Ltd.
-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include "qnativeevents.h"
diff --git a/tests/auto/other/macnativeevents/qnativeevents.h b/tests/auto/other/macnativeevents/qnativeevents.h
index b96dc5bd8c..cab2472083 100644
--- a/tests/auto/other/macnativeevents/qnativeevents.h
+++ b/tests/auto/other/macnativeevents/qnativeevents.h
@@ -1,5 +1,5 @@
// Copyright (C) 2016 The Qt Company Ltd.
-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef Q_NATIVE_INPUT
#define Q_NATIVE_INPUT
diff --git a/tests/auto/other/macnativeevents/qnativeevents_mac.cpp b/tests/auto/other/macnativeevents/qnativeevents_mac.cpp
index d9d76c8fd0..a2e1a66c65 100644
--- a/tests/auto/other/macnativeevents/qnativeevents_mac.cpp
+++ b/tests/auto/other/macnativeevents/qnativeevents_mac.cpp
@@ -1,5 +1,5 @@
// Copyright (C) 2016 The Qt Company Ltd.
-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include "qnativeevents.h"
#include <CoreGraphics/CoreGraphics.h>
diff --git a/tests/auto/other/macnativeevents/tst_macnativeevents.cpp b/tests/auto/other/macnativeevents/tst_macnativeevents.cpp
index bc2145d1a4..3cb934d7d5 100644
--- a/tests/auto/other/macnativeevents/tst_macnativeevents.cpp
+++ b/tests/auto/other/macnativeevents/tst_macnativeevents.cpp
@@ -1,5 +1,5 @@
// Copyright (C) 2016 The Qt Company Ltd.
-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include <QApplication>
#include <QWidget>
diff --git a/tests/auto/other/macplist/CMakeLists.txt b/tests/auto/other/macplist/CMakeLists.txt
index f8323222b9..6a98d4dc16 100644
--- a/tests/auto/other/macplist/CMakeLists.txt
+++ b/tests/auto/other/macplist/CMakeLists.txt
@@ -1,9 +1,13 @@
# Copyright (C) 2022 The Qt Company Ltd.
# SPDX-License-Identifier: BSD-3-Clause
-# Generated from macplist.pro.
+if(NOT QT_BUILD_STANDALONE_TESTS AND NOT QT_BUILDING_QT)
+ cmake_minimum_required(VERSION 3.16)
+ project(tst_macplist LANGUAGES CXX)
+ find_package(Qt6BuildInternals REQUIRED COMPONENTS STANDALONE_TEST)
+endif()
-if(NOT TARGET Qt::Widgets) # special case
+if(NOT TARGET Qt::Widgets)
return()
endif()
add_subdirectory(app)
diff --git a/tests/auto/other/macplist/app/CMakeLists.txt b/tests/auto/other/macplist/app/CMakeLists.txt
index 942b7f03da..8af8e9f578 100644
--- a/tests/auto/other/macplist/app/CMakeLists.txt
+++ b/tests/auto/other/macplist/app/CMakeLists.txt
@@ -1,15 +1,13 @@
# Copyright (C) 2022 The Qt Company Ltd.
# SPDX-License-Identifier: BSD-3-Clause
-# Generated from app.pro.
-
#####################################################################
## app Binary:
#####################################################################
qt_internal_add_executable(app
GUI
- OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} # special case
+ OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
SOURCES
main.cpp
LIBRARIES
diff --git a/tests/auto/other/macplist/app/main.cpp b/tests/auto/other/macplist/app/main.cpp
index 6647fda781..2f07fe3c25 100644
--- a/tests/auto/other/macplist/app/main.cpp
+++ b/tests/auto/other/macplist/app/main.cpp
@@ -1,5 +1,5 @@
// Copyright (C) 2016 The Qt Company Ltd.
-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include <QtWidgets/QApplication>
diff --git a/tests/auto/other/macplist/test/CMakeLists.txt b/tests/auto/other/macplist/test/CMakeLists.txt
index 3a0af486fd..e55dfb2591 100644
--- a/tests/auto/other/macplist/test/CMakeLists.txt
+++ b/tests/auto/other/macplist/test/CMakeLists.txt
@@ -1,8 +1,6 @@
# Copyright (C) 2022 The Qt Company Ltd.
# SPDX-License-Identifier: BSD-3-Clause
-# Generated from test.pro.
-
#####################################################################
## tst_macplist Test:
#####################################################################
diff --git a/tests/auto/other/macplist/tst_macplist.cpp b/tests/auto/other/macplist/tst_macplist.cpp
index 8928600f63..12240c45b5 100644
--- a/tests/auto/other/macplist/tst_macplist.cpp
+++ b/tests/auto/other/macplist/tst_macplist.cpp
@@ -1,5 +1,5 @@
// Copyright (C) 2016 The Qt Company Ltd.
-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include <QTest>
diff --git a/tests/auto/other/networkselftest/BLACKLIST b/tests/auto/other/networkselftest/BLACKLIST
index 20f0295b48..9865f4def5 100644
--- a/tests/auto/other/networkselftest/BLACKLIST
+++ b/tests/auto/other/networkselftest/BLACKLIST
@@ -1,6 +1,5 @@
# QTBUG-27571
[ftpProxyServer]
-windows-7sp1
windows-10
[smbServer]
opensuse-leap
diff --git a/tests/auto/other/networkselftest/CMakeLists.txt b/tests/auto/other/networkselftest/CMakeLists.txt
index e8bf8af0f2..6491c510f6 100644
--- a/tests/auto/other/networkselftest/CMakeLists.txt
+++ b/tests/auto/other/networkselftest/CMakeLists.txt
@@ -1,20 +1,21 @@
# Copyright (C) 2022 The Qt Company Ltd.
# SPDX-License-Identifier: BSD-3-Clause
-# Generated from networkselftest.pro.
-
#####################################################################
## tst_networkselftest Test:
#####################################################################
+if(NOT QT_BUILD_STANDALONE_TESTS AND NOT QT_BUILDING_QT)
+ cmake_minimum_required(VERSION 3.16)
+ project(tst_networkselftest LANGUAGES CXX)
+ find_package(Qt6BuildInternals REQUIRED COMPONENTS STANDALONE_TEST)
+endif()
+
qt_internal_add_test(tst_networkselftest
SOURCES
tst_networkselftest.cpp
LIBRARIES
Qt::CorePrivate
Qt::Network
- QT_TEST_SERVER_LIST "danted" "squid" "apache2" "ftp-proxy" "vsftpd" "cyrus" "echo" # special case
+ QT_TEST_SERVER_LIST "danted" "squid" "apache2" "ftp-proxy" "vsftpd" "cyrus" "echo"
)
-
-#### Keys ignored in scope 1:.:.:networkselftest.pro:<TRUE>:
-# QT_TEST_SERVER_LIST = "cyrus" "vsftpd" "apache2" "ftp-proxy" "danted" "squid" "echo"
diff --git a/tests/auto/other/networkselftest/tst_networkselftest.cpp b/tests/auto/other/networkselftest/tst_networkselftest.cpp
index 16b7d33097..81d3b60248 100644
--- a/tests/auto/other/networkselftest/tst_networkselftest.cpp
+++ b/tests/auto/other/networkselftest/tst_networkselftest.cpp
@@ -1,5 +1,5 @@
// Copyright (C) 2016 The Qt Company Ltd.
-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include <QTest>
#include <QtNetwork/QtNetwork>
@@ -354,7 +354,7 @@ void tst_NetworkSelfTest::initTestCase()
if (resolved.error() == QHostInfo::NoError && !resolved.addresses().isEmpty())
ftpServerIpAddress = resolved.addresses().first();
// TODO: 'ssh', port 22.
- QVERIFY(QtNetworkSettings::verifyConnection(QtNetworkSettings::ftpProxyServerName(), 2121));
+ // QVERIFY(QtNetworkSettings::verifyConnection(QtNetworkSettings::ftpProxyServerName(), 2121));
QVERIFY(QtNetworkSettings::verifyConnection(QtNetworkSettings::httpServerName(), 80));
// TODO: 'smb', port 139.
QVERIFY(QtNetworkSettings::verifyConnection(QtNetworkSettings::imapServerName(), 143));
@@ -511,6 +511,7 @@ void tst_NetworkSelfTest::ftpServer()
void tst_NetworkSelfTest::ftpProxyServer()
{
+ QSKIP("FTP not currently supported.");
netChat(2121, ftpChat("@" + QtNetworkSettings::ftpServerName().toLatin1()));
}
diff --git a/tests/auto/other/qabstractitemmodelutils/dynamictreemodel.cpp b/tests/auto/other/qabstractitemmodelutils/dynamictreemodel.cpp
index 378c198949..d670cec196 100644
--- a/tests/auto/other/qabstractitemmodelutils/dynamictreemodel.cpp
+++ b/tests/auto/other/qabstractitemmodelutils/dynamictreemodel.cpp
@@ -1,5 +1,5 @@
// Copyright (C) 2009 Stephen Kelly <steveire@gmail.com>
-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include "dynamictreemodel.h"
@@ -191,7 +191,7 @@ void ModelMoveCommand::doCommand()
return;
for (int column = 0; column < m_numCols; ++column) {
- QList<qint64> l = m_model->m_childItems.value(srcParent.internalId())[column].mid(
+ const QList<qint64> l = m_model->m_childItems.value(srcParent.internalId())[column].mid(
m_startRow, m_endRow - m_startRow + 1);
for (int i = m_startRow; i <= m_endRow; i++)
@@ -206,7 +206,7 @@ void ModelMoveCommand::doCommand()
d = m_destRow;
}
- foreach (const qint64 id, l)
+ for (qint64 id : l)
m_model->m_childItems[destParent.internalId()][column].insert(d++, id);
}
@@ -283,9 +283,7 @@ void ModelChangeChildrenLayoutsCommand::doCommand()
const QPersistentModelIndex parent1 = findIndex(m_rowNumbers);
const QPersistentModelIndex parent2 = findIndex(m_secondRowNumbers);
- QList<QPersistentModelIndex> parents;
- parents << parent1;
- parents << parent2;
+ const QList<QPersistentModelIndex> parents = { parent1, parent2 };
emit m_model->layoutAboutToBeChanged(parents);
@@ -309,13 +307,13 @@ void ModelChangeChildrenLayoutsCommand::doCommand()
// changing any children of that parent. The reason is that we're keeping parent1 and parent2
// around as QPersistentModelIndex instances, and we query idx.parent() in the loop.
QModelIndexList persistent = m_model->persistentIndexList();
- foreach (const QModelIndex &parent, parents) {
+ for (const QPersistentModelIndex &parent : parents) {
int idx = persistent.indexOf(parent);
if (idx != -1)
persistent.move(idx, 0);
}
- foreach (const QModelIndex &idx, persistent) {
+ for (const QModelIndex &idx : std::as_const(persistent)) {
if (idx.parent() == parent1) {
if (idx.row() == rowSize1 - 1) {
m_model->changePersistentIndex(idx,
diff --git a/tests/auto/other/qabstractitemmodelutils/dynamictreemodel.h b/tests/auto/other/qabstractitemmodelutils/dynamictreemodel.h
index 1f24830602..bc7db2ad0f 100644
--- a/tests/auto/other/qabstractitemmodelutils/dynamictreemodel.h
+++ b/tests/auto/other/qabstractitemmodelutils/dynamictreemodel.h
@@ -1,5 +1,5 @@
// Copyright (C) 2009 Stephen Kelly <steveire@gmail.com>
-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef DYNAMICTREEMODEL_H
#define DYNAMICTREEMODEL_H
diff --git a/tests/auto/other/qaccessibility/CMakeLists.txt b/tests/auto/other/qaccessibility/CMakeLists.txt
index 2c852568e4..9160bafe52 100644
--- a/tests/auto/other/qaccessibility/CMakeLists.txt
+++ b/tests/auto/other/qaccessibility/CMakeLists.txt
@@ -1,7 +1,11 @@
# Copyright (C) 2022 The Qt Company Ltd.
# SPDX-License-Identifier: BSD-3-Clause
-# Generated from qaccessibility.pro.
+if(NOT QT_BUILD_STANDALONE_TESTS AND NOT QT_BUILDING_QT)
+ cmake_minimum_required(VERSION 3.16)
+ project(tst_qaccessibility LANGUAGES CXX)
+ find_package(Qt6BuildInternals REQUIRED COMPONENTS STANDALONE_TEST)
+endif()
if(NOT QT_FEATURE_accessibility)
return()
@@ -23,9 +27,6 @@ qt_internal_add_test(tst_qaccessibility
Qt::WidgetsPrivate
)
-#### Keys ignored in scope 1:.:.:qaccessibility.pro:<TRUE>:
-# _REQUIREMENTS = "qtConfig(accessibility)"
-
## Scopes:
#####################################################################
diff --git a/tests/auto/other/qaccessibility/accessiblewidgets.h b/tests/auto/other/qaccessibility/accessiblewidgets.h
index b0382ef60a..76b1f1f473 100644
--- a/tests/auto/other/qaccessibility/accessiblewidgets.h
+++ b/tests/auto/other/qaccessibility/accessiblewidgets.h
@@ -1,5 +1,5 @@
// Copyright (C) 2016 The Qt Company Ltd.
-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef ACCESSIBLEWIDGETS_H
diff --git a/tests/auto/other/qaccessibility/tst_qaccessibility.cpp b/tests/auto/other/qaccessibility/tst_qaccessibility.cpp
index 662d459af6..cab88e2fc0 100644
--- a/tests/auto/other/qaccessibility/tst_qaccessibility.cpp
+++ b/tests/auto/other/qaccessibility/tst_qaccessibility.cpp
@@ -1,12 +1,11 @@
// Copyright (C) 2016 The Qt Company Ltd.
-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
-
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include <QtCore/qglobal.h>
#ifdef Q_OS_WIN
# include <QtCore/qt_windows.h>
# include <oleacc.h>
-# include <QtGui/private/qwindowsuiawrapper_p.h>
+# include <uiautomation.h>
# include <servprov.h>
# include <winuser.h>
#endif
@@ -40,6 +39,7 @@
#include <QtTest/private/qtesthelpers_p.h>
using namespace QTestPrivate;
+using namespace Qt::StringLiterals;
static inline bool verifyChild(QWidget *child, QAccessibleInterface *interface,
int index, const QRect &domain)
@@ -214,6 +214,7 @@ private slots:
void listTest();
void treeTest();
void tableTest();
+ void rootIndexView();
void uniqueIdTest();
void calendarWidgetTest();
@@ -222,6 +223,7 @@ private slots:
void accessibleName();
#if QT_CONFIG(shortcut)
void labelTest();
+ void relationTest();
void accelerators();
#endif
void bridgeTest();
@@ -663,7 +665,7 @@ void tst_QAccessibility::textAttributes_data()
defaultComplexFont.setStyle(QFont::StyleItalic);
defaultComplexFont.setUnderline(true);
- static QStringList defaults = QString("font-style:normal;font-weight:normal;text-align:left;text-position:baseline;font-size:13pt").split(';');
+ static QStringList defaults = QString("font-style:normal;font-weight:normal;text-align:left;text-position:baseline;font-size:13pt;text-line-through-type:none").split(';');
static QStringList bold = defaults;
bold[1] = QString::fromLatin1("font-weight:bold");
@@ -699,7 +701,7 @@ void tst_QAccessibility::textAttributes_data()
defaultFontDifferentBoldItalic[1] = QString::fromLatin1("font-weight:bold");
static QStringList defaultFontDifferentMonospace = defaultFontDifferent;
- defaultFontDifferentMonospace[7] = (QLatin1String("font-family:\"monospace\""));
+ defaultFontDifferentMonospace[8] = (QLatin1String("font-family:\"monospace\""));
static QStringList defaultFontDifferentFont8pt = defaultFontDifferent;
defaultFontDifferentFont8pt[4] = (QLatin1String("font-size:8pt"));
@@ -964,6 +966,13 @@ void tst_QAccessibility::mainWindowTest()
QCOMPARE(iface->text(QAccessible::Name), name);
QCOMPARE(iface->role(), QAccessible::Window);
QVERIFY(iface->state().active);
+
+ QTestAccessibility::clearEvents();
+ QLatin1String newName = QLatin1String("Main window with updated title");
+ mw->setWindowTitle(newName);
+ QCOMPARE(iface->text(QAccessible::Name), QLatin1String(newName));
+ QAccessibleEvent event(mw, QAccessible::NameChanged);
+ QVERIFY(QTestAccessibility::containsEvent(&event));
}
QTestAccessibility::clearEvents();
@@ -1117,7 +1126,10 @@ void tst_QAccessibility::buttonTest()
interface = QAccessible::queryAccessibleInterface(&toggleButton);
actionInterface = interface->actionInterface();
QCOMPARE(interface->role(), QAccessible::CheckBox);
- QCOMPARE(actionInterface->actionNames(), QStringList() << QAccessibleActionInterface::toggleAction() << QAccessibleActionInterface::setFocusAction());
+ QCOMPARE(actionInterface->actionNames(),
+ QStringList() << QAccessibleActionInterface::toggleAction()
+ << QAccessibleActionInterface::pressAction()
+ << QAccessibleActionInterface::setFocusAction());
QCOMPARE(actionInterface->localizedActionDescription(QAccessibleActionInterface::toggleAction()), QString("Toggles the state"));
QVERIFY(!toggleButton.isChecked());
QVERIFY(!interface->state().checked);
@@ -1153,12 +1165,18 @@ void tst_QAccessibility::buttonTest()
interface = QAccessible::queryAccessibleInterface(&checkBox);
actionInterface = interface->actionInterface();
QCOMPARE(interface->role(), QAccessible::CheckBox);
- QCOMPARE(actionInterface->actionNames(), QStringList() << QAccessibleActionInterface::toggleAction() << QAccessibleActionInterface::setFocusAction());
+ QCOMPARE(actionInterface->actionNames(),
+ QStringList() << QAccessibleActionInterface::toggleAction()
+ << QAccessibleActionInterface::pressAction()
+ << QAccessibleActionInterface::setFocusAction());
QVERIFY(!interface->state().checked);
actionInterface->doAction(QAccessibleActionInterface::toggleAction());
QTest::qWait(500);
- QCOMPARE(actionInterface->actionNames(), QStringList() << QAccessibleActionInterface::toggleAction() << QAccessibleActionInterface::setFocusAction());
+ QCOMPARE(actionInterface->actionNames(),
+ QStringList() << QAccessibleActionInterface::toggleAction()
+ << QAccessibleActionInterface::pressAction()
+ << QAccessibleActionInterface::setFocusAction());
QVERIFY(interface->state().checked);
QVERIFY(checkBox.isChecked());
QAccessible::State st;
@@ -2868,6 +2886,12 @@ void tst_QAccessibility::listTest()
QCOMPARE(iface->indexOfChild(child3), 2);
QCOMPARE(child3->text(QAccessible::Name), QString("Brisbane"));
}
+
+ // Check that application is accessible parent, since it's a top-level widget
+ QAccessibleInterface *parentIface = iface->parent();
+ QVERIFY(parentIface);
+ QVERIFY(parentIface->role() == QAccessible::Application);
+
QTestAccessibility::clearEvents();
// Check for events
@@ -2919,7 +2943,8 @@ void tst_QAccessibility::listTest()
QVERIFY(!(cell4->state().expandable));
QVERIFY( (cell4->state().selectable));
QVERIFY(!(cell4->state().selected));
- table2->selectRow(3);
+ QAccessibleSelectionInterface *selection2 = iface->selectionInterface();
+ selection2->select(cell4);
QCOMPARE(listView->selectedItems().size(), 1);
QCOMPARE(listView->selectedItems().at(0)->text(), QLatin1String("Munich"));
QVERIFY(cell4->state().selected);
@@ -3390,6 +3415,51 @@ void tst_QAccessibility::tableTest()
QTestAccessibility::clearEvents();
}
+void tst_QAccessibility::rootIndexView()
+{
+ QStandardItemModel model;
+ for (int i = 0; i < 2; ++i) {
+ QStandardItem *item = new QStandardItem(u"root %1"_s.arg(i));
+ for (int j = 0; j < 5 * (i + 1); ++j) {
+ switch (i) {
+ case 0:
+ item->appendRow(new QStandardItem(u"child0/%1"_s.arg(j)));
+ break;
+ case 1:
+ item->appendRow({new QStandardItem(u"column0 1/%1"_s.arg(j)),
+ new QStandardItem(u"column1 1/%1"_s.arg(j))
+ });
+ break;
+ }
+ }
+ model.appendRow(item);
+ }
+
+ QListView view;
+ view.setModel(&model);
+ QTestAccessibility::clearEvents();
+
+ QAccessibleInterface *accView = QAccessible::queryAccessibleInterface(&view);
+ QVERIFY(accView);
+ QAccessibleTableInterface *accTable = accView->tableInterface();
+ QVERIFY(accTable);
+ QCOMPARE(accTable->rowCount(), 2);
+ QCOMPARE(accTable->columnCount(), 1);
+
+ view.setRootIndex(model.index(0, 0));
+ QAccessibleTableModelChangeEvent resetEvent(&view, QAccessibleTableModelChangeEvent::ModelReset);
+ QVERIFY(QTestAccessibility::containsEvent(&resetEvent));
+
+ QCOMPARE(accTable->rowCount(), 5);
+ QCOMPARE(accTable->columnCount(), 1);
+
+ view.setRootIndex(model.index(1, 0));
+ QCOMPARE(accTable->rowCount(), 10);
+ QCOMPARE(accTable->columnCount(), 2);
+
+ QTestAccessibility::clearEvents();
+}
+
void tst_QAccessibility::uniqueIdTest()
{
// Test that an ID isn't reassigned to another interface right away when an accessible interface
@@ -3436,7 +3506,7 @@ void tst_QAccessibility::calendarWidgetTest()
QCOMPARE(interface->rect(), globalGeometry);
QWidget *navigationBar = 0;
- foreach (QObject *child, calendarWidget.children()) {
+ for (QObject *child : calendarWidget.children()) {
if (child->objectName() == QLatin1String("qt_calendar_navigationbar")) {
navigationBar = static_cast<QWidget *>(child);
break;
@@ -3446,7 +3516,7 @@ void tst_QAccessibility::calendarWidgetTest()
QVERIFY(verifyChild(navigationBar, interface, 0, globalGeometry));
QAbstractItemView *calendarView = 0;
- foreach (QObject *child, calendarWidget.children()) {
+ for (QObject *child : calendarWidget.children()) {
if (child->objectName() == QLatin1String("qt_calendar_calendarview")) {
calendarView = static_cast<QAbstractItemView *>(child);
break;
@@ -3648,6 +3718,8 @@ void tst_QAccessibility::comboBoxTest()
QCOMPARE(iface->text(QAccessible::Name), QLatin1String("one"));
#endif
QCOMPARE(iface->text(QAccessible::Value), QLatin1String("one"));
+ QCOMPARE(combo.view()->selectionModel()->currentIndex().row(), 0);
+
combo.setCurrentIndex(2);
#ifdef Q_OS_UNIX
QCOMPARE(iface->text(QAccessible::Name), QLatin1String("three"));
@@ -3658,7 +3730,13 @@ void tst_QAccessibility::comboBoxTest()
QCOMPARE(listIface->role(), QAccessible::List);
QCOMPARE(listIface->childCount(), 3);
+ QAccessibleSelectionInterface *selectionIface = listIface->selectionInterface();
+ QVERIFY(selectionIface);
+ QCOMPARE(selectionIface->selectedItemCount(), 1);
+ QCOMPARE(listIface->indexOfChild(selectionIface->selectedItem(0)), 2);
+
QVERIFY(!combo.view()->isVisible());
+ QCOMPARE(combo.view()->selectionModel()->currentIndex().row(), 2);
QVERIFY(iface->actionInterface());
QCOMPARE(iface->actionInterface()->actionNames(), QStringList() << QAccessibleActionInterface::showMenuAction() << QAccessibleActionInterface::pressAction());
iface->actionInterface()->doAction(QAccessibleActionInterface::showMenuAction());
@@ -3688,6 +3766,69 @@ void tst_QAccessibility::comboBoxTest()
QTestAccessibility::clearEvents();
}
+void tst_QAccessibility::relationTest()
+{
+ auto windowHolder = std::make_unique<QWidget>();
+ auto window = windowHolder.get();
+ QString text = "Hello World";
+ QLabel *label = new QLabel(text, window);
+ setFrameless(label);
+ QSpinBox *spinBox = new QSpinBox(window);
+ label->setBuddy(spinBox);
+ QProgressBar *pb = new QProgressBar(window);
+ pb->setRange(0, 99);
+ connect(spinBox, SIGNAL(valueChanged(int)), pb, SLOT(setValue(int)));
+
+ window->resize(320, 200);
+ window->show();
+
+ QVERIFY(QTest::qWaitForWindowExposed(window));
+#if defined(Q_OS_UNIX)
+ QCoreApplication::processEvents();
+#endif
+ QTest::qWait(100);
+
+ QAccessibleInterface *acc_label = QAccessible::queryAccessibleInterface(label);
+ QVERIFY(acc_label);
+ QAccessibleInterface *acc_spinBox = QAccessible::queryAccessibleInterface(spinBox);
+ QVERIFY(acc_spinBox);
+ QAccessibleInterface *acc_pb = QAccessible::queryAccessibleInterface(pb);
+ QVERIFY(acc_pb);
+
+ typedef QPair<QAccessibleInterface*, QAccessible::Relation> RelationPair;
+ {
+ const QList<RelationPair> rels = acc_label->relations(QAccessible::Labelled);
+ QCOMPARE(rels.size(), 1);
+ const RelationPair relPair = rels.first();
+
+ // spinBox is Labelled by acc_label
+ QCOMPARE(relPair.first->object(), spinBox);
+ QCOMPARE(relPair.second, QAccessible::Labelled);
+ }
+
+ {
+ // Test multiple relations (spinBox have two)
+ const QList<RelationPair> rels = acc_spinBox->relations();
+ QCOMPARE(rels.size(), 2);
+ int visitCount = 0;
+ for (const auto &relPair : rels) {
+ if (relPair.second & QAccessible::Label) {
+ // label is the Label of spinBox
+ QCOMPARE(relPair.first->object(), label);
+ ++visitCount;
+ } else if (relPair.second & QAccessible::Controlled) {
+ // progressbar is Controlled by the spinBox
+ QCOMPARE(relPair.first->object(), pb);
+ ++visitCount;
+ }
+ }
+ QCOMPARE(visitCount, rels.size());
+ }
+
+ windowHolder.reset();
+ QTestAccessibility::clearEvents();
+}
+
#if QT_CONFIG(shortcut)
void tst_QAccessibility::labelTest()
@@ -3710,6 +3851,8 @@ void tst_QAccessibility::labelTest()
QAccessibleInterface *acc_label = QAccessible::queryAccessibleInterface(label);
QVERIFY(acc_label);
+ QAccessibleInterface *acc_lineEdit = QAccessible::queryAccessibleInterface(buddy);
+ QVERIFY(acc_lineEdit);
QCOMPARE(acc_label->text(QAccessible::Name), text);
QCOMPARE(acc_label->state().editable, false);
@@ -3719,13 +3862,23 @@ void tst_QAccessibility::labelTest()
QCOMPARE(acc_label->state().focusable, false);
QCOMPARE(acc_label->state().readOnly, true);
- QList<QPair<QAccessibleInterface *, QAccessible::Relation>> rels = acc_label->relations();
- QCOMPARE(rels.size(), 1);
- QAccessibleInterface *iface = rels.first().first;
- QAccessible::Relation rel = rels.first().second;
- QCOMPARE(rel, QAccessible::Labelled);
- QCOMPARE(iface->role(), QAccessible::EditableText);
+ typedef QPair<QAccessibleInterface*, QAccessible::Relation> RelationPair;
+ {
+ const QList<RelationPair> rels = acc_label->relations(QAccessible::Labelled);
+ QCOMPARE(rels.size(), 1);
+ const RelationPair relPair = rels.first();
+ QCOMPARE(relPair.first->object(), buddy);
+ QCOMPARE(relPair.second, QAccessible::Labelled);
+ }
+
+ {
+ const QList<RelationPair> rels = acc_lineEdit->relations(QAccessible::Label);
+ QCOMPARE(rels.size(), 1);
+ const RelationPair relPair = rels.first();
+ QCOMPARE(relPair.first->object(), label);
+ QCOMPARE(relPair.second, QAccessible::Label);
+ }
windowHolder.reset();
QTestAccessibility::clearEvents();
@@ -3821,6 +3974,7 @@ void tst_QAccessibility::bridgeTest()
// For now this is a simple test to see if the bridge is working at all.
// Ideally it should be extended to test all aspects of the bridge.
#if defined(Q_OS_WIN)
+ auto guard = qScopeGuard([]() { QTestAccessibility::clearEvents(); });
QWidget window;
QVBoxLayout *lay = new QVBoxLayout(&window);
@@ -3958,10 +4112,105 @@ void tst_QAccessibility::bridgeTest()
QCOMPARE(controlTypeId, UIA_ButtonControlTypeId);
// Edit
- hr = nodeList.at(2)->get_CurrentControlType(&controlTypeId);
+ IUIAutomationElement *uiaElement = nodeList.at(2);
+ hr = uiaElement->get_CurrentControlType(&controlTypeId);
QVERIFY(SUCCEEDED(hr));
QCOMPARE(controlTypeId, UIA_EditControlTypeId);
+ // "hello world\nhow are you today?\n"
+ IUIAutomationTextPattern *textPattern = nullptr;
+ hr = uiaElement->GetCurrentPattern(UIA_TextPattern2Id, reinterpret_cast<IUnknown**>(&textPattern));
+ QVERIFY(SUCCEEDED(hr));
+ QVERIFY(textPattern);
+
+ IUIAutomationTextRange *docRange = nullptr;
+ hr = textPattern->get_DocumentRange(&docRange);
+ QVERIFY(SUCCEEDED(hr));
+ QVERIFY(docRange);
+
+ IUIAutomationTextRange *textRange = nullptr;
+ hr = docRange->Clone(&textRange);
+ QVERIFY(SUCCEEDED(hr));
+ QVERIFY(textRange);
+ int moved;
+
+ auto rangeText = [](IUIAutomationTextRange *textRange) {
+ BSTR str;
+ QString res = "IUIAutomationTextRange::GetText() failed";
+ HRESULT hr = textRange->GetText(-1, &str);
+ if (SUCCEEDED(hr)) {
+ res = QString::fromWCharArray(str);
+ ::SysFreeString(str);
+ }
+ return res;
+ };
+
+ // Move start endpoint past "hello " to "world"
+ hr = textRange->Move(TextUnit_Character, 6, &moved);
+ QVERIFY(SUCCEEDED(hr));
+ QCOMPARE(moved, 6);
+ // If the range was not empty, it should be collapsed to contain a single text unit
+ QCOMPARE(rangeText(textRange), QString("w"));
+
+ // Move end endpoint to end of "world"
+ hr = textRange->MoveEndpointByUnit(TextPatternRangeEndpoint_End, TextUnit_Character, 4, &moved);
+ QVERIFY(SUCCEEDED(hr));
+ QCOMPARE(moved, 4);
+ QCOMPARE(rangeText(textRange), QString("world"));
+
+ // MSDN: "Zero has no effect". This behavior was also verified with native controls.
+ hr = textRange->Move(TextUnit_Character, 0, &moved);
+ QVERIFY(SUCCEEDED(hr));
+ QCOMPARE(moved, 0);
+ QCOMPARE(rangeText(textRange), QString("world"));
+
+ hr = textRange->Move(TextUnit_Character, 1, &moved);
+ QVERIFY(SUCCEEDED(hr));
+ QCOMPARE(rangeText(textRange), QString("o"));
+
+ // move as far towards the end as possible
+ hr = textRange->Move(TextUnit_Character, 999, &moved);
+ QVERIFY(SUCCEEDED(hr));
+ QCOMPARE(rangeText(textRange), QString(""));
+
+ hr = textRange->MoveEndpointByUnit(TextPatternRangeEndpoint_Start, TextUnit_Character, -1, &moved);
+ QVERIFY(SUCCEEDED(hr));
+ QCOMPARE(rangeText(textRange), QString("\n"));
+
+ // move one forward (last possible position again)
+ hr = textRange->Move(TextUnit_Character, 1, &moved);
+ QVERIFY(SUCCEEDED(hr));
+ QCOMPARE(rangeText(textRange), QString(""));
+
+ hr = textRange->Move(TextUnit_Character, -7, &moved);
+ QVERIFY(SUCCEEDED(hr));
+ QCOMPARE(moved, -7);
+ QCOMPARE(rangeText(textRange), QString(""));
+ // simulate moving cursor (empty range) towards (and past) the end
+ QString today(" today?\n");
+ for (int i = 1; i < 9; ++i) { // 9 is deliberately too much
+ // peek one character back
+ hr = textRange->MoveEndpointByUnit(TextPatternRangeEndpoint_Start, TextUnit_Character, -1, &moved);
+ QVERIFY(SUCCEEDED(hr));
+ QCOMPARE(rangeText(textRange), today.mid(i - 1, 1));
+
+ hr = textRange->Move(TextUnit_Character, 1, &moved);
+ QVERIFY(SUCCEEDED(hr));
+ QCOMPARE(rangeText(textRange), today.mid(i, moved)); // when we cannot move further, moved will be 0
+
+ // Make the range empty again
+ hr = textRange->MoveEndpointByUnit(TextPatternRangeEndpoint_End, TextUnit_Character, -moved, &moved);
+ QVERIFY(SUCCEEDED(hr));
+
+ // advance the empty range
+ hr = textRange->Move(TextUnit_Character, 1, &moved);
+ QVERIFY(SUCCEEDED(hr));
+ }
+ docRange->Release();
+ textRange->Release();
+ textPattern->Release();
+
+
// Table
hr = nodeList.at(3)->get_CurrentControlType(&controlTypeId);
QVERIFY(SUCCEEDED(hr));
@@ -3979,8 +4228,6 @@ void tst_QAccessibility::bridgeTest()
controlWalker->Release();
windowElement->Release();
automation->Release();
-
- QTestAccessibility::clearEvents();
#endif
}
@@ -4071,6 +4318,9 @@ private:
void tst_QAccessibility::focusChild()
{
+ if (!QGuiApplicationPrivate::platformIntegration()->hasCapability(QPlatformIntegration::WindowActivation))
+ QSKIP("Platform does not support window activation");
+
{
QMainWindow mainWindow;
QtTestAccessibleWidget *widget1 = new QtTestAccessibleWidget(0, "Widget1");
diff --git a/tests/auto/other/qaccessibilitylinux/CMakeLists.txt b/tests/auto/other/qaccessibilitylinux/CMakeLists.txt
index 2fb9e25243..5c85827a3b 100644
--- a/tests/auto/other/qaccessibilitylinux/CMakeLists.txt
+++ b/tests/auto/other/qaccessibilitylinux/CMakeLists.txt
@@ -1,13 +1,16 @@
# Copyright (C) 2022 The Qt Company Ltd.
# SPDX-License-Identifier: BSD-3-Clause
-# Generated from qaccessibilitylinux.pro.
-# special case begin
+if(NOT QT_BUILD_STANDALONE_TESTS AND NOT QT_BUILDING_QT)
+ cmake_minimum_required(VERSION 3.16)
+ project(tst_qaccessibilitylinux LANGUAGES CXX)
+ find_package(Qt6BuildInternals REQUIRED COMPONENTS STANDALONE_TEST)
+endif()
+
if (NOT QT_FEATURE_accessibility OR NOT TARGET Qt::LinuxAccessibilitySupportPrivate
OR (QT_BUILD_STANDALONE_TESTS AND QT_WILL_INSTALL))
return()
endif()
-# special case end
#####################################################################
## tst_qaccessibilitylinux Test:
@@ -26,9 +29,7 @@ qt_internal_add_test(tst_qaccessibilitylinux
Qt::Widgets
)
-# special case begin
# require for struct_marshallers_p.h which is included dbus_interface.h
target_include_directories(tst_qaccessibilitylinux PRIVATE
../../../../src/platformsupport/linuxaccessibility
)
-# special case end
diff --git a/tests/auto/other/qaccessibilitylinux/tst_qaccessibilitylinux.cpp b/tests/auto/other/qaccessibilitylinux/tst_qaccessibilitylinux.cpp
index d07258417f..18bcdeca29 100644
--- a/tests/auto/other/qaccessibilitylinux/tst_qaccessibilitylinux.cpp
+++ b/tests/auto/other/qaccessibilitylinux/tst_qaccessibilitylinux.cpp
@@ -1,5 +1,5 @@
// Copyright (C) 2016 The Qt Company Ltd.
-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include <QTest>
#include <QtGui>
@@ -103,7 +103,7 @@ QStringList tst_QAccessibilityLinux::getChildren(QDBusInterface *interface)
Q_ASSERT(interface->property("ChildCount").toInt() == list.count());
QStringList children;
- Q_FOREACH (const QSpiObjectReference &ref, list)
+ for (const QSpiObjectReference &ref : std::as_const(list))
children << ref.path.path();
return children;
diff --git a/tests/auto/other/qaccessibilitymac/CMakeLists.txt b/tests/auto/other/qaccessibilitymac/CMakeLists.txt
index 93692c660d..66896ed384 100644
--- a/tests/auto/other/qaccessibilitymac/CMakeLists.txt
+++ b/tests/auto/other/qaccessibilitymac/CMakeLists.txt
@@ -1,6 +1,12 @@
# Copyright (C) 2022 The Qt Company Ltd.
# SPDX-License-Identifier: BSD-3-Clause
+if(NOT QT_BUILD_STANDALONE_TESTS AND NOT QT_BUILDING_QT)
+ cmake_minimum_required(VERSION 3.16)
+ project(tst_qaccessibilitymac LANGUAGES CXX)
+ find_package(Qt6BuildInternals REQUIRED COMPONENTS STANDALONE_TEST)
+endif()
+
if(NOT APPLE)
return()
endif()
diff --git a/tests/auto/other/qaccessibilitymac/tst_qaccessibilitymac.mm b/tests/auto/other/qaccessibilitymac/tst_qaccessibilitymac.mm
index 3b1979c030..4bedd07e15 100644
--- a/tests/auto/other/qaccessibilitymac/tst_qaccessibilitymac.mm
+++ b/tests/auto/other/qaccessibilitymac/tst_qaccessibilitymac.mm
@@ -1,5 +1,5 @@
// Copyright (C) 2016 The Qt Company Ltd.
-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include <QApplication>
#include <QtWidgets>
@@ -62,6 +62,7 @@ QDebug operator<<(QDebug dbg, AXErrorTag err)
@interface TestAXObject : NSObject
{
AXUIElementRef reference;
+ bool axError;
}
@property (readonly) NSString *role;
@property (readonly) NSString *title;
@@ -77,11 +78,13 @@ QDebug operator<<(QDebug dbg, AXErrorTag err)
if ((self = [super init])) {
reference = ref;
+ axError = false;
}
return self;
}
- (AXUIElementRef) ref { return reference; }
+- (bool)errorOccurred { return axError; }
- (void) print {
NSLog(@"Accessible Object role: '%@', title: '%@', description: '%@', value: '%@', rect: '%@'", self.role, self.title, self.description, self.value, NSStringFromRect(NSRectFromCGRect(self.rect)));
NSLog(@" Children: %ld", [[self childList] count]);
@@ -225,8 +228,8 @@ QDebug operator<<(QDebug dbg, AXErrorTag err)
CFTypeRef value = NULL;
AXError err;
- if (kAXErrorSuccess != (err = AXUIElementCopyAttributeValue(reference, attribute, &value)))
- {
+ if (kAXErrorSuccess != (err = AXUIElementCopyAttributeValue(reference, attribute, &value))) {
+ axError = true;
qDebug() << "AXUIElementCopyAttributeValue(" << QString::fromCFString(attribute) << ") returned error = " << AXErrorTag(err);
}
return value;
@@ -272,8 +275,8 @@ QDebug operator<<(QDebug dbg, AXErrorTag err)
CFTypeRef value = NULL;
AXError err;
- if (kAXErrorSuccess != (err = AXUIElementCopyParameterizedAttributeValue(reference, attribute, parameter, &value)))
- {
+ if (kAXErrorSuccess != (err = AXUIElementCopyParameterizedAttributeValue(reference, attribute, parameter, &value))) {
+ axError = true;
CFStringRef description = CFCopyDescription(parameter);
qDebug() << "AXUIElementCopyParameterizedAttributeValue(" << QString::fromCFString(attribute) << ", parameter=" << QString::fromCFString(description) << ") returned error = " << AXErrorTag(err);
CFRelease(description);
@@ -311,8 +314,8 @@ QDebug operator<<(QDebug dbg, AXErrorTag err)
AXError err;
CFArrayRef actions;
- if (kAXErrorSuccess != (err = AXUIElementCopyActionNames(reference, &actions)))
- {
+ if (kAXErrorSuccess != (err = AXUIElementCopyActionNames(reference, &actions))) {
+ axError = true;
qDebug() << "AXUIElementCopyActionNames(...) returned error = " << AXErrorTag(err);
}
@@ -323,8 +326,8 @@ QDebug operator<<(QDebug dbg, AXErrorTag err)
{
AXError err;
- if (kAXErrorSuccess != (err = AXUIElementPerformAction(reference, action)))
- {
+ if (kAXErrorSuccess != (err = AXUIElementPerformAction(reference, action))) {
+ axError = true;
qDebug() << "AXUIElementPerformAction(" << QString::fromCFString(action) << ") returned error = " << AXErrorTag(err);
}
}
@@ -407,6 +410,7 @@ private Q_SLOTS:
void notificationsTest();
void checkBoxTest();
void tableViewTest();
+ void treeViewTest();
private:
AccessibleTestWindow *m_window;
@@ -416,7 +420,7 @@ private:
void tst_QAccessibilityMac::init()
{
m_window = new AccessibleTestWindow();
- m_window->setWindowTitle("Test window");
+ m_window->setWindowTitle(QString("Test window - %1").arg(QTest::currentTestFunction()));
m_window->show();
m_window->resize(400, 400);
@@ -481,7 +485,7 @@ void tst_QAccessibilityMac::lineEditTest()
// height of window includes title bar
QVERIFY([window rect].size.height >= 400);
- QVERIFY([window.title isEqualToString:@"Test window"]);
+ QVERIFY([window.title isEqualToString:@"Test window - lineEditTest"]);
// children of window:
AXUIElementRef lineEditElement = [window findDirectChildByRole: kAXTextFieldRole];
@@ -705,12 +709,14 @@ void tst_QAccessibilityMac::tableViewTest()
// here start actual tableview tests
// Should have 2 columns
+ const unsigned int columnCount = 2;
NSArray *columnArray = [tv tableColumns];
- QCOMPARE([columnArray count], 2);
+ QCOMPARE([columnArray count], columnCount);
// should have 3 rows
+ const unsigned int rowCount = 3;
NSArray *rowArray = [tv tableRows];
- QCOMPARE([rowArray count], 3);
+ QCOMPARE([rowArray count], rowCount);
// The individual cells are children of the rows
TestAXObject *row = [[TestAXObject alloc] initWithAXUIElementRef:(AXUIElementRef)rowArray[0]];
@@ -722,7 +728,7 @@ void tst_QAccessibilityMac::tableViewTest()
// both rows and columns are direct children of the table
NSArray *childList = [tv childList];
- QCOMPARE([childList count], 5); // 3 rows + 2 columns
+ QCOMPARE([childList count], columnCount + rowCount);
for (id child in childList) {
TestAXObject *childObject = [[TestAXObject alloc] initWithAXUIElementRef:(AXUIElementRef)child];
QVERIFY([childObject.role isEqualToString:NSAccessibilityRowRole] ||
@@ -730,5 +736,73 @@ void tst_QAccessibilityMac::tableViewTest()
}
}
+void tst_QAccessibilityMac::treeViewTest()
+{
+ QTreeWidget *tw = new QTreeWidget;
+ tw->setColumnCount(2);
+ QTreeWidgetItem *root = new QTreeWidgetItem(tw, {"/", "0"});
+ root->setExpanded(false);
+ QTreeWidgetItem *users = new QTreeWidgetItem(root,{ "Users", "1"});
+ (void)new QTreeWidgetItem(root, {"Applications", "2"});
+ QTreeWidgetItem *lastChild = new QTreeWidgetItem(root, {"Libraries", "3"});
+
+ m_window->addWidget(tw);
+ QVERIFY(QTest::qWaitForWindowExposed(m_window));
+ QCoreApplication::processEvents();
+
+ TestAXObject *appObject = [TestAXObject getApplicationAXObject];
+ QVERIFY(appObject);
+
+ NSArray *windowList = [appObject windowList];
+ // one window
+ QVERIFY([windowList count] == 1);
+ AXUIElementRef windowRef = (AXUIElementRef)[windowList objectAtIndex:0];
+ QVERIFY(windowRef != nil);
+ TestAXObject *window = [[TestAXObject alloc] initWithAXUIElementRef:windowRef];
+
+ // children of window
+ AXUIElementRef treeView = [window findDirectChildByRole:kAXOutlineRole];
+ QVERIFY(treeView != nil);
+
+ TestAXObject *tv = [[TestAXObject alloc] initWithAXUIElementRef:treeView];
+
+ // here start actual treeview tests. NSAccessibilityOutline is a specialization
+ // of NSAccessibilityTable, and we represent trees as tables.
+ // Should have 2 columns
+ const unsigned int columnCount = 2;
+ NSArray *columnArray = [tv tableColumns];
+ QCOMPARE([columnArray count], columnCount);
+
+ // should have 1 row for now - as long as the root item is not expanded
+ NSArray *rowArray = [tv tableRows];
+ QCOMPARE(int([rowArray count]), 1);
+
+ root->setExpanded(true);
+ rowArray = [tv tableRows];
+ QCOMPARE(int([rowArray count]), root->childCount() + 1);
+
+ // this should not trigger any assert
+ tw->setCurrentItem(lastChild);
+
+ bool errorOccurred = false;
+
+ const auto cellText = [rowArray, &errorOccurred](int rowIndex, int columnIndex) -> QString {
+ TestAXObject *row = [[TestAXObject alloc] initWithAXUIElementRef:(AXUIElementRef)rowArray[rowIndex]];
+ Q_ASSERT(row);
+ TestAXObject *cell = [[TestAXObject alloc] initWithAXUIElementRef:(AXUIElementRef)[row childList][columnIndex]];
+ Q_ASSERT(cell);
+ const QString result = QString::fromNSString(cell.title);
+ errorOccurred = cell.errorOccurred;
+ return result;
+ };
+
+ QString text = cellText(0, 0);
+ if (errorOccurred)
+ QSKIP("Cocoa Accessibility API error, aborting");
+ QCOMPARE(text, root->text(0));
+ QCOMPARE(cellText(1, 0), users->text(0));
+ QCOMPARE(cellText(1, 1), users->text(1));
+}
+
QTEST_MAIN(tst_QAccessibilityMac)
#include "tst_qaccessibilitymac.moc"
diff --git a/tests/auto/other/qcomplextext/CMakeLists.txt b/tests/auto/other/qcomplextext/CMakeLists.txt
index 60d9128e70..74996c7ad7 100644
--- a/tests/auto/other/qcomplextext/CMakeLists.txt
+++ b/tests/auto/other/qcomplextext/CMakeLists.txt
@@ -1,12 +1,16 @@
# Copyright (C) 2022 The Qt Company Ltd.
# SPDX-License-Identifier: BSD-3-Clause
-# Generated from qcomplextext.pro.
-
#####################################################################
## tst_qcomplextext Test:
#####################################################################
+if(NOT QT_BUILD_STANDALONE_TESTS AND NOT QT_BUILDING_QT)
+ cmake_minimum_required(VERSION 3.16)
+ project(tst_qcomplextext LANGUAGES CXX)
+ find_package(Qt6BuildInternals REQUIRED COMPONENTS STANDALONE_TEST)
+endif()
+
# Collect test data
list(APPEND test_data "data")
diff --git a/tests/auto/other/qcomplextext/bidireorderstring.h b/tests/auto/other/qcomplextext/bidireorderstring.h
index 3b9e4c40ca..831fd34883 100644
--- a/tests/auto/other/qcomplextext/bidireorderstring.h
+++ b/tests/auto/other/qcomplextext/bidireorderstring.h
@@ -1,5 +1,5 @@
// Copyright (C) 2016 The Qt Company Ltd.
-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
struct LV {
const char *name;
const char *logical;
diff --git a/tests/auto/other/qcomplextext/tst_qcomplextext.cpp b/tests/auto/other/qcomplextext/tst_qcomplextext.cpp
index a164851886..b8014126ed 100644
--- a/tests/auto/other/qcomplextext/tst_qcomplextext.cpp
+++ b/tests/auto/other/qcomplextext/tst_qcomplextext.cpp
@@ -1,5 +1,5 @@
// Copyright (C) 2016 The Qt Company Ltd.
-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include <QTest>
#include <QtGui/QtGui>
@@ -347,9 +347,7 @@ void tst_QComplexText::bidiCharacterTest()
{
QString testFile = QFINDTESTDATA("data/BidiCharacterTest.txt");
QFile f(testFile);
- QVERIFY(f.exists());
-
- f.open(QIODevice::ReadOnly);
+ QVERIFY(f.open(QIODevice::ReadOnly));
int linenum = 0;
while (!f.atEnd()) {
@@ -441,9 +439,7 @@ void tst_QComplexText::bidiTest()
{
QString testFile = QFINDTESTDATA("data/BidiTest.txt");
QFile f(testFile);
- QVERIFY(f.exists());
-
- f.open(QIODevice::ReadOnly);
+ QVERIFY(f.open(QIODevice::ReadOnly));
int linenum = 0;
QList<int> resolvedLevels;
diff --git a/tests/auto/other/qfocusevent/CMakeLists.txt b/tests/auto/other/qfocusevent/CMakeLists.txt
index 24a596182e..61682af4e7 100644
--- a/tests/auto/other/qfocusevent/CMakeLists.txt
+++ b/tests/auto/other/qfocusevent/CMakeLists.txt
@@ -1,12 +1,16 @@
# Copyright (C) 2022 The Qt Company Ltd.
# SPDX-License-Identifier: BSD-3-Clause
-# Generated from qfocusevent.pro.
-
#####################################################################
## tst_qfocusevent Test:
#####################################################################
+if(NOT QT_BUILD_STANDALONE_TESTS AND NOT QT_BUILDING_QT)
+ cmake_minimum_required(VERSION 3.16)
+ project(tst_qfocusevent LANGUAGES CXX)
+ find_package(Qt6BuildInternals REQUIRED COMPONENTS STANDALONE_TEST)
+endif()
+
qt_internal_add_test(tst_qfocusevent
SOURCES
tst_qfocusevent.cpp
diff --git a/tests/auto/other/qfocusevent/tst_qfocusevent.cpp b/tests/auto/other/qfocusevent/tst_qfocusevent.cpp
index 2001f14ca4..8297b53ea1 100644
--- a/tests/auto/other/qfocusevent/tst_qfocusevent.cpp
+++ b/tests/auto/other/qfocusevent/tst_qfocusevent.cpp
@@ -1,5 +1,5 @@
// Copyright (C) 2016 The Qt Company Ltd.
-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include <QTest>
@@ -312,7 +312,6 @@ void tst_QFocusEvent::checkReason_ActiveWindow()
QVERIFY(QTest::qWaitForWindowExposed(d));
d->activateWindow(); // ### CDE
- QApplicationPrivate::setActiveWindow(d);
QVERIFY(QTest::qWaitForWindowActive(d));
QTRY_VERIFY(childFocusWidgetOne->focusOutEventRecieved);
@@ -334,9 +333,10 @@ void tst_QFocusEvent::checkReason_ActiveWindow()
d->hide();
if (!QGuiApplication::platformName().compare(QLatin1String("offscreen"), Qt::CaseInsensitive)
- || !QGuiApplication::platformName().compare(QLatin1String("minimal"), Qt::CaseInsensitive)) {
+ || !QGuiApplication::platformName().compare(QLatin1String("minimal"), Qt::CaseInsensitive)
+ || !QGuiApplication::platformName().compare(QLatin1String("cocoa"), Qt::CaseInsensitive)) {
// Activate window of testFocusWidget, focus in that window goes to childFocusWidgetOne
- qWarning("Platforms offscreen and minimal require explicit activateWindow()");
+ qWarning("Platforms offscreen, minimal and macOS require explicit activateWindow()");
testFocusWidget->activateWindow();
}
diff --git a/tests/auto/other/qnetworkaccessmanager_and_qprogressdialog/CMakeLists.txt b/tests/auto/other/qnetworkaccessmanager_and_qprogressdialog/CMakeLists.txt
index 0125b5b107..313d9464a3 100644
--- a/tests/auto/other/qnetworkaccessmanager_and_qprogressdialog/CMakeLists.txt
+++ b/tests/auto/other/qnetworkaccessmanager_and_qprogressdialog/CMakeLists.txt
@@ -1,12 +1,16 @@
# Copyright (C) 2022 The Qt Company Ltd.
# SPDX-License-Identifier: BSD-3-Clause
-# Generated from qnetworkaccessmanager_and_qprogressdialog.pro.
-
#####################################################################
## tst_qnetworkaccessmanager_and_qprogressdialog Test:
#####################################################################
+if(NOT QT_BUILD_STANDALONE_TESTS AND NOT QT_BUILDING_QT)
+ cmake_minimum_required(VERSION 3.16)
+ project(tst_qnetworkaccessmanager_and_qprogressdialog LANGUAGES CXX)
+ find_package(Qt6BuildInternals REQUIRED COMPONENTS STANDALONE_TEST)
+endif()
+
qt_internal_add_test(tst_qnetworkaccessmanager_and_qprogressdialog
SOURCES
tst_qnetworkaccessmanager_and_qprogressdialog.cpp
diff --git a/tests/auto/other/qnetworkaccessmanager_and_qprogressdialog/tst_qnetworkaccessmanager_and_qprogressdialog.cpp b/tests/auto/other/qnetworkaccessmanager_and_qprogressdialog/tst_qnetworkaccessmanager_and_qprogressdialog.cpp
index 30cc76830a..c665068f72 100644
--- a/tests/auto/other/qnetworkaccessmanager_and_qprogressdialog/tst_qnetworkaccessmanager_and_qprogressdialog.cpp
+++ b/tests/auto/other/qnetworkaccessmanager_and_qprogressdialog/tst_qnetworkaccessmanager_and_qprogressdialog.cpp
@@ -1,5 +1,5 @@
// Copyright (C) 2016 The Qt Company Ltd.
-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include <QTest>
diff --git a/tests/auto/other/qobjectrace/CMakeLists.txt b/tests/auto/other/qobjectrace/CMakeLists.txt
index 48d70ee6a7..6516c9ee73 100644
--- a/tests/auto/other/qobjectrace/CMakeLists.txt
+++ b/tests/auto/other/qobjectrace/CMakeLists.txt
@@ -1,12 +1,16 @@
# Copyright (C) 2022 The Qt Company Ltd.
# SPDX-License-Identifier: BSD-3-Clause
-# Generated from qobjectrace.pro.
-
#####################################################################
## qobjectrace Test:
#####################################################################
+if(NOT QT_BUILD_STANDALONE_TESTS AND NOT QT_BUILDING_QT)
+ cmake_minimum_required(VERSION 3.16)
+ project(tst_qobjectrace LANGUAGES CXX)
+ find_package(Qt6BuildInternals REQUIRED COMPONENTS STANDALONE_TEST)
+endif()
+
qt_internal_add_test(tst_qobjectrace
SOURCES
tst_qobjectrace.cpp
diff --git a/tests/auto/other/qobjectrace/tst_qobjectrace.cpp b/tests/auto/other/qobjectrace/tst_qobjectrace.cpp
index 90b1b5c29a..af6634f253 100644
--- a/tests/auto/other/qobjectrace/tst_qobjectrace.cpp
+++ b/tests/auto/other/qobjectrace/tst_qobjectrace.cpp
@@ -1,5 +1,5 @@
// Copyright (C) 2022 The Qt Company Ltd.
-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include <QtCore>
@@ -318,9 +318,6 @@ private:
void tst_QObjectRace::blockingQueuedDestroyRace()
{
-#if !QT_CONFIG(cxx11_future)
- QSKIP("This test requires QThread::create");
-#else
enum { MinIterations = 100, MinTime = 3000, WaitTime = 25 };
BlockingQueuedDestroyRaceObject sender;
@@ -366,7 +363,6 @@ void tst_QObjectRace::blockingQueuedDestroyRace()
thread->wait();
}
-#endif
}
static QAtomicInteger<unsigned> countedStructObjectsCount;
diff --git a/tests/auto/other/qprocess_and_guieventloop/CMakeLists.txt b/tests/auto/other/qprocess_and_guieventloop/CMakeLists.txt
index e8e8d6f5b4..3383677009 100644
--- a/tests/auto/other/qprocess_and_guieventloop/CMakeLists.txt
+++ b/tests/auto/other/qprocess_and_guieventloop/CMakeLists.txt
@@ -1,12 +1,16 @@
# Copyright (C) 2022 The Qt Company Ltd.
# SPDX-License-Identifier: BSD-3-Clause
-# Generated from qprocess_and_guieventloop.pro.
-
#####################################################################
## tst_qprocess_and_guieventloop Test:
#####################################################################
+if(NOT QT_BUILD_STANDALONE_TESTS AND NOT QT_BUILDING_QT)
+ cmake_minimum_required(VERSION 3.16)
+ project(tst_qprocess_and_guieventloop LANGUAGES CXX)
+ find_package(Qt6BuildInternals REQUIRED COMPONENTS STANDALONE_TEST)
+endif()
+
qt_internal_add_test(tst_qprocess_and_guieventloop
SOURCES
tst_qprocess_and_guieventloop.cpp
@@ -14,3 +18,4 @@ qt_internal_add_test(tst_qprocess_and_guieventloop
Qt::Gui
)
add_subdirectory(write-read-write)
+add_dependencies(tst_qprocess_and_guieventloop write-read-write)
diff --git a/tests/auto/other/qprocess_and_guieventloop/tst_qprocess_and_guieventloop.cpp b/tests/auto/other/qprocess_and_guieventloop/tst_qprocess_and_guieventloop.cpp
index 3541576bb8..b5b8c4cfc3 100644
--- a/tests/auto/other/qprocess_and_guieventloop/tst_qprocess_and_guieventloop.cpp
+++ b/tests/auto/other/qprocess_and_guieventloop/tst_qprocess_and_guieventloop.cpp
@@ -1,6 +1,6 @@
// Copyright (C) 2021 The Qt Company Ltd.
// Copyright (C) 2016 Intel Corporation.
-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include <QtGui/QGuiApplication>
#include <QTest>
diff --git a/tests/auto/other/qprocess_and_guieventloop/write-read-write/CMakeLists.txt b/tests/auto/other/qprocess_and_guieventloop/write-read-write/CMakeLists.txt
index 87cfa4dd17..2bc1ebb7b0 100644
--- a/tests/auto/other/qprocess_and_guieventloop/write-read-write/CMakeLists.txt
+++ b/tests/auto/other/qprocess_and_guieventloop/write-read-write/CMakeLists.txt
@@ -5,4 +5,8 @@
## write-read-write Binary:
#####################################################################
-add_executable(write-read-write main.cpp)
+qt_internal_add_executable(write-read-write
+ OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/"
+ SOURCES
+ main.cpp
+)
diff --git a/tests/auto/other/qprocess_and_guieventloop/write-read-write/main.cpp b/tests/auto/other/qprocess_and_guieventloop/write-read-write/main.cpp
index b062542bb0..126c85dfd7 100644
--- a/tests/auto/other/qprocess_and_guieventloop/write-read-write/main.cpp
+++ b/tests/auto/other/qprocess_and_guieventloop/write-read-write/main.cpp
@@ -1,5 +1,5 @@
// Copyright (C) 2016 Intel Corporation.
-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include <stdio.h>
diff --git a/tests/auto/other/qsharedpointer_and_qwidget/CMakeLists.txt b/tests/auto/other/qsharedpointer_and_qwidget/CMakeLists.txt
index 722d338d6f..a405f54151 100644
--- a/tests/auto/other/qsharedpointer_and_qwidget/CMakeLists.txt
+++ b/tests/auto/other/qsharedpointer_and_qwidget/CMakeLists.txt
@@ -1,12 +1,16 @@
# Copyright (C) 2022 The Qt Company Ltd.
# SPDX-License-Identifier: BSD-3-Clause
-# Generated from qsharedpointer_and_qwidget.pro.
-
#####################################################################
## tst_qsharedpointer_and_qwidget Test:
#####################################################################
+if(NOT QT_BUILD_STANDALONE_TESTS AND NOT QT_BUILDING_QT)
+ cmake_minimum_required(VERSION 3.16)
+ project(tst_qsharedpointer_and_qwidget LANGUAGES CXX)
+ find_package(Qt6BuildInternals REQUIRED COMPONENTS STANDALONE_TEST)
+endif()
+
qt_internal_add_test(tst_qsharedpointer_and_qwidget
SOURCES
tst_qsharedpointer_and_qwidget.cpp
diff --git a/tests/auto/other/qsharedpointer_and_qwidget/tst_qsharedpointer_and_qwidget.cpp b/tests/auto/other/qsharedpointer_and_qwidget/tst_qsharedpointer_and_qwidget.cpp
index 9eaff74557..5fa9d8740a 100644
--- a/tests/auto/other/qsharedpointer_and_qwidget/tst_qsharedpointer_and_qwidget.cpp
+++ b/tests/auto/other/qsharedpointer_and_qwidget/tst_qsharedpointer_and_qwidget.cpp
@@ -1,5 +1,5 @@
// Copyright (C) 2016 The Qt Company Ltd.
-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include <QtWidgets/QWidget>
#include <QtWidgets/QPushButton>
diff --git a/tests/auto/other/qvariant_common/tst_qvariant_common.h b/tests/auto/other/qvariant_common/tst_qvariant_common.h
index 86da11ee47..4007cc7db8 100644
--- a/tests/auto/other/qvariant_common/tst_qvariant_common.h
+++ b/tests/auto/other/qvariant_common/tst_qvariant_common.h
@@ -1,5 +1,5 @@
// Copyright (C) 2016 The Qt Company Ltd.
-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef TST_QVARIANT_COMMON
#define TST_QVARIANT_COMMON
@@ -119,6 +119,13 @@ protected:
QFETCH(bool, UIntCast); \
QFETCH(bool, ULongLongCast);
+#if QT_CONFIG(shortcut)
+#define QMETATYPE_QKEYSEQUENCE \
+ QCOMPARE(val.canConvert(QMetaType(QMetaType::QKeySequence)), KeySequenceCast);
+#else
+#define QMETATYPE_QKEYSEQUENCE
+#endif
+
#define TST_QVARIANT_CANCONVERT_COMPARE_DATA \
QCOMPARE(val.canConvert(QMetaType(QMetaType::QBitArray)), BitArrayCast); \
QCOMPARE(val.canConvert(QMetaType(QMetaType::QBitmap)), BitmapCast); \
@@ -135,7 +142,7 @@ protected:
QCOMPARE(val.canConvert(QMetaType(QMetaType::QImage)), ImageCast); \
QCOMPARE(val.canConvert(QMetaType(QMetaType::Int)), IntCast); \
QCOMPARE(val.canConvert(QMetaType(QMetaType::UnknownType)), InvalidCast); \
- QCOMPARE(val.canConvert(QMetaType(QMetaType::QKeySequence)), KeySequenceCast); \
+ QMETATYPE_QKEYSEQUENCE \
QCOMPARE(val.canConvert(QMetaType(QMetaType::QVariantList)), ListCast); \
QCOMPARE(val.canConvert(QMetaType(QMetaType::LongLong)), LongLongCast); \
QCOMPARE(val.canConvert(QMetaType(QMetaType::QVariantMap)), MapCast); \
diff --git a/tests/auto/other/sessionmanagement_macos/tst_sessionmanagement_macos.mm b/tests/auto/other/sessionmanagement_macos/tst_sessionmanagement_macos.mm
index a59ff03a06..02a3464ec7 100644
--- a/tests/auto/other/sessionmanagement_macos/tst_sessionmanagement_macos.mm
+++ b/tests/auto/other/sessionmanagement_macos/tst_sessionmanagement_macos.mm
@@ -1,5 +1,5 @@
// Copyright (C) 2019 Samuel Gaist <samuel.gaist@idiap.ch>
-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include <QTest>
diff --git a/tests/auto/other/toolsupport/CMakeLists.txt b/tests/auto/other/toolsupport/CMakeLists.txt
index 5bc6c5c16a..5b2cc0c0e2 100644
--- a/tests/auto/other/toolsupport/CMakeLists.txt
+++ b/tests/auto/other/toolsupport/CMakeLists.txt
@@ -1,12 +1,16 @@
# Copyright (C) 2022 The Qt Company Ltd.
# SPDX-License-Identifier: BSD-3-Clause
-# Generated from toolsupport.pro.
-
#####################################################################
## tst_toolsupport Test:
#####################################################################
+if(NOT QT_BUILD_STANDALONE_TESTS AND NOT QT_BUILDING_QT)
+ cmake_minimum_required(VERSION 3.16)
+ project(tst_toolsupport LANGUAGES CXX)
+ find_package(Qt6BuildInternals REQUIRED COMPONENTS STANDALONE_TEST)
+endif()
+
qt_internal_add_test(tst_toolsupport
SOURCES
tst_toolsupport.cpp
diff --git a/tests/auto/other/toolsupport/tst_toolsupport.cpp b/tests/auto/other/toolsupport/tst_toolsupport.cpp
index 6a146bae3a..965b55977c 100644
--- a/tests/auto/other/toolsupport/tst_toolsupport.cpp
+++ b/tests/auto/other/toolsupport/tst_toolsupport.cpp
@@ -1,5 +1,5 @@
// Copyright (C) 2015 The Qt Company Ltd.
-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include <QTest>
@@ -38,6 +38,7 @@ template <typename T, typename K>
size_t pmm_to_offsetof(T K:: *pmm)
{
#ifdef Q_CC_MSVC
+
// Even on 64 bit MSVC uses 4 byte offsets.
quint32 ret;
#else
@@ -114,10 +115,10 @@ void tst_toolsupport::offsets_data()
QTestData &data = QTest::newRow("QFilePrivate::fileName")
<< pmm_to_offsetof(&QFilePrivate::fileName);
// Please heed the comment at the top of this file when changing one of these lines:
-#ifdef Q_PROCESSOR_X86
+#ifdef Q_PROCESSOR_X86_32
// x86 32-bit has weird alignment rules. Refer to QtPrivate::AlignOf in
// qglobal.h for more details.
- data << 264 << 424;
+ data << 264 << -1;
#else
data << 300 << 424;
#endif
diff --git a/tests/auto/other/xkbkeyboard/CMakeLists.txt b/tests/auto/other/xkbkeyboard/CMakeLists.txt
index 804f24f5ec..06e471c68b 100644
--- a/tests/auto/other/xkbkeyboard/CMakeLists.txt
+++ b/tests/auto/other/xkbkeyboard/CMakeLists.txt
@@ -1,12 +1,16 @@
# Copyright (C) 2022 The Qt Company Ltd.
# SPDX-License-Identifier: BSD-3-Clause
-# Generated from xkbkeyboard.pro.
-
#####################################################################
## tst_xkbkeyboard Test:
#####################################################################
+if(NOT QT_BUILD_STANDALONE_TESTS AND NOT QT_BUILDING_QT)
+ cmake_minimum_required(VERSION 3.16)
+ project(tst_xkbkeyboard LANGUAGES CXX)
+ find_package(Qt6BuildInternals REQUIRED COMPONENTS STANDALONE_TEST)
+endif()
+
qt_internal_add_test(tst_xkbkeyboard
SOURCES
tst_xkbkeyboard.cpp
diff --git a/tests/auto/other/xkbkeyboard/tst_xkbkeyboard.cpp b/tests/auto/other/xkbkeyboard/tst_xkbkeyboard.cpp
index 05950eee81..323693bb84 100644
--- a/tests/auto/other/xkbkeyboard/tst_xkbkeyboard.cpp
+++ b/tests/auto/other/xkbkeyboard/tst_xkbkeyboard.cpp
@@ -1,5 +1,5 @@
// Copyright (C) 2019 The Qt Company Ltd.
-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include <QtCore>
#include <QtGui>