diff options
Diffstat (limited to 'tests/auto/other')
59 files changed, 650 insertions, 191 deletions
diff --git a/tests/auto/other/CMakeLists.txt b/tests/auto/other/CMakeLists.txt index 3e1a96bce0..16f96cd5f4 100644 --- a/tests/auto/other/CMakeLists.txt +++ b/tests/auto/other/CMakeLists.txt @@ -35,10 +35,10 @@ 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) @@ -46,3 +46,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..f2ba135328 --- /dev/null +++ b/tests/auto/other/android_deployment_settings/CMakeLists.txt @@ -0,0 +1,85 @@ +# 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_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_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..d68d08b58e --- /dev/null +++ b/tests/auto/other/android_deployment_settings/tst_android_deployment_settings.cpp @@ -0,0 +1,112 @@ +// 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"; +} + +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 31c0f377cc..8e96992e4d 100644 --- a/tests/auto/other/gestures/BLACKLIST +++ b/tests/auto/other/gestures/BLACKLIST @@ -1,62 +1,4 @@ [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 565ee19438..815846305a 100644 --- a/tests/auto/other/gestures/CMakeLists.txt +++ b/tests/auto/other/gestures/CMakeLists.txt @@ -5,6 +5,12 @@ ## 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 4d87ee03df..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: @@ -743,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())) @@ -771,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: diff --git a/tests/auto/other/languagechange/CMakeLists.txt b/tests/auto/other/languagechange/CMakeLists.txt index af81580bbf..07f3547d58 100644 --- a/tests/auto/other/languagechange/CMakeLists.txt +++ b/tests/auto/other/languagechange/CMakeLists.txt @@ -5,6 +5,12 @@ ## 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 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 3344c2accd..afa3f0b8df 100644 --- a/tests/auto/other/macgui/CMakeLists.txt +++ b/tests/auto/other/macgui/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_macgui LANGUAGES CXX) + find_package(Qt6BuildInternals REQUIRED COMPONENTS STANDALONE_TEST) +endif() + if(NOT APPLE) return() endif() @@ -16,6 +22,8 @@ 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 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 830ba618f9..c44cf61920 100644 --- a/tests/auto/other/macnativeevents/CMakeLists.txt +++ b/tests/auto/other/macnativeevents/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_macnativeevents LANGUAGES CXX) + find_package(Qt6BuildInternals REQUIRED COMPONENTS STANDALONE_TEST) +endif() + if(NOT APPLE) return() endif() 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 daac225d31..6a98d4dc16 100644 --- a/tests/auto/other/macplist/CMakeLists.txt +++ b/tests/auto/other/macplist/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_macplist LANGUAGES CXX) + find_package(Qt6BuildInternals REQUIRED COMPONENTS STANDALONE_TEST) +endif() + if(NOT TARGET Qt::Widgets) return() endif() 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/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 f0fb3c2e6e..6491c510f6 100644 --- a/tests/auto/other/networkselftest/CMakeLists.txt +++ b/tests/auto/other/networkselftest/CMakeLists.txt @@ -5,6 +5,12 @@ ## 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 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/BLACKLIST b/tests/auto/other/qaccessibility/BLACKLIST deleted file mode 100644 index 5b862380b9..0000000000 --- a/tests/auto/other/qaccessibility/BLACKLIST +++ /dev/null @@ -1,3 +0,0 @@ -[focusChild] -# QTBUG-109763 -wayland diff --git a/tests/auto/other/qaccessibility/CMakeLists.txt b/tests/auto/other/qaccessibility/CMakeLists.txt index a3372456db..9160bafe52 100644 --- a/tests/auto/other/qaccessibility/CMakeLists.txt +++ b/tests/auto/other/qaccessibility/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_qaccessibility LANGUAGES CXX) + find_package(Qt6BuildInternals REQUIRED COMPONENTS STANDALONE_TEST) +endif() + if(NOT QT_FEATURE_accessibility) return() endif() 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 8c51022416..5fd695e2e6 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(); @@ -664,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"); @@ -700,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")); @@ -2878,6 +2879,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 @@ -2929,7 +2936,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); @@ -3400,6 +3408,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 @@ -3446,7 +3499,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; @@ -3456,7 +3509,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; @@ -3658,6 +3711,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")); @@ -3668,7 +3723,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()); @@ -3906,6 +3967,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); @@ -4043,10 +4105,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)); @@ -4064,8 +4221,6 @@ void tst_QAccessibility::bridgeTest() controlWalker->Release(); windowElement->Release(); automation->Release(); - - QTestAccessibility::clearEvents(); #endif } @@ -4156,6 +4311,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 445c33e912..5c85827a3b 100644 --- a/tests/auto/other/qaccessibilitylinux/CMakeLists.txt +++ b/tests/auto/other/qaccessibilitylinux/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_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() 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 22ae50eb19..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]; @@ -732,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 1e1b6efdec..74996c7ad7 100644 --- a/tests/auto/other/qcomplextext/CMakeLists.txt +++ b/tests/auto/other/qcomplextext/CMakeLists.txt @@ -5,6 +5,12 @@ ## 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 5cde50dd9e..61682af4e7 100644 --- a/tests/auto/other/qfocusevent/CMakeLists.txt +++ b/tests/auto/other/qfocusevent/CMakeLists.txt @@ -5,6 +5,12 @@ ## 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 514e804526..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); diff --git a/tests/auto/other/qnetworkaccessmanager_and_qprogressdialog/CMakeLists.txt b/tests/auto/other/qnetworkaccessmanager_and_qprogressdialog/CMakeLists.txt index 46073647fb..313d9464a3 100644 --- a/tests/auto/other/qnetworkaccessmanager_and_qprogressdialog/CMakeLists.txt +++ b/tests/auto/other/qnetworkaccessmanager_and_qprogressdialog/CMakeLists.txt @@ -5,6 +5,12 @@ ## 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 c5b30d9792..6516c9ee73 100644 --- a/tests/auto/other/qobjectrace/CMakeLists.txt +++ b/tests/auto/other/qobjectrace/CMakeLists.txt @@ -5,6 +5,12 @@ ## 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 aa899958e4..3383677009 100644 --- a/tests/auto/other/qprocess_and_guieventloop/CMakeLists.txt +++ b/tests/auto/other/qprocess_and_guieventloop/CMakeLists.txt @@ -5,6 +5,12 @@ ## 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 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/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 bd9ac9e6a2..a405f54151 100644 --- a/tests/auto/other/qsharedpointer_and_qwidget/CMakeLists.txt +++ b/tests/auto/other/qsharedpointer_and_qwidget/CMakeLists.txt @@ -5,6 +5,12 @@ ## 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 824f25f260..5b2cc0c0e2 100644 --- a/tests/auto/other/toolsupport/CMakeLists.txt +++ b/tests/auto/other/toolsupport/CMakeLists.txt @@ -5,6 +5,12 @@ ## 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 82a17f3e73..06e471c68b 100644 --- a/tests/auto/other/xkbkeyboard/CMakeLists.txt +++ b/tests/auto/other/xkbkeyboard/CMakeLists.txt @@ -5,6 +5,12 @@ ## 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> |