diff options
Diffstat (limited to 'tests/auto/other')
175 files changed, 1888 insertions, 13503 deletions
diff --git a/tests/auto/other/CMakeLists.txt b/tests/auto/other/CMakeLists.txt index 6142d086b4..e261ea234d 100644 --- a/tests/auto/other/CMakeLists.txt +++ b/tests/auto/other/CMakeLists.txt @@ -1,17 +1,14 @@ -# Generated from other.pro. +# Copyright (C) 2022 The Qt Company Ltd. +# SPDX-License-Identifier: BSD-3-Clause -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(lancelot) add_subdirectory(qnetworkaccessmanager_and_qprogressdialog) endif() if(MACOS AND TARGET Qt::Gui AND TARGET Qt::Widgets) @@ -22,8 +19,7 @@ endif() if(TARGET Qt::Network) add_subdirectory(networkselftest) endif() -# QTBUG-87674 # special case -if(QT_FEATURE_accessibility AND TARGET Qt::Gui AND TARGET Qt::Widgets AND NOT ANDROID) +if(QT_FEATURE_accessibility AND TARGET Qt::Gui AND TARGET Qt::Widgets) add_subdirectory(qaccessibility) endif() if(TARGET Qt::Gui) @@ -31,22 +27,23 @@ 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) endif() -if(ANDROID) - add_subdirectory(android) -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/CMakeLists.txt b/tests/auto/other/android/CMakeLists.txt deleted file mode 100644 index c2749825ac..0000000000 --- a/tests/auto/other/android/CMakeLists.txt +++ /dev/null @@ -1,21 +0,0 @@ -# Generated from android.pro. - -##################################################################### -## tst_android Test: -##################################################################### - -qt_internal_add_test(tst_android - SOURCES - tst_android.cpp -) - -if(ANDROID) - set_property(TARGET tst_android APPEND PROPERTY QT_ANDROID_PACKAGE_SOURCE_DIR - ${CMAKE_CURRENT_SOURCE_DIR}/testdata - ) - # QTBUG-88840 # special case - qt_android_generate_deployment_settings(tst_android) # special case -endif() - -#### Keys ignored in scope 1:.:.:android.pro:<TRUE>: -# DISTFILES = "testdata/assets/test.txt" diff --git a/tests/auto/other/android/testdata/assets/test.txt b/tests/auto/other/android/testdata/assets/test.txt deleted file mode 100644 index 61e2c47c25..0000000000 --- a/tests/auto/other/android/testdata/assets/test.txt +++ /dev/null @@ -1 +0,0 @@ -FooBar
\ No newline at end of file diff --git a/tests/auto/other/android/tst_android.cpp b/tests/auto/other/android/tst_android.cpp deleted file mode 100644 index 6a492e9315..0000000000 --- a/tests/auto/other/android/tst_android.cpp +++ /dev/null @@ -1,64 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include <QTest> - -class tst_Android : public QObject -{ -Q_OBJECT -private slots: - void assetsRead(); - void assetsNotWritable(); -}; - -void tst_Android::assetsRead() -{ - { - QFile file("assets:/test.txt"); - QVERIFY(file.open(QIODevice::ReadOnly)); - QCOMPARE(file.readAll(), QByteArray("FooBar")); - } - - { - QFile file("assets:/test.txt"); - QVERIFY(file.open(QIODevice::ReadOnly | QIODevice::Text)); - QCOMPARE(file.readAll(), QByteArray("FooBar")); - } -} - -void tst_Android::assetsNotWritable() -{ - QFile file("assets:/test.txt"); - QVERIFY(!file.open(QIODevice::WriteOnly)); - QVERIFY(!file.open(QIODevice::ReadWrite)); - QVERIFY(!file.open(QIODevice::Append)); -} - -QTEST_MAIN(tst_Android) -#include "tst_android.moc" - 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 e4c279d4eb..8e96992e4d 100644 --- a/tests/auto/other/gestures/BLACKLIST +++ b/tests/auto/other/gestures/BLACKLIST @@ -1,37 +1,4 @@ -[] -rhel-7.4 -rhel-7.6 -centos -ubuntu-18.04 -ubuntu-20.04 -[customGesture] -opensuse-leap -# QTBUG-67254 -opensuse-42.3 -[graphicsItemGesture] -ubuntu-18.04 -ubuntu-20.04 -rhel-7.4 -rhel-7.6 -centos -[graphicsItemTreeGesture] -ubuntu-18.04 -ubuntu-20.04 -[graphicsView] -ubuntu-18.04 -ubuntu-20.04 -rhel-7.4 -rhel-7.6 -centos -[explicitGraphicsObjectTarget] -ubuntu-18.04 -ubuntu-20.04 -rhel-7.4 -rhel-7.6 -centos -[autoCancelGestures2] -ubuntu-18.04 -ubuntu-20.04 -rhel-7.4 -rhel-7.6 -centos +[panelPropagation] +ubuntu-22.04 ci +[panelStacksBehindParent] +ubuntu-22.04 ci diff --git a/tests/auto/other/gestures/CMakeLists.txt b/tests/auto/other/gestures/CMakeLists.txt index e4ea953ee3..815846305a 100644 --- a/tests/auto/other/gestures/CMakeLists.txt +++ b/tests/auto/other/gestures/CMakeLists.txt @@ -1,13 +1,20 @@ -# Generated from gestures.pro. +# Copyright (C) 2022 The Qt Company Ltd. +# SPDX-License-Identifier: BSD-3-Clause ##################################################################### ## 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 - PUBLIC_LIBRARIES + LIBRARIES Qt::Gui Qt::Widgets ) diff --git a/tests/auto/other/gestures/tst_gestures.cpp b/tests/auto/other/gestures/tst_gestures.cpp index 48cd355554..a413268321 100644 --- a/tests/auto/other/gestures/tst_gestures.cpp +++ b/tests/auto/other/gestures/tst_gestures.cpp @@ -1,36 +1,11 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #include <QTest> #include <QtTest/qtesttouch.h> #include <qevent.h> +#include <QSet> #include <qpointingdevice.h> #include <qwidget.h> #include <qlayout.h> @@ -233,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; @@ -243,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: @@ -306,6 +281,10 @@ Q_OBJECT private slots: void initTestCase(); void cleanupTestCase(); + + void init(); + void cleanup(); + void customGesture(); void autoCancelingGestures(); void gestureOverChild(); @@ -342,35 +321,60 @@ private slots: void testQGestureRecognizerCleanup(); void testReuseCanceledGestures(); void bug_13501_gesture_not_accepted(); +private: + QPoint m_availableTopLeft; }; void tst_Gestures::initTestCase() { + 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::cleanupTestCase() +void tst_Gestures::cleanup() { QGestureRecognizer::unregisterRecognizer(CustomGesture::GestureType); } +static QtMessageHandler originalMessageHandler = nullptr; +static bool skipCustomGesture = false; +static void messageHandler(QtMsgType type, const QMessageLogContext &context, const QString &text) +{ + if (type == QtMsgType::QtWarningMsg && text == "QGestureManager::deliverEvent: could not find the target for gesture") + skipCustomGesture = true; + originalMessageHandler(type, context, text); +} + void tst_Gestures::customGesture() { + originalMessageHandler = qInstallMessageHandler(messageHandler); + auto guard = qScopeGuard([](){ qInstallMessageHandler(originalMessageHandler); }); GestureWidget widget; widget.grabGesture(CustomGesture::GestureType, Qt::DontStartGestureOnChildren); widget.show(); - QVERIFY(QTest::qWaitForWindowExposed(&widget)); + QVERIFY(QTest::qWaitForWindowActive(&widget)); CustomEvent event; event.hotSpot = widget.mapToGlobal(QPoint(5,5)); event.hasHotSpot = true; sendCustomGesture(&event, &widget); + if (skipCustomGesture) + QSKIP("QApplication unable to access test widget."); static const int TotalGestureEventsCount = CustomGesture::SerialFinishedThreshold - CustomGesture::SerialStartedThreshold + 1; static const int TotalCustomEventsCount = CustomGesture::SerialFinishedThreshold - CustomGesture::SerialMaybeThreshold + 1; - QCOMPARE(widget.customEventsReceived, TotalCustomEventsCount); + QTRY_COMPARE(widget.customEventsReceived, TotalCustomEventsCount); QCOMPARE(widget.gestureEventsReceived, TotalGestureEventsCount); QCOMPARE(widget.gestureOverrideEventsReceived, 0); QCOMPARE(widget.events.all.size(), TotalGestureEventsCount); @@ -430,7 +434,7 @@ void tst_Gestures::gestureOverChild() static const int TotalGestureEventsCount = CustomGesture::SerialFinishedThreshold - CustomGesture::SerialStartedThreshold + 1; static const int TotalCustomEventsCount = CustomGesture::SerialFinishedThreshold - CustomGesture::SerialMaybeThreshold + 1; - QCOMPARE(child->customEventsReceived, TotalCustomEventsCount); + QTRY_COMPARE(child->customEventsReceived, TotalCustomEventsCount); QCOMPARE(widget.customEventsReceived, 0); QCOMPARE(child->gestureEventsReceived, 0); QCOMPARE(child->gestureOverrideEventsReceived, 0); @@ -445,7 +449,7 @@ void tst_Gestures::gestureOverChild() sendCustomGesture(&event, child); - QCOMPARE(child->customEventsReceived, TotalCustomEventsCount); + QTRY_COMPARE(child->customEventsReceived, TotalCustomEventsCount); QCOMPARE(widget.customEventsReceived, 0); QCOMPARE(child->gestureEventsReceived, 0); @@ -477,7 +481,7 @@ void tst_Gestures::multipleWidgetOnlyGestureInTree() CustomEvent event; sendCustomGesture(&event, child); - QCOMPARE(child->customEventsReceived, TotalCustomEventsCount); + QTRY_COMPARE(child->customEventsReceived, TotalCustomEventsCount); QCOMPARE(parent.customEventsReceived, 0); QCOMPARE(child->gestureEventsReceived, TotalGestureEventsCount); QCOMPARE(child->gestureOverrideEventsReceived, 0); @@ -490,8 +494,8 @@ void tst_Gestures::multipleWidgetOnlyGestureInTree() // same for the parent widget sendCustomGesture(&event, &parent); - QCOMPARE(child->customEventsReceived, 0); QCOMPARE(parent.customEventsReceived, TotalCustomEventsCount); + QCOMPARE(child->customEventsReceived, 0); QCOMPARE(child->gestureEventsReceived, 0); QCOMPARE(child->gestureOverrideEventsReceived, 0); QCOMPARE(parent.gestureEventsReceived, TotalGestureEventsCount); @@ -518,7 +522,7 @@ void tst_Gestures::conflictingGestures() CustomEvent event; sendCustomGesture(&event, child); - QCOMPARE(child->gestureOverrideEventsReceived, 1); + QTRY_COMPARE(child->gestureOverrideEventsReceived, 1); QCOMPARE(child->gestureEventsReceived, TotalGestureEventsCount); QCOMPARE(parent.gestureOverrideEventsReceived, 0); QCOMPARE(parent.gestureEventsReceived, 0); @@ -586,8 +590,8 @@ void tst_Gestures::conflictingGestures() // sending events to the child and making sure there is no conflict sendCustomGesture(&event, child); + QTRY_COMPARE(child->gestureEventsReceived, TotalGestureEventsCount); QCOMPARE(child->gestureOverrideEventsReceived, 1); - QCOMPARE(child->gestureEventsReceived, TotalGestureEventsCount); QCOMPARE(parent.gestureOverrideEventsReceived, 1); QCOMPARE(parent.gestureEventsReceived, TotalGestureEventsCount); @@ -595,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. @@ -602,13 +609,11 @@ void tst_Gestures::conflictingGestures() child->acceptGestureOverride = true; sendCustomGesture(&event, child); + QTRY_VERIFY(child->gestureEventsReceived > TotalGestureEventsCount); QCOMPARE(child->gestureOverrideEventsReceived, 1); - QVERIFY(child->gestureEventsReceived > TotalGestureEventsCount); - QCOMPARE(child->events.all.count(), TotalGestureEventsCount + ContinuousGestureEventsCount); + QCOMPARE(child->events.all.size(), TotalGestureEventsCount + ContinuousGestureEventsCount); QCOMPARE(parent.gestureOverrideEventsReceived, 0); QCOMPARE(parent.gestureEventsReceived, 0); - - QGestureRecognizer::unregisterRecognizer(ContinuousGesture); } void tst_Gestures::finishedWithoutStarted() @@ -621,7 +626,7 @@ void tst_Gestures::finishedWithoutStarted() ev.serial = CustomGesture::SerialFinishedThreshold; QApplication::sendEvent(&widget, &ev); - QCOMPARE(widget.customEventsReceived, 1); + QTRY_COMPARE(widget.customEventsReceived, 1); QCOMPARE(widget.gestureEventsReceived, 2); QCOMPARE(widget.gestureOverrideEventsReceived, 0); QCOMPARE(widget.events.all.size(), 2); @@ -643,7 +648,7 @@ void tst_Gestures::unknownGesture() static const int TotalGestureEventsCount = CustomGesture::SerialFinishedThreshold - CustomGesture::SerialStartedThreshold + 1; - QCOMPARE(widget.gestureEventsReceived, TotalGestureEventsCount); + QTRY_COMPARE(widget.gestureEventsReceived, TotalGestureEventsCount); } static const QColor InstanceColors[] = { @@ -737,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())) @@ -765,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: @@ -824,6 +830,7 @@ void tst_Gestures::graphicsItemGesture() QGraphicsScene scene; QGraphicsView view(&scene); view.setWindowFlags(Qt::X11BypassWindowManagerHint); + view.move(m_availableTopLeft); GestureItem *item = new GestureItem("item"); scene.addItem(item); @@ -846,7 +853,7 @@ void tst_Gestures::graphicsItemGesture() QTest::ignoreMessage(QtWarningMsg, "QGestureManager::deliverEvent: could not find the target for gesture"); sendCustomGesture(&event, item, &scene); - QCOMPARE(item->customEventsReceived, TotalCustomEventsCount); + QTRY_COMPARE(item->customEventsReceived, TotalCustomEventsCount); QCOMPARE(item->gestureEventsReceived, 0); QCOMPARE(item->gestureOverrideEventsReceived, 0); @@ -886,6 +893,7 @@ void tst_Gestures::graphicsView() QGraphicsScene scene; QGraphicsView view(&scene); view.setWindowFlags(Qt::X11BypassWindowManagerHint); + view.move(m_availableTopLeft); GestureItem *item = new GestureItem("item"); scene.addItem(item); @@ -906,7 +914,7 @@ void tst_Gestures::graphicsView() event.hasHotSpot = true; sendCustomGesture(&event, item, &scene); - QCOMPARE(item->customEventsReceived, TotalCustomEventsCount); + QTRY_COMPARE(item->customEventsReceived, TotalCustomEventsCount); QCOMPARE(item->gestureEventsReceived, TotalGestureEventsCount); QCOMPARE(item->gestureOverrideEventsReceived, 0); @@ -941,8 +949,8 @@ void tst_Gestures::graphicsView() item->grabGesture(CustomGesture::GestureType); sendCustomGesture(&event, item, &newScene); + QTRY_COMPARE(item->gestureEventsReceived, TotalGestureEventsCount); QCOMPARE(item->customEventsReceived, TotalCustomEventsCount); - QCOMPARE(item->gestureEventsReceived, TotalGestureEventsCount); QCOMPARE(item->gestureOverrideEventsReceived, 0); } @@ -951,6 +959,7 @@ void tst_Gestures::graphicsItemTreeGesture() QGraphicsScene scene; QGraphicsView view(&scene); view.setWindowFlags(Qt::X11BypassWindowManagerHint); + view.move(m_availableTopLeft); GestureItem *item1 = new GestureItem("item1"); item1->setPos(100, 100); @@ -981,12 +990,12 @@ void tst_Gestures::graphicsItemTreeGesture() item1->ignoredGestures << CustomGesture::GestureType; sendCustomGesture(&event, item1_child1, &scene); + QTRY_COMPARE(item1->gestureEventsReceived, TotalGestureEventsCount); QCOMPARE(item1_child1->gestureOverrideEventsReceived, 0); QCOMPARE(item1_child1->gestureEventsReceived, 0); QCOMPARE(item1_child2->gestureEventsReceived, 0); QCOMPARE(item1_child2->gestureOverrideEventsReceived, 0); QCOMPARE(item1->gestureOverrideEventsReceived, 0); - QCOMPARE(item1->gestureEventsReceived, TotalGestureEventsCount); item1->reset(); item1_child1->reset(); item1_child2->reset(); @@ -995,7 +1004,7 @@ void tst_Gestures::graphicsItemTreeGesture() item1->ignoredGestures << CustomGesture::GestureType; item1_child1->ignoredGestures << CustomGesture::GestureType; sendCustomGesture(&event, item1_child1, &scene); - QCOMPARE(item1_child1->gestureOverrideEventsReceived, 1); + QTRY_COMPARE(item1_child1->gestureOverrideEventsReceived, 1); QCOMPARE(item1_child1->gestureEventsReceived, TotalGestureEventsCount); QCOMPARE(item1_child2->gestureEventsReceived, 0); QCOMPARE(item1_child2->gestureOverrideEventsReceived, 0); @@ -1008,6 +1017,7 @@ void tst_Gestures::explicitGraphicsObjectTarget() QGraphicsScene scene; QGraphicsView view(&scene); view.setWindowFlags(Qt::X11BypassWindowManagerHint); + view.move(m_availableTopLeft); GestureItem *item1 = new GestureItem("item1"); scene.addItem(item1); @@ -1041,9 +1051,9 @@ void tst_Gestures::explicitGraphicsObjectTarget() sendCustomGesture(&event, item1, &scene); - QCOMPARE(item1->gestureEventsReceived, 0); + QTRY_COMPARE(item2_child1->gestureEventsReceived, TotalGestureEventsCount); QCOMPARE(item1->gestureOverrideEventsReceived, 1); - QCOMPARE(item2_child1->gestureEventsReceived, TotalGestureEventsCount); + QCOMPARE(item1->gestureEventsReceived, 0); QCOMPARE(item2_child1->gestureOverrideEventsReceived, 1); QCOMPARE(item2_child1->events.all.size(), TotalGestureEventsCount); for(int i = 0; i < item2_child1->events.all.size(); ++i) @@ -1084,7 +1094,7 @@ void tst_Gestures::gestureOverChildGraphicsItem() item2_child1->setPos(0, 0); view.show(); - QVERIFY(QTest::qWaitForWindowExposed(&view)); + QTRY_VERIFY(QTest::qWaitForWindowExposed(&view)); view.ensureVisible(scene.sceneRect()); item1->grabGesture(CustomGesture::GestureType); @@ -1097,7 +1107,7 @@ void tst_Gestures::gestureOverChildGraphicsItem() event.hasHotSpot = true; sendCustomGesture(&event, item0, &scene); - QCOMPARE(item0->customEventsReceived, TotalCustomEventsCount); + QTRY_COMPARE(item0->customEventsReceived, TotalCustomEventsCount); QCOMPARE(item2_child1->gestureEventsReceived, 0); QCOMPARE(item2_child1->gestureOverrideEventsReceived, 0); QCOMPARE(item2->gestureEventsReceived, 0); @@ -1113,11 +1123,11 @@ void tst_Gestures::gestureOverChildGraphicsItem() event.hasHotSpot = true; sendCustomGesture(&event, item0, &scene); - QCOMPARE(item2_child1->gestureEventsReceived, 0); - QCOMPARE(item2_child1->gestureOverrideEventsReceived, 0); + QTRY_COMPARE(item1->gestureEventsReceived, TotalGestureEventsCount); QCOMPARE(item2->gestureEventsReceived, 1); QCOMPARE(item2->gestureOverrideEventsReceived, 1); - QCOMPARE(item1->gestureEventsReceived, TotalGestureEventsCount); + QCOMPARE(item2_child1->gestureEventsReceived, 0); + QCOMPARE(item2_child1->gestureOverrideEventsReceived, 0); QCOMPARE(item1->gestureOverrideEventsReceived, 1); item0->reset(); item1->reset(); item2->reset(); item2_child1->reset(); @@ -1129,9 +1139,9 @@ void tst_Gestures::gestureOverChildGraphicsItem() event.hasHotSpot = true; sendCustomGesture(&event, item0, &scene); + QTRY_COMPARE(item2->gestureEventsReceived, TotalGestureEventsCount); QCOMPARE(item2_child1->gestureEventsReceived, 0); QCOMPARE(item2_child1->gestureOverrideEventsReceived, 0); - QCOMPARE(item2->gestureEventsReceived, TotalGestureEventsCount); QCOMPARE(item2->gestureOverrideEventsReceived, 1); QCOMPARE(item1->gestureEventsReceived, 1); QCOMPARE(item1->gestureOverrideEventsReceived, 1); @@ -1146,9 +1156,9 @@ void tst_Gestures::gestureOverChildGraphicsItem() event.hasHotSpot = true; sendCustomGesture(&event, item0, &scene); + QTRY_COMPARE(item2->gestureEventsReceived, TotalGestureEventsCount); QCOMPARE(item2_child1->gestureEventsReceived, 0); QCOMPARE(item2_child1->gestureOverrideEventsReceived, 0); - QCOMPARE(item2->gestureEventsReceived, TotalGestureEventsCount); QCOMPARE(item2->gestureOverrideEventsReceived, 1); QCOMPARE(item1->gestureEventsReceived, TotalGestureEventsCount); QCOMPARE(item1->gestureOverrideEventsReceived, 1); @@ -1162,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); @@ -1176,20 +1189,18 @@ void tst_Gestures::twoGesturesOnDifferentLevel() static const int TotalGestureEventsCount = CustomGesture::SerialFinishedThreshold - CustomGesture::SerialStartedThreshold + 1; static const int TotalCustomEventsCount = CustomGesture::SerialFinishedThreshold - CustomGesture::SerialMaybeThreshold + 1; - QCOMPARE(child->customEventsReceived, TotalCustomEventsCount); + QTRY_COMPARE(child->customEventsReceived, TotalCustomEventsCount); QCOMPARE(child->gestureEventsReceived, TotalGestureEventsCount); QCOMPARE(child->gestureOverrideEventsReceived, 0); QCOMPARE(child->events.all.size(), TotalGestureEventsCount); for(int i = 0; i < child->events.all.size(); ++i) QCOMPARE(child->events.all.at(i), SecondGesture); + QCOMPARE(parent.events.all.size(), TotalGestureEventsCount); QCOMPARE(parent.gestureEventsReceived, TotalGestureEventsCount); QCOMPARE(parent.gestureOverrideEventsReceived, 0); - QCOMPARE(parent.events.all.size(), TotalGestureEventsCount); 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() @@ -1203,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] @@ -1227,7 +1242,7 @@ void tst_Gestures::multipleGesturesInTree() static const int TotalGestureEventsCount = CustomGesture::SerialFinishedThreshold - CustomGesture::SerialStartedThreshold + 1; // gesture override events - QCOMPARE(D->overrideEvents.all.count(FirstGesture), 1); + QTRY_COMPARE(D->overrideEvents.all.count(FirstGesture), 1); QCOMPARE(D->overrideEvents.all.count(SecondGesture), 0); QCOMPARE(D->overrideEvents.all.count(ThirdGesture), 1); @@ -1259,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() @@ -1279,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] @@ -1308,7 +1328,7 @@ void tst_Gestures::multipleGesturesInComplexTree() static const int TotalGestureEventsCount = CustomGesture::SerialFinishedThreshold - CustomGesture::SerialStartedThreshold + 1; // gesture override events - QCOMPARE(D->overrideEvents.all.count(FirstGesture), 1); + QTRY_COMPARE(D->overrideEvents.all.count(FirstGesture), 1); QCOMPARE(D->overrideEvents.all.count(SecondGesture), 0); QCOMPARE(D->overrideEvents.all.count(ThirdGesture), 1); @@ -1356,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() @@ -1425,13 +1438,13 @@ void tst_Gestures::ungrabGesture() // a method on QWidget // sending an event will cause the QGesture objects to be instantiated for the widgets sendCustomGesture(&event, b); - QCOMPARE(a->gestures.count(), 1); + QTRY_COMPARE(a->gestures.size(), 1); QPointer<QGesture> customGestureA; customGestureA = *(a->gestures.begin()); QVERIFY(!customGestureA.isNull()); QCOMPARE(customGestureA->gestureType(), CustomGesture::GestureType); - QCOMPARE(b->gestures.count(), 1); + QCOMPARE(b->gestures.size(), 1); QPointer<QGesture> customGestureB; customGestureB = *(b->gestures.begin()); QVERIFY(!customGestureB.isNull()); @@ -1442,7 +1455,7 @@ void tst_Gestures::ungrabGesture() // a method on QWidget // sending an event will cause the QGesture objects to be instantiated for the widget sendCustomGesture(&event, a); - QCOMPARE(a->gestures.count(), 1); + QTRY_COMPARE(a->gestures.size(), 1); customGestureA = *(a->gestures.begin()); QVERIFY(!customGestureA.isNull()); QCOMPARE(customGestureA->gestureType(), CustomGesture::GestureType); @@ -1450,7 +1463,7 @@ void tst_Gestures::ungrabGesture() // a method on QWidget a->ungrabGesture(CustomGesture::GestureType); //We changed the deletion of Gestures to lazy during QT-4022, so we can't ensure the QGesture is deleted until now - QVERIFY(!customGestureB.isNull()); + QTRY_VERIFY(!customGestureB.isNull()); a->gestures.clear(); a->reset(); @@ -1487,7 +1500,7 @@ void tst_Gestures::autoCancelGestures() { if (event->type() == QEvent::Gesture) { QGestureEvent *ge = static_cast<QGestureEvent*>(event); - if (ge->gestures().count() != 1) + if (ge->gestures().size() != 1) ++badGestureEvents; // event should contain exactly one gesture ge->gestures().first()->setGestureCancelPolicy(QGesture::CancelAllInContext); } @@ -1498,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); @@ -1520,15 +1536,15 @@ void tst_Gestures::autoCancelGestures() CustomEvent event; event.serial = CustomGesture::SerialStartedThreshold; QApplication::sendEvent(child, &event); - QCOMPARE(child->events.all.count(), 2); - QCOMPARE(child->events.started.count(), 1); - QCOMPARE(child->events.canceled.count(), 1); - QCOMPARE(parent.events.all.count(), 1); + QCOMPARE(child->events.all.size(), 2); + QCOMPARE(child->events.started.size(), 1); + QCOMPARE(child->events.canceled.size(), 1); + QCOMPARE(parent.events.all.size(), 1); // clean up, make the parent gesture finish event.serial = CustomGesture::SerialFinishedThreshold; QApplication::sendEvent(child, &event); - QCOMPARE(parent.events.all.count(), 2); + QCOMPARE(parent.events.all.size(), 2); QCOMPARE(parent.badGestureEvents, 0); } @@ -1542,7 +1558,7 @@ void tst_Gestures::autoCancelGestures2() { if (event->type() == QEvent::Gesture) { QGestureEvent *ge = static_cast<QGestureEvent*>(event); - if (ge->gestures().count() != 1) + if (ge->gestures().size() != 1) ++badGestureEvents; // event should contain exactly one gesture ge->gestures().first()->setGestureCancelPolicy(QGesture::CancelAllInContext); } @@ -1553,10 +1569,14 @@ void tst_Gestures::autoCancelGestures2() }; const Qt::GestureType secondGesture = QGestureRecognizer ::registerRecognizer(new CustomGestureRecognizer); + auto unregisterRecognizer = qScopeGuard([secondGesture]{ + QGestureRecognizer::unregisterRecognizer(secondGesture); + }); QGraphicsScene scene; QGraphicsView view(&scene); view.setWindowFlags(Qt::X11BypassWindowManagerHint); + view.move(m_availableTopLeft); MockItem *parent = new MockItem("parent"); GestureItem *child = new GestureItem("child"); @@ -1576,15 +1596,15 @@ void tst_Gestures::autoCancelGestures2() event.hasHotSpot = true; event.hotSpot = mapToGlobal(QPointF(5, 5), child, &view); scene.sendEvent(child, &event); - QCOMPARE(parent->events.all.count(), 1); - QCOMPARE(child->events.started.count(), 1); - QCOMPARE(child->events.canceled.count(), 1); - QCOMPARE(child->events.all.count(), 2); + QCOMPARE(parent->events.all.size(), 1); + QCOMPARE(child->events.started.size(), 1); + QCOMPARE(child->events.canceled.size(), 1); + QCOMPARE(child->events.all.size(), 2); // clean up, make the parent gesture finish event.serial = CustomGesture::SerialFinishedThreshold; scene.sendEvent(child, &event); - QCOMPARE(parent->events.all.count(), 2); + QCOMPARE(parent->events.all.size(), 2); QCOMPARE(parent->badGestureEvents, 0); } @@ -1593,6 +1613,7 @@ void tst_Gestures::graphicsViewParentPropagation() QGraphicsScene scene; QGraphicsView view(&scene); view.setWindowFlags(Qt::X11BypassWindowManagerHint); + view.move(m_availableTopLeft); GestureItem *item0 = new GestureItem("item0"); scene.addItem(item0); @@ -1638,7 +1659,7 @@ void tst_Gestures::graphicsViewParentPropagation() event.hasHotSpot = true; sendCustomGesture(&event, item0, &scene); - QCOMPARE(item1_c1_c1->gestureEventsReceived, TotalGestureEventsCount); + QTRY_COMPARE(item1_c1_c1->gestureEventsReceived, TotalGestureEventsCount); QCOMPARE(item1_c1_c1->gestureOverrideEventsReceived, 1); QCOMPARE(item1_c1->gestureEventsReceived, TotalGestureEventsCount-1); QCOMPARE(item1_c1->gestureOverrideEventsReceived, 1); @@ -1653,6 +1674,7 @@ void tst_Gestures::panelPropagation() QGraphicsScene scene; QGraphicsView view(&scene); view.setWindowFlags(Qt::X11BypassWindowManagerHint); + view.move(m_availableTopLeft); GestureItem *item0 = new GestureItem("item0"); scene.addItem(item0); @@ -1710,11 +1732,11 @@ void tst_Gestures::panelPropagation() event.hasHotSpot = true; sendCustomGesture(&event, item1, &scene); + QCOMPARE(item1->gestureEventsReceived, TotalGestureEventsCount); QCOMPARE(item1_child1_child1->gestureEventsReceived, 0); QCOMPARE(item1_child1_child1->gestureOverrideEventsReceived, 0); QCOMPARE(item1_child1->gestureEventsReceived, 0); QCOMPARE(item1_child1->gestureOverrideEventsReceived, 0); - QCOMPARE(item1->gestureEventsReceived, TotalGestureEventsCount); QCOMPARE(item1->gestureOverrideEventsReceived, 1); QCOMPARE(item0->gestureEventsReceived, 0); QCOMPARE(item0->gestureOverrideEventsReceived, 1); @@ -1764,7 +1786,7 @@ void tst_Gestures::panelPropagation() QCOMPARE(item1_child1_child1->gestureEventsReceived, 0); QCOMPARE(item1_child1_child1->gestureOverrideEventsReceived, 0); - QCOMPARE(item1_child1->gestureEventsReceived, TotalGestureEventsCount); + QTRY_COMPARE(item1_child1->gestureEventsReceived, TotalGestureEventsCount); QCOMPARE(item1_child1->gestureOverrideEventsReceived, 0); QCOMPARE(item1->gestureEventsReceived, 0); QCOMPARE(item1->gestureOverrideEventsReceived, 0); @@ -1777,6 +1799,7 @@ void tst_Gestures::panelStacksBehindParent() QGraphicsScene scene; QGraphicsView view(&scene); view.setWindowFlags(Qt::X11BypassWindowManagerHint); + view.move(m_availableTopLeft); GestureItem *item1 = new GestureItem("item1"); item1->grabGesture(CustomGesture::GestureType); @@ -1956,7 +1979,7 @@ void tst_Gestures::viewportCoordinates() event.hotSpot = mapToGlobal(item1->boundingRect().center(), item1, &view); event.hasHotSpot = true; sendCustomGesture(&event, item1, &scene); - QVERIFY(item1->gestureEventsReceived != 0); + QTRY_VERIFY(item1->gestureEventsReceived != 0); } void tst_Gestures::partialGesturePropagation() @@ -1964,6 +1987,7 @@ void tst_Gestures::partialGesturePropagation() QGraphicsScene scene; QGraphicsView view(&scene); view.setWindowFlags(Qt::X11BypassWindowManagerHint); + view.move(m_availableTopLeft); GestureItem *item1 = new GestureItem("item1"); item1->grabGesture(CustomGesture::GestureType); @@ -1998,13 +2022,14 @@ void tst_Gestures::partialGesturePropagation() static const int TotalGestureEventsCount = CustomGesture::SerialFinishedThreshold - CustomGesture::SerialStartedThreshold + 1; + QCOMPARE(item1->gestureEventsReceived, TotalGestureEventsCount); + QCOMPARE(item2->gestureEventsReceived, TotalGestureEventsCount-2); // except for started and finished + QCOMPARE(item1->gestureOverrideEventsReceived, 1); QCOMPARE(item2->gestureOverrideEventsReceived, 1); QCOMPARE(item3->gestureOverrideEventsReceived, 1); QCOMPARE(item4->gestureOverrideEventsReceived, 1); - QCOMPARE(item1->gestureEventsReceived, TotalGestureEventsCount); - QCOMPARE(item2->gestureEventsReceived, TotalGestureEventsCount-2); // except for started and finished QCOMPARE(item3->gestureEventsReceived, 0); QCOMPARE(item4->gestureEventsReceived, 0); } @@ -2054,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 @@ -2171,11 +2200,16 @@ 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); QGraphicsView *gv = new QGraphicsView(&mw); QGraphicsScene *scene = new QGraphicsScene; + mw.move(m_availableTopLeft); gv->setScene(scene); scene->setSceneRect(0,0,100,100); @@ -2278,8 +2312,8 @@ void tst_Gestures::conflictingGesturesInGraphicsView() event.hotSpot = mapToGlobal(item2->boundingRect().center(), item2, &view); event.hasHotSpot = true; sendCustomGesture(&event, item2, &scene); + QTRY_COMPARE(item2->gestureEventsReceived, TotalGestureEventsCount); QCOMPARE(item2->gestureOverrideEventsReceived, 1); - QCOMPARE(item2->gestureEventsReceived, TotalGestureEventsCount); QCOMPARE(item1->gestureOverrideEventsReceived, 1); QCOMPARE(item1->gestureEventsReceived, 0); @@ -2291,8 +2325,8 @@ void tst_Gestures::conflictingGesturesInGraphicsView() event.hotSpot = mapToGlobal(item2->boundingRect().center(), item2, &view); event.hasHotSpot = true; sendCustomGesture(&event, item2, &scene); - QCOMPARE(item2->gestureOverrideEventsReceived, 1); QCOMPARE(item2->gestureEventsReceived, TotalGestureEventsCount); + QCOMPARE(item2->gestureOverrideEventsReceived, 1); QCOMPARE(item1->gestureOverrideEventsReceived, 0); QCOMPARE(item1->gestureEventsReceived, 0); @@ -2304,11 +2338,11 @@ void tst_Gestures::conflictingGesturesInGraphicsView() event.hotSpot = mapToGlobal(item2->boundingRect().center(), item2, &view); event.hasHotSpot = true; sendCustomGesture(&event, item2, &scene); + QCOMPARE(item1->gestureEventsReceived, TotalGestureEventsCount); QCOMPARE(item2->gestureOverrideEventsReceived, 1); QCOMPARE(item2->gestureEventsReceived, 0); QCOMPARE(item1->gestureOverrideEventsReceived, 1); - QCOMPARE(item1->gestureEventsReceived, TotalGestureEventsCount); } class NoConsumeWidgetBug13501 :public QWidget diff --git a/tests/auto/other/lancelot/.gitignore b/tests/auto/other/lancelot/.gitignore deleted file mode 100644 index 0a70416d57..0000000000 --- a/tests/auto/other/lancelot/.gitignore +++ /dev/null @@ -1 +0,0 @@ -tst_lancelot diff --git a/tests/auto/other/lancelot/CMakeLists.txt b/tests/auto/other/lancelot/CMakeLists.txt deleted file mode 100644 index a4598ab65a..0000000000 --- a/tests/auto/other/lancelot/CMakeLists.txt +++ /dev/null @@ -1,84 +0,0 @@ -# Generated from lancelot.pro. - -##################################################################### -## tst_lancelot Test: -##################################################################### - -# Collect test data -file(GLOB_RECURSE test_data_glob - RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} - scripts/*) -list(APPEND test_data ${test_data_glob}) - -qt_internal_add_test(tst_lancelot - SOURCES - ../../../baselineserver/shared/baselineprotocol.cpp ../../../baselineserver/shared/baselineprotocol.h - ../../../baselineserver/shared/lookup3.cpp - ../../../baselineserver/shared/qbaselinetest.cpp ../../../baselineserver/shared/qbaselinetest.h - paintcommands.cpp paintcommands.h - tst_lancelot.cpp - DEFINES - QMAKESPEC=\\\"\\\" - INCLUDE_DIRECTORIES - ../../../baselineserver/shared - PUBLIC_LIBRARIES - Qt::Gui - Qt::GuiPrivate - Qt::Network - TESTDATA ${test_data} -) - -# Resources: -set(images_resource_files - "images/alpha.png" - "images/alpha2x2.png" - "images/bitmap.png" - "images/border.png" - "images/borderimage.png" - "images/dome_argb32.png" - "images/dome_indexed.png" - "images/dome_indexed_mask.png" - "images/dome_mono.png" - "images/dome_mono_128.png" - "images/dome_mono_palette.png" - "images/dome_rgb32.png" - "images/dot.png" - "images/face.png" - "images/gam030.png" - "images/gam045.png" - "images/gam056.png" - "images/gam100.png" - "images/gam200.png" - "images/image.png" - "images/mask.png" - "images/mask_100.png" - "images/masked.png" - "images/sign.png" - "images/solid.png" - "images/solid2x2.png" - "images/struct-image-01.jpg" - "images/struct-image-01.png" - "images/zebra.png" -) - -qt_internal_add_resource(tst_lancelot "images" - PREFIX - "/" - FILES - ${images_resource_files} -) - - -## Scopes: -##################################################################### - -qt_internal_extend_target(tst_lancelot CONDITION QT_FEATURE_opengl - PUBLIC_LIBRARIES - Qt::OpenGL -) - -#### Keys ignored in scope 4:.:../../../baselineserver/shared:../../../baselineserver/shared/qbaselinetest.pri:WIN32: -# MKSPEC = "$$replace(QMAKESPEC, \\\\, /)" - -#### Keys ignored in scope 5:.:../../../baselineserver/shared:../../../baselineserver/shared/qbaselinetest.pri:else: -# MKSPEC = "$$QMAKESPEC" diff --git a/tests/auto/other/lancelot/images.qrc b/tests/auto/other/lancelot/images.qrc deleted file mode 100644 index 060b52c85a..0000000000 --- a/tests/auto/other/lancelot/images.qrc +++ /dev/null @@ -1,34 +0,0 @@ -<!DOCTYPE RCC> -<RCC version="1.0"> -<qresource> - <file>images/alpha.png</file> - <file>images/border.png</file> - <file>images/borderimage.png</file> - <file>images/dome_argb32.png</file> - <file>images/dome_indexed.png</file> - <file>images/dome_mono_palette.png</file> - <file>images/dome_rgb32.png</file> - <file>images/face.png</file> - <file>images/gam045.png</file> - <file>images/gam100.png</file> - <file>images/image.png</file> - <file>images/masked.png</file> - <file>images/sign.png</file> - <file>images/struct-image-01.jpg</file> - <file>images/bitmap.png</file> - <file>images/dome_indexed_mask.png</file> - <file>images/dome_mono_128.png</file> - <file>images/dome_mono.png</file> - <file>images/dot.png</file> - <file>images/gam030.png</file> - <file>images/gam056.png</file> - <file>images/gam200.png</file> - <file>images/mask_100.png</file> - <file>images/mask.png</file> - <file>images/solid.png</file> - <file>images/struct-image-01.png</file> - <file>images/zebra.png</file> - <file>images/alpha2x2.png</file> - <file>images/solid2x2.png</file> -</qresource> -</RCC> diff --git a/tests/auto/other/lancelot/images/alpha.png b/tests/auto/other/lancelot/images/alpha.png Binary files differdeleted file mode 100644 index e465b2586d..0000000000 --- a/tests/auto/other/lancelot/images/alpha.png +++ /dev/null diff --git a/tests/auto/other/lancelot/images/alpha2x2.png b/tests/auto/other/lancelot/images/alpha2x2.png Binary files differdeleted file mode 100644 index 8e99feb4cc..0000000000 --- a/tests/auto/other/lancelot/images/alpha2x2.png +++ /dev/null diff --git a/tests/auto/other/lancelot/images/bitmap.png b/tests/auto/other/lancelot/images/bitmap.png Binary files differdeleted file mode 100644 index d21f8f51bb..0000000000 --- a/tests/auto/other/lancelot/images/bitmap.png +++ /dev/null diff --git a/tests/auto/other/lancelot/images/border.png b/tests/auto/other/lancelot/images/border.png Binary files differdeleted file mode 100644 index a3d2fed0a3..0000000000 --- a/tests/auto/other/lancelot/images/border.png +++ /dev/null diff --git a/tests/auto/other/lancelot/images/borderimage.png b/tests/auto/other/lancelot/images/borderimage.png Binary files differdeleted file mode 100644 index f7f6b66227..0000000000 --- a/tests/auto/other/lancelot/images/borderimage.png +++ /dev/null diff --git a/tests/auto/other/lancelot/images/dome_argb32.png b/tests/auto/other/lancelot/images/dome_argb32.png Binary files differdeleted file mode 100644 index e3ccba0c13..0000000000 --- a/tests/auto/other/lancelot/images/dome_argb32.png +++ /dev/null diff --git a/tests/auto/other/lancelot/images/dome_indexed.png b/tests/auto/other/lancelot/images/dome_indexed.png Binary files differdeleted file mode 100644 index beefcd514e..0000000000 --- a/tests/auto/other/lancelot/images/dome_indexed.png +++ /dev/null diff --git a/tests/auto/other/lancelot/images/dome_indexed_mask.png b/tests/auto/other/lancelot/images/dome_indexed_mask.png Binary files differdeleted file mode 100644 index a62f29f40e..0000000000 --- a/tests/auto/other/lancelot/images/dome_indexed_mask.png +++ /dev/null diff --git a/tests/auto/other/lancelot/images/dome_mono.png b/tests/auto/other/lancelot/images/dome_mono.png Binary files differdeleted file mode 100644 index 950c2a7494..0000000000 --- a/tests/auto/other/lancelot/images/dome_mono.png +++ /dev/null diff --git a/tests/auto/other/lancelot/images/dome_mono_128.png b/tests/auto/other/lancelot/images/dome_mono_128.png Binary files differdeleted file mode 100644 index 77e48aaab7..0000000000 --- a/tests/auto/other/lancelot/images/dome_mono_128.png +++ /dev/null diff --git a/tests/auto/other/lancelot/images/dome_mono_palette.png b/tests/auto/other/lancelot/images/dome_mono_palette.png Binary files differdeleted file mode 100644 index dca3f59245..0000000000 --- a/tests/auto/other/lancelot/images/dome_mono_palette.png +++ /dev/null diff --git a/tests/auto/other/lancelot/images/dome_rgb32.png b/tests/auto/other/lancelot/images/dome_rgb32.png Binary files differdeleted file mode 100644 index 27bc02a545..0000000000 --- a/tests/auto/other/lancelot/images/dome_rgb32.png +++ /dev/null diff --git a/tests/auto/other/lancelot/images/dot.png b/tests/auto/other/lancelot/images/dot.png Binary files differdeleted file mode 100644 index 17a7b6a0ba..0000000000 --- a/tests/auto/other/lancelot/images/dot.png +++ /dev/null diff --git a/tests/auto/other/lancelot/images/face.png b/tests/auto/other/lancelot/images/face.png Binary files differdeleted file mode 100644 index 4f6172d83b..0000000000 --- a/tests/auto/other/lancelot/images/face.png +++ /dev/null diff --git a/tests/auto/other/lancelot/images/gam030.png b/tests/auto/other/lancelot/images/gam030.png Binary files differdeleted file mode 100644 index 904c9721bd..0000000000 --- a/tests/auto/other/lancelot/images/gam030.png +++ /dev/null diff --git a/tests/auto/other/lancelot/images/gam045.png b/tests/auto/other/lancelot/images/gam045.png Binary files differdeleted file mode 100644 index b649a8a54f..0000000000 --- a/tests/auto/other/lancelot/images/gam045.png +++ /dev/null diff --git a/tests/auto/other/lancelot/images/gam056.png b/tests/auto/other/lancelot/images/gam056.png Binary files differdeleted file mode 100644 index e5f959dc96..0000000000 --- a/tests/auto/other/lancelot/images/gam056.png +++ /dev/null diff --git a/tests/auto/other/lancelot/images/gam100.png b/tests/auto/other/lancelot/images/gam100.png Binary files differdeleted file mode 100644 index 6c7ba5f1ed..0000000000 --- a/tests/auto/other/lancelot/images/gam100.png +++ /dev/null diff --git a/tests/auto/other/lancelot/images/gam200.png b/tests/auto/other/lancelot/images/gam200.png Binary files differdeleted file mode 100644 index daa20fcbc4..0000000000 --- a/tests/auto/other/lancelot/images/gam200.png +++ /dev/null diff --git a/tests/auto/other/lancelot/images/image.png b/tests/auto/other/lancelot/images/image.png Binary files differdeleted file mode 100644 index 85d486a790..0000000000 --- a/tests/auto/other/lancelot/images/image.png +++ /dev/null diff --git a/tests/auto/other/lancelot/images/mask.png b/tests/auto/other/lancelot/images/mask.png Binary files differdeleted file mode 100644 index c3f3b1b6ca..0000000000 --- a/tests/auto/other/lancelot/images/mask.png +++ /dev/null diff --git a/tests/auto/other/lancelot/images/mask_100.png b/tests/auto/other/lancelot/images/mask_100.png Binary files differdeleted file mode 100644 index fc950dc7ed..0000000000 --- a/tests/auto/other/lancelot/images/mask_100.png +++ /dev/null diff --git a/tests/auto/other/lancelot/images/masked.png b/tests/auto/other/lancelot/images/masked.png Binary files differdeleted file mode 100644 index 6debec534d..0000000000 --- a/tests/auto/other/lancelot/images/masked.png +++ /dev/null diff --git a/tests/auto/other/lancelot/images/sign.png b/tests/auto/other/lancelot/images/sign.png Binary files differdeleted file mode 100644 index 6aac7e150a..0000000000 --- a/tests/auto/other/lancelot/images/sign.png +++ /dev/null diff --git a/tests/auto/other/lancelot/images/solid.png b/tests/auto/other/lancelot/images/solid.png Binary files differdeleted file mode 100644 index 371e9c1aee..0000000000 --- a/tests/auto/other/lancelot/images/solid.png +++ /dev/null diff --git a/tests/auto/other/lancelot/images/solid2x2.png b/tests/auto/other/lancelot/images/solid2x2.png Binary files differdeleted file mode 100644 index f34562f964..0000000000 --- a/tests/auto/other/lancelot/images/solid2x2.png +++ /dev/null diff --git a/tests/auto/other/lancelot/images/struct-image-01.jpg b/tests/auto/other/lancelot/images/struct-image-01.jpg Binary files differdeleted file mode 100644 index a74e07223b..0000000000 --- a/tests/auto/other/lancelot/images/struct-image-01.jpg +++ /dev/null diff --git a/tests/auto/other/lancelot/images/struct-image-01.png b/tests/auto/other/lancelot/images/struct-image-01.png Binary files differdeleted file mode 100644 index 4ed08406dc..0000000000 --- a/tests/auto/other/lancelot/images/struct-image-01.png +++ /dev/null diff --git a/tests/auto/other/lancelot/images/zebra.png b/tests/auto/other/lancelot/images/zebra.png Binary files differdeleted file mode 100644 index ef35f20785..0000000000 --- a/tests/auto/other/lancelot/images/zebra.png +++ /dev/null diff --git a/tests/auto/other/lancelot/paintcommands.cpp b/tests/auto/other/lancelot/paintcommands.cpp deleted file mode 100644 index d8157f047f..0000000000 --- a/tests/auto/other/lancelot/paintcommands.cpp +++ /dev/null @@ -1,2781 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -#include "paintcommands.h" - -#include <qdir.h> -#include <qfile.h> -#include <qfileinfo.h> -#include <qpainter.h> -#include <qpainterpath.h> -#include <qbitmap.h> -#include <qtextstream.h> -#include <qtextlayout.h> -#include <qdebug.h> -#include <QStaticText> -#include <QTextDocument> -#include <private/qimage_p.h> - -#ifndef QT_NO_OPENGL -#include <QOpenGLFramebufferObjectFormat> -#include <QOpenGLContext> -#include <QOpenGLPaintDevice> -#endif - -/********************************************************************************* -** everything to populate static tables -**********************************************************************************/ -const char *PaintCommands::brushStyleTable[] = { - "NoBrush", - "SolidPattern", - "Dense1Pattern", - "Dense2Pattern", - "Dense3Pattern", - "Dense4Pattern", - "Dense5Pattern", - "Dense6Pattern", - "Dense7Pattern", - "HorPattern", - "VerPattern", - "CrossPattern", - "BDiagPattern", - "FDiagPattern", - "DiagCrossPattern", - "LinearGradientPattern" -}; - -const char *PaintCommands::penStyleTable[] = { - "NoPen", - "SolidLine", - "DashLine", - "DotLine", - "DashDotLine", - "DashDotDotLine" -}; - -const char *PaintCommands::fontWeightTable[] = { - "Light", - "Normal", - "DemiBold", - "Bold", - "Black" -}; - -const char *PaintCommands::fontHintingTable[] = { - "Default", - "None", - "Vertical", - "Full" -}; - -const char *PaintCommands::clipOperationTable[] = { - "NoClip", - "ReplaceClip", - "IntersectClip", - "UniteClip" -}; - -const char *PaintCommands::spreadMethodTable[] = { - "PadSpread", - "ReflectSpread", - "RepeatSpread" -}; - -const char *PaintCommands::coordinateMethodTable[] = { - "LogicalMode", - "StretchToDeviceMode", - "ObjectBoundingMode", - "ObjectMode" -}; - -const char *PaintCommands::sizeModeTable[] = { - "AbsoluteSize", - "RelativeSize" -}; - -const char *PaintCommands::compositionModeTable[] = { - "SourceOver", - "DestinationOver", - "Clear", - "Source", - "Destination", - "SourceIn", - "DestinationIn", - "SourceOut", - "DestinationOut", - "SourceAtop", - "DestinationAtop", - "Xor", - "Plus", - "Multiply", - "Screen", - "Overlay", - "Darken", - "Lighten", - "ColorDodge", - "ColorBurn", - "HardLight", - "SoftLight", - "Difference", - "Exclusion", - "SourceOrDestination", - "SourceAndDestination", - "SourceXorDestination", - "NotSourceAndNotDestination", - "NotSourceOrNotDestination", - "NotSourceXorDestination", - "NotSource", - "NotSourceAndDestination", - "SourceAndNotDestination" -}; - -const char *PaintCommands::imageFormatTable[] = { - "Invalid", - "Mono", - "MonoLSB", - "Indexed8", - "RGB32", - "ARGB32", - "ARGB32_Premultiplied", - "Format_RGB16", - "Format_ARGB8565_Premultiplied", - "Format_RGB666", - "Format_ARGB6666_Premultiplied", - "Format_RGB555", - "Format_ARGB8555_Premultiplied", - "Format_RGB888", - "Format_RGB444", - "Format_ARGB4444_Premultiplied", - "Format_RGBX8888", - "Format_RGBA8888", - "Format_RGBA8888_Premultiplied", - "Format_BGR30", - "Format_A2BGR30_Premultiplied", - "Format_RGB30", - "Format_A2RGB30_Premultiplied", - "Alpha8", - "Grayscale8", - "RGBx64", - "RGBA64", - "RGBA64_Premultiplied", -}; - -int PaintCommands::translateEnum(const char *table[], const QString &pattern, int limit) -{ - QByteArray p = pattern.toLatin1().toLower(); - for (int i=0; i<limit; ++i) - if (p == QByteArray::fromRawData(table[i], qstrlen(table[i])).toLower()) - return i; - return -1; -} - -QList<PaintCommands::PaintCommandInfos> PaintCommands::s_commandInfoTable = QList<PaintCommands::PaintCommandInfos>(); -QList<QPair<QString,QStringList> > PaintCommands::s_enumsTable = QList<QPair<QString,QStringList> >(); -QMultiHash<QString, int> PaintCommands::s_commandHash; - -#define DECL_PAINTCOMMAND(identifier, method, regexp, syntax, sample) \ - s_commandInfoTable << PaintCommandInfos(QLatin1String(identifier), &PaintCommands::method, QRegularExpression(regexp), \ - QLatin1String(syntax), QLatin1String(sample) ); - -#define DECL_PAINTCOMMANDSECTION(title) \ - s_commandInfoTable << PaintCommandInfos(QLatin1String(title)); - -#define ADD_ENUMLIST(listCaption, cStrArray) { \ - QStringList list; \ - for (int i=0; i<int(sizeof(cStrArray)/sizeof(char*)); i++) \ - list << cStrArray[i]; \ - s_enumsTable << qMakePair(QString(listCaption), list); \ - } - -void PaintCommands::staticInit() -{ - // check if already done - if (!s_commandInfoTable.isEmpty()) return; - - // populate the command list - DECL_PAINTCOMMANDSECTION("misc"); - DECL_PAINTCOMMAND("comment", command_comment, - "^\\s*#", - "# this is some comments", - "# place your comments here"); - DECL_PAINTCOMMAND("import", command_import, - "^import\\s+\"(.*)\"$", - "import <qrcFilename>", - "import \"myfile.qrc\""); - DECL_PAINTCOMMAND("begin_block", command_begin_block, - "^begin_block\\s+(\\w*)$", - "begin_block <blockName>", - "begin_block blockName"); - DECL_PAINTCOMMAND("end_block", command_end_block, - "^end_block\\s*(\\w*)$", - "end_block [blockName]", - "end_block blockName"); - DECL_PAINTCOMMAND("repeat_block", command_repeat_block, - "^repeat_block\\s+(\\w*)$", - "repeat_block <blockName>", - "repeat_block blockName"); - DECL_PAINTCOMMAND("textlayout_draw", command_textlayout_draw, - "^textlayout_draw\\s+\"(.*)\"\\s+([0-9.]*)$", - "textlayout_draw <text> <width>", - "textlayout_draw \"your text\" 1.0"); - DECL_PAINTCOMMAND("abort", command_abort, - "^abort$", - "abort", - "abort"); - DECL_PAINTCOMMAND("noop", command_noop, - "^$", - "-", - "\n"); - - DECL_PAINTCOMMANDSECTION("setters"); - DECL_PAINTCOMMAND("setBackgroundMode", command_setBgMode, - "^(setBackgroundMode|setBgMode)\\s+(\\w*)$", - "setBackgroundMode <OpaqueMode|TransparentMode>", - "setBackgroundMode TransparentMode"); - DECL_PAINTCOMMAND("setBackground", command_setBackground, - "^setBackground\\s+#?(\\w*)\\s*(\\w*)?$", - "setBackground <color> [brush style enum]", - "setBackground black SolidPattern"); - DECL_PAINTCOMMAND("setOpacity", command_setOpacity, - "^setOpacity\\s+(-?\\d*\\.?\\d*)$", - "setOpacity <opacity>\n - opacity is in [0,1]", - "setOpacity 1.0"); - DECL_PAINTCOMMAND("path_setFillRule", command_path_setFillRule, - "^path_setFillRule\\s+(\\w*)\\s+(\\w*)$", - "path_setFillRule <pathName> [Winding|OddEven]", - "path_setFillRule pathName Winding"); - DECL_PAINTCOMMAND("setBrush", command_setBrush, - "^setBrush\\s+(#?[\\w.:\\/]*)\\s*(\\w*)?$", - "setBrush <imageFileName>\nsetBrush noBrush\nsetBrush <color> <brush style enum>", - "setBrush white SolidPattern"); - DECL_PAINTCOMMAND("setBrushOrigin", command_setBrushOrigin, - "^setBrushOrigin\\s*(-?\\w*)\\s+(-?\\w*)$", - "setBrushOrigin <dx> <dy>", - "setBrushOrigin 0 0"); - DECL_PAINTCOMMAND("brushTranslate", command_brushTranslate, - "^brushTranslate\\s+(-?[\\w.]*)\\s+(-?[\\w.]*)$", - "brushTranslate <tx> <ty>", - "brushTranslate 0.0 0.0"); - DECL_PAINTCOMMAND("brushScale", command_brushScale, - "^brushScale\\s+(-?[\\w.]*)\\s+(-?[\\w.]*)$", - "brushScale <kx> <ky>", - "brushScale 0.0 0.0"); - DECL_PAINTCOMMAND("brushRotate", command_brushRotate, - "^brushRotate\\s+(-?[\\w.]*)$", - "brushRotate <angle>\n - angle in degrees", - "brushRotate 0.0"); - DECL_PAINTCOMMAND("brushShear", command_brushShear, - "^brushShear\\s+(-?[\\w.]*)\\s+(-?[\\w.]*)$", - "brushShear <sx> <sy>", - "brushShear 0.0 0.0"); - DECL_PAINTCOMMAND("setCompositionMode", command_setCompositionMode, - "^setCompositionMode\\s+([\\w_0-9]*)$", - "setCompositionMode <composition mode enum>", - "setCompositionMode SourceOver"); - DECL_PAINTCOMMAND("setFont", command_setFont, - "^setFont\\s+\"([\\w\\s]*)\"\\s*(\\w*)\\s*(\\w*)\\s*(\\w*)\\s*(\\w*)\\s*(\\w*)\\s*(\\w*)\\s*(\\w*)$", - "setFont <fontFace> [size] [font weight|font weight enum] [italic] [hinting enum] [underline] [strikeout] [overline]\n - font weight is an integer between 0 and 99", - "setFont \"times\" 12"); - DECL_PAINTCOMMAND("setPen", command_setPen, - "^setPen\\s+#?(\\w*)$", - "setPen <color>\nsetPen <pen style enum>\nsetPen brush", - "setPen black"); - DECL_PAINTCOMMAND("setPen", command_setPen2, - "^setPen\\s+(#?\\w*)\\s+([\\w.]+)\\s*(\\w*)\\s*(\\w*)\\s*(\\w*)$", - "setPen brush|<color> [width] [pen style enum] [FlatCap|SquareCap|RoundCap] [MiterJoin|BevelJoin|RoundJoin]", - "setPen black 1 FlatCap MiterJoin"); - DECL_PAINTCOMMAND("pen_setDashOffset", command_pen_setDashOffset, - "^pen_setDashOffset\\s+(-?[\\w.]+)$", - "pen_setDashOffset <offset>\n", - "pen_setDashOffset 1.0"); - DECL_PAINTCOMMAND("pen_setDashPattern", command_pen_setDashPattern, - "^pen_setDashPattern\\s+\\[([\\w\\s.]*)\\]$", - "pen_setDashPattern <[ <dash_1> <space_1> ... <dash_n> <space_n> ]>", - "pen_setDashPattern [ 2 1 4 1 3 3 ]"); - DECL_PAINTCOMMAND("pen_setCosmetic", command_pen_setCosmetic, - "^pen_setCosmetic\\s+(\\w*)$", - "pen_setCosmetic <true|false>", - "pen_setCosmetic true"); - DECL_PAINTCOMMAND("setRenderHint", command_setRenderHint, - "^setRenderHint\\s+([\\w_0-9]*)\\s*(\\w*)$", - "setRenderHint <Antialiasing|SmoothPixmapTransform> <true|false>", - "setRenderHint Antialiasing true"); - DECL_PAINTCOMMAND("clearRenderHint", command_clearRenderHint, - "^clearRenderHint$", - "clearRenderHint", - "clearRenderHint"); - - DECL_PAINTCOMMANDSECTION("gradients"); - DECL_PAINTCOMMAND("gradient_appendStop", command_gradient_appendStop, - "^gradient_appendStop\\s+([\\w.]*)\\s+#?(\\w*)$", - "gradient_appendStop <pos> <color>", - "gradient_appendStop 1.0 red"); - DECL_PAINTCOMMAND("gradient_clearStops", command_gradient_clearStops, - "^gradient_clearStops$", - "gradient_clearStops", - "gradient_clearStops"); - DECL_PAINTCOMMAND("gradient_setConical", command_gradient_setConical, - "^gradient_setConical\\s+([\\w.]*)\\s+([\\w.]*)\\s+([\\w.]*)$", - "gradient_setConical <cx> <cy> <angle>\n - angle in degrees", - "gradient_setConical 5.0 5.0 45.0"); - DECL_PAINTCOMMAND("gradient_setLinear", command_gradient_setLinear, - "^gradient_setLinear\\s+([\\w.]*)\\s+([\\w.]*)\\s+([\\w.]*)\\s+([\\w.]*)$", - "gradient_setLinear <x1> <y1> <x2> <y2>", - "gradient_setLinear 1.0 1.0 2.0 2.0"); - DECL_PAINTCOMMAND("gradient_setRadial", command_gradient_setRadial, - "^gradient_setRadial\\s+([\\w.]*)\\s+([\\w.]*)\\s+([\\w.]*)\\s?([\\w.]*)\\s?([\\w.]*)$", - "gradient_setRadial <cx> <cy> <rad> <fx> <fy>\n - C is the center\n - rad is the radius\n - F is the focal point", - "gradient_setRadial 1.0 1.0 45.0 2.0 2.0"); - DECL_PAINTCOMMAND("gradient_setRadialExtended", command_gradient_setRadialExtended, - "^gradient_setRadialExtended\\s+([\\w.]*)\\s+([\\w.]*)\\s+([\\w.]*)\\s?([\\w.]*)\\s?([\\w.]*)\\s?([\\w.]*)$", - "gradient_setRadialExtended <cx> <cy> <rad> <fx> <fy> <frad>\n - C is the center\n - rad is the center radius\n - F is the focal point\n - frad is the focal radius", - "gradient_setRadialExtended 1.0 1.0 45.0 2.0 2.0 45.0"); - DECL_PAINTCOMMAND("gradient_setLinearPen", command_gradient_setLinearPen, - "^gradient_setLinearPen\\s+([\\w.]*)\\s+([\\w.]*)\\s+([\\w.]*)\\s+([\\w.]*)$", - "gradient_setLinearPen <x1> <y1> <x2> <y2>", - "gradient_setLinearPen 1.0 1.0 2.0 2.0"); - DECL_PAINTCOMMAND("gradient_setSpread", command_gradient_setSpread, - "^gradient_setSpread\\s+(\\w*)$", - "gradient_setSpread <spread method enum>", - "gradient_setSpread PadSpread"); - DECL_PAINTCOMMAND("gradient_setCoordinateMode", command_gradient_setCoordinateMode, - "^gradient_setCoordinateMode\\s+(\\w*)$", - "gradient_setCoordinateMode <coordinate method enum>", - "gradient_setCoordinateMode ObjectBoundingMode"); - - DECL_PAINTCOMMANDSECTION("drawing ops"); - DECL_PAINTCOMMAND("drawPoint", command_drawPoint, - "^drawPoint\\s+(-?[\\w.]*)\\s+(-?[\\w.]*)$", - "drawPoint <x> <y>", - "drawPoint 10.0 10.0"); - DECL_PAINTCOMMAND("drawLine", command_drawLine, - "^drawLine\\s+(-?[\\w.]*)\\s+(-?[\\w.]*)\\s+(-?[\\w.]*)\\s+(-?[\\w.]*)$", - "drawLine <x1> <y1> <x2> <y2>", - "drawLine 10.0 10.0 20.0 20.0"); - DECL_PAINTCOMMAND("drawRect", command_drawRect, - "^drawRect\\s+(-?[\\w.]*)\\s+(-?[\\w.]*)\\s+(-?[\\w.]*)\\s+(-?[\\w.]*)$", - "drawRect <x> <y> <w> <h>", - "drawRect 10.0 10.0 20.0 20.0"); - DECL_PAINTCOMMAND("drawRoundRect", command_drawRoundRect, - "^drawRoundRect\\s+(-?\\w*)\\s+(-?\\w*)\\s+(-?\\w*)\\s+(-?\\w*)\\s*(-?\\w*)?\\s*(-?\\w*)?$", - "drawRoundRect <x> <y> <w> <h> [rx] [ry]", - "drawRoundRect 10 10 20 20 3 3"); - DECL_PAINTCOMMAND("drawRoundedRect", command_drawRoundedRect, - "^drawRoundedRect\\s+(-?[\\w.]*)\\s+(-?[\\w.]*)\\s+(-?[\\w.]*)\\s+(-?[\\w.]*)\\s+(-?[\\w.]*)\\s+(-?[\\w.]*)\\s*(\\w*)?$", - "drawRoundedRect <x> <y> <w> <h> <rx> <ry> [SizeMode enum]", - "drawRoundedRect 10 10 20 20 4 4 AbsoluteSize"); - DECL_PAINTCOMMAND("drawArc", command_drawArc, - "^drawArc\\s+(-?\\w*)\\s+(-?\\w*)\\s+(-?\\w*)\\s+(-?\\w*)\\s+(-?\\w*)\\s+(-?\\w*)$", - "drawArc <x> <y> <w> <h> <angleStart> <angleArc>\n - angles are expressed in 1/16th of degree", - "drawArc 10 10 20 20 0 5760"); - DECL_PAINTCOMMAND("drawChord", command_drawChord, - "^drawChord\\s+(-?\\w*)\\s+(-?\\w*)\\s+(-?\\w*)\\s+(-?\\w*)\\s+(-?\\w*)\\s+(-?\\w*)$", - "drawChord <x> <y> <w> <h> <angleStart> <angleArc>\n - angles are expressed in 1/16th of degree", - "drawChord 10 10 20 20 0 5760"); - DECL_PAINTCOMMAND("drawEllipse", command_drawEllipse, - "^drawEllipse\\s+(-?[\\w.]*)\\s+(-?[\\w.]*)\\s+(-?[\\w.]*)\\s+(-?[\\w.]*)$", - "drawEllipse <x> <y> <w> <h>", - "drawEllipse 10.0 10.0 20.0 20.0"); - DECL_PAINTCOMMAND("drawPath", command_drawPath, - "^drawPath\\s+(\\w*)$", - "drawPath <pathName>", - "drawPath mypath"); - DECL_PAINTCOMMAND("drawPie", command_drawPie, - "^drawPie\\s+(-?\\w*)\\s+(-?\\w*)\\s+(-?\\w*)\\s+(-?\\w*)\\s+(-?\\w*)\\s+(-?\\w*)$", - "drawPie <x> <y> <w> <h> <angleStart> <angleArc>\n - angles are expressed in 1/16th of degree", - "drawPie 10 10 20 20 0 5760"); - DECL_PAINTCOMMAND("drawPixmap", command_drawPixmap, - "^drawPixmap\\s+([\\w.:\\-/]*)" - "\\s+(-?[\\w.]*)\\s+(-?[\\w.]*)\\s*(-?[\\w.]*)?\\s*(-?[\\w.]*)?" // target rect - "\\s*(-?[\\w.]*)?\\s*(-?[\\w.]*)?\\s*(-?[\\w.]*)?\\s*(-?[\\w.]*)?$", // source rect - "drawPixmap <filename> <tx> <ty> <tw> <th> <sx> <sy> <sw> <sh>" - "\n- where t means target and s means source" - "\n- a width or height of -1 means maximum space", - "drawPixmap :/images/face.png 0 0 -1 -1 0 0 -1 -1"); - DECL_PAINTCOMMAND("drawImage", command_drawImage, - "^drawImage\\s+([\\w.:\\/]*)" - "\\s+(-?[\\w.]*)\\s+(-?[\\w.]*)\\s*(-?[\\w.]*)?\\s*(-?[\\w.]*)?" // target rect - "\\s*(-?[\\w.]*)?\\s*(-?[\\w.]*)?\\s*(-?[\\w.]*)?\\s*(-?[\\w.]*)?$", // source rect - "drawImage <filename> <tx> <ty> <tw> <th> <sx> <sy> <sw> <sh>" - "\n- where t means target and s means source" - "\n- a width or height of -1 means maximum space", - "drawImage :/images/face.png 0 0 -1 -1 0 0 -1 -1"); - DECL_PAINTCOMMAND("drawPolygon", command_drawPolygon, - "^drawPolygon\\s+\\[([\\w\\s\\-.]*)\\]\\s*(\\w*)$", - "drawPolygon <[ <x1> <y1> ... <xn> <yn> ]> <Winding|OddEven>", - "drawPolygon [ 1 4 6 8 5 3 ] Winding"); - DECL_PAINTCOMMAND("drawConvexPolygon", command_drawConvexPolygon, - "^drawConvexPolygon\\s+\\[([\\w\\s-.]*)\\]$", - "drawConvexPolygon <[ <x1> <y1> ... <xn> <yn> ]>", - "drawConvexPolygon [ 1 4 6 8 5 3 ]"); - DECL_PAINTCOMMAND("drawPolyline", command_drawPolyline, - "^drawPolyline\\s+\\[([\\w\\s]*)\\]$", - "drawPolyline <[ <x1> <y1> ... <xn> <yn> ]>", - "drawPolyline [ 1 4 6 8 5 3 ]"); - DECL_PAINTCOMMAND("drawText", command_drawText, - "^drawText\\s+(-?\\w*)\\s+(-?\\w*)\\s+\"(.*)\"$", - "drawText <x> <y> <text>", - "drawText 10 10 \"my text\""); - DECL_PAINTCOMMAND("drawStaticText", command_drawStaticText, - "^drawStaticText\\s+(-?\\w*)\\s+(-?\\w*)\\s+\"(.*)\"$", - "drawStaticText <x> <y> <text>", - "drawStaticText 10 10 \"my text\""); - DECL_PAINTCOMMAND("drawGlyphRun", command_drawGlyphRun, - "^drawGlyphRun\\s+(-?\\w*)\\s+(-?\\w*)\\s+\"(.*)\"$", - "drawGlyphRun <x> <y> <text> - Will create glyph run using QTextLayout and draw this", - "drawGlyphRun 10 10 \"my text\""); - DECL_PAINTCOMMAND("drawTextDocument", command_drawTextDocument, - "^drawTextDocument\\s+(-?\\w*)\\s+(-?\\w*)\\s+\"(.*)\"$", - "drawTextDocument <x> <y> <html>", - "drawTextDocument 10 10 \"html\""); - DECL_PAINTCOMMAND("drawTiledPixmap", command_drawTiledPixmap, - "^drawTiledPixmap\\s+([\\w.:\\/]*)" - "\\s+(-?\\w*)\\s+(-?\\w*)\\s*(-?\\w*)\\s*(-?\\w*)" - "\\s*(-?\\w*)\\s*(-?\\w*)$", - "drawTiledPixmap <tile image filename> <tx> <ty> <tx> <ty> <sx> <sy>" - "\n - where t means tile" - "\n - and s is an offset in the tile", - "drawTiledPixmap :/images/alpha.png "); - DECL_PAINTCOMMAND("fillRect", command_fillRect, - "^fillRect\\s+(-?\\w*)\\s+(-?\\w*)\\s+(-?\\w*)\\s+(-?\\w*)\\s*(\\w*)?$", - "fillRect <x> <y> <w> <h> [color]\n - Uses current brush if no color given", - "fillRect 10 10 20 20 blue"); - DECL_PAINTCOMMAND("fillRectF", command_fillRectF, - "^fillRectF\\s+(-?[.\\w]*)\\s+(-?[.\\w]*)\\s+(-?[.\\w]*)\\s+(-?[.\\w]*)\\s*(\\w*)?$", - "fillRectF <x> <y> <w> <h> [color]\n - Uses current brush if no color given", - "fillRectF 10.5 10.5 20.2 20.2 blue"); - - DECL_PAINTCOMMANDSECTION("painterPaths"); - DECL_PAINTCOMMAND("path_moveTo", command_path_moveTo, - "^path_moveTo\\s+([.\\w]*)\\s+(-?[.\\w]*)\\s+(-?[.\\w]*)$", - "path_moveTo <pathName> <x> <y>", - "path_moveTo mypath 1.0 1.0"); - DECL_PAINTCOMMAND("path_lineTo", command_path_lineTo, - "^path_lineTo\\s+([.\\w]*)\\s+(-?[.\\w]*)\\s+(-?[.\\w]*)$", - "path_lineTo <pathName> <x> <y>", - "path_lineTo mypath 1.0 1.0"); - DECL_PAINTCOMMAND("path_addEllipse", command_path_addEllipse, - "^path_addEllipse\\s+(\\w*)\\s+(-?[.\\w]*)\\s+(-?[.\\w]*)\\s+(-?[.\\w]*)\\s+(-?[.\\w]*)$", - "path_addEllipse <pathName> <x1> <y1> <x2> <y2>", - "path_addEllipse mypath 10.0 10.0 20.0 20.0"); - DECL_PAINTCOMMAND("path_addPolygon", command_path_addPolygon, - "^path_addPolygon\\s+(\\w*)\\s+\\[([\\w\\s]*)\\]\\s*(\\w*)$", - "path_addPolygon <pathName> <[ <x1> <y1> ... <xn> <yn> ]>", - "path_addPolygon mypath [ 1 4 6 8 5 3 ]"); - DECL_PAINTCOMMAND("path_addRect", command_path_addRect, - "^path_addRect\\s+(\\w*)\\s+(-?[.\\w]*)\\s+(-?[.\\w]*)\\s+(-?[.\\w]*)\\s+(-?[.\\w]*)$", - "path_addRect <pathName> <x1> <y1> <x2> <y2>", - "path_addRect mypath 10.0 10.0 20.0 20.0"); - DECL_PAINTCOMMAND("path_addText", command_path_addText, - "^path_addText\\s+(\\w*)\\s+(-?[.\\w]*)\\s+(-?[.\\w]*)\\s+\"(.*)\"$", - "path_addText <pathName> <x> <y> <text>", - "path_addText mypath 10.0 20.0 \"some text\""); - DECL_PAINTCOMMAND("path_arcTo", command_path_arcTo, - "^path_arcTo\\s+(\\w*)\\s+(-?[.\\w]*)\\s+(-?[.\\w]*)\\s+(-?[.\\w]*)\\s+(-?[.\\w]*)\\s+(-?[.\\w]*)\\s+(-?[.\\w]*)$", - "path_arcTo <pathName> <x> <y> <w> <h> <angleStart> <angleArc>\n - angles are expressed in degrees", - "path_arcTo mypath 0.0 0.0 10.0 10.0 0.0 360.0"); - DECL_PAINTCOMMAND("path_cubicTo", command_path_cubicTo, - "^path_cubicTo\\s+(\\w*)\\s+(-?[.\\w]*)\\s+(-?[.\\w]*)\\s+(-?[.\\w]*)\\s+(-?[.\\w]*)\\s+(-?[.\\w]*)\\s+(-?[.\\w]*)$", - "path_cubicTo <pathName> <x1> <y1> <x2> <y2> <x3> <y3>", - "path_cubicTo mypath 0.0 0.0 10.0 10.0 20.0 20.0"); - DECL_PAINTCOMMAND("path_closeSubpath", command_path_closeSubpath, - "^path_closeSubpath\\s+(\\w*)$", - "path_closeSubpath <pathName>", - "path_closeSubpath mypath"); - DECL_PAINTCOMMAND("path_createOutline", command_path_createOutline, - "^path_createOutline\\s+(\\w*)\\s+(\\w*)$", - "path_createOutline <pathName> <newName>", - "path_createOutline mypath myoutline"); - DECL_PAINTCOMMAND("path_debugPrint", command_path_debugPrint, - "^path_debugPrint\\s+(\\w*)$", - "path_debugPrint <pathName>", - "path_debugPrint mypath"); - - DECL_PAINTCOMMANDSECTION("regions"); - DECL_PAINTCOMMAND("region_addRect", command_region_addRect, - "^region_addRect\\s+(\\w*)\\s+(-?\\w*)\\s+(-?\\w*)\\s+(-?\\w*)\\s+(-?\\w*)$", - "region_addRect <regionName> <x1> <y1> <x2> <y2>", - "region_addRect myregion 0.0 0.0 10.0 10.0"); - DECL_PAINTCOMMAND("region_addEllipse", command_region_addEllipse, - "^region_addEllipse\\s+(\\w*)\\s+(-?\\w*)\\s+(-?\\w*)\\s+(-?\\w*)\\s+(-?\\w*)$", - "region_addEllipse <regionName> <x1> <y1> <x2> <y2>", - "region_addEllipse myregion 0.0 0.0 10.0 10.0"); - - DECL_PAINTCOMMANDSECTION("clipping"); - DECL_PAINTCOMMAND("region_getClipRegion", command_region_getClipRegion, - "^region_getClipRegion\\s+(\\w*)$", - "region_getClipRegion <regionName>", - "region_getClipRegion myregion"); - DECL_PAINTCOMMAND("setClipRegion", command_setClipRegion, - "^setClipRegion\\s+(\\w*)\\s*(\\w*)$", - "setClipRegion <regionName> <clip operation enum>", - "setClipRegion myregion ReplaceClip"); - DECL_PAINTCOMMAND("path_getClipPath", command_path_getClipPath, - "^path_getClipPath\\s+([\\w0-9]*)$", - "path_getClipPath <pathName>", - "path_getClipPath mypath"); - DECL_PAINTCOMMAND("setClipPath", command_setClipPath, - "^setClipPath\\s+(\\w*)\\s*(\\w*)$", - "setClipPath <pathName> <clip operation enum>", - "setClipPath mypath ReplaceClip"); - DECL_PAINTCOMMAND("setClipRect", command_setClipRect, - "^setClipRect\\s+(-?\\w*)\\s+(-?\\w*)\\s+(-?\\w*)\\s+(-?\\w*)\\s*(\\w*)$", - "setClipRect <x1> <y1> <x2> <y2> <clip operation enum>", - "setClipRect 0.0 0.0 10.0 10.0 ReplaceClip"); - DECL_PAINTCOMMAND("setClipping", command_setClipping, - "^setClipping\\s+(\\w*)$", - "setClipping <true|false>", - "setClipping true"); - - DECL_PAINTCOMMANDSECTION("surface"); - DECL_PAINTCOMMAND("surface_begin", command_surface_begin, - "^surface_begin\\s+(-?[\\w.]*)\\s+(-?[\\w.]*)\\s+(-?[\\w.]*)\\s+(-?[\\w.]*)$", - "surface_begin <x> <y> <w> <h>", - "surface_begin 0.0 0.0 10.0 10.0"); - DECL_PAINTCOMMAND("surface_end", command_surface_end, - "^surface_end$", - "surface_end", - "surface_end"); - - DECL_PAINTCOMMANDSECTION("painter states"); - DECL_PAINTCOMMAND("restore", command_restore, - "^restore$", - "restore", - "restore"); - DECL_PAINTCOMMAND("save", command_save, - "^save$", - "save", - "save"); - - DECL_PAINTCOMMANDSECTION("pixmaps'n'images"); - DECL_PAINTCOMMAND("pixmap_load", command_pixmap_load, - "^pixmap_load\\s+([\\w.:\\/]*)\\s*([\\w.:\\/]*)$", - "pixmap_load <image filename> <pixmapName>", - "pixmap_load :/images/face.png myPixmap"); - DECL_PAINTCOMMAND("pixmap_setMask", command_pixmap_setMask, - "^pixmap_setMask\\s+([\\w.:\\/]*)\\s+([\\w.:\\/]*)$", - "pixmap_setMask <pixmapName> <bitmap filename>", - "pixmap_setMask myPixmap :/images/bitmap.png"); - DECL_PAINTCOMMAND("bitmap_load", command_bitmap_load, - "^bitmap_load\\s+([\\w.:\\/]*)\\s*([\\w.:\\/]*)$", - "bitmap_load <bitmap filename> <bitmapName>\n - note that the image is stored as a pixmap", - "bitmap_load :/images/bitmap.png myBitmap"); - DECL_PAINTCOMMAND("pixmap_setDevicePixelRatio", command_pixmap_setDevicePixelRatio, - "^pixmap_setDevicePixelRatio\\s+([\\w.:\\/]*)\\s+([.0-9]*)$", - "pixmap_setDevicePixelRatio <pixmapName> <dpr>", - "pixmap_setDevicePixelRatio myPixmap 2.0"); - DECL_PAINTCOMMAND("image_convertToFormat", command_image_convertToFormat, - "^image_convertToFormat\\s+([\\w.:\\/]*)\\s+([\\w.:\\/]+)\\s+([\\w0-9_]*)$", - "image_convertToFormat <sourceImageName> <destImageName> <image format enum>", - "image_convertToFormat myImage myNewImage Indexed8"); - DECL_PAINTCOMMAND("image_load", command_image_load, - "^image_load\\s+([\\w.:\\/]*)\\s*([\\w.:\\/]*)$", - "image_load <filename> <imageName>", - "image_load :/images/face.png myImage"); - DECL_PAINTCOMMAND("image_setColor", command_image_setColor, - "^image_setColor\\s+([\\w.:\\/]*)\\s+([0-9]*)\\s+#([0-9]*)$", - "image_setColor <imageName> <index> <color>", - "image_setColor myImage 0 black"); - DECL_PAINTCOMMAND("image_setColorCount", command_image_setColorCount, - "^image_setColorCount\\s+([\\w.:\\/]*)\\s+([0-9]*)$", - "image_setColorCount <imageName> <nbColors>", - "image_setColorCount myImage 128"); - DECL_PAINTCOMMAND("image_setDevicePixelRatio", command_image_setDevicePixelRatio, - "^image_setDevicePixelRatio\\s+([\\w.:\\/]*)\\s+([.0-9]*)$", - "image_setDevicePixelRatio <imageName> <dpr>", - "image_setDevicePixelRatio myImage 2.0"); - - DECL_PAINTCOMMANDSECTION("transformations"); - DECL_PAINTCOMMAND("resetMatrix", command_resetMatrix, - "^resetMatrix$", - "resetMatrix", - "resetMatrix"); - DECL_PAINTCOMMAND("setMatrix", command_setMatrix, - "^setMatrix\\s+(-?[.\\w]*)\\s+(-?[.\\w]*)\\s+(-?[.\\w]*)\\s+(-?[.\\w]*)\\s+(-?[.\\w]*)\\s+(-?[.\\w]*)\\s+(-?[.\\w]*)\\s+(-?[.\\w]*)\\s+(-?[.\\w]*)$", - "setMatrix <m11> <m12> <m13> <m21> <m22> <m23> <m31> <m32> <m33>", - "setMatrix 1.0 0.0 0.0 0.0 1.0 0.0 0.0 0.0 1.0"); - DECL_PAINTCOMMAND("translate", command_translate, - "^translate\\s+(-?[\\w.]*)\\s+(-?[\\w.]*)$", - "translate <tx> <ty>", - "translate 10.0 10.0"); - DECL_PAINTCOMMAND("rotate", command_rotate, - "^rotate\\s+(-?[\\w.]*)$", - "rotate <angle>\n - with angle in degrees", - "rotate 30.0"); - DECL_PAINTCOMMAND("rotate_x", command_rotate_x, - "^rotate_x\\s+(-?[\\w.]*)$", - "rotate_x <angle>\n - with angle in degrees", - "rotate_x 30.0"); - DECL_PAINTCOMMAND("rotate_y", command_rotate_y, - "^rotate_y\\s+(-?[\\w.]*)$", - "rotate_y <angle>\n - with angle in degrees", - "rotate_y 30.0"); - DECL_PAINTCOMMAND("scale", command_scale, - "^scale\\s+(-?[\\w.]*)\\s+(-?[\\w.]*)$", - "scale <sx> <sy>", - "scale 2.0 1.0"); - DECL_PAINTCOMMAND("mapQuadToQuad", command_mapQuadToQuad, - "^mapQuadToQuad\\s+(-?[.\\w]*)\\s+(-?[.\\w]*)\\s+(-?[.\\w]*)\\s+(-?[.\\w]*)\\s+(-?[.\\w]*)\\s+(-?[.\\w]*)\\s+(-?[.\\w]*)\\s+(-?[.\\w]*)\\s+(-?[.\\w]*)\\s+(-?[.\\w]*)\\s+(-?[.\\w]*)\\s+(-?[.\\w]*)\\s+(-?[.\\w]*)\\s+(-?[.\\w]*)\\s+(-?[.\\w]*)\\s+(-?[.\\w]*)$", - "mapQuadToQuad <x1> <y1> <x2> <y2> <x3> <y3> <x4> <y4> <x5> <y5> <x6> <y6> <x7> <y7> <x8> <y8>" - "\n - where vertices 1 to 4 defines the source quad and 5 to 8 the destination quad", - "mapQuadToQuad 0.0 0.0 1.0 1.0 0.0 0.0 -1.0 -1.0"); - - // populate the command lookup hash - for (int i=0; i<s_commandInfoTable.size(); i++) { - // and pre-optimize the regexps. - s_commandInfoTable.at(i).regExp.optimize(); - if (s_commandInfoTable.at(i).isSectionHeader() || - s_commandInfoTable.at(i).identifier == QLatin1String("comment") || - s_commandInfoTable.at(i).identifier == QLatin1String("noop")) - continue; - s_commandHash.insert(s_commandInfoTable.at(i).identifier, i); - } - - // populate the enums list - ADD_ENUMLIST("brush styles", brushStyleTable); - ADD_ENUMLIST("pen styles", penStyleTable); - ADD_ENUMLIST("font weights", fontWeightTable); - ADD_ENUMLIST("font hintings", fontHintingTable); - ADD_ENUMLIST("clip operations", clipOperationTable); - ADD_ENUMLIST("spread methods", spreadMethodTable); - ADD_ENUMLIST("composition modes", compositionModeTable); - ADD_ENUMLIST("image formats", imageFormatTable); - ADD_ENUMLIST("coordinate modes", coordinateMethodTable); - ADD_ENUMLIST("size modes", sizeModeTable); -} - -#undef DECL_PAINTCOMMAND -#undef ADD_ENUMLIST -/********************************************************************************* -** utility -**********************************************************************************/ -template <typename T> T PaintCommands::image_load(const QString &filepath) -{ - T t(filepath); - - if (t.isNull()) - t = T(":images/" + filepath); - - if (t.isNull()) - t = T("images/" + filepath); - - if (t.isNull()) { - QFileInfo fi(filepath); - QDir dir = fi.absoluteDir(); - dir.cdUp(); - dir.cd("images"); - QString fileName = dir.absolutePath() + QLatin1Char('/') + fi.fileName(); - t = T(fileName); - if (t.isNull() && !fileName.endsWith(".png")) { - fileName.append(".png"); - t = T(fileName); - } - } - - return t; -} - -/********************************************************************************* -** setters -**********************************************************************************/ -void PaintCommands::insertAt(int commandIndex, const QStringList &newCommands) -{ - int index = 0; - int left = newCommands.size(); - while (left--) - m_commands.insert(++commandIndex, newCommands.at(index++)); -} - -/********************************************************************************* -** run -**********************************************************************************/ -void PaintCommands::runCommand(const QString &scriptLine) -{ - static QRegularExpression separators("\\s"); - if (scriptLine.isEmpty()) { - command_noop(QRegularExpressionMatch()); - return; - } - if (scriptLine.startsWith('#')) { - command_comment(QRegularExpressionMatch()); - return; - } - QString firstWord = scriptLine.section(separators, 0, 0); - QList<int> indices = s_commandHash.values(firstWord); - foreach(int idx, indices) { - PaintCommandInfos command = s_commandInfoTable.at(idx); - Q_ASSERT(command.regExp.isValid()); - QRegularExpressionMatch match = command.regExp.match(scriptLine); - if (match.hasMatch()) { - (this->*(command.paintMethod))(match); - return; - } - } - qWarning("ERROR: unknown command or argument syntax error in \"%s\"", qPrintable(scriptLine)); -} - -void PaintCommands::runCommands() -{ - staticInit(); - int width = m_painter->window().width(); - int height = m_painter->window().height(); - - if (width <= 0) - width = 800; - if (height <= 0) - height = 800; - - m_pathMap.clear(); - m_imageMap.clear(); - m_pixmapMap.clear(); - m_regionMap.clear(); - m_gradientStops.clear(); - m_blockMap.clear(); - - // paint background - if (m_checkers_background) { - QPixmap pm(20, 20); - pm.fill(Qt::white); - QPainter pt(&pm); - pt.fillRect(0, 0, 10, 10, QColor::fromRgba(0xffdfdfdf)); - pt.fillRect(10, 10, 10, 10, QColor::fromRgba(0xffdfdfdf)); - pt.end(); - m_painter->drawTiledPixmap(0, 0, width, height, pm); - } else { - m_painter->fillRect(0, 0, width, height, Qt::white); - } - - // run each command - m_abort = false; - for (int i=0; i<m_commands.size() && !m_abort; ++i) { - const QString &commandNow = m_commands.at(i); - m_currentCommand = commandNow; - m_currentCommandIndex = i; - runCommand(commandNow.trimmed()); - } -} - -/********************************************************************************* -** conversions -**********************************************************************************/ -int PaintCommands::convertToInt(const QString &str) -{ - return qRound(convertToDouble(str)); -} - -float PaintCommands::convertToFloat(const QString &str) -{ - return float(convertToDouble(str)); -} - -double PaintCommands::convertToDouble(const QString &str) -{ - static QRegularExpression re("cp([0-9])([xy])"); - if (str.toLower() == "width") { - if (m_painter->device()->devType() == Qt::Widget) - return m_painter->window().width(); - else - return 800; - } - if (str.toLower() == "height") { - if (m_painter->device()->devType() == Qt::Widget) - return m_painter->window().height(); - else - return 800; - } - QRegularExpressionMatch match = re.match(str); - if (match.hasMatch()) { - int index = match.captured(1).toInt(); - bool is_it_x = match.captured(2) == "x"; - if (index < 0 || index >= m_controlPoints.size()) { - qWarning("ERROR: control point index=%d is out of bounds", index); - return 0; - } - return is_it_x ? m_controlPoints.at(index).x() : m_controlPoints.at(index).y(); - } - return str.toDouble(); -} - -QColor PaintCommands::convertToColor(const QString &str) -{ - static QRegularExpression alphaColorRe("#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})"); - static QRegularExpression opaqueColorRe("#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})"); - - Q_ASSERT(alphaColorRe.isValid()); - Q_ASSERT(opaqueColorRe.isValid()); - - QRegularExpressionMatch alphaColor = alphaColorRe.match(str); - QRegularExpressionMatch opaqueColor = opaqueColorRe.match(str); - if (alphaColor.hasMatch()) { - return QColor(alphaColor.captured(2).toInt(0, 16), - alphaColor.captured(3).toInt(0, 16), - alphaColor.captured(4).toInt(0, 16), - alphaColor.captured(1).toInt(0, 16)); - } else if (opaqueColor.hasMatch()) { - return QColor(opaqueColor.captured(1).toInt(0, 16), - opaqueColor.captured(2).toInt(0, 16), - opaqueColor.captured(3).toInt(0, 16)); - } - return QColor(str); -} - -/********************************************************************************* -** command implementations -**********************************************************************************/ -void PaintCommands::command_comment(QRegularExpressionMatch) -{ - if (m_verboseMode) - printf(" -(lance) comment: %s\n", qPrintable(m_currentCommand)); -} - -/***************************************************************************************************/ -void PaintCommands::command_import(QRegularExpressionMatch re) -{ - QString importFile(re.captured(1)); - QFileInfo fi(m_filepath); - QDir dir = fi.absoluteDir(); - QFile *file = new QFile(dir.absolutePath() + QDir::separator() + importFile); - - if (importFile.isEmpty() || !file->exists()) { - dir.cdUp(); - dir.cd("data"); - dir.cd("qps"); - delete file; - file = new QFile(dir.absolutePath() + QDir::separator() + importFile); - } - - if (importFile.isEmpty() || !file->exists()) { - dir.cdUp(); - dir.cd("images"); - delete file; - file = new QFile(dir.absolutePath() + QDir::separator() + importFile); - } - - if (importFile.isEmpty() || !file->exists()) { - printf(" - importing non-existing file at line %d (%s)\n", m_currentCommandIndex, - qPrintable(file->fileName())); - delete file; - return; - } - - if (!file->open(QIODevice::ReadOnly)) { - printf(" - failed to read file: '%s'\n", qPrintable(file->fileName())); - delete file; - return; - } - if (m_verboseMode) - printf(" -(lance) importing file at line %d (%s)\n", m_currentCommandIndex, - qPrintable(fi.fileName())); - - QFileInfo fileinfo(*file); - m_commands[m_currentCommandIndex] = QLatin1String("# import file (") + fileinfo.fileName() - + QLatin1String(") start"); - QString rawContent = QString::fromUtf8(file->readAll()); - QStringList importedData = rawContent.split('\n', Qt::SkipEmptyParts); - importedData.append(QLatin1String("# import file (") + fileinfo.fileName() + QLatin1String(") end ---")); - insertAt(m_currentCommandIndex, importedData); - - if (m_verboseMode) { - printf(" -(lance) Command buffer now looks like:\n"); - for (int i = 0; i < m_commands.count(); ++i) - printf(" ---> {%s}\n", qPrintable(m_commands.at(i))); - } - delete file; -} - -/***************************************************************************************************/ -void PaintCommands::command_begin_block(QRegularExpressionMatch re) -{ - const QString &blockName = re.captured(1); - if (m_verboseMode) - printf(" -(lance) begin_block (%s)\n", qPrintable(blockName)); - if (m_blockMap.contains(blockName)) - qFatal("Two blocks named (%s)", qPrintable(blockName)); - - m_commands[m_currentCommandIndex] = QLatin1String("# begin block (") + blockName + QLatin1Char(')'); - QStringList newBlock; - int i = m_currentCommandIndex + 1; - for (; i < m_commands.count(); ++i) { - const QString &nextCmd = m_commands.at(i); - if (nextCmd.startsWith("end_block")) { - m_commands[i] = QLatin1String("# end block (") + blockName + QLatin1Char(')'); - break; - } - newBlock += nextCmd; - } - - if (m_verboseMode) - for (int j = 0; j < newBlock.count(); ++j) - printf(" %d: %s\n", j, qPrintable(newBlock.at(j))); - - if (i >= m_commands.count()) - printf(" - Warning! Block doesn't have an 'end_block' marker!\n"); - - m_blockMap.insert(blockName, newBlock); -} - -/***************************************************************************************************/ -void PaintCommands::command_end_block(QRegularExpressionMatch) -{ - printf(" - end_block should be consumed by begin_block command.\n"); - printf(" You will never see this if your block markers are in sync\n"); - printf(" (noop)\n"); -} - -/***************************************************************************************************/ -void PaintCommands::command_repeat_block(QRegularExpressionMatch re) -{ - QString blockName = re.captured(1); - if (m_verboseMode) - printf(" -(lance) repeating block (%s)\n", qPrintable(blockName)); - - QStringList block = m_blockMap.value(blockName); - if (block.isEmpty()) { - printf(" - repeated block (%s) is empty!\n", qPrintable(blockName)); - return; - } - - m_commands[m_currentCommandIndex] = QLatin1String("# repeated block (") + blockName + QLatin1Char(')'); - insertAt(m_currentCommandIndex, block); -} - -/***************************************************************************************************/ -void PaintCommands::command_drawLine(QRegularExpressionMatch re) -{ - QStringList caps = re.capturedTexts(); - double x1 = convertToDouble(caps.at(1)); - double y1 = convertToDouble(caps.at(2)); - double x2 = convertToDouble(caps.at(3)); - double y2 = convertToDouble(caps.at(4)); - - if (m_verboseMode) - printf(" -(lance) drawLine((%.2f, %.2f), (%.2f, %.2f))\n", x1, y1, x2, y2); - - m_painter->drawLine(QLineF(x1, y1, x2, y2)); -} - -/***************************************************************************************************/ -void PaintCommands::command_drawPath(QRegularExpressionMatch re) -{ - if (m_verboseMode) - printf(" -(lance) drawPath(name=%s)\n", qPrintable(re.captured(1))); - - QPainterPath &path = m_pathMap[re.captured(1)]; - m_painter->drawPath(path); -} - -/***************************************************************************************************/ -void PaintCommands::command_drawPixmap(QRegularExpressionMatch re) -{ - QPixmap pm; - pm = m_pixmapMap[re.captured(1)]; // try cache first - if (pm.isNull()) - pm = image_load<QPixmap>(re.captured(1)); - if (pm.isNull()) { - QFileInfo fi(m_filepath); - QDir dir = fi.absoluteDir(); - dir.cdUp(); - dir.cd("images"); - QString fileName = dir.absolutePath() + QLatin1Char('/') + re.captured(1); - pm = QPixmap(fileName); - if (pm.isNull() && !fileName.endsWith(".png")) { - fileName.append(".png"); - pm = QPixmap(fileName); - } - } - if (pm.isNull()) { - fprintf(stderr, "ERROR(drawPixmap): failed to load pixmap: '%s'\n", - qPrintable(re.captured(1))); - return; - } - - qreal tx = convertToFloat(re.captured(2)); - qreal ty = convertToFloat(re.captured(3)); - qreal tw = convertToFloat(re.captured(4)); - qreal th = convertToFloat(re.captured(5)); - - qreal sx = convertToFloat(re.captured(6)); - qreal sy = convertToFloat(re.captured(7)); - qreal sw = convertToFloat(re.captured(8)); - qreal sh = convertToFloat(re.captured(9)); - - if (tw == 0) tw = -1; - if (th == 0) th = -1; - if (sw == 0) sw = -1; - if (sh == 0) sh = -1; - - if (m_verboseMode) - printf(" -(lance) drawPixmap('%s' dim=(%d, %d), depth=%d, (%f, %f, %f, %f), (%f, %f, %f, %f)\n", - qPrintable(re.captured(1)), pm.width(), pm.height(), pm.depth(), - tx, ty, tw, th, sx, sy, sw, sh); - - if (!re.capturedLength(4)) // at most two coordinates specified - m_painter->drawPixmap(QPointF(tx, ty), pm); - else - m_painter->drawPixmap(QRectF(tx, ty, tw, th), pm, QRectF(sx, sy, sw, sh)); -} - -/***************************************************************************************************/ -void PaintCommands::command_drawImage(QRegularExpressionMatch re) -{ - QImage im; - im = m_imageMap[re.captured(1)]; // try cache first - if (im.isNull()) - im = image_load<QImage>(re.captured(1)); - - if (im.isNull()) { - QFileInfo fi(m_filepath); - QDir dir = fi.absoluteDir(); - dir.cdUp(); - dir.cd("images"); - QString fileName = dir.absolutePath() + QLatin1Char('/') + re.captured(1); - im = QImage(fileName); - if (im.isNull() && !fileName.endsWith(".png")) { - fileName.append(".png"); - im = QImage(fileName); - } - } - if (im.isNull()) { - fprintf(stderr, "ERROR(drawImage): failed to load image: '%s'\n", qPrintable(re.captured(1))); - return; - } - - qreal tx = convertToFloat(re.captured(2)); - qreal ty = convertToFloat(re.captured(3)); - qreal tw = convertToFloat(re.captured(4)); - qreal th = convertToFloat(re.captured(5)); - - qreal sx = convertToFloat(re.captured(6)); - qreal sy = convertToFloat(re.captured(7)); - qreal sw = convertToFloat(re.captured(8)); - qreal sh = convertToFloat(re.captured(9)); - - if (tw == 0) tw = -1; - if (th == 0) th = -1; - if (sw == 0) sw = -1; - if (sh == 0) sh = -1; - - if (m_verboseMode) - printf(" -(lance) drawImage('%s' dim=(%d, %d), (%f, %f, %f, %f), (%f, %f, %f, %f)\n", - qPrintable(re.captured(1)), im.width(), im.height(), tx, ty, tw, th, sx, sy, sw, sh); - - if (!re.capturedLength(4)) // at most two coordinates specified - m_painter->drawImage(QPointF(tx, ty), im); - else - m_painter->drawImage(QRectF(tx, ty, tw, th), im, QRectF(sx, sy, sw, sh)); -} - -/***************************************************************************************************/ -void PaintCommands::command_drawTiledPixmap(QRegularExpressionMatch re) -{ - QPixmap pm; - pm = m_pixmapMap[re.captured(1)]; // try cache first - if (pm.isNull()) - pm = image_load<QPixmap>(re.captured(1)); - if (pm.isNull()) { - QFileInfo fi(m_filepath); - QDir dir = fi.absoluteDir(); - dir.cdUp(); - dir.cd("images"); - QString fileName = dir.absolutePath() + QLatin1Char('/') + re.captured(1); - pm = QPixmap(fileName); - if (pm.isNull() && !fileName.endsWith(".png")) { - fileName.append(".png"); - pm = QPixmap(fileName); - } - } - if (pm.isNull()) { - fprintf(stderr, "ERROR(drawTiledPixmap): failed to load pixmap: '%s'\n", - qPrintable(re.captured(1))); - return; - } - - int tx = convertToInt(re.captured(2)); - int ty = convertToInt(re.captured(3)); - int tw = convertToInt(re.captured(4)); - int th = convertToInt(re.captured(5)); - - int sx = convertToInt(re.captured(6)); - int sy = convertToInt(re.captured(7)); - - if (tw == 0) tw = -1; - if (th == 0) th = -1; - - if (m_verboseMode) - printf(" -(lance) drawTiledPixmap('%s' dim=(%d, %d), (%d, %d, %d, %d), (%d, %d)\n", - qPrintable(re.captured(1)), pm.width(), pm.height(), tx, ty, tw, th, sx, sy); - - m_painter->drawTiledPixmap(tx, ty, tw, th, pm, sx, sy); -} - -/***************************************************************************************************/ -void PaintCommands::command_drawPoint(QRegularExpressionMatch re) -{ - QStringList caps = re.capturedTexts(); - float x = convertToFloat(caps.at(1)); - float y = convertToFloat(caps.at(2)); - - if (m_verboseMode) - printf(" -(lance) drawPoint(%.2f, %.2f)\n", x, y); - - m_painter->drawPoint(QPointF(x, y)); -} - -/***************************************************************************************************/ -void PaintCommands::command_drawPolygon(QRegularExpressionMatch re) -{ - static QRegularExpression separators("\\s"); - QStringList caps = re.capturedTexts(); - QString cap = caps.at(1); - QStringList numbers = cap.split(separators, Qt::SkipEmptyParts); - - QPolygonF array; - for (int i=0; i + 1<numbers.size(); i+=2) - array.append(QPointF(convertToDouble(numbers.at(i)), convertToDouble(numbers.at(i+1)))); - - if (m_verboseMode) - printf(" -(lance) drawPolygon(size=%zd)\n", size_t(array.size())); - - m_painter->drawPolygon(array, caps.at(2).toLower() == "winding" ? Qt::WindingFill : Qt::OddEvenFill); -} - -/***************************************************************************************************/ -void PaintCommands::command_drawPolyline(QRegularExpressionMatch re) -{ - static QRegularExpression separators("\\s"); - QStringList numbers = re.captured(1).split(separators, Qt::SkipEmptyParts); - - QPolygonF array; - for (int i=0; i + 1<numbers.size(); i+=2) - array.append(QPointF(numbers.at(i).toFloat(),numbers.at(i+1).toFloat())); - - if (m_verboseMode) - printf(" -(lance) drawPolyline(size=%zd)\n", size_t(array.size())); - - m_painter->drawPolyline(array.toPolygon()); -} - -/***************************************************************************************************/ -void PaintCommands::command_drawRect(QRegularExpressionMatch re) -{ - QStringList caps = re.capturedTexts(); - float x = convertToFloat(caps.at(1)); - float y = convertToFloat(caps.at(2)); - float w = convertToFloat(caps.at(3)); - float h = convertToFloat(caps.at(4)); - - if (m_verboseMode) - printf(" -(lance) drawRect(%.2f, %.2f, %.2f, %.2f)\n", x, y, w, h); - - m_painter->drawRect(QRectF(x, y, w, h)); -} - -/***************************************************************************************************/ -void PaintCommands::command_drawRoundedRect(QRegularExpressionMatch re) -{ - QStringList caps = re.capturedTexts(); - float x = convertToFloat(caps.at(1)); - float y = convertToFloat(caps.at(2)); - float w = convertToFloat(caps.at(3)); - float h = convertToFloat(caps.at(4)); - float xr = convertToFloat(caps.at(5)); - float yr = convertToFloat(caps.at(6)); - - int mode = translateEnum(sizeModeTable, caps.at(7), sizeof(sizeModeTable)/sizeof(char *)); - if (mode < 0) - mode = Qt::AbsoluteSize; - - if (m_verboseMode) - printf(" -(lance) drawRoundRect(%f, %f, %f, %f, %f, %f, %s)\n", x, y, w, h, xr, yr, mode ? "RelativeSize" : "AbsoluteSize"); - - m_painter->drawRoundedRect(QRectF(x, y, w, h), xr, yr, Qt::SizeMode(mode)); -} - -/***************************************************************************************************/ -void PaintCommands::command_drawRoundRect(QRegularExpressionMatch re) -{ - QStringList caps = re.capturedTexts(); - int x = convertToInt(caps.at(1)); - int y = convertToInt(caps.at(2)); - int w = convertToInt(caps.at(3)); - int h = convertToInt(caps.at(4)); - int xs = caps.at(5).isEmpty() ? 50 : convertToInt(caps.at(5)); - int ys = caps.at(6).isEmpty() ? 50 : convertToInt(caps.at(6)); - - if (m_verboseMode) - printf(" -(lance) drawRoundRect(%d, %d, %d, %d, [%d, %d])\n", x, y, w, h, xs, ys); - - QT_WARNING_PUSH - QT_WARNING_DISABLE_DEPRECATED - m_painter->drawRoundedRect(x, y, w, h, xs, ys, Qt::RelativeSize); - QT_WARNING_POP -} - -/***************************************************************************************************/ -void PaintCommands::command_drawEllipse(QRegularExpressionMatch re) -{ - QStringList caps = re.capturedTexts(); - float x = convertToFloat(caps.at(1)); - float y = convertToFloat(caps.at(2)); - float w = convertToFloat(caps.at(3)); - float h = convertToFloat(caps.at(4)); - - if (m_verboseMode) - printf(" -(lance) drawEllipse(%.2f, %.2f, %.2f, %.2f)\n", x, y, w, h); - - m_painter->drawEllipse(QRectF(x, y, w, h)); -} - -/***************************************************************************************************/ -void PaintCommands::command_drawPie(QRegularExpressionMatch re) -{ - QStringList caps = re.capturedTexts(); - int x = convertToInt(caps.at(1)); - int y = convertToInt(caps.at(2)); - int w = convertToInt(caps.at(3)); - int h = convertToInt(caps.at(4)); - int angle = convertToInt(caps.at(5)); - int sweep = convertToInt(caps.at(6)); - - if (m_verboseMode) - printf(" -(lance) drawPie(%d, %d, %d, %d, %d, %d)\n", x, y, w, h, angle, sweep); - - m_painter->drawPie(x, y, w, h, angle, sweep); -} - -/***************************************************************************************************/ -void PaintCommands::command_drawChord(QRegularExpressionMatch re) -{ - QStringList caps = re.capturedTexts(); - int x = convertToInt(caps.at(1)); - int y = convertToInt(caps.at(2)); - int w = convertToInt(caps.at(3)); - int h = convertToInt(caps.at(4)); - int angle = convertToInt(caps.at(5)); - int sweep = convertToInt(caps.at(6)); - - if (m_verboseMode) - printf(" -(lance) drawChord(%d, %d, %d, %d, %d, %d)\n", x, y, w, h, angle, sweep); - - m_painter->drawChord(x, y, w, h, angle, sweep); -} - -/***************************************************************************************************/ -void PaintCommands::command_drawArc(QRegularExpressionMatch re) -{ - QStringList caps = re.capturedTexts(); - int x = convertToInt(caps.at(1)); - int y = convertToInt(caps.at(2)); - int w = convertToInt(caps.at(3)); - int h = convertToInt(caps.at(4)); - int angle = convertToInt(caps.at(5)); - int sweep = convertToInt(caps.at(6)); - - if (m_verboseMode) - printf(" -(lance) drawArc(%d, %d, %d, %d, %d, %d)\n", x, y, w, h, angle, sweep); - - m_painter->drawArc(x, y, w, h, angle, sweep); -} - -/***************************************************************************************************/ -void PaintCommands::command_drawText(QRegularExpressionMatch re) -{ - if (!m_shouldDrawText) - return; - QStringList caps = re.capturedTexts(); - int x = convertToInt(caps.at(1)); - int y = convertToInt(caps.at(2)); - QString txt = caps.at(3); - - if (m_verboseMode) - printf(" -(lance) drawText(%d, %d, %s)\n", x, y, qPrintable(txt)); - - m_painter->drawText(x, y, txt); -} - -void PaintCommands::command_drawStaticText(QRegularExpressionMatch re) -{ - if (!m_shouldDrawText) - return; - QStringList caps = re.capturedTexts(); - int x = convertToInt(caps.at(1)); - int y = convertToInt(caps.at(2)); - QString txt = caps.at(3); - - if (m_verboseMode) - printf(" -(lance) drawStaticText(%d, %d, %s)\n", x, y, qPrintable(txt)); - - m_painter->drawStaticText(x, y, QStaticText(txt)); -} - -void PaintCommands::command_drawGlyphRun(QRegularExpressionMatch re) -{ - if (!m_shouldDrawText) - return; - QStringList caps = re.capturedTexts(); - int x = convertToInt(caps.at(1)); - int y = convertToInt(caps.at(2)); - QString txt = caps.at(3); - - if (m_verboseMode) - printf(" -(lance) drawGlyphRun(%d, %d, %s)\n", x, y, qPrintable(txt)); - - QTextLayout layout; - layout.setFont(m_painter->font()); - layout.setText(txt); - layout.beginLayout(); - qreal lineY = 0.0; - forever { - QTextLine line = layout.createLine(); - if (!line.isValid()) - break; - line.setPosition(QPointF(0.0, lineY)); - lineY += line.height(); - } - layout.endLayout(); - - QList<QGlyphRun> glyphRuns = layout.glyphRuns(); - - for (const QGlyphRun &glyphRun : glyphRuns) - m_painter->drawGlyphRun(QPointF(x, y), glyphRun); -} - -void PaintCommands::command_drawTextDocument(QRegularExpressionMatch re) -{ - if (!m_shouldDrawText) - return; - QStringList caps = re.capturedTexts(); - int x = convertToInt(caps.at(1)); - int y = convertToInt(caps.at(2)); - QString txt = caps.at(3); - - if (m_verboseMode) - printf(" -(lance) drawTextDocument(%d, %d, %s)\n", x, y, qPrintable(txt)); - - QTextDocument doc; - doc.setBaseUrl(QUrl::fromLocalFile(QDir::currentPath() + QLatin1String("/"))); - doc.setHtml(txt); - - m_painter->save(); - m_painter->translate(x, y); - doc.drawContents(m_painter); - m_painter->restore(); -} - -/***************************************************************************************************/ -void PaintCommands::command_fillRect(QRegularExpressionMatch re) -{ - QStringList caps = re.capturedTexts(); - int x = convertToInt(caps.at(1)); - int y = convertToInt(caps.at(2)); - int w = convertToInt(caps.at(3)); - int h = convertToInt(caps.at(4)); - - if (!caps.at(5).isEmpty()) { - QColor color = convertToColor(caps.at(5)); - if (m_verboseMode) - printf(" -(lance) fillRect(%d, %d, %d, %d, %s)\n", x, y, w, h, qPrintable(color.name())); - m_painter->fillRect(x, y, w, h, color); - } else { - if (m_verboseMode) - printf(" -(lance) fillRect(%d, %d, %d, %d)\n", x, y, w, h); - m_painter->fillRect(x, y, w, h, m_painter->brush()); - } -} - -void PaintCommands::command_fillRectF(QRegularExpressionMatch re) -{ - QStringList caps = re.capturedTexts(); - double x = convertToDouble(caps.at(1)); - double y = convertToDouble(caps.at(2)); - double w = convertToDouble(caps.at(3)); - double h = convertToDouble(caps.at(4)); - - if (!caps.at(5).isEmpty()) { - QColor color = convertToColor(caps.at(5)); - if (m_verboseMode) - printf(" -(lance) fillRectF(%.2f, %.2f, %.2f, %.2f, %s)\n", x, y, w, h, qPrintable(color.name())); - m_painter->fillRect(QRectF(x, y, w, h), color); - } else { - if (m_verboseMode) - printf(" -(lance) fillRectF(%.2f, %.2f, %.2f, %.2f)\n", x, y, w, h); - m_painter->fillRect(QRectF(x, y, w, h), m_painter->brush()); - } -} - -/***************************************************************************************************/ -void PaintCommands::command_noop(QRegularExpressionMatch) -{ - if (m_verboseMode) - printf(" -(lance) noop: %s\n", qPrintable(m_currentCommand)); - - if (!m_currentCommand.trimmed().isEmpty()) { - fprintf(stderr, "unknown command: '%s'\n", qPrintable(m_currentCommand.trimmed())); - } -} - -/***************************************************************************************************/ -void PaintCommands::command_path_addText(QRegularExpressionMatch re) -{ - QStringList caps = re.capturedTexts(); - QString name = caps.at(1); - double x = convertToDouble(caps.at(2)); - double y = convertToDouble(caps.at(3)); - QString text = caps.at(4); - - if (m_verboseMode) - printf(" -(lance) path_addText(%s, %.2f, %.2f, text=%s\n", qPrintable(name), x, y, qPrintable(text)); - - m_pathMap[name].addText(x, y, m_painter->font(), text); -} - -/***************************************************************************************************/ -void PaintCommands::command_path_addEllipse(QRegularExpressionMatch re) -{ - QStringList caps = re.capturedTexts(); - QString name = caps.at(1); - double x = convertToDouble(caps.at(2)); - double y = convertToDouble(caps.at(3)); - double w = convertToDouble(caps.at(4)); - double h = convertToDouble(caps.at(5)); - - if (m_verboseMode) - printf(" -(lance) path_addEllipse(%s, %.2f, %.2f, %.2f, %.2f)\n", qPrintable(name), x, y, w, h); - - m_pathMap[name].addEllipse(x, y, w, h); -} - -/***************************************************************************************************/ -void PaintCommands::command_path_addRect(QRegularExpressionMatch re) -{ - QStringList caps = re.capturedTexts(); - QString name = caps.at(1); - double x = convertToDouble(caps.at(2)); - double y = convertToDouble(caps.at(3)); - double w = convertToDouble(caps.at(4)); - double h = convertToDouble(caps.at(5)); - - if (m_verboseMode) - printf(" -(lance) path_addRect(%s, %.2f, %.2f, %.2f, %.2f)\n", qPrintable(name), x, y, w, h); - - m_pathMap[name].addRect(x, y, w, h); -} - -/***************************************************************************************************/ -void PaintCommands::command_path_addPolygon(QRegularExpressionMatch re) -{ - static QRegularExpression separators("\\s"); - QStringList caps = re.capturedTexts(); - QString name = caps.at(1); - QString cap = caps.at(2); - QStringList numbers = cap.split(separators, Qt::SkipEmptyParts); - - QPolygonF array; - for (int i=0; i + 1<numbers.size(); i+=2) - array.append(QPointF(numbers.at(i).toFloat(),numbers.at(i+1).toFloat())); - - if (m_verboseMode) - printf(" -(lance) path_addPolygon(name=%s, size=%zd)\n", qPrintable(name), size_t(array.size())); - - m_pathMap[name].addPolygon(array); -} - -/***************************************************************************************************/ -void PaintCommands::command_path_arcTo(QRegularExpressionMatch re) -{ - QStringList caps = re.capturedTexts(); - QString name = caps.at(1); - double x = convertToDouble(caps.at(2)); - double y = convertToDouble(caps.at(3)); - double w = convertToDouble(caps.at(4)); - double h = convertToDouble(caps.at(5)); - double angle = convertToDouble(caps.at(6)); - double length = convertToDouble(caps.at(7)); - - if (m_verboseMode) - printf(" -(lance) path_arcTo(%s, %.2f, %.2f, %.2f, %.2f, angle=%.2f, len=%.2f)\n", qPrintable(name), x, y, w, h, angle, length); - - m_pathMap[name].arcTo(x, y, w, h, angle, length); -} - -/***************************************************************************************************/ -void PaintCommands::command_path_createOutline(QRegularExpressionMatch re) -{ - QStringList caps = re.capturedTexts(); - QString name = caps.at(1); - QString newName = caps.at(2); - QPen pen = m_painter->pen(); - - if (m_verboseMode) - printf(" -(lance) path_createOutline(%s, name=%s, width=%d)\n", - qPrintable(name), qPrintable(newName), pen.width()); - - if (!m_pathMap.contains(name)) { - fprintf(stderr, "createOutline(), unknown path: %s\n", qPrintable(name)); - return; - } - QPainterPathStroker stroker; - stroker.setWidth(pen.widthF()); - stroker.setDashPattern(pen.style()); - stroker.setCapStyle(pen.capStyle()); - stroker.setJoinStyle(pen.joinStyle()); - m_pathMap[newName] = stroker.createStroke(m_pathMap[name]); -} - -/***************************************************************************************************/ -void PaintCommands::command_path_cubicTo(QRegularExpressionMatch re) -{ - QStringList caps = re.capturedTexts(); - QString name = caps.at(1); - double x1 = convertToDouble(caps.at(2)); - double y1 = convertToDouble(caps.at(3)); - double x2 = convertToDouble(caps.at(4)); - double y2 = convertToDouble(caps.at(5)); - double x3 = convertToDouble(caps.at(6)); - double y3 = convertToDouble(caps.at(7)); - - if (m_verboseMode) - printf(" -(lance) path_cubicTo(%s, (%.2f, %.2f), (%.2f, %.2f), (%.2f, %.2f))\n", qPrintable(name), x1, y1, x2, y2, x3, y3); - - m_pathMap[name].cubicTo(x1, y1, x2, y2, x3, y3); -} - -/***************************************************************************************************/ -void PaintCommands::command_path_moveTo(QRegularExpressionMatch re) -{ - QStringList caps = re.capturedTexts(); - QString name = caps.at(1); - double x1 = convertToDouble(caps.at(2)); - double y1 = convertToDouble(caps.at(3)); - - if (m_verboseMode) - printf(" -(lance) path_moveTo(%s, (%.2f, %.2f))\n", qPrintable(name), x1, y1); - - m_pathMap[name].moveTo(x1, y1); -} - -/***************************************************************************************************/ -void PaintCommands::command_path_lineTo(QRegularExpressionMatch re) -{ - QStringList caps = re.capturedTexts(); - QString name = caps.at(1); - double x1 = convertToDouble(caps.at(2)); - double y1 = convertToDouble(caps.at(3)); - - if (m_verboseMode) - printf(" -(lance) path_lineTo(%s, (%.2f, %.2f))\n", qPrintable(name), x1, y1); - - m_pathMap[name].lineTo(x1, y1); -} - -/***************************************************************************************************/ -void PaintCommands::command_path_setFillRule(QRegularExpressionMatch re) -{ - QStringList caps = re.capturedTexts(); - QString name = caps.at(1); - bool winding = caps.at(2).toLower() == "winding"; - - if (m_verboseMode) - printf(" -(lance) path_setFillRule(name=%s, winding=%d)\n", qPrintable(name), winding); - - m_pathMap[name].setFillRule(winding ? Qt::WindingFill : Qt::OddEvenFill); -} - -/***************************************************************************************************/ -void PaintCommands::command_path_closeSubpath(QRegularExpressionMatch re) -{ - QStringList caps = re.capturedTexts(); - QString name = caps.at(1); - - if (m_verboseMode) - printf(" -(lance) path_closeSubpath(name=%s)\n", qPrintable(name)); - - m_pathMap[name].closeSubpath(); -} - -/***************************************************************************************************/ -void PaintCommands::command_path_getClipPath(QRegularExpressionMatch re) -{ - QStringList caps = re.capturedTexts(); - QString name = caps.at(1); - - if (m_verboseMode) - printf(" -(lance) path_closeSubpath(name=%s)\n", qPrintable(name)); - - m_pathMap[name] = m_painter->clipPath(); -} - -/***************************************************************************************************/ -static void qt_debug_path(const QPainterPath &path, const QString &name) -{ - const char *names[] = { - "MoveTo ", - "LineTo ", - "CurveTo ", - "CurveToData" - }; - - printf("\nQPainterPath (%s): elementCount=%d\n", qPrintable(name), path.elementCount()); - for (int i=0; i<path.elementCount(); ++i) { - const QPainterPath::Element &e = path.elementAt(i); - Q_ASSERT(e.type >= 0 && e.type <= QPainterPath::CurveToDataElement); - printf(" - %3d:: %s, (%.2f, %.2f)\n", i, names[e.type], e.x, e.y); - } -} - -/***************************************************************************************************/ -void PaintCommands::command_path_debugPrint(QRegularExpressionMatch re) -{ - QStringList caps = re.capturedTexts(); - QString name = caps.at(1); - qt_debug_path(m_pathMap[name], name); -} - -/***************************************************************************************************/ -void PaintCommands::command_region_addRect(QRegularExpressionMatch re) -{ - QStringList caps = re.capturedTexts(); - QString name = caps.at(1); - int x = convertToInt(caps.at(2)); - int y = convertToInt(caps.at(3)); - int w = convertToInt(caps.at(4)); - int h = convertToInt(caps.at(5)); - - if (m_verboseMode) - printf(" -(lance) region_addRect(%s, %d, %d, %d, %d)\n", qPrintable(name), x, y, w, h); - - m_regionMap[name] += QRect(x, y, w, h); -} - -/***************************************************************************************************/ -void PaintCommands::command_region_addEllipse(QRegularExpressionMatch re) -{ - QStringList caps = re.capturedTexts(); - QString name = caps.at(1); - int x = convertToInt(caps.at(2)); - int y = convertToInt(caps.at(3)); - int w = convertToInt(caps.at(4)); - int h = convertToInt(caps.at(5)); - - if (m_verboseMode) - printf(" -(lance) region_addEllipse(%s, %d, %d, %d, %d)\n", qPrintable(name), x, y, w, h); - - m_regionMap[name] += QRegion(x, y, w, h, QRegion::Ellipse); -} - -/***************************************************************************************************/ -void PaintCommands::command_region_getClipRegion(QRegularExpressionMatch re) -{ - QStringList caps = re.capturedTexts(); - QString name = caps.at(1); - QRegion region = m_painter->clipRegion(); - - if (m_verboseMode) - printf(" -(lance) region_getClipRegion(name=%s), bounds=[%d, %d, %d, %d]\n", qPrintable(name), - region.boundingRect().x(), - region.boundingRect().y(), - region.boundingRect().width(), - region.boundingRect().height()); - - m_regionMap[name] = region; -} - -/***************************************************************************************************/ -void PaintCommands::command_resetMatrix(QRegularExpressionMatch) -{ - if (m_verboseMode) - printf(" -(lance) resetMatrix()\n"); - - m_painter->resetTransform(); -} - -/***************************************************************************************************/ -void PaintCommands::command_restore(QRegularExpressionMatch) -{ - if (m_verboseMode) - printf(" -(lance) restore()\n"); - - m_painter->restore(); -} - -/***************************************************************************************************/ -void PaintCommands::command_rotate(QRegularExpressionMatch re) -{ - QStringList caps = re.capturedTexts(); - double angle = convertToDouble(caps.at(1)); - - if (m_verboseMode) - printf(" -(lance) rotate(%.2f)\n", angle); - - m_painter->rotate(angle); -} - -/***************************************************************************************************/ -void PaintCommands::command_rotate_x(QRegularExpressionMatch re) -{ - QStringList caps = re.capturedTexts(); - double angle = convertToDouble(caps.at(1)); - - if (m_verboseMode) - printf(" -(lance) rotate_x(%.2f)\n", angle); - - QTransform transform; - transform.rotate(angle, Qt::XAxis); - m_painter->setTransform(transform, true); -} - -/***************************************************************************************************/ -void PaintCommands::command_rotate_y(QRegularExpressionMatch re) -{ - QStringList caps = re.capturedTexts(); - double angle = convertToDouble(caps.at(1)); - - if (m_verboseMode) - printf(" -(lance) rotate_y(%.2f)\n", angle); - - QTransform transform; - transform.rotate(angle, Qt::YAxis); - m_painter->setTransform(transform, true); -} - -/***************************************************************************************************/ -void PaintCommands::command_save(QRegularExpressionMatch) -{ - if (m_verboseMode) - printf(" -(lance) save()\n"); - - m_painter->save(); -} - -/***************************************************************************************************/ -void PaintCommands::command_mapQuadToQuad(QRegularExpressionMatch re) -{ - QStringList caps = re.capturedTexts(); - double x1 = convertToDouble(caps.at(1)); - double y1 = convertToDouble(caps.at(2)); - double x2 = convertToDouble(caps.at(3)); - double y2 = convertToDouble(caps.at(4)); - double x3 = convertToDouble(caps.at(5)); - double y3 = convertToDouble(caps.at(6)); - double x4 = convertToDouble(caps.at(7)); - double y4 = convertToDouble(caps.at(8)); - QPolygonF poly1(4); - poly1[0] = QPointF(x1, y1); - poly1[1] = QPointF(x2, y2); - poly1[2] = QPointF(x3, y3); - poly1[3] = QPointF(x4, y4); - - double x5 = convertToDouble(caps.at(9)); - double y5 = convertToDouble(caps.at(10)); - double x6 = convertToDouble(caps.at(11)); - double y6 = convertToDouble(caps.at(12)); - double x7 = convertToDouble(caps.at(13)); - double y7 = convertToDouble(caps.at(14)); - double x8 = convertToDouble(caps.at(15)); - double y8 = convertToDouble(caps.at(16)); - QPolygonF poly2(4); - poly2[0] = QPointF(x5, y5); - poly2[1] = QPointF(x6, y6); - poly2[2] = QPointF(x7, y7); - poly2[3] = QPointF(x8, y8); - - if (m_verboseMode) - printf(" -(lance) mapQuadToQuad(%.2f, %.2f, %.2f, %.2f, %.2f, %.2f, %.2f, %.2f ->\n\t" - ",%.2f, %.2f, %.2f, %.2f, %.2f, %.2f, %.2f, %.2f)\n", - x1, y1, x2, y2, x3, y3, x4, y4, x5, y5, x6, y6, x7, y7, x8, y8); - - QTransform trans; - - if (!QTransform::quadToQuad(poly1, poly2, trans)) { - qWarning("Couldn't perform quad to quad transformation!"); - } - - m_painter->setTransform(trans, true); -} - -/***************************************************************************************************/ -void PaintCommands::command_setMatrix(QRegularExpressionMatch re) -{ - QStringList caps = re.capturedTexts(); - double m11 = convertToDouble(caps.at(1)); - double m12 = convertToDouble(caps.at(2)); - double m13 = convertToDouble(caps.at(3)); - double m21 = convertToDouble(caps.at(4)); - double m22 = convertToDouble(caps.at(5)); - double m23 = convertToDouble(caps.at(6)); - double m31 = convertToDouble(caps.at(7)); - double m32 = convertToDouble(caps.at(8)); - double m33 = convertToDouble(caps.at(9)); - - if (m_verboseMode) - printf(" -(lance) setMatrix(%.2f, %.2f, %.2f, %.2f, %.2f, %.2f, %.2f, %.2f, %.2f)\n", - m11, m12, m13, m21, m22, m23, m31, m32, m33); - - QTransform trans; - trans.setMatrix(m11, m12, m13, - m21, m22, m23, - m31, m32, m33); - - m_painter->setTransform(trans, true); -} - -/***************************************************************************************************/ -void PaintCommands::command_scale(QRegularExpressionMatch re) -{ - QStringList caps = re.capturedTexts(); - double sx = convertToDouble(caps.at(1)); - double sy = convertToDouble(caps.at(2)); - - if (m_verboseMode) - printf(" -(lance) scale(%.2f, %.2f)\n", sx, sy); - - - m_painter->scale(sx, sy); -} - -/***************************************************************************************************/ -void PaintCommands::command_setBackground(QRegularExpressionMatch re) -{ - QStringList caps = re.capturedTexts(); - QColor color = convertToColor(caps.at(1)); - QString pattern = caps.at(2); - - int style = translateEnum(brushStyleTable, pattern, Qt::LinearGradientPattern); - if (style < 0) - style = Qt::SolidPattern; - - if (m_verboseMode) - printf(" -(lance) setBackground(%s, %s)\n", qPrintable(color.name()), qPrintable(pattern)); - - m_painter->setBackground(QBrush(color, Qt::BrushStyle(style))); -} - -/***************************************************************************************************/ -void PaintCommands::command_setOpacity(QRegularExpressionMatch re) -{ - QStringList caps = re.capturedTexts(); - double opacity = convertToDouble(caps.at(1)); - - if (m_verboseMode) - printf(" -(lance) setOpacity(%lf)\n", opacity); - - m_painter->setOpacity(opacity); -} - -/***************************************************************************************************/ -void PaintCommands::command_setBgMode(QRegularExpressionMatch re) -{ - QString cap = re.captured(2); - Qt::BGMode mode = Qt::TransparentMode; - if (cap.toLower() == QLatin1String("opaquemode") || cap.toLower() == QLatin1String("opaque")) - mode = Qt::OpaqueMode; - - if (m_verboseMode) - printf(" -(lance) setBackgroundMode(%s)\n", mode == Qt::OpaqueMode ? "OpaqueMode" : "TransparentMode"); - - m_painter->setBackgroundMode(mode); -} - -/***************************************************************************************************/ -void PaintCommands::command_setBrush(QRegularExpressionMatch re) -{ - QStringList caps = re.capturedTexts(); - - QImage img = m_imageMap[caps.at(1)]; // try cache first - if (img.isNull()) - img = image_load<QImage>(caps.at(1)); - if (!img.isNull()) { // Assume image brush - if (m_verboseMode) - printf(" -(lance) setBrush(image=%s, width=%d, height=%d)\n", - qPrintable(caps.at(1)), img.width(), img.height()); - - m_painter->setBrush(QBrush(img)); - } else if (caps.at(1).toLower() == "nobrush") { - m_painter->setBrush(Qt::NoBrush); - if (m_verboseMode) - printf(" -(lance) setBrush(Qt::NoBrush)\n"); - } else { - QColor color = convertToColor(caps.at(1)); - QString pattern = caps.at(2); - - int style = translateEnum(brushStyleTable, pattern, Qt::LinearGradientPattern); - if (style < 0) - style = Qt::SolidPattern; - - if (m_verboseMode) - printf(" -(lance) setBrush(%s, %s (%d))\n", qPrintable(color.name()), qPrintable(pattern), style); - - m_painter->setBrush(QBrush(color, Qt::BrushStyle(style))); - } -} - -/***************************************************************************************************/ -void PaintCommands::command_setBrushOrigin(QRegularExpressionMatch re) -{ - int x = convertToInt(re.captured(1)); - int y = convertToInt(re.captured(2)); - - if (m_verboseMode) - printf(" -(lance) setBrushOrigin(%d, %d)\n", x, y); - - m_painter->setBrushOrigin(x, y); -} - -/***************************************************************************************************/ -void PaintCommands::command_brushTranslate(QRegularExpressionMatch re) -{ - QStringList caps = re.capturedTexts(); - double dx = convertToDouble(caps.at(1)); - double dy = convertToDouble(caps.at(2)); - - if (m_verboseMode) - printf(" -(lance) brushTranslate(%f, %f)\n", dx, dy); - - QBrush new_brush = m_painter->brush(); - QTransform brush_matrix = new_brush.transform(); - brush_matrix.translate(dx, dy); - new_brush.setTransform(brush_matrix); - m_painter->setBrush(new_brush); -} - -/***************************************************************************************************/ -void PaintCommands::command_brushScale(QRegularExpressionMatch re) -{ - QStringList caps = re.capturedTexts(); - double sx = convertToDouble(caps.at(1)); - double sy = convertToDouble(caps.at(2)); - - if (m_verboseMode) - printf(" -(lance) brushScale(%f, %f)\n", sx, sy); - - QBrush new_brush = m_painter->brush(); - QTransform brush_matrix = new_brush.transform(); - brush_matrix.scale(sx, sy); - new_brush.setTransform(brush_matrix); - m_painter->setBrush(new_brush); -} - -/***************************************************************************************************/ -void PaintCommands::command_brushRotate(QRegularExpressionMatch re) -{ - QStringList caps = re.capturedTexts(); - double rot = convertToDouble(caps.at(1)); - - if (m_verboseMode) - printf(" -(lance) brushScale(%f)\n", rot); - - QBrush new_brush = m_painter->brush(); - QTransform brush_matrix = new_brush.transform(); - brush_matrix.rotate(rot); - new_brush.setTransform(brush_matrix); - m_painter->setBrush(new_brush); -} - -/***************************************************************************************************/ -void PaintCommands::command_brushShear(QRegularExpressionMatch re) -{ - QStringList caps = re.capturedTexts(); - double sx = convertToDouble(caps.at(1)); - double sy = convertToDouble(caps.at(2)); - - if (m_verboseMode) - printf(" -(lance) brushShear(%f, %f)\n", sx, sy); - - QBrush new_brush = m_painter->brush(); - QTransform brush_matrix = new_brush.transform(); - brush_matrix.shear(sx, sy); - new_brush.setTransform(brush_matrix); - m_painter->setBrush(new_brush); -} - -/***************************************************************************************************/ -void PaintCommands::command_setClipping(QRegularExpressionMatch re) -{ - bool clipping = re.captured(1).toLower() == "true"; - - if (m_verboseMode) - printf(" -(lance) setClipping(%d)\n", clipping); - - m_painter->setClipping(clipping); -} - -/***************************************************************************************************/ -void PaintCommands::command_setClipRect(QRegularExpressionMatch re) -{ - QStringList caps = re.capturedTexts(); - int x = convertToInt(caps.at(1)); - int y = convertToInt(caps.at(2)); - int w = convertToInt(caps.at(3)); - int h = convertToInt(caps.at(4)); - - int combine = translateEnum(clipOperationTable, caps.at(5), Qt::IntersectClip + 1); - if (combine == -1) - combine = Qt::ReplaceClip; - - if (m_verboseMode) - printf(" -(lance) setClipRect(%d, %d, %d, %d), %s\n", x, y, w, h, clipOperationTable[combine]); - - m_painter->setClipRect(x, y, w, h, Qt::ClipOperation(combine)); -} - -/***************************************************************************************************/ -void PaintCommands::command_setClipPath(QRegularExpressionMatch re) -{ - int combine = translateEnum(clipOperationTable, re.captured(2), Qt::IntersectClip + 1); - if (combine == -1) - combine = Qt::ReplaceClip; - - if (m_verboseMode) - printf(" -(lance) setClipPath(name=%s), %s\n", qPrintable(re.captured(1)), clipOperationTable[combine]); - - if (!m_pathMap.contains(re.captured(1))) - fprintf(stderr, " - setClipPath, no such path"); - m_painter->setClipPath(m_pathMap[re.captured(1)], Qt::ClipOperation(combine)); -} - -/***************************************************************************************************/ -void PaintCommands::command_setClipRegion(QRegularExpressionMatch re) -{ - int combine = translateEnum(clipOperationTable, re.captured(2), Qt::IntersectClip + 1); - if (combine == -1) - combine = Qt::ReplaceClip; - QRegion r = m_regionMap[re.captured(1)]; - - if (m_verboseMode) - printf(" -(lance) setClipRegion(name=%s), bounds=[%d, %d, %d, %d], %s\n", - qPrintable(re.captured(1)), - r.boundingRect().x(), - r.boundingRect().y(), - r.boundingRect().width(), - r.boundingRect().height(), - clipOperationTable[combine]); - - m_painter->setClipRegion(m_regionMap[re.captured(1)], Qt::ClipOperation(combine)); -} - -/***************************************************************************************************/ -void PaintCommands::command_setFont(QRegularExpressionMatch re) -{ - QStringList caps = re.capturedTexts(); - QString family = caps.at(1); - int size = convertToInt(caps.at(2)); - - int weight = translateEnum(fontWeightTable, re.captured(3).toLower(), 5); - if (weight != -1) { - switch (weight) { - case 0: weight = QFont::Light; break; - case 1: weight = QFont::Normal; break; - case 2: weight = QFont::DemiBold; break; - case 3: weight = QFont::Bold; break; - case 4: weight = QFont::Black; break; - } - } else { - weight = convertToInt(re.captured(3)); - } - - bool italic = caps.at(4).toLower() == "true" || caps.at(4).toLower() == "italic"; - - QFont font(family, size, weight, italic); - - int hinting = translateEnum(fontHintingTable, caps.at(5), 4); - if (hinting == -1) - hinting = 0; - else - font.setHintingPreference(QFont::HintingPreference(hinting)); - - bool underline = caps.at(6).toLower() == "true" || caps.at(6).toLower() == "underline"; - bool strikeOut = caps.at(7).toLower() == "true" || caps.at(7).toLower() == "strikeout"; - bool overline = caps.at(8).toLower() == "true" || caps.at(8).toLower() == "overline"; - font.setUnderline(underline); - font.setStrikeOut(strikeOut); - font.setOverline(overline); - - if (m_verboseMode) - printf(" -(lance) setFont(family=%s, size=%d, weight=%d, italic=%d hinting=%s\n", - qPrintable(family), size, weight, italic, fontHintingTable[hinting]); - - m_painter->setFont(font); -} - -/***************************************************************************************************/ -void PaintCommands::command_setPen(QRegularExpressionMatch re) -{ - QString cap = re.captured(1); - int style = translateEnum(penStyleTable, cap, Qt::DashDotDotLine + 1); - if (style >= 0) { - if (m_verboseMode) - printf(" -(lance) setPen(%s)\n", qPrintable(cap)); - - m_painter->setPen(Qt::PenStyle(style)); - } else if (cap.toLower() == "brush") { - QPen pen(m_painter->brush(), 0); - if (m_verboseMode) { - printf(" -(lance) setPen(brush), style=%d, color=%08x\n", - pen.brush().style(), pen.color().rgba()); - } - m_painter->setPen(pen); - } else { - QColor color = convertToColor(cap); - if (m_verboseMode) - printf(" -(lance) setPen(%s)\n", qPrintable(color.name())); - - m_painter->setPen(color); - } -} - -/***************************************************************************************************/ -void PaintCommands::command_setPen2(QRegularExpressionMatch re) -{ - QStringList caps = re.capturedTexts(); - - QBrush brush; - - if (caps.at(1).toLower() == "brush") - brush = m_painter->brush(); - else - brush = convertToColor(caps.at(1)); - - double width = convertToDouble(caps.at(2)); - int penStyle = translateEnum(penStyleTable, caps.at(3), Qt::DashDotDotLine + 1); - if (penStyle < 0) - penStyle = Qt::SolidLine; - - Qt::PenCapStyle capStyle = Qt::SquareCap; - if (caps.at(4).toLower() == "flatcap") capStyle = Qt::FlatCap; - else if (caps.at(4).toLower() == "squarecap") capStyle = Qt::SquareCap; - else if (caps.at(4).toLower() == "roundcap") capStyle = Qt::RoundCap; - else if (!caps.at(4).isEmpty()) - fprintf(stderr, "ERROR: setPen, unknown capStyle: %s\n", qPrintable(caps.at(4))); - - Qt::PenJoinStyle joinStyle = Qt::BevelJoin; - if (caps.at(5).toLower() == "miterjoin") joinStyle = Qt::MiterJoin; - else if (caps.at(5).toLower() == "beveljoin") joinStyle = Qt::BevelJoin; - else if (caps.at(5).toLower() == "roundjoin") joinStyle = Qt::RoundJoin; - else if (!caps.at(5).isEmpty()) - fprintf(stderr, "ERROR: setPen, unknown joinStyle: %s\n", qPrintable(caps.at(5))); - - if (m_verboseMode) - printf(" -(lance) setPen(%s, width=%f, style=%d, cap=%d, join=%d)\n", - qPrintable(brush.color().name()), width, penStyle, capStyle, joinStyle); - - m_painter->setPen(QPen(brush, width, Qt::PenStyle(penStyle), capStyle, joinStyle)); -} - -/***************************************************************************************************/ -void PaintCommands::command_setRenderHint(QRegularExpressionMatch re) -{ - QString hintString = re.captured(1).toLower(); - bool on = re.captured(2).isEmpty() || re.captured(2).toLower() == "true"; - if (hintString.contains("antialiasing")) { - if (m_verboseMode) - printf(" -(lance) setRenderHint Antialiasing\n"); - - m_painter->setRenderHint(QPainter::Antialiasing, on); - } else if (hintString.contains("smoothpixmaptransform")) { - if (m_verboseMode) - printf(" -(lance) setRenderHint SmoothPixmapTransform\n"); - m_painter->setRenderHint(QPainter::SmoothPixmapTransform, on); - } else { - fprintf(stderr, "ERROR(setRenderHint): unknown hint '%s'\n", qPrintable(hintString)); - } -} - -/***************************************************************************************************/ -void PaintCommands::command_clearRenderHint(QRegularExpressionMatch /*re*/) -{ - m_painter->setRenderHint(QPainter::Antialiasing, false); - m_painter->setRenderHint(QPainter::SmoothPixmapTransform, false); - if (m_verboseMode) - printf(" -(lance) clearRenderHint\n"); -} - -/***************************************************************************************************/ -void PaintCommands::command_setCompositionMode(QRegularExpressionMatch re) -{ - QString modeString = re.captured(1).toLower(); - int mode = translateEnum(compositionModeTable, modeString, 33); - - if (mode < 0 || mode > QPainter::RasterOp_SourceAndNotDestination) { - fprintf(stderr, "ERROR: invalid mode: %s\n", qPrintable(modeString)); - return; - } - - if (m_verboseMode) - printf(" -(lance) setCompositionMode: %d: %s\n", mode, qPrintable(modeString)); - - m_painter->setCompositionMode(QPainter::CompositionMode(mode)); -} - -/***************************************************************************************************/ -void PaintCommands::command_translate(QRegularExpressionMatch re) -{ - QStringList caps = re.capturedTexts(); - double dx = convertToDouble(caps.at(1)); - double dy = convertToDouble(caps.at(2)); - - if (m_verboseMode) - printf(" -(lance) translate(%f, %f)\n", dx, dy); - - m_painter->translate(dx, dy); -} - -/***************************************************************************************************/ -void PaintCommands::command_pixmap_load(QRegularExpressionMatch re) -{ - QStringList caps = re.capturedTexts(); - - QString fileName = caps.at(1); - QString name = caps.at(2); - - if (name.isEmpty()) - name = fileName; - - QImage im = image_load<QImage>(fileName); - QPixmap px = QPixmap::fromImage(im, Qt::OrderedDither | Qt::OrderedAlphaDither); - - if (m_verboseMode) - printf(" -(lance) pixmap_load(%s as %s), size=[%d, %d], depth=%d\n", - qPrintable(fileName), qPrintable(name), - px.width(), px.height(), px.depth()); - - m_pixmapMap[name] = px; -} - -/***************************************************************************************************/ -void PaintCommands::command_bitmap_load(QRegularExpressionMatch re) -{ - QStringList caps = re.capturedTexts(); - - QString fileName = caps.at(1); - QString name = caps.at(2); - - if (name.isEmpty()) - name = fileName; - - QBitmap bm = image_load<QBitmap>(fileName); - - if (m_verboseMode) - printf(" -(lance) bitmap_load(%s as %s), size=[%d, %d], depth=%d\n", - qPrintable(fileName), qPrintable(name), - bm.width(), bm.height(), bm.depth()); - - m_pixmapMap[name] = bm; -} - -void PaintCommands::command_pixmap_setDevicePixelRatio(QRegularExpressionMatch re) -{ - QStringList caps = re.capturedTexts(); - - QString name = caps.at(1); - double dpr = convertToDouble(caps.at(2)); - - if (m_verboseMode) - printf(" -(lance) pixmap_setDevicePixelRatio(%s), %.1f -> %.1f\n", - qPrintable(name), m_pixmapMap[name].devicePixelRatio(), dpr); - - m_pixmapMap[name].setDevicePixelRatio(dpr); -} - -/***************************************************************************************************/ -void PaintCommands::command_pixmap_setMask(QRegularExpressionMatch re) -{ - QStringList caps = re.capturedTexts(); - QBitmap mask = image_load<QBitmap>(caps.at(2)); - - if (m_verboseMode) - printf(" -(lance) pixmap_setMask(%s, %s)\n", qPrintable(caps.at(1)), qPrintable(caps.at(2))); - - if (!m_pixmapMap[caps.at(1)].isNull()) - m_pixmapMap[caps.at(1)].setMask(mask); -} - -/***************************************************************************************************/ -void PaintCommands::command_image_load(QRegularExpressionMatch re) -{ - QStringList caps = re.capturedTexts(); - - QString fileName = caps.at(1); - QString name = caps.at(2); - - if (name.isEmpty()) - name = fileName; - - QImage image = image_load<QImage>(fileName); - - if (m_verboseMode) - printf(" -(lance) image_load(%s as %s), size=[%d, %d], format=%d\n", - qPrintable(fileName), qPrintable(name), - image.width(), image.height(), image.format()); - - m_imageMap[name] = image; -} - -/***************************************************************************************************/ -void PaintCommands::command_image_setColorCount(QRegularExpressionMatch re) -{ - QStringList caps = re.capturedTexts(); - - QString name = caps.at(1); - int count = convertToInt(caps.at(2)); - - if (m_verboseMode) - printf(" -(lance) image_setColorCount(%s), %d -> %d\n", - qPrintable(name), m_imageMap[name].colorCount(), count); - - m_imageMap[name].setColorCount(count); -} - -/***************************************************************************************************/ -void PaintCommands::command_image_setColor(QRegularExpressionMatch re) -{ - QStringList caps = re.capturedTexts(); - - QString name = caps.at(1); - int index = convertToInt(caps.at(2)); - QColor color = convertToColor(caps.at(3)); - - if (m_verboseMode) - printf(" -(lance) image_setColor(%s), %d = %08x\n", qPrintable(name), index, color.rgba()); - - m_imageMap[name].setColor(index, color.rgba()); -} - -/***************************************************************************************************/ -void PaintCommands::command_image_setDevicePixelRatio(QRegularExpressionMatch re) -{ - QStringList caps = re.capturedTexts(); - - QString name = caps.at(1); - double dpr = convertToDouble(caps.at(2)); - - if (m_verboseMode) - printf(" -(lance) image_setDevicePixelRatio(%s), %.1f -> %.1f\n", - qPrintable(name), m_imageMap[name].devicePixelRatio(), dpr); - - m_imageMap[name].setDevicePixelRatio(dpr); -} - -/***************************************************************************************************/ -void PaintCommands::command_abort(QRegularExpressionMatch) -{ - m_abort = true; -} - -/***************************************************************************************************/ -void PaintCommands::command_gradient_clearStops(QRegularExpressionMatch) -{ - if (m_verboseMode) - printf(" -(lance) gradient_clearStops\n"); - m_gradientStops.clear(); -} - -/***************************************************************************************************/ -void PaintCommands::command_gradient_appendStop(QRegularExpressionMatch re) -{ - QStringList caps = re.capturedTexts(); - double pos = convertToDouble(caps.at(1)); - QColor color = convertToColor(caps.at(2)); - - if (m_verboseMode) - printf(" -(lance) gradient_appendStop(%.2f, %x)\n", pos, color.rgba()); - - m_gradientStops << QGradientStop(pos, color); -} - -/***************************************************************************************************/ -void PaintCommands::command_gradient_setLinear(QRegularExpressionMatch re) -{ - QStringList caps = re.capturedTexts(); - double x1 = convertToDouble(caps.at(1)); - double y1 = convertToDouble(caps.at(2)); - double x2 = convertToDouble(caps.at(3)); - double y2 = convertToDouble(caps.at(4)); - - if (m_verboseMode) - printf(" -(lance) gradient_setLinear (%.2f, %.2f), (%.2f, %.2f), spread=%d\n", - x1, y1, x2, y2, m_gradientSpread); - - QLinearGradient lg(QPointF(x1, y1), QPointF(x2, y2)); - lg.setStops(m_gradientStops); - lg.setSpread(m_gradientSpread); - lg.setCoordinateMode(m_gradientCoordinate); - QBrush brush(lg); - QTransform brush_matrix = m_painter->brush().transform(); - brush.setTransform(brush_matrix); - m_painter->setBrush(brush); -} - -/***************************************************************************************************/ -void PaintCommands::command_gradient_setLinearPen(QRegularExpressionMatch re) -{ - QStringList caps = re.capturedTexts(); - double x1 = convertToDouble(caps.at(1)); - double y1 = convertToDouble(caps.at(2)); - double x2 = convertToDouble(caps.at(3)); - double y2 = convertToDouble(caps.at(4)); - - if (m_verboseMode) - printf(" -(lance) gradient_setLinear (%.2f, %.2f), (%.2f, %.2f), spread=%d\n", - x1, y1, x2, y2, m_gradientSpread); - - QLinearGradient lg(QPointF(x1, y1), QPointF(x2, y2)); - lg.setStops(m_gradientStops); - lg.setSpread(m_gradientSpread); - lg.setCoordinateMode(m_gradientCoordinate); - QPen pen = m_painter->pen(); - pen.setBrush(lg); - m_painter->setPen(pen); -} - -/***************************************************************************************************/ -void PaintCommands::command_gradient_setRadial(QRegularExpressionMatch re) -{ - QStringList caps = re.capturedTexts(); - double cx = convertToDouble(caps.at(1)); - double cy = convertToDouble(caps.at(2)); - double rad = convertToDouble(caps.at(3)); - double fx = convertToDouble(caps.at(4)); - double fy = convertToDouble(caps.at(5)); - - if (m_verboseMode) - printf(" -(lance) gradient_setRadial center=(%.2f, %.2f), radius=%.2f, focal=(%.2f, %.2f), " - "spread=%d\n", - cx, cy, rad, fx, fy, m_gradientSpread); - - QRadialGradient rg(QPointF(cx, cy), rad, QPointF(fx, fy)); - rg.setStops(m_gradientStops); - rg.setSpread(m_gradientSpread); - rg.setCoordinateMode(m_gradientCoordinate); - QBrush brush(rg); - QTransform brush_matrix = m_painter->brush().transform(); - brush.setTransform(brush_matrix); - m_painter->setBrush(brush); -} - -/***************************************************************************************************/ -void PaintCommands::command_gradient_setRadialExtended(QRegularExpressionMatch re) -{ - QStringList caps = re.capturedTexts(); - double cx = convertToDouble(caps.at(1)); - double cy = convertToDouble(caps.at(2)); - double rad = convertToDouble(caps.at(3)); - double fx = convertToDouble(caps.at(4)); - double fy = convertToDouble(caps.at(5)); - double frad = convertToDouble(caps.at(6)); - - if (m_verboseMode) - printf(" -(lance) gradient_setRadialExtended center=(%.2f, %.2f), radius=%.2f, focal=(%.2f, %.2f), " - "focal radius=%.2f, spread=%d\n", - cx, cy, rad, fx, fy, frad, m_gradientSpread); - - QRadialGradient rg(QPointF(cx, cy), rad, QPointF(fx, fy), frad); - rg.setStops(m_gradientStops); - rg.setSpread(m_gradientSpread); - rg.setCoordinateMode(m_gradientCoordinate); - QBrush brush(rg); - QTransform brush_matrix = m_painter->brush().transform(); - brush.setTransform(brush_matrix); - m_painter->setBrush(brush); -} - -/***************************************************************************************************/ -void PaintCommands::command_gradient_setConical(QRegularExpressionMatch re) -{ - QStringList caps = re.capturedTexts(); - double cx = convertToDouble(caps.at(1)); - double cy = convertToDouble(caps.at(2)); - double angle = convertToDouble(caps.at(3)); - - if (m_verboseMode) { - printf(" -(lance) gradient_setConical center=(%.2f, %.2f), angle=%.2f\n, spread=%d", - cx, cy, angle, m_gradientSpread); - } - - QConicalGradient cg(QPointF(cx, cy), angle); - cg.setStops(m_gradientStops); - cg.setSpread(m_gradientSpread); - cg.setCoordinateMode(m_gradientCoordinate); - QBrush brush(cg); - QTransform brush_matrix = m_painter->brush().transform(); - brush.setTransform(brush_matrix); - m_painter->setBrush(brush); -} - -/***************************************************************************************************/ -void PaintCommands::command_gradient_setSpread(QRegularExpressionMatch re) -{ - int spreadMethod = translateEnum(spreadMethodTable, re.captured(1), 3); - - if (m_verboseMode) - printf(" -(lance) gradient_setSpread %d=[%s]\n", spreadMethod, spreadMethodTable[spreadMethod]); - - m_gradientSpread = QGradient::Spread(spreadMethod); -} - -void PaintCommands::command_gradient_setCoordinateMode(QRegularExpressionMatch re) -{ - int coord = translateEnum(coordinateMethodTable, re.captured(1), 4); - - if (m_verboseMode) - printf(" -(lance) gradient_setCoordinateMode %d=[%s]\n", coord, - coordinateMethodTable[coord]); - - m_gradientCoordinate = QGradient::CoordinateMode(coord); -} - -/***************************************************************************************************/ -void PaintCommands::command_surface_begin(QRegularExpressionMatch re) -{ - QStringList caps = re.capturedTexts(); - double x = convertToDouble(caps.at(1)); - double y = convertToDouble(caps.at(2)); - double w = convertToDouble(caps.at(3)); - double h = convertToDouble(caps.at(4)); - - if (m_surface_painter) { - fprintf(stderr, "ERROR: surface already active"); - return; - } - - if (m_verboseMode) - printf(" -(lance) surface_begin, pos=[%.2f, %.2f], size=[%.2f, %.2f]\n", x, y, w, h); - - m_surface_painter = m_painter; - - if (m_type == OpenGLType || m_type == OpenGLBufferType) { -#ifndef QT_NO_OPENGL - m_default_glcontext = QOpenGLContext::currentContext(); - m_surface_glcontext = new QOpenGLContext(); - // Pick up the format from the current context; this is especially - // important in order to pick the right version/profile to test. - m_surface_glcontext->setFormat(m_default_glcontext->format()); - m_surface_glcontext->create(); - m_surface_glcontext->makeCurrent(m_default_glcontext->surface()); - QOpenGLFramebufferObjectFormat fmt; // ###TBD: get format from caller - fmt.setAttachment(QOpenGLFramebufferObject::CombinedDepthStencil); - fmt.setSamples(4); - m_surface_glbuffer = new QOpenGLFramebufferObject(qRound(w), qRound(h), fmt); - m_surface_glbuffer->bind(); - m_surface_glpaintdevice = new QOpenGLPaintDevice(qRound(w), qRound(h)); - m_painter = new QPainter(m_surface_glpaintdevice); - m_painter->save(); - m_painter->setCompositionMode(QPainter::CompositionMode_Clear); - m_painter->fillRect(QRect(0, 0, qRound(w), qRound(h)), Qt::transparent); - m_painter->restore(); -#endif - } else { - QImage::Format surface_format; - if (QImage::toPixelFormat(m_format).alphaUsage() != QPixelFormat::UsesAlpha) - surface_format = qt_alphaVersion(m_format); - else - surface_format = m_format; - - m_surface_image = QImage(qRound(w), qRound(h), surface_format); - m_surface_image.fill(0); - m_painter = new QPainter(&m_surface_image); - } - m_surface_rect = QRectF(x, y, w, h); -} - -/***************************************************************************************************/ -void PaintCommands::command_surface_end(QRegularExpressionMatch) -{ - if (!m_surface_painter) { - fprintf(stderr, "ERROR: surface not active"); - return; - } - - if (m_verboseMode) - printf(" -(lance) surface_end, pos=[%.2f, %.2f], size=[%.2f, %.2f]\n", - m_surface_rect.x(), - m_surface_rect.y(), - m_surface_rect.width(), - m_surface_rect.height()); - m_painter->end(); - - delete m_painter; - m_painter = m_surface_painter; - m_surface_painter = 0; - - if (m_type == OpenGLType || m_type == OpenGLBufferType) { -#ifndef QT_NO_OPENGL - QImage new_image = m_surface_glbuffer->toImage().convertToFormat(QImage::Format_ARGB32_Premultiplied); - - delete m_surface_glpaintdevice; - m_surface_glpaintdevice = 0; - delete m_surface_glbuffer; - m_surface_glbuffer = 0; - delete m_surface_glcontext; - m_surface_glcontext = 0; - - m_default_glcontext->makeCurrent(m_default_glcontext->surface()); - m_painter->drawImage(m_surface_rect, new_image); - // Flush the pipeline: - m_painter->beginNativePainting(); - m_painter->endNativePainting(); -#endif - } else { - m_painter->drawImage(m_surface_rect, m_surface_image); - m_surface_image = QImage(); - } - m_surface_rect = QRectF(); -} - -/***************************************************************************************************/ -void PaintCommands::command_image_convertToFormat(QRegularExpressionMatch re) -{ - QStringList caps = re.capturedTexts(); - - QString srcName = caps.at(1); - QString destName = caps.at(2); - - if (!m_imageMap.contains(srcName)) { - fprintf(stderr, "ERROR(convertToFormat): no such image '%s'\n", qPrintable(srcName)); - return; - } - - int format = translateEnum(imageFormatTable, caps.at(3), QImage::NImageFormats); - if (format < 0 || format >= QImage::NImageFormats) { - fprintf(stderr, "ERROR(convertToFormat): invalid format %d = '%s'\n", - format, qPrintable(caps.at(3))); - return; - } - - QImage src = m_imageMap[srcName]; - QImage dest = src.convertToFormat(QImage::Format(format), - Qt::OrderedAlphaDither | Qt::OrderedDither); - - if (m_verboseMode) { - printf(" -(lance) convertToFormat %s:%d -> %s:%d\n", - qPrintable(srcName), src.format(), - qPrintable(destName), dest.format()); - } - - m_imageMap[destName] = dest; -} - -/***************************************************************************************************/ -void PaintCommands::command_textlayout_draw(QRegularExpressionMatch re) -{ - QStringList caps = re.capturedTexts(); - - QString text = caps.at(1); - double width = convertToDouble(caps.at(2)); - - if (m_verboseMode) - printf(" -(lance) textlayout_draw text='%s', width=%f\n", - qPrintable(text), width); - - QFont copy = m_painter->font(); - copy.setPointSize(10); - - QTextLayout layout(text, copy, m_painter->device()); - layout.beginLayout(); - - double y_offset = 0; - - while (true) { - QTextLine line = layout.createLine(); - if (!line.isValid()) - break; - line.setLineWidth(width); - line.setPosition(QPointF(0, y_offset)); - - y_offset += line.height(); - } - - layout.draw(m_painter, QPointF(0, 0)); -} - -/***************************************************************************************************/ -void PaintCommands::command_pen_setDashOffset(QRegularExpressionMatch re) -{ - QStringList caps = re.capturedTexts(); - double offset = convertToDouble(caps.at(1)); - - if (m_verboseMode) - printf(" -(lance) setDashOffset(%lf)\n", offset); - - QPen p = m_painter->pen(); - p.setDashOffset(offset); - m_painter->setPen(p); -} - -/***************************************************************************************************/ -void PaintCommands::command_pen_setDashPattern(QRegularExpressionMatch re) -{ - static QRegularExpression separators("\\s"); - QStringList caps = re.capturedTexts(); - QString cap = caps.at(1); - QStringList numbers = cap.split(separators, Qt::SkipEmptyParts); - - QList<qreal> pattern; - for (int i=0; i<numbers.size(); ++i) - pattern.append(convertToDouble(numbers.at(i))); - - if (m_verboseMode) - printf(" -(lance) pen_setDashPattern(size=%zd)\n", size_t(pattern.size())); - - QPen p = m_painter->pen(); - p.setDashPattern(pattern); - m_painter->setPen(p); -} - -/***************************************************************************************************/ -void PaintCommands::command_pen_setCosmetic(QRegularExpressionMatch re) -{ - QString hm = re.capturedTexts().at(1); - bool on = hm == "true" || hm == "yes" || hm == "on"; - - if (m_verboseMode) { - printf(" -(lance) pen_setCosmetic(%s)\n", on ? "true" : "false"); - } - - QPen p = m_painter->pen(); - p.setCosmetic(on); - - m_painter->setPen(p); -} - -/***************************************************************************************************/ -void PaintCommands::command_drawConvexPolygon(QRegularExpressionMatch re) -{ - static QRegularExpression separators("\\s"); - QStringList caps = re.capturedTexts(); - QString cap = caps.at(1); - QStringList numbers = cap.split(separators, Qt::SkipEmptyParts); - - QPolygonF array; - for (int i=0; i + 1<numbers.size(); i+=2) - array.append(QPointF(convertToDouble(numbers.at(i)), convertToDouble(numbers.at(i+1)))); - - if (m_verboseMode) - printf(" -(lance) drawConvexPolygon(size=%zd)\n", size_t(array.size())); - - - m_painter->drawConvexPolygon(array); -} diff --git a/tests/auto/other/lancelot/paintcommands.h b/tests/auto/other/lancelot/paintcommands.h deleted file mode 100644 index e9468b1f42..0000000000 --- a/tests/auto/other/lancelot/paintcommands.h +++ /dev/null @@ -1,346 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -#ifndef PAINTCOMMANDS_H -#define PAINTCOMMANDS_H - -#include <qcolor.h> -#include <qmap.h> -#include <qpainterpath.h> -#include <qregion.h> -#include <qregularexpression.h> -#include <qstringlist.h> -#include <qpixmap.h> -#include <qbrush.h> -#include <qhash.h> - -QT_FORWARD_DECLARE_CLASS(QPainter) -#ifndef QT_NO_OPENGL -QT_FORWARD_DECLARE_CLASS(QOpenGLFramebufferObject) -QT_FORWARD_DECLARE_CLASS(QOpenGLPaintDevice) -QT_FORWARD_DECLARE_CLASS(QOpenGLContext) -#endif - -enum DeviceType { - WidgetType, - BitmapType, - PixmapType, - ImageType, - ImageMonoType, - OpenGLType, - OpenGLBufferType, - PictureType, - PrinterType, - PdfType, - PsType, - GrabType, - CustomDeviceType, - CustomWidgetType, - ImageWidgetType -}; - -/************************************************************************/ -class PaintCommands -{ -public: - // construction / initialization - PaintCommands(const QStringList &cmds, int w, int h, QImage::Format format) - : m_painter(0) - , m_surface_painter(0) - , m_format(format) - , m_commands(cmds) - , m_gradientSpread(QGradient::PadSpread) - , m_gradientCoordinate(QGradient::LogicalMode) - , m_width(w) - , m_height(h) - , m_verboseMode(false) - , m_type(WidgetType) - , m_checkers_background(true) - , m_shouldDrawText(true) -#ifndef QT_NO_OPENGL - , m_default_glcontext(0) - , m_surface_glcontext(0) - , m_surface_glbuffer(0) - , m_surface_glpaintdevice(0) -#endif - { staticInit(); } - -public: - void setCheckersBackground(bool b) { staticInit(); m_checkers_background = b; } - void setContents(const QStringList &cmds) { - staticInit(); - m_blockMap.clear(); - m_pathMap.clear(); - m_pixmapMap.clear(); - m_imageMap.clear(); - m_regionMap.clear(); - m_gradientStops.clear(); - m_controlPoints.clear(); - m_gradientSpread = QGradient::PadSpread; - m_gradientCoordinate = QGradient::LogicalMode; - m_commands = cmds; - - - } - void setPainter(QPainter *pt) { staticInit(); m_painter = pt; } - void setType(DeviceType t) { staticInit(); m_type = t; } - void setFilePath(const QString &path) { staticInit(); m_filepath = path; } - void setControlPoints(const QList<QPointF> &points) - { - staticInit(); - m_controlPoints = points; - } - void setVerboseMode(bool v) { staticInit(); m_verboseMode = v; } - void insertAt(int commandIndex, const QStringList &newCommands); - void setShouldDrawText(bool drawText) { m_shouldDrawText = drawText; } - - // run - void runCommands(); - -private: - // run - void runCommand(const QString &scriptLine); - - // conversion methods - int convertToInt(const QString &str); - double convertToDouble(const QString &str); - float convertToFloat(const QString &str); - QColor convertToColor(const QString &str); - - // commands: comments - void command_comment(QRegularExpressionMatch re); - - // commands: importer - void command_import(QRegularExpressionMatch re); - - // commands: blocks - void command_begin_block(QRegularExpressionMatch re); - void command_end_block(QRegularExpressionMatch re); - void command_repeat_block(QRegularExpressionMatch re); - - // commands: misc - void command_textlayout_draw(QRegularExpressionMatch re); - void command_abort(QRegularExpressionMatch re); - - // commands: noops - void command_noop(QRegularExpressionMatch re); - - // commands: setters - void command_setBgMode(QRegularExpressionMatch re); - void command_setBackground(QRegularExpressionMatch re); - void command_setOpacity(QRegularExpressionMatch re); - void command_path_setFillRule(QRegularExpressionMatch re); - void command_setBrush(QRegularExpressionMatch re); - void command_setBrushOrigin(QRegularExpressionMatch re); - void command_brushTranslate(QRegularExpressionMatch re); - void command_brushRotate(QRegularExpressionMatch re); - void command_brushScale(QRegularExpressionMatch re); - void command_brushShear(QRegularExpressionMatch re); - void command_setClipPath(QRegularExpressionMatch re); - void command_setClipRect(QRegularExpressionMatch re); - void command_setClipRectangle(QRegularExpressionMatch re); - void command_setClipRegion(QRegularExpressionMatch re); - void command_setClipping(QRegularExpressionMatch re); - void command_setCompositionMode(QRegularExpressionMatch re); - void command_setFont(QRegularExpressionMatch re); - void command_setPen(QRegularExpressionMatch re); - void command_setPen2(QRegularExpressionMatch re); - void command_pen_setDashOffset(QRegularExpressionMatch re); - void command_pen_setDashPattern(QRegularExpressionMatch re); - void command_pen_setCosmetic(QRegularExpressionMatch re); - void command_setRenderHint(QRegularExpressionMatch re); - void command_clearRenderHint(QRegularExpressionMatch re); - void command_gradient_appendStop(QRegularExpressionMatch re); - void command_gradient_clearStops(QRegularExpressionMatch re); - void command_gradient_setConical(QRegularExpressionMatch re); - void command_gradient_setLinear(QRegularExpressionMatch re); - void command_gradient_setRadial(QRegularExpressionMatch re); - void command_gradient_setRadialExtended(QRegularExpressionMatch re); - void command_gradient_setLinearPen(QRegularExpressionMatch re); - void command_gradient_setSpread(QRegularExpressionMatch re); - void command_gradient_setCoordinateMode(QRegularExpressionMatch re); - - // commands: drawing ops - void command_drawArc(QRegularExpressionMatch re); - void command_drawChord(QRegularExpressionMatch re); - void command_drawConvexPolygon(QRegularExpressionMatch re); - void command_drawEllipse(QRegularExpressionMatch re); - void command_drawImage(QRegularExpressionMatch re); - void command_drawLine(QRegularExpressionMatch re); - void command_drawPath(QRegularExpressionMatch re); - void command_drawPie(QRegularExpressionMatch re); - void command_drawPixmap(QRegularExpressionMatch re); - void command_drawPoint(QRegularExpressionMatch re); - void command_drawPolygon(QRegularExpressionMatch re); - void command_drawPolyline(QRegularExpressionMatch re); - void command_drawRect(QRegularExpressionMatch re); - void command_drawRoundedRect(QRegularExpressionMatch re); - void command_drawRoundRect(QRegularExpressionMatch re); - void command_drawText(QRegularExpressionMatch re); - void command_drawStaticText(QRegularExpressionMatch re); - void command_drawGlyphRun(QRegularExpressionMatch re); - void command_drawTextDocument(QRegularExpressionMatch re); - void command_drawTiledPixmap(QRegularExpressionMatch re); - void command_fillRect(QRegularExpressionMatch re); - void command_fillRectF(QRegularExpressionMatch re); - - // paths - void command_path_addEllipse(QRegularExpressionMatch re); - void command_path_addPolygon(QRegularExpressionMatch re); - void command_path_addRect(QRegularExpressionMatch re); - void command_path_addText(QRegularExpressionMatch re); - void command_path_arcTo(QRegularExpressionMatch re); - void command_path_closeSubpath(QRegularExpressionMatch re); - void command_path_createOutline(QRegularExpressionMatch re); - void command_path_cubicTo(QRegularExpressionMatch re); - void command_path_debugPrint(QRegularExpressionMatch re); - void command_path_lineTo(QRegularExpressionMatch re); - void command_path_moveTo(QRegularExpressionMatch re); - void command_region_addEllipse(QRegularExpressionMatch re); - void command_region_addRect(QRegularExpressionMatch re); - - // getters - void command_region_getClipRegion(QRegularExpressionMatch re); - void command_path_getClipPath(QRegularExpressionMatch re); - - // commands: surface begin/end - void command_surface_begin(QRegularExpressionMatch re); - void command_surface_end(QRegularExpressionMatch re); - - // commands: save/restore painter state - void command_restore(QRegularExpressionMatch re); - void command_save(QRegularExpressionMatch re); - - // commands: pixmap/image - void command_pixmap_load(QRegularExpressionMatch re); - void command_pixmap_setMask(QRegularExpressionMatch re); - void command_bitmap_load(QRegularExpressionMatch re); - void command_pixmap_setDevicePixelRatio(QRegularExpressionMatch re); - void command_image_convertToFormat(QRegularExpressionMatch re); - void command_image_load(QRegularExpressionMatch re); - void command_image_setColor(QRegularExpressionMatch re); - void command_image_setColorCount(QRegularExpressionMatch re); - void command_image_setDevicePixelRatio(QRegularExpressionMatch re); - - // commands: transformation - void command_resetMatrix(QRegularExpressionMatch re); - void command_translate(QRegularExpressionMatch re); - void command_rotate(QRegularExpressionMatch re); - void command_rotate_x(QRegularExpressionMatch re); - void command_rotate_y(QRegularExpressionMatch re); - void command_scale(QRegularExpressionMatch re); - void command_mapQuadToQuad(QRegularExpressionMatch re); - void command_setMatrix(QRegularExpressionMatch re); - - // attributes - QPainter *m_painter; - QPainter *m_surface_painter; - QImage::Format m_format; - QImage m_surface_image; - QRectF m_surface_rect; - QStringList m_commands; - QString m_currentCommand; - int m_currentCommandIndex; - QString m_filepath; - QMap<QString, QStringList> m_blockMap; - QMap<QString, QPainterPath> m_pathMap; - QMap<QString, QPixmap> m_pixmapMap; - QMap<QString, QImage> m_imageMap; - QMap<QString, QRegion> m_regionMap; - QGradientStops m_gradientStops; - QGradient::Spread m_gradientSpread; - QGradient::CoordinateMode m_gradientCoordinate; - bool m_abort; - int m_width; - int m_height; - - bool m_verboseMode; - DeviceType m_type; - bool m_checkers_background; - bool m_shouldDrawText; - - QList<QPointF> m_controlPoints; - -#ifndef QT_NO_OPENGL - QOpenGLContext *m_default_glcontext; - QOpenGLContext *m_surface_glcontext; - QOpenGLFramebufferObject *m_surface_glbuffer; - QOpenGLPaintDevice *m_surface_glpaintdevice; -#endif - - // painter functionalities string tables - static const char *brushStyleTable[]; - static const char *penStyleTable[]; - static const char *fontWeightTable[]; - static const char *fontHintingTable[]; - static const char *clipOperationTable[]; - static const char *spreadMethodTable[]; - static const char *coordinateMethodTable[]; - static const char *compositionModeTable[]; - static const char *imageFormatTable[]; - static const char *sizeModeTable[]; - static int translateEnum(const char *table[], const QString &pattern, int limit); - - // utility - template <typename T> T image_load(const QString &filepath); - - // commands dictionary management - static void staticInit(); - -public: - struct PaintCommandInfos - { - PaintCommandInfos(QString id, void (PaintCommands::*p)(QRegularExpressionMatch), QRegularExpression r, QString sy, QString sa) - : identifier(id) - , regExp(r) - , syntax(sy) - , sample(sa) - , paintMethod(p) - {} - PaintCommandInfos(QString title) - : identifier(title), paintMethod(0) {} - bool isSectionHeader() const { return paintMethod == 0; } - QString identifier; - QRegularExpression regExp; - QString syntax; - QString sample; - void (PaintCommands::*paintMethod)(QRegularExpressionMatch); - }; - - static PaintCommandInfos *findCommandById(const QString &identifier) { - for (int i=0; i<s_commandInfoTable.size(); i++) - if (s_commandInfoTable[i].identifier == identifier) - return &s_commandInfoTable[i]; - return 0; - } - - static QList<PaintCommandInfos> s_commandInfoTable; - static QList<QPair<QString,QStringList> > s_enumsTable; - static QMultiHash<QString, int> s_commandHash; -}; - -#endif // PAINTCOMMANDS_H diff --git a/tests/auto/other/lancelot/scripts/aliasing.qps b/tests/auto/other/lancelot/scripts/aliasing.qps deleted file mode 100644 index 59878f9c4d..0000000000 --- a/tests/auto/other/lancelot/scripts/aliasing.qps +++ /dev/null @@ -1,156 +0,0 @@ - -path_moveTo convexPath 25 0 -path_lineTo convexPath 50 50 -path_lineTo convexPath 25 25 -path_lineTo convexPath 0 50 -path_closeSubpath convexPath - -pixmap_load border.png pixmap - -setRenderHint LineAntialiasing false -translate 10 10 - -begin_block drawing - setPen black 1 - setBrush 7f7fff - drawPath convexPath - - setFont "monospace" 8 - setPen black - drawText 0 68 "QwErTy@" - - - setPen black 1 - setBrush 7f7fff - drawRect 0 80 10 5 - - setPen black 1 - setBrush noBrush - drawRect 20 80 10 5 - - setPen noPen - setBrush 7f7fff - drawRect 40 80 10 5 - - - setPen black 2 - setBrush 7f7fff - drawRect 0 90 10 5 - - setPen black 2 - setBrush noBrush - drawRect 20 90 10 5 - - setPen noPen - setBrush 7f7fff - drawRect 40 90 10 5 - - - setPen black 3 - setBrush 7f7fff - drawRect 0 100 10 5 - - setPen black 3 - setBrush noBrush - drawRect 20 100 10 5 - - setPen noPen - setBrush 7f7fff - drawRect 40 100 10 5 - - - setPen black 1 - setBrush noBrush - drawLine 10 110 20 120 - drawLine 30 120 40 110 - - setPen black 2 - setBrush noBrush - drawLine 10 120 20 130 - drawLine 30 130 40 120 - - setPen black 3 - setBrush noBrush - drawLine 10 130 20 140 - drawLine 30 140 40 130 - - drawPixmap pixmap 0 150 - - setRenderHint SmoothPixmapTransform false - drawPixmap pixmap 20 150 15 15 0 0 10 10 - -end_block - -translate 0 180 -setRenderHint LineAntialiasing true -repeat_block drawing -drawText 15 185 "0.0" - -resetMatrix -translate 70.2 10.2 -setRenderHint LineAntialiasing false -repeat_block drawing -translate 0 180 -setRenderHint LineAntialiasing true -repeat_block drawing -translate -0.2 -0.2 -drawText 15 185 "0.2" - - -resetMatrix -translate 130.4 10.4 -setRenderHint LineAntialiasing false -repeat_block drawing -translate 0 180 -setRenderHint LineAntialiasing true -repeat_block drawing -translate -0.4 -0.4 -drawText 15 185 "0.4" - - -resetMatrix -translate 190.5 10.5 -setRenderHint LineAntialiasing false -repeat_block drawing -translate 0 180 -setRenderHint LineAntialiasing true -repeat_block drawing -translate -0.5 -0.5 -drawText 15 185 "0.5" - - -resetMatrix -translate 250.6 10.6 -setRenderHint LineAntialiasing false -repeat_block drawing -translate 0 180 -setRenderHint LineAntialiasing true -repeat_block drawing -translate -0.6 -0.6 -drawText 15 185 "0.6" - - -resetMatrix -translate 310.8 10.8 -setRenderHint LineAntialiasing false -repeat_block drawing -translate 0 180 -setRenderHint LineAntialiasing true -repeat_block drawing -translate -0.8 -0.8 -drawText 15 185 "0.8" - - -resetMatrix -translate 371 11 -setRenderHint LineAntialiasing false -repeat_block drawing -translate 0 180 -setRenderHint LineAntialiasing true -repeat_block drawing -drawText 15 185 "1.0" - - -resetMatrix -drawText 430 95 "Aliased" -drawText 430 275 "Anti-Aliased"
\ No newline at end of file diff --git a/tests/auto/other/lancelot/scripts/arcs.qps b/tests/auto/other/lancelot/scripts/arcs.qps deleted file mode 100644 index 8afaf73ff1..0000000000 --- a/tests/auto/other/lancelot/scripts/arcs.qps +++ /dev/null @@ -1,68 +0,0 @@ -# Version: 1 -# CheckVsReference: 5 - -setRenderHint LineAntialiasing - -setPen red 0 - -drawEllipse 0 0 600 400 - -path_moveTo arcs 300 200 -path_arcTo arcs 0 0 600 400 0 10 -path_closeSubpath arcs - -path_moveTo arcs 300 200 -path_arcTo arcs 0 0 600 400 20 30 -path_closeSubpath arcs - -path_moveTo arcs 300 200 -path_arcTo arcs 0 0 600 400 60 45 -path_closeSubpath arcs - -path_moveTo arcs 300 200 -path_arcTo arcs 0 0 600 400 115 60 -path_closeSubpath arcs - -path_moveTo arcs 300 200 -path_arcTo arcs 0 0 600 400 180 90 -path_closeSubpath arcs - -path_moveTo arcs 590 200 -path_arcTo arcs 10 10 580 380 0 360 -path_closeSubpath arcs - -path_moveTo arcs 300 200 -path_arcTo arcs 20 20 560 360 0 -10 -path_closeSubpath arcs - -path_moveTo arcs 300 200 -path_arcTo arcs 20 20 560 360 -20 -30 -path_closeSubpath arcs - -path_moveTo arcs 300 200 -path_arcTo arcs 20 20 560 360 -60 -45 -path_closeSubpath arcs - -path_moveTo arcs 300 200 -path_arcTo arcs 20 20 560 360 -115 -60 -path_closeSubpath arcs - -path_moveTo arcs 300 200 -path_arcTo arcs 20 20 560 360 -180 -90 -path_closeSubpath arcs - -setPen black 1 solidline -setBrush #3f00ff00 -drawPath arcs - -# Then again with a matrix set... -translate 200 400 -rotate 10 -scale 0.5 0.5 -setPen red 0 -setBrush nobrush -drawEllipse 0 0 600 400 - -setPen black 1 solidline -setBrush #3f0000ff -drawPath arcs
\ No newline at end of file diff --git a/tests/auto/other/lancelot/scripts/arcs2.qps b/tests/auto/other/lancelot/scripts/arcs2.qps deleted file mode 100644 index a2739a8c97..0000000000 --- a/tests/auto/other/lancelot/scripts/arcs2.qps +++ /dev/null @@ -1,54 +0,0 @@ -# Version: 1 -# CheckVsReference: 5 - -drawArc 100 100 100 100 0 1440 -drawArc 100 100 100 100 1440 1440 -drawArc 100 100 100 100 2880 1440 -drawArc 100 100 100 100 4320 1440 - -drawArc 100 200 100 100 0 -1440 -drawArc 100 200 100 100 -1440 -1440 -drawArc 100 200 100 100 -2880 -1440 -drawArc 100 200 100 100 -4320 -1440 - -drawArc 200 100 100 100 720 1440 -drawArc 200 100 100 100 2160 1440 -drawArc 200 100 100 100 3600 1440 -drawArc 200 100 100 100 5040 1440 - -drawArc 200 200 100 100 -720 -1440 -drawArc 200 200 100 100 -2160 -1440 -drawArc 200 200 100 100 -3600 -1440 -drawArc 200 200 100 100 -5040 -1440 - - -drawArc 300 100 100 100 3840 480 -drawArc 300 200 100 100 -3840 -480 - -drawArc 300 100 100 100 1600 1340 - -setPen black -drawArc 400 100 200 200 0 5760 -setPen white -drawArc 400 100 200 200 960 960 -drawArc 400 100 200 200 2880 960 -drawArc 400 100 200 200 4800 960 - -setPen black -drawArc 100 350 300 300 160 5760 -drawArc 100 350 300 300 320 5760 -drawArc 100 350 300 300 1920 5760 -drawArc 100 350 300 300 2080 5760 -drawArc 100 350 300 300 3680 5760 -drawArc 100 350 300 300 3840 5760 -drawArc 100 350 300 300 5440 5760 -drawArc 100 350 300 300 5600 5760 -setPen white -drawArc 100 350 300 300 0 5760 - -translate 400 300 -setRenderHint Antialiasing true -setPen blue 40 -drawArc 100 100 200 200 0 4320 -setPen red 40 -drawArc 60 60 280 280 0 4320 diff --git a/tests/auto/other/lancelot/scripts/background.qps b/tests/auto/other/lancelot/scripts/background.qps deleted file mode 100644 index d1efe5c178..0000000000 --- a/tests/auto/other/lancelot/scripts/background.qps +++ /dev/null @@ -1,136 +0,0 @@ -# Version: 1 -# CheckVsReference: 5% - -translate 10 30 -setBackground 7f7fff -setBackgroundMode Transparent -setPen ff7f7f - -path_moveTo path 0 0 -path_lineTo path 25 0 -path_cubicTo path 50 0 25 25 25 50 -path_lineTo path 0 50 - -bitmap_load bitmap.png bitmap - -begin_block drawing - save - drawRect 0 0 50 50 - - translate 60 0 - drawEllipse 0 0 50 50 - - translate 60 0 - drawPolygon [0 0 50 0 25 50 25 25] - - translate 60 0 - drawPath path - - translate 60 0 - drawPie 0 0 50 50 1440 2000 - - translate 60 0 - drawChord 0 0 50 50 1440 2000 - - translate 60 0 - drawLine 0 0 50 0 - drawLine 0 0 50 50 - drawLine 0 0 0 50 - - translate 60 0 - drawPolyline [0 0 50 0 25 50 25 25] - - translate 60 0 - drawArc 0 0 50 50 1440 2000 - - translate 60 0 - drawText 0 10 "Jambi-Bambi" - - translate 80 0 - drawPixmap bitmap 0 0 - restore - - save - setRenderHint Antialiasing - translate 5 55 - drawRect 0 0 50 50 - - translate 60 0 - drawEllipse 0 0 50 50 - - translate 60 0 - drawPolygon [0 0 50 0 25 50 25 25] - - translate 60 0 - drawPath path - - translate 60 0 - drawPie 0 0 50 50 1440 2000 - - translate 60 0 - drawChord 0 0 50 50 1440 2000 - - translate 60 0 - drawLine 0 0 50 0 - drawLine 0 0 50 50 - drawLine 0 0 0 50 - - translate 60 0 - drawPolyline [0 0 50 0 25 50 25 25] - - translate 60 0 - drawArc 0 0 50 50 1440 2000 - - translate 60 0 - drawText 0 10 "Jambi-Bambi" - - translate 80 0 - drawPixmap bitmap 0 0 - restore -end_block - -translate 0 160 -setBackgroundMode Transparent -setPen ff7f7f 0 dotline flatcap beveljoin -repeat_block drawing - -translate 0 160 -setBackgroundMode Opaque -setPen ff7f7f 0 dotline flatcap beveljoin -repeat_block drawing - -translate 0 160 -setBackgroundMode Transparent -setPen ff7f7f 4 dashline flatcap beveljoin -repeat_block drawing - -translate 0 160 -setBackgroundMode OpaqueMode -setPen ff7f7f 4 dashline flatcap beveljoin -repeat_block drawing - -resetMatrix - -translate 5 5 - -setBrush nobrush -setPen black -setBackgroundMode transparent -drawText 10 15 "TransparentMode with solid 0-width pen" -drawRect 0 0 685 135 - -translate 0 160 -drawText 10 15 "TransparentMode with dotted 0-width pen" -drawRect 0 0 685 135 - -translate 0 160 -drawText 10 15 "OpaqueMode with dotted 0-width pen" -drawRect 0 0 685 135 - -translate 0 160 -drawText 10 15 "TransparentMode with dotted 4-width pen" -drawRect 0 0 685 135 - -translate 0 160 -drawText 10 15 "OpaqueMode with solid 4-width pen" -drawRect 0 0 685 135 diff --git a/tests/auto/other/lancelot/scripts/background_brush.qps b/tests/auto/other/lancelot/scripts/background_brush.qps deleted file mode 100644 index ca1f944964..0000000000 --- a/tests/auto/other/lancelot/scripts/background_brush.qps +++ /dev/null @@ -1,5 +0,0 @@ -# Version: 1 -# CheckVsReference: 5% - -setBrush #00ff00 crosspattern -import "background.qps"
\ No newline at end of file diff --git a/tests/auto/other/lancelot/scripts/beziers.qps b/tests/auto/other/lancelot/scripts/beziers.qps deleted file mode 100644 index 62d9d031a6..0000000000 --- a/tests/auto/other/lancelot/scripts/beziers.qps +++ /dev/null @@ -1,148 +0,0 @@ -# Version: 1 -# CheckVsReference: 5% - -setRenderHint LineAntialiasing - -setPen green 0 - -translate 20 20 -path_moveTo fullSize 0 0 -path_cubicTo fullSize 200 100 -100 100 100 0 - -path_moveTo fullSize 0 200 -path_cubicTo fullSize 0 100 100 100 100 200 - -path_moveTo fullSize 0 250 -path_cubicTo fullSize 50 200 50 200 100 250 -drawPath fullSize - -translate 110 0 -scale 10 10 -path_moveTo medSize 0 0 -path_cubicTo medSize 20 10 -10 10 10 0 - -path_moveTo medSize 0 20 -path_cubicTo medSize 0 10 10 10 10 20 - -path_moveTo medSize 0 25 -path_cubicTo medSize 5 20 5 20 10 25 -drawPath medSize - -resetMatrix -translate 240 20 -scale 100 100 -path_moveTo smallSize 0 0 -path_cubicTo smallSize 2 1 -1 1 1 0 - -path_moveTo smallSize 0 2 -path_cubicTo smallSize 0 1 1 1 1 2 - -path_moveTo smallSize 0 2.5 -path_cubicTo smallSize 0.5 2 0.5 2 1 2.5 -drawPath smallSize - -resetMatrix -translate 20 300 -drawPath medSize - -resetMatrix -translate 250 -100 -path_moveTo maxSize 0 500 -path_cubicTo maxSize 1000 0 -500 0 500 500 -drawPath maxSize - -setRenderHint Antialiasing off -resetMatrix - -path_moveTo path1 0 0 -path_cubicTo path1 10 10 0 10 10 0 - -path_moveTo path2 0 0 -path_cubicTo path2 15 15 -5 15 10 0 - -path_moveTo path3 0 0 -path_cubicTo path3 20 20 -10 20 10 0 - -path_moveTo path4 0 0 -path_cubicTo path4 0 5 10 10 0 15 - -path_moveTo path5 0 10 -path_cubicTo path5 10 10 -10 20 0 0 - -path_moveTo path6 0 0 -path_cubicTo path6 10 5 -10 10 0 15 - -setPen black 2 -setBrush nobrush - -translate 10 500 -scale 3 3 -begin_block paths -save -drawPath path1 -translate 20 0 -drawPath path2 -translate 20 0 -drawPath path3 -translate 20 0 -drawPath path4 -translate 20 0 -drawPath path5 -translate 20 0 -drawPath path6 -restore -end_block - -setPen nopen -setBrush black - -translate 0 20 -repeat_block paths - -setRenderHint Antialiasing - -setPen black 2 -setBrush nobrush - -translate 120 -20 -repeat_block paths - -setPen nopen -setBrush black - -translate 0 20 -repeat_block paths - -resetMatrix -path_moveTo miterPath 20 0 -path_cubicTo miterPath 20 20 0 0 1 0 -path_lineTo miterPath -1 -0.2 - -setBrush nobrush - -translate 50 660 -scale 5 5 - -setPen black 4 solidline flatcap miterjoin -drawPath miterPath -setPen red 0 -drawPath miterPath - -path_moveTo miterPath2 21 0.2 -path_lineTo miterPath2 19 0 -path_cubicTo miterPath2 20 0 0 20 0 0 - -translate 30 0 -setPen black 4 solidline flatcap miterjoin -drawPath miterPath2 -setPen red 0 -drawPath miterPath2 - -path_moveTo wonkyPath 0 0 -path_cubicTo wonkyPath 5 15 20 0 17 0 - -translate 30 0 -setPen black 4 solidline flatcap miterjoin -drawPath wonkyPath -setPen red 0 -drawPath wonkyPath diff --git a/tests/auto/other/lancelot/scripts/bitmaps.qps b/tests/auto/other/lancelot/scripts/bitmaps.qps deleted file mode 100644 index 4966490337..0000000000 --- a/tests/auto/other/lancelot/scripts/bitmaps.qps +++ /dev/null @@ -1,166 +0,0 @@ -# Version: 1 -# CheckVsReference: 5% - - -#setRenderHint SmoothPixmapTransform - -translate 10 50 -setBackground ff7f7f -setPen 3f3f9f - -bitmap_load dome_mono.png the_pixmap - -save - # Draw with opaque pen/bg in transparent/opaque mode - setBackgroundMode Transparent - drawPixmap the_pixmap 0 0 - setBackgroundMode Opaque - drawPixmap the_pixmap 110 0 - - translate 220 0 - - # Draw with alpha pen/bg in transparent/opaque mode - save - setBackground 7fff7f7f - setPen 7f3f3f9f - setBackgroundMode Transparent - drawPixmap the_pixmap 0 0 - setBackgroundMode Opaque - drawPixmap the_pixmap 110 0 - restore - - translate 220 0 - - # Draw with rotated opaque pen/bg in transparent/opaque mode - setBackgroundMode Transparent - save - translate 50 50 - rotate 10 - translate -50 -50 - drawPixmap the_pixmap 0 0 - restore - setBackgroundMode Opaque - translate 110 0 - save - translate 50 50 - rotate 10 - translate -50 -50 - drawPixmap the_pixmap 0 0 - restore -restore - -translate 0 150 - -save - setBackgroundMode Transparent - drawTiledPixmap the_pixmap 0 0 200 100 - setBackgroundMode Opaque - drawTiledPixmap the_pixmap 210 0 200 100 - - translate 440 -10 - save - rotate 10 - drawTiledPixmap the_pixmap 0 0 200 100 - restore -restore - -translate 0 150 -save - setBackgroundMode Transparent - drawTiledPixmap the_pixmap 0 0 200 100 10 20 - setBackgroundMode Opaque - drawTiledPixmap the_pixmap 210 0 200 100 10 20 - - translate 440 -10 - save - rotate 10 - drawTiledPixmap the_pixmap 0 0 200 100 10 20 - restore -restore - - -pixmap_setMask the_pixmap mask_100.png -drawPixmap the_pixmap 0 150 -setBackgroundMode Opaque -drawPixmap the_pixmap 110 150 - -translate 220 150 -save - translate 50 50 - rotate 10 - translate -50 -50 - setBackgroundMode Transparent - drawPixmap the_pixmap 0 0 -restore - -translate 110 0 -save - translate 50 50 - rotate 10 - translate -50 -50 - setBackgroundMode Opaque - drawPixmap the_pixmap 0 0 -restore - -resetMatrix -translate 10 650 -bitmap_load dome_mono.png the_bitmap -setBackgroundMode Transparent - -begin_block draw_subrected - drawPixmap the_bitmap 0 0 50 50 0 0 50 50 - drawPixmap the_bitmap 50 0 50 50 50 0 50 50 - drawPixmap the_bitmap 0 50 50 50 0 50 50 50 - drawPixmap the_bitmap 50 50 50 50 50 50 50 50 -end_block - -translate 110 0 -setBackgroundMode Opaque -repeat_block draw_subrected - -translate 110 0 -save - translate 20 -10 - rotate 10 - setBackgroundMode Transparent - repeat_block draw_subrected -restore - -translate 110 0 -save - translate 20 -10 - rotate 10 - setBackgroundMode Opaque - repeat_block draw_subrected -restore - -# Some helpful texts - -resetMatrix -setPen black -drawText 10 40 "Transparent" -drawText 120 40 "Opaque" -drawText 230 40 "Trans w/alpha" -drawText 340 40 "Opaque w/alpha" -drawText 450 40 "Trans w/xform" -drawText 560 40 "Opaque w/xform" - -drawText 10 190 "Transparent tiled" -drawText 220 190 "Opaque tiled" -drawText 440 190 "Opaque w/xform" - -drawText 10 340 "Transparent tiled w/offset" -drawText 220 340 "Opaque tiled w/offset" -drawText 440 340 "Opaque w/xform w/offset" - -drawText 10 490 "Trans masked" -drawText 120 490 "Opaque masked" -drawText 230 490 "masked w/xform" -drawText 340 490 "masked w/xform" - -drawText 10 640 "Subrected" -drawText 110 640 "Subrected opaque" -drawText 220 640 "subrect w/xform" -drawText 330 640 "subrect w/xform opaque" - - diff --git a/tests/auto/other/lancelot/scripts/borderimage.qps b/tests/auto/other/lancelot/scripts/borderimage.qps deleted file mode 100644 index ebd4f4d249..0000000000 --- a/tests/auto/other/lancelot/scripts/borderimage.qps +++ /dev/null @@ -1,120 +0,0 @@ -# Version: 1 -# CheckVsReference: 10% - -image_load borderimage.png borderimage -translate -128 -128 -begin_block draw_border -# top -drawImage borderimage 0 0 16 16 0 0 16 16 -drawImage borderimage 16 0 36 16 16 0 32 16 -drawImage borderimage 52 0 16 16 48 0 16 16 -# sides -drawImage borderimage 0 16 16 16 0 16 16 32 -drawImage borderimage 52 16 16 16 48 16 16 32 -#bottom -drawImage borderimage 0 32 16 16 0 48 16 16 -drawImage borderimage 16 32 36 16 16 48 32 16 -drawImage borderimage 52 32 16 16 48 48 16 16 -end_block draw_border -resetMatrix -begin_block draw_column -translate 1 1 -repeat_block draw_border -translate 0.1 64.1 -repeat_block draw_border -translate 0.1 64.1 -repeat_block draw_border -translate 0.1 64.1 -repeat_block draw_border -translate 0.1 64.1 -repeat_block draw_border -translate 0.1 64.1 -repeat_block draw_border -translate 0.1 64.1 -repeat_block draw_border -translate 0.1 64.1 -repeat_block draw_border -translate 0.1 64.1 -repeat_block draw_border -translate 0.1 64.1 -repeat_block draw_border -end_block draw_column -setRenderHint Antialiasing -resetMatrix -translate 72 0 -repeat_block draw_column -resetMatrix -scale 1.25 1.25 -translate 144 0 -repeat_block draw_border -resetMatrix -scale 1.25 1.25 -translate 246 0 -rotate 30 -repeat_block draw_border -setRenderHint SmoothPixmapTransform -resetMatrix -scale 1.25 1.25 -translate 144 120 -repeat_block draw_border -resetMatrix -scale 1.25 1.25 -translate 246 120 -rotate 30 -repeat_block draw_border -resetMatrix -translate 215 260 -scale 3.55 3.55 -rotate 30 -repeat_block draw_border -resetMatrix -setRenderHint SmoothPixmapTransform off -setRenderHint Antialiasing off -translate 480 627 -rotate 180 -repeat_block draw_column -resetMatrix -setRenderHint Antialiasing -translate 552 627 -rotate 180 -repeat_block draw_column -resetMatrix -setRenderHint Antialiasing off -translate 200.1 520.1 -begin_block one_pixel_border -drawImage borderimage 0 0 16 16 0 0 16 16 -drawImage borderimage 16 0 64 16 16 0 1 1 -drawImage borderimage 80 0 16 16 48 0 16 16 -drawImage borderimage 0 16 16 64 16 0 1 1 -drawImage borderimage 80 16 16 64 16 0 1 1 -drawImage borderimage 0 80 16 16 0 48 16 16 -drawImage borderimage 16 80 64 16 16 0 1 1 -drawImage borderimage 80 80 16 16 48 48 16 16 -end_block one_pixel_border -resetMatrix -translate 205.1 626.1 -scale 0.4 0.4 -repeat_block one_pixel_border -resetMatrix -translate 255.1 624.1 -scale 0.4 0.4 -rotate 10 -repeat_block one_pixel_border -resetMatrix -setPen red -drawRect 0 0 70 680 -drawText 10 670 "aa off" -drawRect 72 0 70 680 -drawText 80 670 "aa on" -drawRect 409 0 70 680 -drawText 419 650 "rot 180" -drawText 419 670 "aa off" -drawRect 481 0 70 680 -drawText 491 650 "rot 180" -drawText 491 670 "aa on" -drawRect 164 0 224 124 -drawText 174 114 "smoothpixmaptransform off" -drawRect 164 128 224 134 -drawText 174 252 "smoothpixmaptransform on" -drawRect 200 520 97 188 -drawText 210 698 "1x1 edges"
\ No newline at end of file diff --git a/tests/auto/other/lancelot/scripts/brush_pens.qps b/tests/auto/other/lancelot/scripts/brush_pens.qps deleted file mode 100644 index b9a2bc0ada..0000000000 --- a/tests/auto/other/lancelot/scripts/brush_pens.qps +++ /dev/null @@ -1,104 +0,0 @@ -# Version: 1 -# CheckVsReference: 5% - -path_addRect p 0 0 75 75 -path_addEllipse p 25 25 75 75 - -translate 10 10 - -begin_block setup_gradient - gradient_clearStops - gradient_appendStop 0 red - gradient_appendStop 0.1 blue - gradient_appendStop 0.2 yellow - gradient_appendStop 0.3 cyan - gradient_appendStop 0.4 magenta - gradient_appendStop 0.5 green - gradient_appendStop 0.6 black - gradient_appendStop 0.7 indianred - gradient_appendStop 0.8 white - gradient_appendStop 0.9 orange - gradient_appendStop 1 blue - gradient_setLinear 0 0 100 100 -end_block - -setPen brush 0 -setBrush nobrush - -begin_block drawing - save - drawLine 0 0 100 100 - - translate 0 100 - drawPath p - - translate 0 110 - drawRect 0 0 100 100 - - translate 0 110 - drawPolyline [0 0 100 0 50 50] - - drawPoint 40 40 - drawPoint 41 40 - drawPoint 42 40 - drawPoint 43 40 - drawPoint 44 40 - drawPoint 45 40 - drawPoint 46 40 - drawPoint 47 40 - drawPoint 48 40 - drawPoint 49 40 - drawPoint 50 40 - - restore -end_block - -save - translate 110 0 - save - setRenderHint Antialiasing - repeat_block drawing - restore - - setBrush dome_rgb32.png - setPen brush 0 - setBrush nobrush - - translate 110 0 - repeat_block drawing - - translate 110 0 - save - setRenderHint Antialiasing - repeat_block drawing - restore -restore - -translate 0 0 - -save - repeat_block setup_gradient - setPen brush 5 - setBrush nobrush - translate 0 350 - repeat_block drawing - - translate 110 0 - save - setRenderHint Antialiasing - repeat_block drawing - restore - - setBrush dome_rgb32.png - setPen brush 5 - setBrush nobrush - - translate 110 0 - repeat_block drawing - - translate 110 0 - save - setRenderHint Antialiasing - repeat_block drawing - restore -restore
\ No newline at end of file diff --git a/tests/auto/other/lancelot/scripts/brushes.qps b/tests/auto/other/lancelot/scripts/brushes.qps deleted file mode 100644 index 43a7843601..0000000000 --- a/tests/auto/other/lancelot/scripts/brushes.qps +++ /dev/null @@ -1,88 +0,0 @@ -# Version: 1 -# CheckVsReference: 5% - -# Fill the background -drawRect 0 0 width height - -setRenderHint Antialiasing -setRenderHint SmoothPixmapTransform - -translate 10 10 -# Draw all the pattern types as 40x40 rects using green, transparent background -begin_block drawrects -setBrush green Dense1Pattern -drawRect 0 0 40 40 -setBrush green Dense2Pattern -drawRect 40 0 40 40 -setBrush green Dense3Pattern -drawRect 80 0 40 40 -setBrush green Dense4Pattern -drawRect 120 0 40 40 -setBrush green Dense5Pattern -drawRect 160 0 40 40 -setBrush green Dense6Pattern -drawRect 200 0 40 40 -setBrush green Dense7Pattern -drawRect 240 0 40 40 -setBrush green HorPattern -drawRect 280 0 40 40 -setBrush green VerPattern -drawRect 320 0 40 40 -setBrush green CrossPattern -drawRect 360 0 40 40 -setBrush green BDiagPattern -drawRect 400 0 40 40 -setBrush green FDiagPattern -drawRect 440 0 40 40 -setBrush green DiagCrossPattern -drawRect 480 0 40 40 -setBrush green SolidPattern -drawRect 520 0 40 40 -setBrush green NoBrush -drawRect 560 0 40 40 -gradient_setLinear 0 0 0 40 -drawRect 600 0 40 40 -setBrush face.png -drawRect 640 0 80 40 -end_block - -# Switch to opaque mode -setBackground #7fff7f -setBackgroundMode OpaqueMode -translate 0 50 - -# Draw all the pattern types as 40x40 rects using green, opaque background -repeat_block drawrects - -translate 50 50 -rotate 10 - - -setBackgroundMode TransparentMode -repeat_block drawrects -setBackgroundMode OpaqueMode -translate 0 40 -repeat_block drawrects - - -setBrush dot.png -setPen nopen -resetMatrix -drawRect 0 200 50 50 -drawRect 50 200 50 50 - -setPen red -setBrushOrigin 0 250 -drawRect 0 250 50 50 -setBrushOrigin 50 250 -drawRect 50 250 50 50 - - -setBrush dome_indexed.png -setPen nopen -brushScale 0.7 0.7 -drawRect 20 320 600 200 - -setBrush dome_argb32.png -brushScale 1.5 1.5 -drawRect 20 540 600 200 diff --git a/tests/auto/other/lancelot/scripts/clippaths.qps b/tests/auto/other/lancelot/scripts/clippaths.qps deleted file mode 100644 index fe8e198a17..0000000000 --- a/tests/auto/other/lancelot/scripts/clippaths.qps +++ /dev/null @@ -1,60 +0,0 @@ -# Version: 1 -# CheckVsReference: 5% - -path_addRect hor 0 0 50 10 -path_addRect ver 0 0 10 50 - -translate 10 10 -setPen NoPen - -begin_block clipping -save - - setBrush 0x7f7fff - save - setClipPath hor - drawRect 0 0 100 100 - - setClipPath ver IntersectClip - setBrush black CrossPattern - drawRect 0 0 100 100 - restore - - translate 100 0 - save - setClipPath hor - drawRect 0 0 100 100 - - setClipPath ver ReplaceClip - setBrush black CrossPattern - drawRect 0 0 100 100 - restore - - translate 100 0 - save - setClipPath hor - drawRect 0 0 100 100 - - setClipPath ver UniteClip - setBrush black CrossPattern - drawRect 0 0 100 100 - restore - -restore -end_block - -translate 300 0 -setRenderHint Antialiasing -repeat_block clipping - -translate -300 100 -setRenderHint Antialiasing false -scale 1.2 1.2 -repeat_block clipping - -translate 300 0 -setRenderHint Antialiasing -setRenderHint SmoothPixmapTransform -repeat_block clipping - - diff --git a/tests/auto/other/lancelot/scripts/clipping.qps b/tests/auto/other/lancelot/scripts/clipping.qps deleted file mode 100644 index 3694ff2ba7..0000000000 --- a/tests/auto/other/lancelot/scripts/clipping.qps +++ /dev/null @@ -1,182 +0,0 @@ -# Version: 1 -# CheckVsReference: 5% - -region_addRect clip 50 0 90 190 -region_addRect clip 0 50 180 90 - -region_addRect clip2 30 30 60 60 - -region_addRect clip3 10 10 60 60 - -path_cubicTo path 90 0 50 50 90 90 -path_cubicTo path 0 90 50 50 0 0 - -path_addRect path2 0 0 90 90 -path_moveTo path2 90 45 -path_arcTo path2 0 0 90 90 0 -360 - -path_addRect emptypath 0 0 0 0 -region_addRect emptyregion 0 0 0 0 - -# Normal clip rect -setClipRect 0 0 50 150 -begin_block repaint -save -setBrush red -setPen nopen -resetMatrix -region_getClipRegion tmpclip -path_getClipPath tmpclippath -drawRect 0 0 width height -setBrush #3f0000ff -setClipRegion tmpclip -drawRect 0 0 width height -setClipPath tmpclippath -setBrush #3f00ff00 -drawRect 0 0 width height -restore -end_block - -# Rotated clip rect -translate 100 0 -rotate 10 -setClipRect 0 0 50 150 -repeat_block repaint - -# simple clip region -resetMatrix -translate 0 200 -setClipRegion clip -repeat_block repaint - -# simle rotated clip region -translate 250 -10 -rotate 10 -setClipRegion clip -repeat_block repaint - -# verify that clip is not xformed with painter -resetMatrix -translate 200 0 -setClipRegion clip -rotate 30 -setBrush red -setPen nopen -drawRect 0 0 width height - -resetMatrix -translate 0 400 -save -setClipRegion clip -setClipRegion clip2 IntersectClip -repeat_block repaint -translate 0 100 -rotate 10 -setClipRegion clip -setClipRegion clip2 IntersectClip -restore - -translate 100 0 -save -setClipRegion clip3 -setClipRegion clip2 UniteClip -repeat_block repaint -translate 0 100 -rotate 10 -setClipRegion clip3 -setClipRegion clip2 UniteClip -repeat_block repaint -restore - -translate 100 0 -save -setClipPath path -repeat_block repaint -translate 50 100 -rotate 45 -setClipPath path -repeat_block repaint -restore - -translate 100 0 -save -setClipPath path -setClipPath path2 IntersectClip -repeat_block repaint -translate 0 100 -rotate 10 -setClipPath path -setClipPath path2 IntersectClip -repeat_block repaint -restore - -translate 100 0 -save -setClipPath path -setClipPath path2 UniteClip -repeat_block repaint -translate 0 100 -rotate 10 -setClipPath path -setClipPath path2 UniteClip -repeat_block repaint -restore - -translate 100 0 -save -setClipPath path -setClipRegion clip3 IntersectClip -repeat_block repaint -translate 0 100 -rotate 10 -setClipRegion clip3 -setClipPath path IntersectClip -repeat_block repaint -restore - -translate 100 0 -save -setClipPath path -setClipRegion clip3 UniteClip -repeat_block repaint -translate 0 100 -rotate 10 -setClipRegion clip3 -setClipPath path UniteClip -repeat_block repaint -restore - -# test that an empty region is not drawn. -resetMatrix -setClipRegion emptyregion -setBrush #3f00ff00 -drawRect 0 0 300 300 -drawText 50 50 "Text should be clipped away by region" -setClipping false - -setClipPath emptypath -setBrush #3fffff00 -drawRect 50 50 300 300 -drawText 70 80 "Text should be clipped away by path" - -# Test that we can extract a clipregion when a matrix is set too -resetMatrix -translate 500 10 -scale 2 1 -setBrush blue -setClipping false -rotate 5 -drawRect 0 0 100 100 -setClipRect 0 0 100 100 -resetMatrix -rotate 10 -region_getClipRegion xclip -setClipRegion xclip -resetMatrix -setBrush #7f00ff00 -drawRect 0 0 width height - -# the below used to assert in debug mode -setClipRect 10 10 20 20 -setClipping false -setClipping true
\ No newline at end of file diff --git a/tests/auto/other/lancelot/scripts/clipping_state.qps b/tests/auto/other/lancelot/scripts/clipping_state.qps deleted file mode 100644 index a29d3738c8..0000000000 --- a/tests/auto/other/lancelot/scripts/clipping_state.qps +++ /dev/null @@ -1,47 +0,0 @@ -# Version: 1 -# CheckVsReference: 5% - -path_addRect path1 10 10 50 50 -path_addRect path2 30 30 50 50 -# enable/disable a clip path -setPen nopen -setBrush red -setClipPath path1 -setClipPath path2 UniteClip -drawRect 0 0 100 100 -setClipping false -setBrush #630000ff -drawRect 0 0 100 100 -setClipping true -setBrush #6300ff00 -drawRect 0 0 100 100 -# enable/disable noclip -translate 150 0 -setClipPath path1 NoClip -setClipping false -setBrush #630000ff -drawRect 0 0 100 100 -setClipping true -setBrush #6300ff00 -drawRect 25 25 50 50 -# enable/disable full clipping -translate 150 0 -path_addRect path3 0 0 10 10 -path_addRect path4 20 20 10 10 -setClipPath path3 -setClipPath path4 IntersectClip -setClipping false -setBrush #630000ff -drawRect 0 0 100 100 -setClipping true -setBrush #6300ff00 -drawRect 25 25 50 50 -# disable clipping followed by setClipRect -translate 150 0 -setClipRect 0 0 50 50 ReplaceClip -setClipping false -setBrush #630000ff -drawRect 0 0 100 100 -setClipRect 25 25 75 75 IntersectClip -setBrush #6300ff00 -drawRect 25 25 50 50
\ No newline at end of file diff --git a/tests/auto/other/lancelot/scripts/cliprects.qps b/tests/auto/other/lancelot/scripts/cliprects.qps deleted file mode 100644 index aa0367eccf..0000000000 --- a/tests/auto/other/lancelot/scripts/cliprects.qps +++ /dev/null @@ -1,59 +0,0 @@ -# Version: 1 -# CheckVsReference: 5% - - - -translate 10 10 -setPen NoPen - -begin_block clipping -save - - setBrush 0x7f7fff - save - setClipRect 0 0 50 10 - drawRect 0 0 100 100 - - setClipRect 0 0 10 50 IntersectClip - setBrush black CrossPattern - drawRect 0 0 100 100 - restore - - translate 100 0 - save - setClipRect 0 0 50 10 - drawRect 0 0 100 100 - - setClipRect 0 0 10 50 ReplaceClip - setBrush black CrossPattern - drawRect 0 0 100 100 - restore - - translate 100 0 - save - setClipRect 0 0 50 10 - drawRect 0 0 100 100 - - setClipRect 0 0 10 50 UniteClip - setBrush black CrossPattern - drawRect 0 0 100 100 - restore - -restore -end_block - -translate 300 0 -setRenderHint Antialiasing -repeat_block clipping - -translate -300 100 -setRenderHint Antialiasing false -scale 1.2 1.2 -repeat_block clipping - -translate 300 0 -setRenderHint Antialiasing -setRenderHint SmoothPixmapTransform -repeat_block clipping - - diff --git a/tests/auto/other/lancelot/scripts/conical_gradients.qps b/tests/auto/other/lancelot/scripts/conical_gradients.qps deleted file mode 100644 index d6eb860f3f..0000000000 --- a/tests/auto/other/lancelot/scripts/conical_gradients.qps +++ /dev/null @@ -1,85 +0,0 @@ -# Version: 1 -# CheckVsReference: 5% - -path_addRect path 300 0 80 80 -path_addEllipse path 340 40 60 60 - -setRenderHint Antialiasing - -setPen black - -begin_block gradients -gradient_clearStops -gradient_appendStop 0 red -gradient_appendStop 0.25 orange -gradient_appendStop 0.5 yellow -gradient_appendStop 0.8 green -gradient_appendStop 1 cyan - -gradient_setConical 40 40 50 -drawRect 0 0 100 100 - -gradient_setConical 140 40 230 -drawEllipse 100 0 100 100 - -gradient_clearStops -gradient_appendStop 0 3f7f7fff -gradient_appendStop 0.5 dfdfffff -gradient_appendStop 1 7f00007f - -gradient_setConical 240 40 50 -drawPolygon [200 0 290 0 250 99] - -gradient_setConical 340 40 230 -drawPath path - -end_block - -translate 0 100 -scale 1 2 -repeat_block gradients - -resetMatrix -translate 0 300 -brushTranslate 30 0 -brushScale 0.9 0.9 -brushRotate 20 -repeat_block gradients - -# Some helpful info perhaps? -resetMatrix -setPen black - -drawText 410 50 "No XForm" -drawText 410 200 "scale 1x2" -drawText 410 300 "brush transform" -drawText 10 450 "50 deg" -drawText 110 450 "230 deg" -drawText 210 450 "50 deg w/alpha " -drawText 310 450 "230 deg w/alpha" - -setPen 3f000000 -setBrush nobrush - -begin_block ellipse_draw - setClipRect 0 0 100 100 - drawEllipse 35 35 11 11 - save - translate 40 40 - rotate -50 - drawLine -100 0 100 0 - restore - translate 100 0 -end_block - -repeat_block ellipse_draw -repeat_block ellipse_draw -repeat_block ellipse_draw - -resetMatrix -translate 0 100 -scale 1 2 -repeat_block ellipse_draw -repeat_block ellipse_draw -repeat_block ellipse_draw -repeat_block ellipse_draw
\ No newline at end of file diff --git a/tests/auto/other/lancelot/scripts/conical_gradients_perspectives.qps b/tests/auto/other/lancelot/scripts/conical_gradients_perspectives.qps deleted file mode 100644 index a9c14f1ce7..0000000000 --- a/tests/auto/other/lancelot/scripts/conical_gradients_perspectives.qps +++ /dev/null @@ -1,64 +0,0 @@ -# Version: 1 -# CheckVsReference: 5% - - -setRenderHint Antialiasing - -setPen #00ff00 - -translate 10 10 -# standard draw -begin_block gradient -gradient_clearStops -gradient_appendStop 0 red -gradient_appendStop 0.25 orange -gradient_appendStop 0.5 yellow -gradient_appendStop 0.8 green -gradient_appendStop 0.9 cyan -gradient_appendStop 1 red - -gradient_setSpread PadSpread -gradient_setConical 140 140 100 -drawRect 0 0 300 300 -end_block gradient - -# Rotation w/o smooth xform -save -translate 350 0 -save - setRenderHint SmoothPixmapTransform on - mapQuadToQuad 0 0 0 300 300 300 300 0 0 50 0 200 300 300 300 0 - repeat_block gradient -restore -restore - -translate 0 320 - -save - setRenderHint SmoothPixmapTransform on - mapQuadToQuad 0 0 0 300 300 300 300 0 0 0 100 300 200 300 300 0 - repeat_block gradient -restore - -save -translate 350 0 -save - setRenderHint SmoothPixmapTransform on - mapQuadToQuad 0 0 0 300 300 300 300 0 0 0 0 300 300 250 300 50 - repeat_block gradient -restore -restore - - -resetMatrix -setPen black -translate 125 20 -drawText 0 0 "No transform" -translate 350 0 -drawText 0 0 "Left Tilted" -resetMatrix -translate 125 350 -drawText 0 0 "Bottom Tilted" -translate 350 0 -drawText 0 0 "Right Tilted" -translate 120 0
\ No newline at end of file diff --git a/tests/auto/other/lancelot/scripts/dashes.qps b/tests/auto/other/lancelot/scripts/dashes.qps deleted file mode 100644 index 185443a292..0000000000 --- a/tests/auto/other/lancelot/scripts/dashes.qps +++ /dev/null @@ -1,268 +0,0 @@ -# Version: 1 -# CheckVsReference: 5% - -translate 20 20 - -begin_block draw -save - save - setPen black 1 SolidLine FlatCap BevelJoin - drawPolyline [0 0 80 0 80 30 40 20 0 30] - translate 0 40 - setPen black 1 SolidLine SquareCap BevelJoin - drawPolyline [0 0 80 0 80 30 40 20 0 30] - translate 0 40 - setPen black 1 SolidLine RoundCap BevelJoin - drawPolyline [0 0 80 0 80 30 40 20 0 30] - translate 0 40 - - setPen black 2 SolidLine FlatCap BevelJoin - drawPolyline [0 0 80 0 80 30 40 20 0 30] - translate 0 40 - setPen black 2 SolidLine SquareCap BevelJoin - drawPolyline [0 0 80 0 80 30 40 20 0 30] - translate 0 40 - setPen black 2 SolidLine RoundCap BevelJoin - drawPolyline [0 0 80 0 80 30 40 20 0 30] - translate 0 40 - - setPen black 6 SolidLine FlatCap BevelJoin - drawPolyline [0 0 80 0 80 30 40 20 0 30] - translate 0 40 - setPen black 6 SolidLine SquareCap BevelJoin - drawPolyline [0 0 80 0 80 30 40 20 0 30] - translate 0 40 - setPen black 6 SolidLine RoundCap BevelJoin - drawPolyline [0 0 80 0 80 30 40 20 0 30] - translate 0 40 - restore - - - translate 100 0 - save - setPen black 1 DotLine FlatCap BevelJoin - drawPolyline [0 0 80 0 80 30 40 20 0 30] - translate 0 40 - setPen black 1 DotLine SquareCap BevelJoin - drawPolyline [0 0 80 0 80 30 40 20 0 30] - translate 0 40 - setPen black 1 DotLine RoundCap BevelJoin - drawPolyline [0 0 80 0 80 30 40 20 0 30] - translate 0 40 - - setPen black 2 DotLine FlatCap BevelJoin - drawPolyline [0 0 80 0 80 30 40 20 0 30] - translate 0 40 - setPen black 2 DotLine SquareCap BevelJoin - drawPolyline [0 0 80 0 80 30 40 20 0 30] - translate 0 40 - setPen black 2 DotLine RoundCap BevelJoin - drawPolyline [0 0 80 0 80 30 40 20 0 30] - translate 0 40 - - setPen black 6 DotLine FlatCap BevelJoin - drawPolyline [0 0 80 0 80 30 40 20 0 30] - translate 0 40 - setPen black 6 DotLine SquareCap BevelJoin - drawPolyline [0 0 80 0 80 30 40 20 0 30] - translate 0 40 - setPen black 6 DotLine RoundCap BevelJoin - drawPolyline [0 0 80 0 80 30 40 20 0 30] - translate 0 40 - restore - - translate 100 0 - save - setPen black 1 DashLine FlatCap BevelJoin - drawPolyline [0 0 80 0 80 30 40 20 0 30] - translate 0 40 - setPen black 1 DashLine SquareCap BevelJoin - drawPolyline [0 0 80 0 80 30 40 20 0 30] - translate 0 40 - setPen black 1 DashLine RoundCap BevelJoin - drawPolyline [0 0 80 0 80 30 40 20 0 30] - translate 0 40 - - setPen black 2 DashLine FlatCap BevelJoin - drawPolyline [0 0 80 0 80 30 40 20 0 30] - translate 0 40 - setPen black 2 DashLine SquareCap BevelJoin - drawPolyline [0 0 80 0 80 30 40 20 0 30] - translate 0 40 - setPen black 2 DashLine RoundCap BevelJoin - drawPolyline [0 0 80 0 80 30 40 20 0 30] - translate 0 40 - - setPen black 6 DashLine FlatCap BevelJoin - drawPolyline [0 0 80 0 80 30 40 20 0 30] - translate 0 40 - setPen black 6 DashLine SquareCap BevelJoin - drawPolyline [0 0 80 0 80 30 40 20 0 30] - translate 0 40 - setPen black 6 DashLine RoundCap BevelJoin - drawPolyline [0 0 80 0 80 30 40 20 0 30] - translate 0 40 - restore - - translate 100 0 - - save - setPen black 1 DashDotLine FlatCap BevelJoin - drawPolyline [0 0 80 0 80 30 40 20 0 30] - translate 0 40 - setPen black 1 DashDotLine SquareCap BevelJoin - drawPolyline [0 0 80 0 80 30 40 20 0 30] - translate 0 40 - setPen black 1 DashDotLine RoundCap BevelJoin - drawPolyline [0 0 80 0 80 30 40 20 0 30] - translate 0 40 - - setPen black 2 DashDotLine FlatCap BevelJoin - drawPolyline [0 0 80 0 80 30 40 20 0 30] - translate 0 40 - setPen black 2 DashDotLine SquareCap BevelJoin - drawPolyline [0 0 80 0 80 30 40 20 0 30] - translate 0 40 - setPen black 2 DashDotLine RoundCap BevelJoin - drawPolyline [0 0 80 0 80 30 40 20 0 30] - translate 0 40 - - setPen black 6 DashDotLine FlatCap BevelJoin - drawPolyline [0 0 80 0 80 30 40 20 0 30] - translate 0 40 - setPen black 6 DashDotLine SquareCap BevelJoin - drawPolyline [0 0 80 0 80 30 40 20 0 30] - translate 0 40 - setPen black 6 DashDotLine RoundCap BevelJoin - drawPolyline [0 0 80 0 80 30 40 20 0 30] - translate 0 40 - restore - - translate 100 0 - - save - setPen black 1 DashDotDotLine FlatCap BevelJoin - drawPolyline [0 0 80 0 80 30 40 20 0 30] - translate 0 40 - setPen black 1 DashDotDotLine SquareCap BevelJoin - drawPolyline [0 0 80 0 80 30 40 20 0 30] - translate 0 40 - setPen black 1 DashDotDotLine RoundCap BevelJoin - drawPolyline [0 0 80 0 80 30 40 20 0 30] - translate 0 40 - - setPen black 2 DashDotDotLine FlatCap BevelJoin - drawPolyline [0 0 80 0 80 30 40 20 0 30] - translate 0 40 - setPen black 2 DashDotDotLine SquareCap BevelJoin - drawPolyline [0 0 80 0 80 30 40 20 0 30] - translate 0 40 - setPen black 2 DashDotDotLine RoundCap BevelJoin - drawPolyline [0 0 80 0 80 30 40 20 0 30] - translate 0 40 - - setPen black 4 DashDotDotLine FlatCap BevelJoin - drawPolyline [0 0 80 0 80 30 40 20 0 30] - translate 0 40 - setPen black 4 DashDotDotLine SquareCap BevelJoin - drawPolyline [0 0 80 0 80 30 40 20 0 30] - translate 0 40 - setPen black 4 DashDotDotLine RoundCap BevelJoin - drawPolyline [0 0 80 0 80 30 40 20 0 30] - translate 0 40 - restore - - translate 100 0 - - save - setPen black 1 SolidLine FlatCap BevelJoin - pen_setDashPattern [1 4 9 4 27 4] - drawPolyline [0 0 80 0 80 30 40 20 0 30] - translate 0 40 - setPen black 1 SolidLine SquareCap BevelJoin - pen_setDashPattern [1 4 9 4 27 4] - drawPolyline [0 0 80 0 80 30 40 20 0 30] - translate 0 40 - setPen black 1 SolidLine RoundCap BevelJoin - pen_setDashPattern [1 4 9 4 27 4] - drawPolyline [0 0 80 0 80 30 40 20 0 30] - translate 0 40 - - setPen black 2 SolidLine FlatCap BevelJoin - pen_setDashPattern [1 4 9 4 27 4] - drawPolyline [0 0 80 0 80 30 40 20 0 30] - translate 0 40 - setPen black 2 SolidLine SquareCap BevelJoin - pen_setDashPattern [1 4 9 4 27 4] - drawPolyline [0 0 80 0 80 30 40 20 0 30] - translate 0 40 - setPen black 2 SolidLine RoundCap BevelJoin - pen_setDashPattern [1 4 9 4 27 4] - drawPolyline [0 0 80 0 80 30 40 20 0 30] - translate 0 40 - - setPen black 4 SolidLine FlatCap BevelJoin - pen_setDashPattern [1 4 9 4 27 4] - drawPolyline [0 0 80 0 80 30 40 20 0 30] - translate 0 40 - setPen black 4 SolidLine SquareCap BevelJoin - pen_setDashPattern [1 4 9 4 27 4] - drawPolyline [0 0 80 0 80 30 40 20 0 30] - translate 0 40 - setPen black 4 SolidLine RoundCap BevelJoin - pen_setDashPattern [1 4 9 4 27 4] - drawPolyline [0 0 80 0 80 30 40 20 0 30] - translate 0 40 - restore - -restore -end_block - -translate 0 400 -setRenderHint Antialiasing -repeat_block draw - -translate 0 -20 -drawText 30 0 "Solid" - -translate 100 0 -drawText 20 0 "DotLine" - -translate 100 0 -drawText 10 0 "DashLine" - -translate 100 0 -drawText 0 0 "DashDotLine" - -translate 100 0 -drawText 0 0 "DashDotDotLine" - -translate 100 0 -drawText 0 0 "CustomDashLine" - -resetMatrix - -translate 620 40 - -begin_block width_and_caps_texts - drawText 0 0 "Width=1, FlatCap" - translate 0 40 - drawText 0 0 "Width=1, SquareCap" - translate 0 40 - drawText 0 0 "Width=1, RoundCap" - translate 0 40 - drawText 0 0 "Width=2, FlatCap" - translate 0 40 - drawText 0 0 "Width=2, SquareCap" - translate 0 40 - drawText 0 0 "Width=2, RoundCap" - translate 0 40 - drawText 0 0 "Width=6, FlatCap" - translate 0 40 - drawText 0 0 "Width=6, SqareCap" - translate 0 40 - drawText 0 0 "Width=6, RoundCap" -end_block - -translate 0 80 -repeat_block width_and_caps_texts
\ No newline at end of file diff --git a/tests/auto/other/lancelot/scripts/degeneratebeziers.qps b/tests/auto/other/lancelot/scripts/degeneratebeziers.qps deleted file mode 100644 index 948968b0cd..0000000000 --- a/tests/auto/other/lancelot/scripts/degeneratebeziers.qps +++ /dev/null @@ -1,47 +0,0 @@ -# Version: 1 -# CheckVsReference: 5% - -path_moveTo degenerate 3427.0918499999997948 3872.1318999999998596 -path_cubicTo degenerate 3427.0918499999997948 3872.1318999999994048 4729.4590867905308187 5176.8613451144155988 5389.9325499999995372 5837.8072499999998399 - -scale 0.05 0.05 -translate -2500 -3000 -setPen black 800 -drawPath degenerate - -resetMatrix -path_moveTo revbez 0 20 -path_cubicTo revbez 0 0 120 0 120 -20 - -path_moveTo revbez 0 80 -path_cubicTo revbez 0 100 120 100 120 120 - -translate 50 250 - -setPen blue 40 solidline flatcap -drawPath revbez -setPen red 0 -drawPath revbez - -translate 200 0 -setPen blue 40 solidline squarecap -drawPath revbez -setPen red 0 -drawPath revbez - -translate 200 0 -setPen blue 40 solidline roundcap -drawPath revbez -setPen red 0 -drawPath revbez - -resetMatrix -path_lineTo tightJoin 60 10 -path_cubicTo tightJoin 50 0 100 0 100 50 - -translate 50 500 - -setPen green 40 solidline roundcap roundjoin -drawPath tightJoin -setPen red 0 -drawPath tightJoin diff --git a/tests/auto/other/lancelot/scripts/deviceclipping.qps b/tests/auto/other/lancelot/scripts/deviceclipping.qps deleted file mode 100644 index 8608a50994..0000000000 --- a/tests/auto/other/lancelot/scripts/deviceclipping.qps +++ /dev/null @@ -1,48 +0,0 @@ -# Version: 1 -# CheckVsReference: 5% - -setBrush 0xff7f7f -setPen 0x7f0000 - -path_moveTo path -1000000 10000 -path_cubicTo path 100 100 100 150 150 400 -path_closeSubpath path - -begin_block drawing - - drawPath ellipse - - drawLine -1000000 200 200 200 - drawLine 200 -1000000 200 200 - drawLine 200 200 1000000 200 - drawLine 200 200 200 1000000 - drawLine -1000000 -1000000 200 200 - - drawPolygon [-1000000 100 100 -1000000 100 100] - drawRect 300 -500000 1000000 1000000 - - drawPath path - -end_block - -save -translate 20 20 -setBrush #0x7f7f7fff -setPen #0x7f00007f -repeat_block drawing - -translate 20 20 -setRenderHint Antialiasing -setBrush #0x7f7fff7f -setPen #0x7f007f00 -repeat_block drawing -restore - -setPen 0x00007f 2 -setRenderHint Antialiasing - -drawLine 0 -200 200 200 - -setPen 0x007f00 10 - -drawLine 0 -200 200 0
\ No newline at end of file diff --git a/tests/auto/other/lancelot/scripts/drawpoints.qps b/tests/auto/other/lancelot/scripts/drawpoints.qps deleted file mode 100644 index c02cd85737..0000000000 --- a/tests/auto/other/lancelot/scripts/drawpoints.qps +++ /dev/null @@ -1,101 +0,0 @@ -# Version: 1 -# CheckVsReference: 5% - -#setRenderHint Antialiasing - -setPen red 0 solidline -begin_block points -drawPoint 00 00 -drawPoint 10 00 -drawPoint 20 00 -drawPoint 30 00 -drawPoint 40 00 -drawPoint 50 00 -drawPoint 00 10 -drawPoint 10 10 -drawPoint 20 10 -drawPoint 30 10 -drawPoint 40 10 -drawPoint 50 10 -drawPoint 00 20 -drawPoint 10 20 -drawPoint 20 20 -drawPoint 30 20 -drawPoint 40 20 -drawPoint 50 20 -drawPoint 00 30 -drawPoint 10 30 -drawPoint 20 30 -drawPoint 30 30 -drawPoint 40 30 -drawPoint 50 30 -drawPoint 00 40 -drawPoint 10 40 -drawPoint 20 40 -drawPoint 30 40 -drawPoint 40 40 -drawPoint 50 40 -drawPoint 00 50 -drawPoint 10 50 -drawPoint 20 50 -drawPoint 30 50 -drawPoint 40 50 -drawPoint 50 50 -end_block points - -translate 100 0 -setPen blue 1 solidline -repeat_block points - -translate 100 0 -setPen green 5 solidline roundcap -repeat_block points - -resetMatrix - -translate 0 100 -scale 3 3 -setPen red 0 solidline roundcap -repeat_block points - -translate 60 0 -setPen blue 1 solidline roundcap -repeat_block points - -translate 60 0 -setPen green 5 solidline roundcap -repeat_block points - -resetMatrix - -translate 0 300 -scale 3 3 -setPen red 0 solidline flatcap -repeat_block points - -translate 60 0 -setPen blue 1 solidline flatcap -repeat_block points - -translate 60 0 -setPen green 5 solidline flatcap -repeat_block points - -resetMatrix -translate 10 500 -setPen black 1 solidline flatcap -drawPoint 0 0 -setPen black 2 solidline flatcap -drawPoint 3 0 -setPen black 3 solidline flatcap -drawPoint 8 0 -setPen black 4 solidline flatcap -drawPoint 15 0 -setPen black 5 solidline flatcap -drawPoint 24 0 -setPen black 6 solidline flatcap -drawPoint 35 0 -setPen black 7 solidline flatcap -drawPoint 48 0 -setPen black 8 solidline flatcap -drawPoint 63 0
\ No newline at end of file diff --git a/tests/auto/other/lancelot/scripts/ellipses.qps b/tests/auto/other/lancelot/scripts/ellipses.qps deleted file mode 100644 index e2cffd7f27..0000000000 --- a/tests/auto/other/lancelot/scripts/ellipses.qps +++ /dev/null @@ -1,86 +0,0 @@ -# Version: 1 -# CheckVsReference: 5% - - -surface_begin 0 0 600 600 -translate 0 50 - -setPen nopen -setBrush 0x7f000000 -gradient_clearStops -gradient_appendStop 0 red -gradient_appendStop 0.25 orange -gradient_appendStop 0.5 yellow -gradient_appendStop 0.8 green -gradient_appendStop 1 cyan - -gradient_setSpread PadSpread -gradient_setRadial 20 20 220 200 - -drawEllipse 10 10 80 80 -drawEllipse 50 50 120 90 - -translate 100 0 -brushTranslate 40 20 -brushScale 0.25 0.25 - -setPen black - -drawEllipse 10 10 80 80 -setOpacity 0.5 -setCompositionMode SourceIn -drawEllipse 50 50 120 90 -setOpacity 1.0 -setRenderHint Antialiasing -setCompositionMode Xor -brushTranslate 70 0 -translate 100 0 -drawEllipse 10 10 80 80 - -setPen nopen -drawEllipse 50 50 120 90 - -setOpacity 0.7 -setBrush red -translate 100 0 -setCompositionMode SourceOver - -drawEllipse 10 10 80 80 - -setOpacity 0.6 -setPen black 5.0 -gradient_clearStops -gradient_appendStop 0 red -gradient_appendStop 0.25 orange -gradient_appendStop 0.5 yellow -gradient_appendStop 0.8 green -gradient_appendStop 1 cyan - -gradient_setSpread PadSpread -gradient_setLinear 20 20 120 100 -drawEllipse 50 50 120 90 - - -translate 100 0 - -setOpacity 1.0 -drawEllipse 10 10 80 80 - -setCompositionMode SourceIn -setOpacity 0.7 -setPen black 3.0 -gradient_clearStops -gradient_appendStop 0 red -gradient_appendStop 0.25 orange -gradient_appendStop 0.5 yellow -gradient_appendStop 0.8 green -gradient_appendStop 1 cyan - -gradient_setSpread PadSpread -gradient_setLinear 50 50 80 90 -drawEllipse 50 50 120 90 - -surface_end - -drawText 200 220 "Testing Ellipse drawing with varios combinations" -drawText 200 240 "of features such as brushes, pens and composition modes"
\ No newline at end of file diff --git a/tests/auto/other/lancelot/scripts/fillrect.qps b/tests/auto/other/lancelot/scripts/fillrect.qps deleted file mode 100644 index 103ef2646a..0000000000 --- a/tests/auto/other/lancelot/scripts/fillrect.qps +++ /dev/null @@ -1,121 +0,0 @@ -setRenderHint Antialiasing false - -# offscreen -translate 0 -200 - -begin_block rects -# int API -fillRect 10 10 20 20 green -fillRect 40 10 20 20 -drawRect 70 10 20 20 - -# float API, int values -fillRectF 10.0 40.0 20.0 20.0 green -fillRectF 40.0 40.0 20.0 20.0 -drawRect 70.0 40.0 20.0 20.0 - -# float API, float values -fillRectF 10.0 70.0 20.5 20.5 green -fillRectF 40.0 70.0 20.5 20.5 -drawRect 70.0 70.0 20.5 20.5 - -# alignment, int api, color -fillRect 10 100 10 10 green -fillRect 20 100 10 10 green -fillRect 10 110 10 10 green -fillRect 20 110 10 10 green - -# alignment, int api, brush -fillRect 40 100 10 10 -fillRect 50 100 10 10 -fillRect 40 110 10 10 -fillRect 50 110 10 10 - -# alignment comparison -drawRect 70 100 10 10 -drawRect 80 100 10 10 -drawRect 70 110 10 10 -drawRect 80 110 10 10 - -# alignment, float api, color -fillRectF 10.0 130.0 10.0 10.0 green -fillRectF 20.0 130.0 10.0 10.0 green -fillRectF 10.0 140.0 10.0 10.0 green -fillRectF 20.0 140.0 10.0 10.0 green - -# alignment, float api, brush -fillRectF 40.0 130.0 10.0 10.0 -fillRectF 50.0 130.0 10.0 10.0 -fillRectF 40.0 140.0 10.0 10.0 -fillRectF 50.0 140.0 10.0 10.0 - -# alignment comparison -drawRect 70.0 130.0 10.0 10.0 -drawRect 80.0 130.0 10.0 10.0 -drawRect 70.0 140.0 10.0 10.0 -drawRect 80.0 140.0 10.0 10.0 - -end_block - -begin_block row - -repeat_block rects - -save -translate 100.2 0.2 -repeat_block rects -restore - -save -translate 200.5 0.5 -repeat_block rects -restore - -save -translate 300.7 0.7 -repeat_block rects -restore - -end_block - -# end of block defs - -resetMatrix - -setPen NoPen -setBrush green -repeat_block row - -save -translate 500 50 -scale 0.42 0.42 -repeat_block row -restore - -save -translate 0 160 -scale 1.8 0.8 -repeat_block row -restore - -save -translate 650 320 -rotate 80 -repeat_block row -restore - -save -setBrush green Dense2Pattern -translate 0 400 -repeat_block row -restore - -save -gradient_clearStops -gradient_appendStop 0 green -gradient_appendStop 1 blue -gradient_setCoordinateMode ObjectBoundingMode -gradient_setLinear 0.0 0.0 1.0 1.0 -translate 0 600 -repeat_block row -restore diff --git a/tests/auto/other/lancelot/scripts/fillrect_aa.qps b/tests/auto/other/lancelot/scripts/fillrect_aa.qps deleted file mode 100644 index 3232899661..0000000000 --- a/tests/auto/other/lancelot/scripts/fillrect_aa.qps +++ /dev/null @@ -1,121 +0,0 @@ -setRenderHint Antialiasing true - -# offscreen -translate 0 -200 - -begin_block rects -# int API -fillRect 10 10 20 20 green -fillRect 40 10 20 20 -drawRect 70 10 20 20 - -# float API, int values -fillRectF 10.0 40.0 20.0 20.0 green -fillRectF 40.0 40.0 20.0 20.0 -drawRect 70.0 40.0 20.0 20.0 - -# float API, float values -fillRectF 10.0 70.0 20.5 20.5 green -fillRectF 40.0 70.0 20.5 20.5 -drawRect 70.0 70.0 20.5 20.5 - -# alignment, int api, color -fillRect 10 100 10 10 green -fillRect 20 100 10 10 green -fillRect 10 110 10 10 green -fillRect 20 110 10 10 green - -# alignment, int api, brush -fillRect 40 100 10 10 -fillRect 50 100 10 10 -fillRect 40 110 10 10 -fillRect 50 110 10 10 - -# alignment comparison -drawRect 70 100 10 10 -drawRect 80 100 10 10 -drawRect 70 110 10 10 -drawRect 80 110 10 10 - -# alignment, float api, color -fillRectF 10.0 130.0 10.0 10.0 green -fillRectF 20.0 130.0 10.0 10.0 green -fillRectF 10.0 140.0 10.0 10.0 green -fillRectF 20.0 140.0 10.0 10.0 green - -# alignment, float api, brush -fillRectF 40.0 130.0 10.0 10.0 -fillRectF 50.0 130.0 10.0 10.0 -fillRectF 40.0 140.0 10.0 10.0 -fillRectF 50.0 140.0 10.0 10.0 - -# alignment comparison -drawRect 70.0 130.0 10.0 10.0 -drawRect 80.0 130.0 10.0 10.0 -drawRect 70.0 140.0 10.0 10.0 -drawRect 80.0 140.0 10.0 10.0 - -end_block - -begin_block row - -repeat_block rects - -save -translate 100.2 0.2 -repeat_block rects -restore - -save -translate 200.5 0.5 -repeat_block rects -restore - -save -translate 300.7 0.7 -repeat_block rects -restore - -end_block - -# end of block defs - -resetMatrix - -setPen NoPen -setBrush green -repeat_block row - -save -translate 500 50 -scale 0.42 0.42 -repeat_block row -restore - -save -translate 0 160 -scale 1.8 0.8 -repeat_block row -restore - -save -translate 650 320 -rotate 80 -repeat_block row -restore - -save -setBrush green Dense2Pattern -translate 0 400 -repeat_block row -restore - -save -gradient_clearStops -gradient_appendStop 0 green -gradient_appendStop 1 blue -gradient_setCoordinateMode ObjectBoundingMode -gradient_setLinear 0.0 0.0 1.0 1.0 -translate 0 600 -repeat_block row -restore diff --git a/tests/auto/other/lancelot/scripts/filltest.qps b/tests/auto/other/lancelot/scripts/filltest.qps deleted file mode 100644 index 112ffc85be..0000000000 --- a/tests/auto/other/lancelot/scripts/filltest.qps +++ /dev/null @@ -1,413 +0,0 @@ -# Version: 1 -# CheckVsReference: 5% - -setPen nopen -setBrush red -translate 0 4 -begin_block polys -drawPolygon [0 0 2 -2 4 0] -drawPolygon [0 2 2 4 4 2] -end_block polys -translate 6 .5 -repeat_block polys -translate 6.5 0 -repeat_block polys -translate 6 .5 -repeat_block polys - -resetMatrix - -translate 0 12 -setPen black -drawPolygon [0 0 5 0 5 5 0 5] - -translate 10 0 -setPen nopen -drawPolygon [0 0 5 0 5 5 0 5] - -translate 10 0 -drawPolygon [0 0 5 0 5 5 0 5] - -setBrush black -path_addRect stroke -.5 -.5 6 6 -path_addRect stroke .5 .5 4 4 -drawPath stroke - -resetMatrix - -translate 0 65 - -setPen red -drawText 0 0 "path" -drawText 40 0 "rect" -drawText 80 0 "img" -drawText 120 0 "pix" -drawText 160 0 "brush" -setPen nopen - -translate 0 5 - -image_load border.png img -pixmap_load border.png pix - -path_addRect rect 0 0 10 10 -begin_block rects -drawPath rect -drawRect 40 0 10 10 -drawImage img 80 0 -drawPixmap pix 120 0 -setBrush border.png -drawRect 160 0 10 10 -setBrush black -end_block rects - -setPen red -drawText 180 10 "0.0" -setPen nopen - -translate 0.1 20 -repeat_block rects -setPen red -drawText 180 10 "0.1" -setPen nopen -translate 0.1 20 -repeat_block rects -setPen red -drawText 180 10 "0.2" -setPen nopen -translate 0.1 20 -repeat_block rects -setPen red -drawText 180 10 "0.3" -setPen nopen -translate 0.1 20 -repeat_block rects -setPen red -drawText 180 10 "0.4" -setPen nopen -translate 0.1 20 -repeat_block rects -setPen red -drawText 180 10 "0.5" -setPen nopen -translate 0.1 20 -repeat_block rects -setPen red -drawText 180 10 "0.6" -setPen nopen -translate 0.1 20 -repeat_block rects -setPen red -drawText 180 10 "0.7" -setPen nopen -translate 0.1 20 -repeat_block rects -setPen red -drawText 180 10 "0.8" -setPen nopen -translate 0.1 20 -repeat_block rects -setPen red -drawText 180 10 "0.9" -setPen nopen -translate 0.1 20 -repeat_block rects -setPen red -drawText 180 10 "1.0" -setPen nopen - -resetMatrix - -translate 0 400 - -setPen red -drawText 0 10 "path" -drawText 0 30 "rect" -drawText 0 50 "img" -drawText 0 70 "pix" -drawText 0 90 "brush" -drawText 0 110 "stroke" -drawText 0 130 "scale" -drawText 0 170 "rotate" -setPen nopen - -translate 50 0 - -begin_block rects2 -drawPath rect -drawRect 0 20 10 10 -drawImage img 0 40 -drawPixmap pix 0 60 -save -setBrush border.png -drawRect 0 80 10 10 -translate 0 100 -setBrush red -setPen black -drawRect 0 0 10 10 -setBrush border.png -setPen nopen -translate 0 20 -scale 2 2 -drawRect 0 0 10 10 -translate 10 20 -rotate 90 -drawRect 0 0 10 10 -restore -end_block rects2 - -setPen red -drawText -5 -10 "0.0" -setPen nopen - -translate 40 0.1 -repeat_block rects2 -setPen red -drawText -5 -10 "0.1" -setPen nopen -translate 40 0.1 -repeat_block rects2 -setPen red -drawText -5 -10 "0.2" -setPen nopen -translate 40 0.1 -repeat_block rects2 -setPen red -drawText -5 -10 "0.3" -setPen nopen -translate 40 0.1 -repeat_block rects2 -setPen red -drawText -5 -10 "0.4" -setPen nopen -translate 40 0.1 -repeat_block rects2 -setPen red -drawText -5 -10 "0.5" -setPen nopen -translate 40 0.1 -repeat_block rects2 -setPen red -drawText -5 -10 "0.6" -setPen nopen -translate 40 0.1 -repeat_block rects2 -setPen red -drawText -5 -10 "0.7" -setPen nopen -translate 40 0.1 -repeat_block rects2 -setPen red -drawText -5 -10 "0.8" -setPen nopen -translate 40 0.1 -repeat_block rects2 -setPen red -drawText -5 -10 "0.9" -setPen nopen -translate 40 0.1 -repeat_block rects2 -setPen red -drawText -5 -10 "1.0" -setPen nopen - -resetMatrix - -translate 0 620 - -setPen red -drawText 0 10 "path" -setPen nopen - -path_addRect rect2 -5 -5 10 10 - -translate 55 5 -drawPath rect2 - -translate 20 0 -rotate 10 -drawPath rect2 -rotate -10 -translate 20 0 -rotate 20 -drawPath rect2 -rotate -20 -translate 20 0 -rotate 30 -drawPath rect2 -rotate -30 -translate 20 0 -rotate 40 -drawPath rect2 -rotate -40 -translate 20 0 -rotate 50 -drawPath rect2 -rotate -50 -translate 20 0 -rotate 60 -drawPath rect2 -rotate -60 -translate 20 0 -rotate 70 -drawPath rect2 -rotate -70 -translate 20 0 -rotate 80 -drawPath rect2 -rotate -80 -translate 20 0 -rotate 90 -drawPath rect2 -rotate -90 - -resetMatrix - -translate 0 600 - -setPen red -drawText 0 10 "rect" -setPen nopen - -translate 55 5 -drawRect -5 -5 10 10 - -translate 20 0 -rotate 10 -drawRect -5 -5 10 10 -rotate -10 -translate 20 0 -rotate 20 -drawRect -5 -5 10 10 -rotate -20 -translate 20 0 -rotate 30 -drawRect -5 -5 10 10 -rotate -30 -translate 20 0 -rotate 40 -drawRect -5 -5 10 10 -rotate -40 -translate 20 0 -rotate 50 -drawRect -5 -5 10 10 -rotate -50 -translate 20 0 -rotate 60 -drawRect -5 -5 10 10 -rotate -60 -translate 20 0 -rotate 70 -drawRect -5 -5 10 10 -rotate -70 -translate 20 0 -rotate 80 -drawRect -5 -5 10 10 -rotate -80 -translate 20 0 -rotate 90 -drawRect -5 -5 10 10 -rotate -90 - -resetMatrix -path_addRect vertical 0.1 0.1 0.2 10 - -translate 0 320 -drawPath vertical -translate 2.2 0 -drawPath vertical -translate 2.2 0 -drawPath vertical -translate 2.2 0 -drawPath vertical -translate 2.2 0 -drawPath vertical - -resetMatrix -path_addRect horizontal 0.1 0.1 10 0.2 - -translate 0 340 -drawPath horizontal -translate 0 2.2 -drawPath horizontal -translate 0 2.2 -drawPath horizontal -translate 0 2.2 -drawPath horizontal -translate 0 2.2 -drawPath horizontal - -setOpacity 0.8 -resetMatrix - -translate 0.1 24.7 -translate 400 0 -#rotate 88.8 -rotate 89.9 -setBrush red -drawPolygon [0 0 300 0 0 173] -setBrush green -drawPolygon [0 173 300 0 300 173] - -resetMatrix - -translate 410 24 -path_lineTo left 0 273 -path_lineTo left 300 273 -path_cubicTo left 50 273 250 0 0 0 - -path_cubicTo right 250 0 50 273 300 273 -path_lineTo right 300 0 - -translate 310 0 -rotate 90 -setBrush red -drawPath left -setBrush green -drawPath right - -resetMatrix -translate 0.1 680.1 -setPen red -setOpacity 1 -drawText 115 -20 "0.1" -drawText 0 0 "pixmap w/ opacity" -setOpacity 0.6 -drawPixmap pix 120 -10 -translate 0 20 -setOpacity 1 -drawText 0 0 "image w/ opacity" -setOpacity 0.6 -drawImage img 120 -10 - -resetMatrix -path_lineTo fillpath 0 50 -path_lineTo fillpath 50 50 -path_moveTo fillpath 70 50 -path_lineTo fillpath 70 100 -path_lineTo fillpath 40 100 -translate 500 400 -drawPath fillpath - -resetMatrix -path_moveTo vectorarne 50 10 -path_lineTo vectorarne 50 50 -path_lineTo vectorarne 100 50 -path_addEllipse vectorarne 350 20 230 230 -path_moveTo vectorarne 500 500 -path_cubicTo vectorarne 20 20 250 30 50 150 -translate 500 550 -scale 0.4 0.4 -setRenderHint antialiasing -drawPath vectorarne - -resetMatrix -translate 200 730 -setRenderHint antialiasing off -setOpacity 1 -setPen red -drawText 0 0 "outline/fill consistency" -setPen red -setBrush green -translate 80 -30 -drawPolygon [13.6965 -99.1837 -71.4767 13.823 32.4596 -33.1847] diff --git a/tests/auto/other/lancelot/scripts/glyphruns.qps b/tests/auto/other/lancelot/scripts/glyphruns.qps deleted file mode 100644 index 2b70c72610..0000000000 --- a/tests/auto/other/lancelot/scripts/glyphruns.qps +++ /dev/null @@ -1,175 +0,0 @@ -drawGlyphRun -5 5 "Text that is drawn outside the bounds..." - -translate 20 20 -begin_block text_drawing -save - setFont "sansserif" 10 normal - drawGlyphRun 0 20 "sansserif 10pt, normal" - - setFont "sansserif" 12 normal - drawGlyphRun 0 40 "sansserif 12pt, normal" - - setFont "sansserif" 12 bold - drawGlyphRun 0 60 "sansserif 12pt, bold" - - setFont "sansserif" 10 bold italic - drawGlyphRun 0 80 "sansserif 10pt, bold italic" - - - translate 0 100 - setPen #7fff0000 - - setFont "sansserif" 10 normal - drawGlyphRun 0 20 "alpha sansserif 10pt, normal" - - setFont "sansserif" 12 normal - drawGlyphRun 0 40 "alpha sansserif 12pt, normal" - - setFont "sansserif" 12 bold - drawGlyphRun 0 60 "alpha sansserif 12pt, bold" - - setFont "sansserif" 10 bold italic - drawGlyphRun 0 80 "alpha sansserif 10pt, bold italic" - - - translate 0 100 - setPen black - save - scale 0.9 0.9 - - setFont "sansserif" 10 normal - drawGlyphRun 0 20 "scaled sansserif 10pt, normal" - - setFont "sansserif" 12 normal - drawGlyphRun 0 40 "scaled sansserif 12pt, normal" - - setFont "sansserif" 12 bold - drawGlyphRun 0 60 "scaled sansserif 12pt, bold" - - setFont "sansserif" 10 bold italic - drawGlyphRun 0 80 "scaled sansserif 10pt, bold italic" - restore - - translate 200 200 - setPen black - save - scale -1 -1 - - setFont "sansserif" 10 normal - drawGlyphRun 0 20 "flipped sansserif 10pt, normal" - - setFont "sansserif" 12 normal - drawGlyphRun 0 40 "flipped sansserif 12pt, normal" - - setFont "sansserif" 12 bold - drawGlyphRun 0 60 "flipped sansserif 12pt, bold" - - setFont "sansserif" 10 bold italic - drawGlyphRun 0 80 "flipped sansserif 10pt, bold italic" - restore - - translate -200 20 - setPen black - save - translate 200 90 - rotate 185 - - setFont "sansserif" 10 normal - drawGlyphRun 0 20 "rotated sansserif 10pt, normal" - - setFont "sansserif" 12 normal - drawGlyphRun 0 40 "rotated sansserif 12pt, normal" - - setFont "sansserif" 12 bold - drawGlyphRun 0 60 "rotated sansserif 12pt, bold" - - setFont "sansserif" 10 bold italic - drawGlyphRun 0 80 "rotated sansserif 10pt, bold italic" - restore - - translate 0 100 - gradient_appendStop 0 red - gradient_appendStop 0.5 #00ff00 - gradient_appendStop 1 blue - gradient_setLinear 0 0 200 0 - setPen brush - - setFont "sansserif" 10 normal - drawGlyphRun 0 0 "gradient sansserif 10pt, normal" - - setFont "sansserif" 12 normal - drawGlyphRun 0 20 "gradient sansserif 12pt, normal" - - setFont "sansserif" 12 bold - drawGlyphRun 0 40 "gradient sansserif 12pt, bold" - - setFont "sansserif" 10 bold italic - drawGlyphRun 0 60 "gradient sansserif 10pt, bold italic" -restore -end_block - -translate 250 0 -drawGlyphRun 25 640 "clipped to rectangle" -save - setPen #3f000000 - setBrush nobrush - drawRect 20 0 100 620 - setClipRect 20 0 100 620 - setPen black - repeat_block text_drawing -restore - -translate 150 0 -drawGlyphRun 25 640 "clipped to path" -save - path_moveTo clip 20 0 - path_cubicTo clip 0 200 40 400 20 400 - path_lineTo clip 30 620 - path_lineTo clip 30 0 - path_lineTo clip 40 0 - path_lineTo clip 40 620 - path_lineTo clip 120 620 - path_lineTo clip 120 0 - path_lineTo clip 20 0 - setPen #3f000000 - setBrush nobrush - drawPath clip - setClipPath clip - setPen black - repeat_block text_drawing -restore - -translate 150 0 -save - setPen black - setFont "sansserif" 16 normal - drawGlyphRun 0 40 "e😃m😇o😍j😜i😸!" -restore - -translate 0 55 -save - setPen black - setFont "sansserif" 12 normal normal default underline - drawGlyphRun 0 20 "Underlined text drawing" -restore - -translate 0 35 -save - setPen black - setFont "sansserif" 12 normal normal default normal strikeout - drawGlyphRun 0 20 "Struck out text drawing" -restore - -translate 0 35 -save - setPen black - setFont "sansserif" 12 normal normal default normal normal overline - drawGlyphRun 0 20 "Overlined text drawing" -restore - -translate 0 35 -save - setPen black - setFont "sansserif" 12 normal normal default underline strikeout overline - drawGlyphRun 0 20 "All the effects text drawing" -restore diff --git a/tests/auto/other/lancelot/scripts/gradients.qps b/tests/auto/other/lancelot/scripts/gradients.qps deleted file mode 100644 index eb3cda9cad..0000000000 --- a/tests/auto/other/lancelot/scripts/gradients.qps +++ /dev/null @@ -1,44 +0,0 @@ -# Version: 1 -# CheckVsReference: 5% - -drawText 75 20 "Linear" -drawText 176 20 "Radial" -drawText 277 20 "Conical" -translate 0 30 -drawText 0 50 "AA off" -drawText 0 151 "AA on" - -setPen nopen - -gradient_clearStops -gradient_appendStop 0 0x00000000 -gradient_appendStop 0.001 red -gradient_appendStop 0.2 blue -gradient_appendStop 0.4 yellow -gradient_appendStop 0.6 cyan -gradient_appendStop 0.8 green -gradient_appendStop 0.999 red -gradient_appendStop 1 0x00000000 - -gradient_setSpread PadSpread -gradient_setCoordinateMode ObjectBoundingMode - -begin_block row -save -gradient_setLinear 0.1 0.0 0.9 0.0 -drawRect 50 0 100 100 - -gradient_setRadial 0.5 0.5 0.5 0.5 0.5 -translate 101 0 -drawRect 50 0 100 100 - -gradient_setConical 0.5 0.5 45 -translate 101 0 -drawRect 50 0 100 100 -restore -end_block row - -setRenderHint Antialiasing - -translate 0 101 -repeat_block row
\ No newline at end of file diff --git a/tests/auto/other/lancelot/scripts/gradientxform_device.qps b/tests/auto/other/lancelot/scripts/gradientxform_device.qps deleted file mode 100644 index cd8b55d5b6..0000000000 --- a/tests/auto/other/lancelot/scripts/gradientxform_device.qps +++ /dev/null @@ -1,67 +0,0 @@ -# Version: 1 -# CheckVsReference: 5% - -gradient_clearStops -gradient_appendStop 0 black -gradient_appendStop 0.4 yellow -gradient_appendStop 1 gray - -gradient_setSpread PadSpread - -gradient_setCoordinateMode StretchToDeviceMode - -# first run is dummy, make it offscreen -save -translate -500 -500 - -begin_block row -save - -setPen nopen -drawRect 50 0 100 100 - -setPen brush 30 -setBrush lightblue -drawRect 175 15 70 70 - -setFont "times" 110 1000 -drawText 270 100 "X" - -restore -end_block row - -restore - -drawText 160 20 "PLAIN" -drawText 560 20 "BRUSH XFORM" -translate 0 20 - -begin_block block -save - -drawText 75 20 "Brush Fill" -drawText 176 20 "Pen Stroke" -drawText 277 20 "Text Stroke" -translate 0 30 -drawText 0 50 "Linear" -drawText 0 160 "Radial" -drawText 0 270 "Conical" - -gradient_setLinear 0.0 0.0 0.4 0.0 -repeat_block row - -translate 0 110 -gradient_setRadial 0.04 0.08 0.3 0.3 0.05 -repeat_block row - -translate 0 110 -gradient_setConical 0.25 0.1 45 -repeat_block row -restore -end_block block - -translate 400 0 -brushRotate 30.0 -brushScale 1.5 .5 -brushTranslate 0 -80 -repeat_block block diff --git a/tests/auto/other/lancelot/scripts/gradientxform_logical.qps b/tests/auto/other/lancelot/scripts/gradientxform_logical.qps deleted file mode 100644 index 1bba63a929..0000000000 --- a/tests/auto/other/lancelot/scripts/gradientxform_logical.qps +++ /dev/null @@ -1,67 +0,0 @@ -# Version: 1 -# CheckVsReference: 5% - -gradient_clearStops -gradient_appendStop 0 black -gradient_appendStop 0.4 yellow -gradient_appendStop 1 gray - -gradient_setSpread PadSpread - -gradient_setCoordinateMode LogicalMode - -# first run is dummy, make it offscreen -save -translate -500 -500 - -begin_block row -save - -setPen nopen -drawRect 50 0 100 100 - -setPen brush 30 -setBrush lightblue -drawRect 175 15 70 70 - -setFont "times" 110 1000 -drawText 270 100 "X" - -restore -end_block row - -restore - -drawText 160 20 "PLAIN" -drawText 560 20 "BRUSH XFORM" -translate 0 20 - -begin_block block -save - -drawText 75 20 "Brush Fill" -drawText 176 20 "Pen Stroke" -drawText 277 20 "Text Stroke" -translate 0 30 -drawText 0 50 "Linear" -drawText 0 160 "Radial" -drawText 0 270 "Conical" - -gradient_setLinear 0 0 400 0 -repeat_block row - -translate 0 110 -gradient_setRadial 200 50 140 70 20 -repeat_block row - -translate 0 110 -gradient_setConical 220 60 45 -repeat_block row -restore -end_block block - -translate 400 0 -brushRotate 30.0 -brushScale 1.5 .5 -brushTranslate 0 -80 -repeat_block block diff --git a/tests/auto/other/lancelot/scripts/gradientxform_object.qps b/tests/auto/other/lancelot/scripts/gradientxform_object.qps deleted file mode 100644 index e34da24d46..0000000000 --- a/tests/auto/other/lancelot/scripts/gradientxform_object.qps +++ /dev/null @@ -1,83 +0,0 @@ -# Version: 1 -# CheckVsReference: 5% - -gradient_clearStops -gradient_appendStop 0 black -gradient_appendStop 0.4 yellow -gradient_appendStop 1 gray - -gradient_setSpread PadSpread - -gradient_setCoordinateMode ObjectBoundingMode - -# first run is dummy, make it offscreen -save -translate -500 -500 - -begin_block row -save - -setPen nopen -drawRect 50 0 100 100 - -setPen brush 30 -setBrush lightblue -translate 110 0 -drawRect 65 15 70 70 - -translate 110 0 -setFont "times" 110 1000 -drawText 50 100 "X" - -restore -end_block row - -restore - -drawText 160 20 "PLAIN" -drawText 560 20 "BRUSH XFORM" -translate 0 20 - -begin_block block -save - -drawText 75 20 "Brush Fill" -drawText 176 20 "Pen Stroke" -drawText 277 20 "Text Stroke" -translate 0 30 -drawText 0 50 "Linear" -drawText 0 160 "Radial" -drawText 0 270 "Conical" - -gradient_setLinear 0.1 0.0 0.5 0.0 -repeat_block row - -translate 0 110 -gradient_setRadial 0.3 0.2 0.5 0.4 0.5 -repeat_block row - -translate 0 110 -gradient_setConical 0.5 0.7 45 -repeat_block row -restore -end_block block - -save -translate 400 0 -brushRotate 30.0 -brushScale 1.5 .5 -repeat_block block -restore - -drawText 80 400 "BRUSH XFORM, OBJECT BOUNDING MODE" -drawText 500 400 "BRUSH XFORM, OBJECT MODE" - -translate 0 400 -brushTranslate 0.5 0.5 -brushRotate 180.0 -brushTranslate -0.5 -0.5 -repeat_block block - -translate 400 0 -gradient_setCoordinateMode ObjectMode -repeat_block block diff --git a/tests/auto/other/lancelot/scripts/hinting.qps b/tests/auto/other/lancelot/scripts/hinting.qps deleted file mode 100644 index 7ce21b287a..0000000000 --- a/tests/auto/other/lancelot/scripts/hinting.qps +++ /dev/null @@ -1,26 +0,0 @@ -translate 10 50 -setFont "sansserif" 10 -drawText 0 0 "Default hinting:" -setFont "times" 12 normal normal default -drawText 0 20 "The quick brown fox jumps over the lazy dog" - -translate 0 50 -setFont "sansserif" 10 -drawText 0 0 "No hinting:" -setFont "times" 12 normal normal none -drawText 0 20 "The quick brown fox jumps over the lazy dog" - -translate 0 50 -setFont "sansserif" 10 -drawText 0 0 "Vertical hinting:" -setFont "times" 12 normal normal vertical -drawText 0 20 "The quick brown fox jumps over the lazy dog" - -translate 0 50 -setFont "sansserif" 10 -drawText 0 0 "Full hinting:" -setFont "times" 12 normal normal full -drawText 0 20 "The quick brown fox jumps over the lazy dog" - - -# Note: there is also the textlayout_draw command which might be interesting here. diff --git a/tests/auto/other/lancelot/scripts/image_dpr.qps b/tests/auto/other/lancelot/scripts/image_dpr.qps deleted file mode 100644 index 7d3ca3099c..0000000000 --- a/tests/auto/other/lancelot/scripts/image_dpr.qps +++ /dev/null @@ -1,43 +0,0 @@ - -setRenderHint Antialiasing true -setRenderHint SmoothPixmapTransform true - -image_load sign.png img1 -pixmap_load sign.png pix1 - -begin_block drawIt -save - -drawImage img1 20 20 -1 -1 -drawRect 17.5 17.5 85 85 - -setBrush img1 -setPen NoPen -drawRect 20 120 120 120 - -brushRotate 45 -drawRect 20 260 120 120 - -setBrush NoBrush -drawTiledPixmap pix1 20 400 120 120 - -restore -end_block - -save -translate 150 0 -rotate -5 -repeat_block drawIt -restore - -image_setDevicePixelRatio img1 2.0 -pixmap_setDevicePixelRatio pix1 2.0 -translate 400 0 -repeat_block drawIt - -save -translate 150 0 -rotate -5 -repeat_block drawIt -restore - diff --git a/tests/auto/other/lancelot/scripts/image_formats.qps b/tests/auto/other/lancelot/scripts/image_formats.qps deleted file mode 100644 index d817d04bf8..0000000000 --- a/tests/auto/other/lancelot/scripts/image_formats.qps +++ /dev/null @@ -1,81 +0,0 @@ -# Version: 1 -# CheckVsReference: 5% - - -image_load dome_argb32.png the_pixmap -image_convertToFormat the_pixmap the_pixmap ARGB32_Premultiplied - -begin_block draw_stuff - save - image_convertToFormat the_pixmap converted ARGB32_Premultiplied - drawImage converted 0 0 - translate 0 110 - - image_convertToFormat the_pixmap converted ARGB32 - drawImage converted 0 0 - translate 0 110 - - image_convertToFormat the_pixmap converted RGB32 - drawImage converted 0 0 - translate 0 110 - - image_convertToFormat the_pixmap converted Indexed8 - drawImage converted 0 0 - translate 0 110 - - image_convertToFormat the_pixmap converted MonoLSB - drawImage converted 0 0 - translate 0 110 - - image_convertToFormat the_pixmap converted Mono - drawImage converted 0 0 - translate 0 110 - restore -end_block - - -image_load dome_argb32.png the_pixmap -translate 110 0 -repeat_block draw_stuff - - -image_load dome_rgb32.png the_pixmap -translate 110 0 -repeat_block draw_stuff - -image_load dome_indexed.png the_pixmap -translate 110 0 -repeat_block draw_stuff - - -image_load dome_mono.png the_pixmap -translate 110 0 -repeat_block draw_stuff - -image_load dome_mono_palette.png the_pixmap -translate 110 0 -repeat_block draw_stuff - -image_load dome_indexed_mask.png the_pixmap -translate 110 0 -repeat_block draw_stuff - - -# helpful texts -resetMatrix -setPen black - -drawText 10 670 "ARGB32_PM" -drawText 120 670 "ARGB32" -drawText 230 670 "RGB32" -drawText 340 670 "Indexed" -drawText 450 670 "Mono" -drawText 560 670 "Mono w/lut" -drawText 670 670 "Indexed w/mask" - -drawText 770 50 "ARGB32_PM" -drawText 770 160 "ARGB32" -drawText 770 270 "RGB32" -drawText 770 380 "Indexed" -drawText 770 490 "MonoLSB" -drawText 770 600 "Mono"
\ No newline at end of file diff --git a/tests/auto/other/lancelot/scripts/images.qps b/tests/auto/other/lancelot/scripts/images.qps deleted file mode 100644 index 3f892400e2..0000000000 --- a/tests/auto/other/lancelot/scripts/images.qps +++ /dev/null @@ -1,106 +0,0 @@ -# Version: 1 -# CheckVsReference: 5% - - -setRenderHint Antialiasing - -setPen #00ff00 - -image_load dome_argb32.png the_image -begin_block draw_stuff - -save - - # standard draw - drawImage the_image 0 0 - - # sub recting - translate 120 0 - drawImage the_image 0 0 40 40 0 0 40 40 - drawImage the_image 60 0 40 40 60 0 40 40 - drawImage the_image 0 60 40 40 0 60 40 40 - drawImage the_image 60 60 40 40 60 60 40 40 - drawImage the_image 0 40 40 20 0 40 40 20 - drawImage the_image 60 40 40 20 60 40 40 20 - drawImage the_image 40 0 20 100 40 0 20 100 - - # subrecting w/scale - translate 120 0 - drawImage the_image 0 0 50 50 0 0 25 25 - drawImage the_image 50 0 50 50 25 0 25 25 - drawImage the_image 0 50 50 50 0 25 25 25 - drawImage the_image 50 50 50 50 25 25 25 25 - - # subrecting w/scale & smooth xform - translate 120 0 - setRenderHint SmoothPixmapTransformation - drawImage the_image 0 0 50 50 0 0 25 25 - drawImage the_image 50 0 50 50 25 0 25 25 - drawImage the_image 0 50 50 50 0 25 25 25 - drawImage the_image 50 50 50 50 25 25 25 25 - - - # Rotation w/o smooth xform - translate 120 0 - save - setRenderHint SmoothPixmapTransform off - rotate 10 - drawImage the_image 0 0 - restore - - # Rotation w smooth xform - translate 120 0 - save - setRenderHint SmoothPixmapTransform - rotate 10 - drawImage the_image 0 0 - restore - -restore - -end_block - - -translate 0 120 -image_load dome_rgb32.png the_image -repeat_block draw_stuff - -translate 0 120 -image_load dome_indexed.png the_image -repeat_block draw_stuff - -translate 0 120 -image_load dome_indexed_mask.png the_image -repeat_block draw_stuff - -translate 0 120 -image_load dome_mono.png the_image -repeat_block draw_stuff - - -resetMatrix -translate 700 60 -setPen black -drawText 0 0 "32 bit w/alpha" -translate 0 120 -drawText 0 0 "32 bit w/o alpha" -translate 0 120 -drawText 0 0 "8 bit indexed" -translate 0 120 -drawText 0 0 "8 bit indexed w/mask" -translate 0 120 -drawText 0 0 "1 bit" -resetMatrix -translate 0 600 -drawText 0 0 "normal" -translate 120 0 -drawText 0 0 "subrect" -translate 120 0 -drawText 0 0 "subrect scale" -translate 120 0 -drawText 0 0 "subrect scale smooth" -translate 120 0 -drawText 0 0 "xform" -translate 120 0 -drawText 0 0 "smooth xform" -translate 120 0
\ No newline at end of file diff --git a/tests/auto/other/lancelot/scripts/images2.qps b/tests/auto/other/lancelot/scripts/images2.qps deleted file mode 100644 index 5159abc928..0000000000 --- a/tests/auto/other/lancelot/scripts/images2.qps +++ /dev/null @@ -1,145 +0,0 @@ -# Version: 1 -# CheckVsReference: 5% - -image_load dome_argb32.png the_image -begin_block draw_stuff - -save - # standard draw - drawImage the_image 0 0 - - # flip x - translate 220 0 - scale -1 1 - drawImage the_image 0 0 - scale -1 1 - - # flip y - translate 20 100 - scale 1 -1 - drawImage the_image 0 0 - scale 1 -1 - - # flip x and y - translate 220 0 - scale -1 -1 - drawImage the_image 0 0 - scale -1 -1 - - # flip y and scale - translate 20 10 - save - scale 1 -1.1 - drawImage the_image 0 0 - restore - - # flip y and scale - translate 220 -110 - save - scale -1.1 0.9 - drawImage the_image 0 0 - restore -restore -end_block - -setRenderHint Antialiasing - -resetMatrix -translate 0 120 -repeat_block draw_stuff - -resetMatrix -translate 720 60 -setPen black -drawText 0 0 "aliased" -translate 0 120 -drawText 0 0 "antialiased" -resetMatrix -translate 0 260 -drawText 0 0 "normal" -translate 120 0 -drawText 0 0 "flip x" -translate 120 0 -drawText 0 0 "flip y" -translate 120 0 -drawText 0 0 "flip x and y" -translate 120 0 -drawText 0 0 "flip y and scale" -translate 120 0 -drawText 0 0 "flip x and scale" -translate 120 0 - -setRenderHint SmoothPixmapTransform - -resetMatrix -translate 20 300 -drawImage border.png 0 0 100 100 1 1 8 8 -drawText 0 -5 "subrect color bleeding" -translate 0 120 -drawImage border.png 0 0 100 100 0 0 10 10 - -image_load sign.png the_image -resetMatrix -drawText 240 300 "drawImage() with varying sx/sy offsets" -translate 0 10 -drawRect 240 300 50 50 -drawImage the_image 240 300 50 50 20 0 80 80 -drawRect 300 300 50 50 -drawImage the_image 300 300 50 50 -20 0 80 80 -drawRect 240 370 50 50 -drawImage the_image 240 370 50 50 0 20 80 80 -drawRect 300 370 50 50 -drawImage the_image 300 370 50 50 0 -20 80 80 - -pixmap_load sign.png the_pixmap -translate 220 0 -translate 0 -10 -drawText 240 300 "drawPixmap() with varying sx/sy offsets" -translate 0 10 -drawRect 240 300 50 50 -drawPixmap the_pixmap 240 300 50 50 20 0 80 80 -drawRect 300 300 50 50 -drawPixmap the_pixmap 300 300 50 50 -20 0 80 80 -drawRect 240 370 50 50 -drawPixmap the_pixmap 240 370 50 50 0 20 80 80 -drawRect 300 370 50 50 -drawPixmap the_pixmap 300 370 50 50 0 -20 80 80 - - -resetMatrix -translate 0 170 -drawText 240 300 "drawImage() with varying sx/sy offsets" -translate 0 10 -drawRect 240 300 50 50 -drawImage the_image 240 300 50 50 50 0 50 50 -drawRect 300 300 50 50 -drawImage the_image 300 300 50 50 -20 0 50 50 -drawRect 240 370 50 50 -drawImage the_image 240 370 50 50 0 50 50 50 -drawRect 300 370 50 50 -drawImage the_image 300 370 50 50 0 -20 50 50 - -resetMatrix -translate 220 170 -drawText 240 300 "drawPixmap() with varying sx/sy offsets" -translate 0 10 -drawRect 240 300 50 50 -drawPixmap the_pixmap 240 300 50 50 50 0 50 50 -drawRect 300 300 50 50 -drawPixmap the_pixmap 300 300 50 50 -20 0 50 50 -drawRect 240 370 50 50 -drawPixmap the_pixmap 240 370 50 50 0 50 50 50 -drawRect 300 370 50 50 -drawPixmap the_pixmap 300 370 50 50 0 -20 50 50 - -resetMatrix -drawText 10 620 "drawImage/Pixmap() with negative x/y and sx/sy" -setPen red - -translate 20 640 -drawImage the_image -10 -10 -1 -1 -10 -10 0 0 -drawRect 0 0 80 80 - -translate 100 0 -drawPixmap the_pixmap -10 -10 -1 -1 -10 -10 0 0 -drawRect 0 0 80 80 diff --git a/tests/auto/other/lancelot/scripts/join_cap_styles.qps b/tests/auto/other/lancelot/scripts/join_cap_styles.qps deleted file mode 100644 index ed823f53f5..0000000000 --- a/tests/auto/other/lancelot/scripts/join_cap_styles.qps +++ /dev/null @@ -1,63 +0,0 @@ -# Version: 1 -# CheckVsReference: 5% - - -setRenderHint Antialiasing - -path_moveTo p 20 20 -path_cubicTo p 100 20 100 180 180 100 -path_lineTo p 20 180 -path_lineTo p 180 20 - -setPen black 20 solidline roundcap roundjoin -drawPath p -setPen red -drawPath p - -translate 200 0 -setPen black 20 solidline roundcap miterjoin -drawPath p -setPen red -drawPath p - -translate 200 0 -setPen black 20 solidline roundcap beveljoin -drawPath p -setPen red -drawPath p - -translate -400 200 -setPen black 20 solidline squarecap roundjoin -drawPath p -setPen red -drawPath p - -translate 200 0 -setPen black 20 solidline squarecap miterjoin -drawPath p -setPen red -drawPath p - -translate 200 0 -setPen black 20 solidline squarecap beveljoin -drawPath p -setPen red -drawPath p - -translate -400 200 -setPen black 20 solidline flatcap roundjoin -drawPath p -setPen red -drawPath p - -translate 200 0 -setPen black 20 solidline flatcap miterjoin -drawPath p -setPen red -drawPath p - -translate 200 0 -setPen black 20 solidline flatcap beveljoin -drawPath p -setPen red -drawPath p
\ No newline at end of file diff --git a/tests/auto/other/lancelot/scripts/join_cap_styles_duplicate_control_points.qps b/tests/auto/other/lancelot/scripts/join_cap_styles_duplicate_control_points.qps deleted file mode 100644 index 96405ceae7..0000000000 --- a/tests/auto/other/lancelot/scripts/join_cap_styles_duplicate_control_points.qps +++ /dev/null @@ -1,68 +0,0 @@ -# Version: 1 -# CheckVsReference: 1% (0 0 600 650) - - -setRenderHint Antialiasing - -path_moveTo p 40 70 -path_lineTo p 20 70 -path_cubicTo p 20 70 40 20 80 80 - -path_moveTo p 20 120 -path_cubicTo p 50 60 80 110 80 110 -path_lineTo p 60 110 - -scale 2 2 - -setPen black 10 solidline roundcap roundjoin -drawPath p -setPen red 0 -drawPath p - -translate 100 0 -setPen black 10 solidline roundcap miterjoin -drawPath p -setPen red 0 -drawPath p - -translate 100 0 -setPen black 10 solidline roundcap beveljoin -drawPath p -setPen red 0 -drawPath p - -translate -200 100 -setPen black 10 solidline squarecap roundjoin -drawPath p -setPen red 0 -drawPath p - -translate 100 0 -setPen black 10 solidline squarecap miterjoin -drawPath p -setPen red 0 -drawPath p - -translate 100 0 -setPen black 10 solidline squarecap beveljoin -drawPath p -setPen red 0 -drawPath p - -translate -200 100 -setPen black 10 solidline flatcap roundjoin -drawPath p -setPen red 0 -drawPath p - -translate 100 0 -setPen black 10 solidline flatcap miterjoin -drawPath p -setPen red 0 -drawPath p - -translate 100 0 -setPen black 10 solidline flatcap beveljoin -drawPath p -setPen red 0 -drawPath p
\ No newline at end of file diff --git a/tests/auto/other/lancelot/scripts/linear_gradients.qps b/tests/auto/other/lancelot/scripts/linear_gradients.qps deleted file mode 100644 index b1b8dd69e7..0000000000 --- a/tests/auto/other/lancelot/scripts/linear_gradients.qps +++ /dev/null @@ -1,144 +0,0 @@ -# Version: 1 -# CheckVsReference: 2% (0 0 600 750) - -path_addRect path 400 0 80 80 -path_addEllipse path 440 40 60 60 - -setRenderHint Antialiasing - -setPen black - -begin_block gradients -gradient_clearStops -gradient_appendStop 0 red -gradient_appendStop 0.25 orange -gradient_appendStop 0.5 yellow -gradient_appendStop 0.8 green -gradient_appendStop 1 cyan - -gradient_setSpread PadSpread -gradient_setLinear 20 20 70 70 -drawRect 0 0 100 100 - -gradient_setSpread ReflectSpread -gradient_setLinear 120 20 170 70 -drawEllipse 100 0 100 100 - -gradient_setSpread RepeatSpread -gradient_setLinear 220 20 270 70 -drawRoundRect 200 0 100 100 - -gradient_clearStops -gradient_appendStop 0 3f7f7fff -gradient_appendStop 0.5 dfdfffff -gradient_appendStop 1 7f00007f - -gradient_setSpread PadSpread -gradient_setLinear 320 20 340 40 -drawPolygon [300 0 390 0 350 99] - -gradient_setSpread ReflectSpread -gradient_setLinear 420 20 440 40 -drawPath path - -gradient_setSpread RepeatSpread -gradient_setLinear 520 20 540 40 -drawPie 500 0 100 100 720 4320 -end_block - -translate 0 100 -scale 1 2 -repeat_block gradients - -resetMatrix -translate 0 300 -brushTranslate 30 0 -brushScale 0.9 0.9 -brushRotate 20 -repeat_block gradients - -# Vertical gradient tests -resetMatrix -setBrush noBrush -translate 0 400 - -begin_block vertical_gradients -gradient_clearStops -gradient_appendStop 0 red -gradient_appendStop 0.25 orange -gradient_appendStop 0.5 yellow -gradient_appendStop 0.8 green -gradient_appendStop 1 cyan - -gradient_setSpread PadSpread -gradient_setLinear 20 20 20 70 -drawRect 0 0 100 100 - -gradient_setSpread ReflectSpread -gradient_setLinear 120 20 120 70 -drawEllipse 100 0 100 100 - -gradient_setSpread RepeatSpread -gradient_setLinear 220 20 220 70 -drawRoundRect 200 0 100 100 - -gradient_clearStops -gradient_appendStop 0 3f7f7fff -gradient_appendStop 0.5 dfdfffff -gradient_appendStop 1 7f00007f - -gradient_setSpread PadSpread -gradient_setLinear 320 20 320 40 -drawPolygon [300 0 390 0 350 99] - -gradient_setSpread ReflectSpread -gradient_setLinear 420 20 420 40 -drawPath path - -gradient_setSpread RepeatSpread -gradient_setLinear 520 20 520 40 -drawPie 500 0 100 100 720 4320 -end_block - -translate 0 100 -scale 1 1.5 -repeat_block vertical_gradients - -resetMatrix -translate 0 650 -brushTranslate 30 0 -brushScale 0.9 0.9 -brushRotate 20 -repeat_block vertical_gradients - -# Some helpful info perhaps? -resetMatrix -setPen black -# gradient line indicators -drawLine 20 20 70 70 -drawLine 120 20 170 70 -drawLine 220 20 270 70 -drawLine 320 20 340 40 -drawLine 420 20 440 40 -drawLine 520 20 540 40 - -drawLine 20 140 70 240 -drawLine 120 140 170 240 -drawLine 220 140 270 240 -drawLine 320 140 340 180 -drawLine 420 140 440 180 -drawLine 520 140 540 180 - -drawText 610 50 "No XForm" -drawText 610 200 "scale 1x2" -drawText 610 350 "brush transform" -drawText 610 450 "vertical brush" -drawText 610 570 "vertical brush scale 1x1.5" -drawText 610 700 "vertical brush transform" - -drawText 10 780 "Pad" -drawText 110 780 "Reflect" -drawText 210 780 "Repeat" -drawText 310 780 "Pad w/alpha" -drawText 410 780 "Reflect w/alpha" -drawText 510 780 "Repeat w/alpha"
\ No newline at end of file diff --git a/tests/auto/other/lancelot/scripts/linear_gradients_perspectives.qps b/tests/auto/other/lancelot/scripts/linear_gradients_perspectives.qps deleted file mode 100644 index 3ea39fbe46..0000000000 --- a/tests/auto/other/lancelot/scripts/linear_gradients_perspectives.qps +++ /dev/null @@ -1,62 +0,0 @@ -# Version: 1 - - -setRenderHint Antialiasing - -setPen #00ff00 - -translate 10 10 -# standard draw -begin_block gradient -gradient_clearStops -gradient_appendStop 0 red -gradient_appendStop 0.25 orange -gradient_appendStop 0.5 yellow -gradient_appendStop 0.8 green -gradient_appendStop 1 cyan - -gradient_setSpread PadSpread -gradient_setLinear 10 10 290 290 -drawRect 0 0 300 300 -end_block gradient - -# Rotation w/o smooth xform -save -translate 350 0 -save - setRenderHint SmoothPixmapTransform on - mapQuadToQuad 0 0 0 300 300 300 300 0 0 50 0 200 300 300 300 0 - repeat_block gradient -restore -restore - -translate 0 320 - -save - setRenderHint SmoothPixmapTransform on - mapQuadToQuad 0 0 0 300 300 300 300 0 0 0 100 300 200 300 300 0 - repeat_block gradient -restore - -save -translate 350 0 -save - setRenderHint SmoothPixmapTransform on - mapQuadToQuad 0 0 0 300 300 300 300 0 0 0 0 300 300 250 300 50 - repeat_block gradient -restore -restore - - -resetMatrix -setPen black -translate 125 20 -drawText 0 0 "No transform" -translate 350 0 -drawText 0 0 "Left Tilted" -resetMatrix -translate 125 350 -drawText 0 0 "Bottom Tilted" -translate 350 0 -drawText 0 0 "Right Tilted" -translate 120 0
\ No newline at end of file diff --git a/tests/auto/other/lancelot/scripts/linear_resolving_gradients.qps b/tests/auto/other/lancelot/scripts/linear_resolving_gradients.qps deleted file mode 100644 index 779760cb9a..0000000000 --- a/tests/auto/other/lancelot/scripts/linear_resolving_gradients.qps +++ /dev/null @@ -1,66 +0,0 @@ -# Version: 2 -# CheckVsReference: 2% (0 0 500 400) - -setRenderHint Antialiasing - -setPen black - -begin_block gradients -gradient_clearStops -gradient_appendStop 0 red -gradient_appendStop 0.25 orange -gradient_appendStop 0.5 yellow -gradient_appendStop 0.8 green -gradient_appendStop 1 cyan - -gradient_setSpread PadSpread -gradient_setCoordinateMode ObjectBoundingMode -gradient_setLinear 0.2 0.2 0.7 0.7 -drawRect 0 0 100 100 - -gradient_setSpread ReflectSpread -gradient_setLinear 0.2 0.2 0.7 0.7 -drawEllipse 100 0 100 100 - -gradient_setSpread RepeatSpread -gradient_setLinear 0.2 0.2 0.7 0.7 -drawRoundRect 200 0 100 100 - -gradient_clearStops -gradient_appendStop 0 3f7f7fff -gradient_appendStop 0.5 dfdfffff -gradient_appendStop 1 7f00007f - -gradient_setSpread PadSpread -gradient_setLinear 0.2 0.2 0.8 0.4 -drawPolygon [300 0 400 0 350 100] - -gradient_setSpread RepeatSpread -gradient_setLinear 0.2 0.2 0.4 0.4 -drawPie 400 0 100 100 0 4320 -end_block - -translate 0 100 -scale 1 2 -repeat_block gradients - -resetMatrix -translate 0 300 -brushTranslate 30 0 -brushScale 0.9 0.9 -brushRotate 20 -repeat_block gradients - -# Some helpful info perhaps? -resetMatrix -setPen black - -drawText 510 50 "No XForm" -drawText 510 200 "scale 1x2" -drawText 510 350 "brush transform" - -drawText 10 450 "Pad" -drawText 110 450 "Reflect" -drawText 210 450 "Repeat" -drawText 310 450 "Pad w/alpha" -drawText 410 450 "Repeat w/alpha"
\ No newline at end of file diff --git a/tests/auto/other/lancelot/scripts/lineconsistency.qps b/tests/auto/other/lancelot/scripts/lineconsistency.qps deleted file mode 100644 index 0b40577659..0000000000 --- a/tests/auto/other/lancelot/scripts/lineconsistency.qps +++ /dev/null @@ -1,72 +0,0 @@ -# Version: 1 - -begin_block draw -setPen red -drawPolygon [1.1 1 3.3 30.6 23.1 39.2 38.9 6.5] -setPen black -drawLine 1.1 1 3.3 30.6 -drawLine 3.3 30.6 23.1 39.2 -drawLine 23.1 39.2 38.9 6.5 -drawLine 38.9 6.5 1.1 1 -end_block draw -drawText 0 60 "0.0 aligned" -translate 0.1 80.1 -repeat_block draw -drawText 0 60 "0.1 aligned" -translate 0.1 80.1 -repeat_block draw -drawText 0 60 "0.2 aligned" -translate 0.1 80.1 -repeat_block draw -drawText 0 60 "0.3 aligned" -translate 0.1 80.1 -repeat_block draw -drawText 0 60 "0.4 aligned" -translate 0.1 80.1 -repeat_block draw -drawText 0 60 "0.5 aligned" -translate 0.1 80.1 -repeat_block draw -drawText 0 60 "0.6 aligned" -translate 0.1 80.1 -repeat_block draw -drawText 0 60 "0.7 aligned" -translate 0.1 80.1 -repeat_block draw -drawText 0 60 "0.8 aligned" -translate 0.1 80.1 -repeat_block draw -drawText 0 60 "0.9 aligned" - -resetMatrix -translate 100 0 -setPen black -drawText 0 20 "Line and text, 0.0 aligned" -drawLine 0 21 160 21 -translate 0 40.1 -drawText 0 20 "Line and text, 0.1 aligned" -drawLine 0 21 160 21 -translate 0 40.1 -drawText 0 20 "Line and text, 0.2 aligned" -drawLine 0 21 160 21 -translate 0 40.1 -drawText 0 20 "Line and text, 0.3 aligned" -drawLine 0 21 160 21 -translate 0 40.1 -drawText 0 20 "Line and text, 0.4 aligned" -drawLine 0 21 160 21 -translate 0 40.1 -drawText 0 20 "Line and text, 0.5 aligned" -drawLine 0 21 160 21 -translate 0 40.1 -drawText 0 20 "Line and text, 0.6 aligned" -drawLine 0 21 160 21 -translate 0 40.1 -drawText 0 20 "Line and text, 0.7 aligned" -drawLine 0 21 160 21 -translate 0 40.1 -drawText 0 20 "Line and text, 0.8 aligned" -drawLine 0 21 160 21 -translate 0 40.1 -drawText 0 20 "Line and text, 0.9 aligned" -drawLine 0 21 160 21
\ No newline at end of file diff --git a/tests/auto/other/lancelot/scripts/linedashes.qps b/tests/auto/other/lancelot/scripts/linedashes.qps deleted file mode 100644 index 78c791e68b..0000000000 --- a/tests/auto/other/lancelot/scripts/linedashes.qps +++ /dev/null @@ -1,132 +0,0 @@ -# Version: 1 - -translate 10 10 - -setPen 0xffff0000 0 solidline squarecap -translate 50 50 -begin_block draw_lines - save - drawLine 10 0 50 0 - rotate 10 - drawLine 10 0 50 0 - rotate 10 - drawLine 10 0 50 0 - rotate 10 - drawLine 10 0 50 0 - rotate 10 - drawLine 10 0 50 0 - rotate 10 - drawLine 10 0 50 0 - rotate 10 - drawLine 10 0 50 0 - rotate 10 - drawLine 10 0 50 0 - rotate 10 - drawLine 10 0 50 0 - rotate 10 - drawLine 10 0 50 0 - rotate 10 - drawLine 10 0 50 0 - rotate 10 - drawLine 10 0 50 0 - rotate 10 - drawLine 10 0 50 0 - rotate 10 - drawLine 10 0 50 0 - rotate 10 - drawLine 10 0 50 0 - rotate 10 - drawLine 10 0 50 0 - rotate 10 - drawLine 10 0 50 0 - rotate 10 - drawLine 10 0 50 0 - rotate 10 - drawLine 10 0 50 0 - rotate 10 - drawLine 10 0 50 0 - rotate 10 - drawLine 10 0 50 0 - rotate 10 - drawLine 10 0 50 0 - rotate 10 - drawLine 10 0 50 0 - rotate 10 - drawLine 10 0 50 0 - rotate 10 - drawLine 10 0 50 0 - rotate 10 - drawLine 10 0 50 0 - rotate 10 - drawLine 10 0 50 0 - rotate 10 - drawLine 10 0 50 0 - rotate 10 - drawLine 10 0 50 0 - rotate 10 - drawLine 10 0 50 0 - rotate 10 - drawLine 10 0 50 0 - rotate 10 - drawLine 10 0 50 0 - rotate 10 - drawLine 10 0 50 0 - rotate 10 - drawLine 10 0 50 0 - rotate 10 - drawLine 10 0 50 0 - rotate 10 - drawLine 10 0 50 0 - restore -end_block - -setPen 0xffff0000 0 dotline squarecap -translate 100 0 -repeat_block draw_lines -setPen 0xffff0000 0 dashdotline squarecap -translate 100 0 -repeat_block draw_lines -setPen 0xffff0000 0 dashdotdotline squarecap -translate 100 0 -repeat_block draw_lines -setPen 0xffff0000 0 dashline squarecap -translate 100 0 -repeat_block draw_lines - -path_moveTo mypath 10 10 -path_lineTo mypath 87 10 -path_moveTo mypath 10 30 -path_lineTo mypath 87 30 -path_moveTo mypath 10 50 -path_lineTo mypath 87 50 - -resetMatrix -translate 0 150 - -begin_block distinctLines - -setPen black 0 SolidLine SquareCap -pen_setDashPattern [ 3 3 ] -drawPath mypath - -translate 100 0 -setPen black 5 SolidLine SquareCap -pen_setDashPattern [ 3 3 ] -drawPath mypath - -translate 100 0 -setPen black 0 SolidLine RoundCap -pen_setDashPattern [ 3 3 ] -drawPath mypath - -translate 100 0 -setPen black 5 SolidLine RoundCap -pen_setDashPattern [ 3 3 ] -drawPath mypath - -end_block distinctLines - -resetMatrix -translate 0 220 -setRenderHint Antialiasing true -repeat_block distinctLines diff --git a/tests/auto/other/lancelot/scripts/linedashes2.qps b/tests/auto/other/lancelot/scripts/linedashes2.qps deleted file mode 100644 index 1dc4fd310e..0000000000 --- a/tests/auto/other/lancelot/scripts/linedashes2.qps +++ /dev/null @@ -1,154 +0,0 @@ -# Version: 1 -# CheckVsReference: 5% (0 0 800 800) - -translate -30 10 - -setPen 0xffff0000 0 dashline squarecap -pen_setDashPattern [10 5] - -save -translate 100 100 -begin_block lines -drawLine 100 100 200 100 -drawLine 100 100 200 200 -drawLine 100 100 100 200 -end_block - -setPen 0xffff0000 2 dashline squarecap -translate 150 0 -repeat_block lines -restore - -save -save -begin_block horizontal -drawLine 0 0 50 0 -drawLine 3 10 53 10 -drawLine 6 20 56 20 -drawLine 9 30 59 30 - -translate 0 50 - -drawLine 0 0 50 5 -drawLine 3 10 53 15 -drawLine 6 20 56 25 -drawLine 9 30 59 35 - -translate 0 50 - -drawLine 0 0 50 -5 -drawLine 3 10 53 5 -drawLine 6 20 56 15 -drawLine 9 30 59 25 -end_block -restore - -save -translate 80 0 -repeat_block horizontal -restore -save -translate 800 0 -repeat_block horizontal -restore - -translate 180 -40 -save -begin_block vertical -drawLine 0 0 0 50 -drawLine 10 3 10 53 -drawLine 20 6 20 56 -drawLine 30 9 30 59 - -translate 50 0 - -drawLine 0 0 5 50 -drawLine 10 3 15 53 -drawLine 20 6 25 56 -drawLine 30 9 35 59 - -translate 50 0 - -drawLine 0 0 -5 50 -drawLine 10 3 5 53 -drawLine 20 6 15 56 -drawLine 30 9 25 59 -end_block -restore - -save -translate 0 80 -repeat_block vertical -restore -translate 0 800 -repeat_block vertical -restore - -translate 0 200 - -setPen 0xffff0000 2 dashline squarecap -save -repeat_block horizontal -restore -save -translate 80 0 -repeat_block horizontal -restore -save -translate 780 0 -repeat_block horizontal -restore - -translate 360 -240 -save -repeat_block vertical -restore -save -translate 0 80 -repeat_block vertical -restore -translate 0 780 -repeat_block vertical - -resetMatrix -translate 40 400 -setPen 0xffff0000 5 dashdotline flatcap -pen_setDashPattern [1 1 4 1 1 4] -pen_setDashOffset -4 -drawLine 0 0 300 0 -translate 0 8 -pen_setDashOffset -2 -drawLine 0 0 300 0 -translate 0 8 -pen_setDashOffset 0 -drawLine 0 0 300 0 -translate 0 8 -pen_setDashOffset 2 -drawLine 0 0 300 0 -translate 0 8 -pen_setDashOffset 4 -drawLine 0 0 300 0 -translate 0 8 -pen_setDashOffset 6 -drawLine 0 0 300 0 -translate 0 8 -pen_setDashOffset 8 -drawLine 0 0 300 0 -translate 0 8 -pen_setDashOffset 10 -drawLine 0 0 300 0 -translate 0 8 -pen_setDashOffset 12 -drawLine 0 0 300 0 -translate 0 8 -pen_setDashOffset 14 -drawLine 0 0 300 0 -translate 0 8 -pen_setDashOffset 16 -drawLine 0 0 300 0 - -resetMatrix -setPen black 3 dashdotline -pen_setCosmetic true -translate 0 -150 -drawLine 500 160 500 410
\ No newline at end of file diff --git a/tests/auto/other/lancelot/scripts/linedashes2_aa.qps b/tests/auto/other/lancelot/scripts/linedashes2_aa.qps deleted file mode 100644 index c818ab62fe..0000000000 --- a/tests/auto/other/lancelot/scripts/linedashes2_aa.qps +++ /dev/null @@ -1,5 +0,0 @@ -# Version: 1 -# CheckVsReference: 1% (0 0 800 800) - -setRenderHint LineAntialiasing -import "linedashes2.qps"
\ No newline at end of file diff --git a/tests/auto/other/lancelot/scripts/lines.qps b/tests/auto/other/lancelot/scripts/lines.qps deleted file mode 100644 index 274a7f31ec..0000000000 --- a/tests/auto/other/lancelot/scripts/lines.qps +++ /dev/null @@ -1,433 +0,0 @@ -# Version: 1 -# CheckVsReference: 5% (0 0 310 425) - -translate 10 10 - -begin_block draw_lines - save - translate 50 50 - - save - setPen 0x7fff0000 - drawLine 10 0 50 0 - rotate 10 - drawLine 10 0 50 0 - rotate 10 - drawLine 10 0 50 0 - rotate 10 - drawLine 10 0 50 0 - rotate 10 - drawLine 10 0 50 0 - rotate 10 - drawLine 10 0 50 0 - rotate 10 - drawLine 10 0 50 0 - rotate 10 - drawLine 10 0 50 0 - rotate 10 - drawLine 10 0 50 0 - rotate 10 - drawLine 10 0 50 0 - rotate 10 - drawLine 10 0 50 0 - rotate 10 - drawLine 10 0 50 0 - rotate 10 - drawLine 10 0 50 0 - rotate 10 - drawLine 10 0 50 0 - rotate 10 - drawLine 10 0 50 0 - rotate 10 - drawLine 10 0 50 0 - rotate 10 - drawLine 10 0 50 0 - rotate 10 - drawLine 10 0 50 0 - rotate 10 - drawLine 10 0 50 0 - rotate 10 - drawLine 10 0 50 0 - rotate 10 - drawLine 10 0 50 0 - rotate 10 - drawLine 10 0 50 0 - rotate 10 - drawLine 10 0 50 0 - rotate 10 - drawLine 10 0 50 0 - rotate 10 - drawLine 10 0 50 0 - rotate 10 - drawLine 10 0 50 0 - rotate 10 - drawLine 10 0 50 0 - rotate 10 - drawLine 10 0 50 0 - rotate 10 - drawLine 10 0 50 0 - rotate 10 - drawLine 10 0 50 0 - rotate 10 - drawLine 10 0 50 0 - rotate 10 - drawLine 10 0 50 0 - rotate 10 - drawLine 10 0 50 0 - rotate 10 - drawLine 10 0 50 0 - rotate 10 - drawLine 10 0 50 0 - rotate 10 - drawLine 10 0 50 0 - restore - - # and then draw the lines the other direction - save - setPen 0x7f0000ff - drawLine 50 0 10 0 - rotate 10 - drawLine 50 0 10 0 - rotate 10 - drawLine 50 0 10 0 - rotate 10 - drawLine 50 0 10 0 - rotate 10 - drawLine 50 0 10 0 - rotate 10 - drawLine 50 0 10 0 - rotate 10 - drawLine 50 0 10 0 - rotate 10 - drawLine 50 0 10 0 - rotate 10 - drawLine 50 0 10 0 - rotate 10 - drawLine 50 0 10 0 - rotate 10 - drawLine 50 0 10 0 - rotate 10 - drawLine 50 0 10 0 - rotate 10 - drawLine 50 0 10 0 - rotate 10 - drawLine 50 0 10 0 - rotate 10 - drawLine 50 0 10 0 - rotate 10 - drawLine 50 0 10 0 - rotate 10 - drawLine 50 0 10 0 - rotate 10 - drawLine 50 0 10 0 - rotate 10 - drawLine 50 0 10 0 - rotate 10 - drawLine 50 0 10 0 - rotate 10 - drawLine 50 0 10 0 - rotate 10 - drawLine 50 0 10 0 - rotate 10 - drawLine 50 0 10 0 - rotate 10 - drawLine 50 0 10 0 - rotate 10 - drawLine 50 0 10 0 - rotate 10 - drawLine 50 0 10 0 - rotate 10 - drawLine 50 0 10 0 - rotate 10 - drawLine 50 0 10 0 - rotate 10 - drawLine 50 0 10 0 - rotate 10 - drawLine 50 0 10 0 - rotate 10 - drawLine 50 0 10 0 - rotate 10 - drawLine 50 0 10 0 - rotate 10 - drawLine 50 0 10 0 - rotate 10 - drawLine 50 0 10 0 - rotate 10 - drawLine 50 0 10 0 - rotate 10 - drawLine 50 0 10 0 - restore - - # and now with a clip - save - setClipRect -30 -30 60 60 - setPen 0x7f00ff00 - drawLine 10 0 50 0 - rotate 10 - drawLine 10 0 50 0 - rotate 10 - drawLine 10 0 50 0 - rotate 10 - drawLine 10 0 50 0 - rotate 10 - drawLine 10 0 50 0 - rotate 10 - drawLine 10 0 50 0 - rotate 10 - drawLine 10 0 50 0 - rotate 10 - drawLine 10 0 50 0 - rotate 10 - drawLine 10 0 50 0 - rotate 10 - drawLine 10 0 50 0 - rotate 10 - drawLine 10 0 50 0 - rotate 10 - drawLine 10 0 50 0 - rotate 10 - drawLine 10 0 50 0 - rotate 10 - drawLine 10 0 50 0 - rotate 10 - drawLine 10 0 50 0 - rotate 10 - drawLine 10 0 50 0 - rotate 10 - drawLine 10 0 50 0 - rotate 10 - drawLine 10 0 50 0 - rotate 10 - drawLine 10 0 50 0 - rotate 10 - drawLine 10 0 50 0 - rotate 10 - drawLine 10 0 50 0 - rotate 10 - drawLine 10 0 50 0 - rotate 10 - drawLine 10 0 50 0 - rotate 10 - drawLine 10 0 50 0 - rotate 10 - drawLine 10 0 50 0 - rotate 10 - drawLine 10 0 50 0 - rotate 10 - drawLine 10 0 50 0 - rotate 10 - drawLine 10 0 50 0 - rotate 10 - drawLine 10 0 50 0 - rotate 10 - drawLine 10 0 50 0 - rotate 10 - drawLine 10 0 50 0 - rotate 10 - drawLine 10 0 50 0 - rotate 10 - drawLine 10 0 50 0 - rotate 10 - drawLine 10 0 50 0 - rotate 10 - drawLine 10 0 50 0 - rotate 10 - drawLine 10 0 50 0 - restore - - restore -end_block - -save - translate 100 0 - scale 2 2 - repeat_block draw_lines -restore - -translate 0 10 - -save - translate 0 200 - setRenderHint Antialiasing - repeat_block draw_lines -restore - -save - translate 100 200 - scale 2 2 - setRenderHint Antialiasing - repeat_block draw_lines -restore - -setPen 0x000000 8 -translate 350 240 -drawText 0 0 "Steep slopes:" - -translate 0 10 - -drawLine 0 0 -8 400 -translate 20 0 -drawLine 0 0 -7 400 -translate 20 0 -drawLine 0 0 -6 400 -translate 20 0 -drawLine 0 0 -5 400 -translate 20 0 -drawLine 0 0 -4 400 -translate 20 0 -drawLine 0 0 -3 400 -translate 20 0 -drawLine 0 0 -2 400 -translate 20 0 -drawLine 0 0 -1 400 -translate 20 0 -drawLine 0 0 0 400 -translate 20 0 -drawLine 0 0 1 400 -translate 20 0 -drawLine 0 0 2 400 -translate 20 0 -drawLine 0 0 3 400 -translate 20 0 -drawLine 0 0 4 400 -translate 20 0 -drawLine 0 0 5 400 -translate 20 0 -drawLine 0 0 6 400 -translate 20 0 -drawLine 0 0 7 400 -translate 20 0 -drawLine 0 0 8 400 - -resetMatrix - -translate 20 450 - -drawText 0 0 "Zero length lines:" - -translate 0 20 -drawText 100 10 "Square cap" -save -begin_block points -setPen 0x000000 1 solidline squarecap -drawLine 0 0 0 0 -setPen 0x000000 2 solidline squarecap -drawLine 8 0 8 0 -setPen 0x000000 3 solidline squarecap -drawLine 16 0 16 0 -setPen 0x000000 4 solidline squarecap -drawLine 24 0 24 0 -setPen 0x000000 5 solidline squarecap -drawLine 32 0 32 0 -setPen 0x000000 6 solidline squarecap -drawLine 40 0 40 0 -setPen 0x000000 7 solidline squarecap -drawLine 48 0 48 0 -setPen 0x000000 8 solidline squarecap -drawLine 57 0 57 0 -setPen 0x000000 9 solidline squarecap -drawLine 67 0 67 0 -setPen 0x000000 10 solidline squarecap -drawLine 78 0 78 0 -end_block points -restore - -translate 0 12 -setRenderHint Antialiasing off -repeat_block points -setRenderHint Antialiasing - -translate 0 20 -drawText 100 10 "Round cap" -save -begin_block points2 -setPen 0x000000 1 solidline roundcap -drawLine 0 0 0 0 -setPen 0x000000 2 solidline roundcap -drawLine 8 0 8 0 -setPen 0x000000 3 solidline roundcap -drawLine 16 0 16 0 -setPen 0x000000 4 solidline roundcap -drawLine 24 0 24 0 -setPen 0x000000 5 solidline roundcap -drawLine 32 0 32 0 -setPen 0x000000 6 solidline roundcap -drawLine 40 0 40 0 -setPen 0x000000 7 solidline roundcap -drawLine 48 0 48 0 -setPen 0x000000 8 solidline roundcap -drawLine 57 0 57 0 -setPen 0x000000 9 solidline roundcap -drawLine 67 0 67 0 -setPen 0x000000 10 solidline roundcap -drawLine 78 0 78 0 -end_block points2 -restore - -translate 0 12 -setRenderHint Antialiasing off -repeat_block points2 -setRenderHint Antialiasing - -translate 0 20 -drawText 100 10 "Flat cap" -save -begin_block points3 -setPen 0x000000 1 solidline flatcap -drawLine 0 0 0 0 -setPen 0x000000 2 solidline flatcap -drawLine 8 0 8 0 -setPen 0x000000 3 solidline flatcap -drawLine 16 0 16 0 -setPen 0x000000 4 solidline flatcap -drawLine 24 0 24 0 -setPen 0x000000 5 solidline flatcap -drawLine 32 0 32 0 -setPen 0x000000 6 solidline flatcap -drawLine 40 0 40 0 -setPen 0x000000 7 solidline flatcap -drawLine 48 0 48 0 -setPen 0x000000 8 solidline flatcap -drawLine 57 0 57 0 -setPen 0x000000 9 solidline flatcap -drawLine 67 0 67 0 -setPen 0x000000 10 solidline flatcap -drawLine 78 0 78 0 -end_block points3 -restore - -translate 0 12 -setRenderHint Antialiasing off -repeat_block points3 - -resetMatrix -translate -220 667.226 -drawText 230 -80 "Task 194266 (should see only one line):" -setPen black -drawRect 230.5 -70.5 122 12 -setRenderHint Antialiasing -setPen red -drawLine 236.842105263 -63.775117299 247.368421053 -63.775437504 - -setRenderHint Antialiasing off -resetMatrix -translate 10 640 -setPen black -drawText 0 -10 "Task 207147 (should see two lines):" -drawRect 0.5 0.5 64 64 -setRenderHint Antialiasing -setPen red - -drawLine 4.5 4.5 4.5001 60.5 -drawLine 4.5 4.5 60.5 4.5001 - -setRenderHint Antialiasing off -resetMatrix -translate 10 730 -setPen black -drawText 0 -10 "Task 229459 (should see one diagonal line):" -drawRect 0.5 0.5 64 64 -setPen red 2 solidline flatcap - -setClipRect 2 2 63 63 -drawLine 1.5 1.5 33560000 33560000 diff --git a/tests/auto/other/lancelot/scripts/lines2.qps b/tests/auto/other/lancelot/scripts/lines2.qps deleted file mode 100644 index af6ad65939..0000000000 --- a/tests/auto/other/lancelot/scripts/lines2.qps +++ /dev/null @@ -1,179 +0,0 @@ -# Version: 1 -# CheckVsReference: 5% - -translate 10 20 -drawText 0 0 "Thin lines" - -translate 60 70 - -save -begin_block lines -translate 0 -60 -translate 0 5 -setPen 0x000000 0.05 -drawLine -60 -2 60 2 -translate 0 5 -setPen 0x000000 0.1 -drawLine -60 -2 60 2 -translate 0 5 -setPen 0x000000 0.15 -drawLine -60 -2 60 2 -translate 0 5 -setPen 0x000000 0.2 -drawLine -60 -2 60 2 -translate 0 5 -setPen 0x000000 0.25 -drawLine -60 -2 60 2 -translate 0 5 -setPen 0x000000 0.3 -drawLine -60 -2 60 2 -translate 0 5 -setPen 0x000000 0.35 -drawLine -60 -2 60 2 -translate 0 5 -setPen 0x000000 0.2 -drawLine -60 -2 60 2 -translate 0 5 -setPen 0x000000 0.25 -drawLine -60 -2 60 2 -translate 0 5 -setPen 0x000000 0.5 -drawLine -60 -2 60 2 -translate 0 5 -setPen 0x000000 0.55 -drawLine -60 -2 60 2 -translate 0 5 -setPen 0x000000 0.6 -drawLine -60 -2 60 2 -translate 0 5 -setPen 0x000000 0.65 -drawLine -60 -2 60 2 -translate 0 5 -setPen 0x000000 0.7 -drawLine -60 -2 60 2 -translate 0 5 -setPen 0x000000 0.75 -drawLine -60 -2 60 2 -translate 0 5 -setPen 0x000000 0.8 -drawLine -60 -2 60 2 -translate 0 5 -setPen 0x000000 0.85 -drawLine -60 -2 60 2 -translate 0 5 -setPen 0x000000 0.9 -drawLine -60 -2 60 2 -translate 0 5 -setPen 0x000000 0.95 -drawLine -60 -2 60 2 -translate 0 5 -setPen 0x000000 1 -drawLine -60 -2 60 2 -translate 0 5 -setPen 0x000000 1.05 -drawLine -60 -2 60 2 -translate 0 5 -setPen 0x000000 1.1 -drawLine -60 -2 60 2 -translate 0 5 -setPen 0x000000 1.15 -drawLine -60 -2 60 2 -translate 0 5 -setPen 0x000000 1.2 -drawLine -60 -2 60 2 -translate 0 5 -setPen 0x000000 1.25 -drawLine -60 -2 60 2 -translate 0 5 -setPen 0x000000 1.3 -drawLine -60 -2 60 2 -translate 0 5 -setPen 0x000000 1.35 -drawLine -60 -2 60 2 -translate 0 5 -setPen 0x000000 1.2 -drawLine -60 -2 60 2 -translate 0 5 -setPen 0x000000 1.25 -drawLine -60 -2 60 2 -translate 0 5 -setPen 0x000000 1.5 -drawLine -60 -2 60 2 -translate 0 5 -setPen 0x000000 1.55 -drawLine -60 -2 60 2 -translate 0 5 -setPen 0x000000 1.6 -drawLine -60 -2 60 2 -translate 0 5 -setPen 0x000000 1.65 -drawLine -60 -2 60 2 -translate 0 5 -setPen 0x000000 1.7 -drawLine -60 -2 60 2 -translate 0 5 -setPen 0x000000 1.75 -drawLine -60 -2 60 2 -translate 0 5 -setPen 0x000000 1.8 -drawLine -60 -2 60 2 -translate 0 5 -setPen 0x000000 1.85 -drawLine -60 -2 60 2 -translate 0 5 -setPen 0x000000 1.9 -drawLine -60 -2 60 2 -translate 0 5 -setPen 0x000000 1.95 -drawLine -60 -2 60 2 -translate 0 5 -setPen 0x000000 2 -drawLine -60 -2 60 2 -end_block -restore - -save -translate 150 0 -scale -1 1 -repeat_block lines -restore - -save -translate 80 220 -rotate 90 -repeat_block lines -restore - -save -translate 80 370 -rotate 90 -scale -1 1 -repeat_block lines -restore - -setRenderHint Antialiasing - -translate 300 0 - -save -repeat_block lines -restore - -save -translate 150 0 -scale -1 1 -repeat_block lines -restore - -save -translate 80 220 -rotate 90 -repeat_block lines -restore - -save -translate 80 370 -rotate 90 -scale -1 1 -repeat_block lines -restore
\ No newline at end of file diff --git a/tests/auto/other/lancelot/scripts/lines3.qps b/tests/auto/other/lancelot/scripts/lines3.qps deleted file mode 100644 index 676235e652..0000000000 --- a/tests/auto/other/lancelot/scripts/lines3.qps +++ /dev/null @@ -1,171 +0,0 @@ - -clearRenderHint -setPen black 0 solidline squarecap - -save -translate 20 20 - -begin_block lines - -# 0 -> 45 degress -drawLine 100 100 200 90 -drawLine 100 100 200 80 -drawLine 100 100 200 70 -drawLine 100 100 200 60 -drawLine 100 100 200 50 -drawLine 100 100 200 40 -drawLine 100 100 200 30 -drawLine 100 100 200 20 -drawLine 100 100 200 10 - -# 45 -drawLine 100 100 200 0 - -# 45 -> 90 -drawLine 100 100 190 0 -drawLine 100 100 180 0 -drawLine 100 100 170 0 -drawLine 100 100 160 0 -drawLine 100 100 150 0 -drawLine 100 100 140 0 -drawLine 100 100 130 0 -drawLine 100 100 120 0 -drawLine 100 100 110 0 - -# 90 -drawLine 100 100 100 0 - -# 90 -> 135 -drawLine 100 100 90 0 -drawLine 100 100 80 0 -drawLine 100 100 70 0 -drawLine 100 100 60 0 -drawLine 100 100 50 0 -drawLine 100 100 40 0 -drawLine 100 100 30 0 -drawLine 100 100 20 0 -drawLine 100 100 10 0 - -# 135 -drawLine 100 100 0 0 - -# 135 -> 180 degress -drawLine 100 100 0 10 -drawLine 100 100 0 20 -drawLine 100 100 0 30 -drawLine 100 100 0 40 -drawLine 100 100 0 50 -drawLine 100 100 0 60 -drawLine 100 100 0 70 -drawLine 100 100 0 80 -drawLine 100 100 0 90 - -# 180 -drawLine 100 100 0 100 - -# 180 -> 225 -drawLine 100 100 0 110 -drawLine 100 100 0 120 -drawLine 100 100 0 130 -drawLine 100 100 0 140 -drawLine 100 100 0 150 -drawLine 100 100 0 160 -drawLine 100 100 0 170 -drawLine 100 100 0 180 -drawLine 100 100 0 190 - -# 225 -drawLine 100 100 0 200 - -# 225 -> 270 -drawLine 100 100 10 200 -drawLine 100 100 20 200 -drawLine 100 100 30 200 -drawLine 100 100 40 200 -drawLine 100 100 50 200 -drawLine 100 100 60 200 -drawLine 100 100 70 200 -drawLine 100 100 80 200 -drawLine 100 100 90 200 - -# 270 -drawLine 100 100 100 200 - -# 270 -> 315 degrees -drawLine 100 100 110 200 -drawLine 100 100 120 200 -drawLine 100 100 130 200 -drawLine 100 100 140 200 -drawLine 100 100 150 200 -drawLine 100 100 160 200 -drawLine 100 100 170 200 -drawLine 100 100 180 200 -drawLine 100 100 190 200 - -# 315 -drawLine 100 100 200 200 - -# 315 -> 360 degress -drawLine 100 100 200 100 -drawLine 100 100 200 110 -drawLine 100 100 200 120 -drawLine 100 100 200 130 -drawLine 100 100 200 140 -drawLine 100 100 200 150 -drawLine 100 100 200 160 -drawLine 100 100 200 170 -drawLine 100 100 200 180 -drawLine 100 100 200 190 - -end_block - -setRenderHint Antialiasing -setPen 0x7fff0000 0 solidline squarecap -repeat_block lines - -translate 250.5 0.5 -clearRenderHint -setPen black 0 solidline squarecap -repeat_block lines -setRenderHint Antialiasing -setPen 0x7fff0000 0 solidline squarecap -repeat_block lines - -restore - -save - -translate 20 250 -clearRenderHint -setPen black 1 solidline squarecap -repeat_block lines -setRenderHint Antialiasing -setPen 0x7fff0000 1 solidline squarecap -repeat_block lines - -translate 250.5 0.5 -clearRenderHint -setPen black 1 soslidline squarecap -repeat_block lines -setRenderHint Antialiasing -setPen 0x7fff0000 0 solidline squarecap -repeat_block lines - -restore - -translate 20 500 -scale 1.5 1.5 -clearRenderHint -setPen black 1 solidline squarecap -repeat_block lines -setRenderHint Antialiasing -setPen 0x7fff0000 1 solidline squarecap -repeat_block lines - -translate 250.5 0.5 -clearRenderHint -setPen black 1 soslidline squarecap -repeat_block lines -setRenderHint Antialiasing -setPen 0x7fff0000 0 solidline squarecap -repeat_block lines diff --git a/tests/auto/other/lancelot/scripts/pathfill.qps b/tests/auto/other/lancelot/scripts/pathfill.qps deleted file mode 100644 index 821b4684c9..0000000000 --- a/tests/auto/other/lancelot/scripts/pathfill.qps +++ /dev/null @@ -1,38 +0,0 @@ -# Version: 1 -# CheckVsReference: 1% (0 0 850 420) - -setPen afff0000 4 - -setBrush dome_rgb32.png -drawEllipse 10 10 200 200 - -setBrush dome_argb32.png -drawEllipse 220 10 200 200 - -setPen NoPen - -setBrush dome_rgb32.png -drawEllipse 10 220 200 200 - -setBrush dome_argb32.png -drawEllipse 220 220 200 200 - -setBrushOrigin -30 -30 - -setPen afff0000 4 -setBrush dome_rgb32.png -drawEllipse 430 10 200 200 - -setBrush dome_argb32.png -drawEllipse 640 10 200 200 - -setPen NoPen -setBrush dome_rgb32.png -drawEllipse 430 220 200 200 - -setBrush dome_argb32.png -drawEllipse 640 220 200 200 - -setPen black -drawText 150 450 "No offset RGB/ARGB" -drawText 550 450 "-30 offset RGB/ARGB"
\ No newline at end of file diff --git a/tests/auto/other/lancelot/scripts/paths.qps b/tests/auto/other/lancelot/scripts/paths.qps deleted file mode 100644 index 454b2a039d..0000000000 --- a/tests/auto/other/lancelot/scripts/paths.qps +++ /dev/null @@ -1,49 +0,0 @@ -# Version: 1 - -setPen black 1 -setBrush 7f7fff - -setFont "arial" 12 -drawText 10 330 "Non-Cosmetic" -drawText 10 730 "Cosmetic" - -path_moveTo star 50 0 -path_lineTo star 30 90 -path_lineTo star 100 60 -path_lineTo star 0 20 -path_lineTo star 80 100 - -setFont "times" 50 -path_addText text 0 50 "ABCD, 1234, abcd, #¤%&" - -path_addRect rectncircle 0 0 75 75 -path_addEllipse rectncircle 25 25 75 75 -path_setFillRule rectncircle winding - -path_moveTo curve 100 0 -path_cubicTo curve 100 100 50 50 0 100 - -begin_block drawing -drawPath star -translate 100 0 -drawPath rectncircle -translate 100 0 -drawPath curve -translate -200 100 -drawPath text -end_block - -begin_block xform -save -translate 50 60 -rotate 10 -scale 1.0 0.7 -repeat_block drawing -restore -end_block xform - -setPen black 0 -setBrush ff7f7f -translate 0 300 -repeat_block drawing -repeat_block xform diff --git a/tests/auto/other/lancelot/scripts/paths_aa.qps b/tests/auto/other/lancelot/scripts/paths_aa.qps deleted file mode 100644 index 4812e2fa5f..0000000000 --- a/tests/auto/other/lancelot/scripts/paths_aa.qps +++ /dev/null @@ -1,4 +0,0 @@ -# Version: 1 - -setRenderHint LineAntialiasing -import "paths.qps" diff --git a/tests/auto/other/lancelot/scripts/pens.qps b/tests/auto/other/lancelot/scripts/pens.qps deleted file mode 100644 index c72636dcef..0000000000 --- a/tests/auto/other/lancelot/scripts/pens.qps +++ /dev/null @@ -1,133 +0,0 @@ -# Version: 1 -# CheckVsReference: 1% (0 0 800 800) - - -translate 10 10 - -begin_block penstyles -setPen black 0 solidline flatcap -drawLine 0 0 100 0 -setPen black 0 dashline flatcap -drawLine 100 0 100 40 -setPen black 0 dotline flatcap -drawLine 100 40 200 0 -setPen black 0 dashdotline flatcap -drawLine 200 0 300 0 -setPen black 0 dashdotdotline flatcap -drawLine 300 0 400 40 - -translate 0 50 -setPen blue 2 solidline flatcap -drawLine 0 0 100 0 -setPen blue 2 dashline flatcap -drawLine 100 0 100 40 -setPen blue 2 dotline flatcap -drawLine 100 40 200 0 -setPen blue 2 dashdotline flatcap -drawLine 200 0 300 0 -setPen blue 2 dashdotdotline flatcap -drawLine 300 0 400 40 - -translate 0 50 -setPen red 5 solidline flatcap -drawLine 0 0 100 0 -setPen red 5 dashline flatcap -drawLine 100 0 100 40 -setPen red 5 dotline flatcap -drawLine 100 40 200 0 -setPen red 5 dashdotline flatcap -drawLine 200 0 300 0 -setPen red 5 dashdotdotline flatcap -drawLine 300 0 400 40 -end_block - -translate 0 50 -scale 1 2 -repeat_block penstyles - - -# Test cap styles -resetMatrix -translate 420 10 -setPen green 5 dashdotline flatcap -drawLine 0 0 200 0 -setPen green 5 dashdotline roundcap -drawLine 0 20 200 20 -setPen green 5 dashdotline squarecap -drawLine 0 40 200 40 - - -# Test join styles -resetMatrix -translate 420 80 -setBrush nobrush -begin_block joinstyles -setPen orange 10 solidline flatcap miterjoin -drawPolyline [ 0 0 80 0 80 80 0 80 ] - -translate 0 100 -setPen aquamarine 10 solidline squarecap beveljoin -drawPolyline [ 0 0 80 0 80 80 0 80 ] - -translate 0 100 -setPen purple 10 solidline roundcap roundjoin -drawPolyline [ 0 0 80 0 80 80 0 80 ] -end_block - -translate 130 -200 -scale 2 1 -rotate 1 -repeat_block joinstyles - -# transparent lines -resetMatrix -translate 10 400 -setPen #7f000000 -drawLine 0 0 50 0 -setPen #7f000000 1 SolidLine -drawLine 0 10 50 10 -setPen #7f000000 5 SolidLine -drawLine 0 20 50 20 -setPen #7f000000 10 SolidLine -drawLine 0 30 50 30 -setPen #7f000000 -drawLine 0 0 0 50 -setPen #7f000000 1 SolidLine -drawLine 10 0 10 50 -setPen #7f000000 5 SolidLine -drawLine 20 0 20 50 -setPen #7f000000 10 SolidLine -drawLine 30 0 30 50 - -# pen styles -resetMatrix -translate 0 500 -setPen black 0 DashLine -drawLine 20 20 100 20 -translate 0 10 -setPen black 0 DotLine -drawLine 20 20 100 20 -translate 0 10 -setPen black 0 DashDotLine -drawLine 20 20 100 20 -translate 0 10 -setPen black 0 DashDotDotLine -drawLine 20 20 100 20 - -# scaling ellipse -resetMatrix -setPen black 0.008 DashLine -translate 250 550 -rotate 30 -scale 250 250 -drawEllipse -0.4 -0.4 0.8 0.8 - -# scaling path -path_addEllipse star -0.3 -0.3 0.6 0.6 - -resetMatrix -setPen black 0.008 DashLine -translate 250 550 -rotate 30 -scale 250 250 -drawPath star diff --git a/tests/auto/other/lancelot/scripts/pens_aa.qps b/tests/auto/other/lancelot/scripts/pens_aa.qps deleted file mode 100644 index 066cac365f..0000000000 --- a/tests/auto/other/lancelot/scripts/pens_aa.qps +++ /dev/null @@ -1,6 +0,0 @@ -# Version: 1 -# CheckVsReference: 1% (0 0 800 800) - -setRenderHint LineAntialiasing - -import "pens.qps"
\ No newline at end of file diff --git a/tests/auto/other/lancelot/scripts/pens_cosmetic.qps b/tests/auto/other/lancelot/scripts/pens_cosmetic.qps deleted file mode 100644 index 9120290462..0000000000 --- a/tests/auto/other/lancelot/scripts/pens_cosmetic.qps +++ /dev/null @@ -1,116 +0,0 @@ -# Version: 1 -# CheckVsReference: 1% (0 0 585 470) - -path_addEllipse path 22 0 7 7 -path_addRect path 25 5 4 4 - -translate 20 20 - -setPen black 0 -pen_setCosmetic false - -begin_block lines - save - drawLine 0 0 10 10 - drawLine 2 0 10 0 - drawLine 0 2 0 10 - drawPolygon [12 0 20 0 15 10] - drawPath path - drawEllipse 32 0 8 8 - drawPoint 36 4 - - translate 100 0 - save - scale 4 1 - drawLine 0 0 10 10 - drawLine 2 0 10 0 - drawLine 0 2 0 10 - drawPolygon [12 0 20 0 15 10] - drawPath path - drawEllipse 32 0 8 8 - drawPoint 36 4 - restore - - translate 200 0 - save - scale 1 4 - drawLine 0 0 10 10 - drawLine 2 0 10 0 - drawLine 0 2 0 10 - drawPolygon [12 0 20 0 15 10] - drawPath path - drawEllipse 32 0 8 8 - drawPoint 36 4 - restore - - translate 100 0 - save - scale 4 4 - drawLine 0 0 10 10 - drawLine 2 0 10 0 - drawLine 0 2 0 10 - drawPolygon [12 0 20 0 15 10] - drawPath path - drawEllipse 32 0 8 8 - drawPoint 36 4 - restore - restore -end_block - -drawText 580 15 "non-cosmetic, 0-width" -translate 0 50 - -setPen black 2 -pen_setCosmetic false -repeat_block lines -drawText 580 15 "non-cosmetic, 2-width" - -translate 0 20 -translate 0 50 -setPen black 0 -pen_setCosmetic true -repeat_block lines -drawText 580 15 "cosmetic, 0-width" - -translate 0 50 -setPen black 2 -pen_setCosmetic true -repeat_block lines -drawText 580 15 "cosmetic, 2-width" - - -setRenderHint Antialiasing -translate 0 20 - -translate 0 50 -setPen black 0 -pen_setCosmetic false -repeat_block lines -drawText 580 15 "non-cosmetic, 0-width" - -translate 0 50 - -setPen black 2 -pen_setCosmetic false -repeat_block lines -drawText 580 15 "non-cosmetic, 2-width" - -translate 0 20 -translate 0 50 -setPen black 0 -pen_setCosmetic true -repeat_block lines -drawText 580 15 "cosmetic, 0-width" - -translate 0 50 -setPen black 2 -pen_setCosmetic true -repeat_block lines -drawText 580 15 "cosmetic, 2-width" - - -translate 0 70 -drawText 0 0 "scale(1, 1)" -drawText 150 0 "scale(4, 1)" -drawText 300 0 "scale(1, 4)" -drawText 450 0 "scale(4, 4)"
\ No newline at end of file diff --git a/tests/auto/other/lancelot/scripts/perspectives.qps b/tests/auto/other/lancelot/scripts/perspectives.qps deleted file mode 100644 index 0b903e5260..0000000000 --- a/tests/auto/other/lancelot/scripts/perspectives.qps +++ /dev/null @@ -1,72 +0,0 @@ -# Version: 1 - - -setRenderHint Antialiasing - -setPen #00ff00 - -image_load image.png the_image - -translate 10 10 -# standard draw -drawImage the_image 0 0 - -# Rotation w/o smooth xform -save -translate 350 0 -save - setRenderHint SmoothPixmapTransform on - mapQuadToQuad 0 0 0 300 300 300 300 0 0 50 0 200 300 300 300 0 - drawImage the_image 0 0 -restore -restore - -translate 0 320 - -save - setRenderHint SmoothPixmapTransform on - mapQuadToQuad 0 0 0 300 300 300 300 0 0 0 100 300 200 300 300 0 - drawImage the_image 0 0 -restore - -save -translate 350 0 -save - setRenderHint SmoothPixmapTransform on - mapQuadToQuad 0 0 0 300 300 300 300 0 0 0 0 300 300 250 300 50 - drawImage the_image 0 0 -restore -restore - -setRenderHint SmoothPixmapTransform on -setBrush red -setPen black -resetMatrix -translate 100 720 -rotate_y 85 -scale 7 0.01 -drawRect -150 -150 300 300 - -resetMatrix -setBrush gam030.png -setPen black 30 -translate 700 700 -rotate_y -85 -scale 7 0.01 -drawRect -150 -150 300 300 - -resetMatrix -setPen black -translate 125 20 -drawText 0 0 "No transform" -translate 350 0 -drawText 0 0 "Left Tilted" -resetMatrix -translate 125 350 -drawText 0 0 "Bottom Tilted" -translate 350 0 -drawText 0 0 "Right Tilted" -translate 120 0 -resetMatrix -translate 300 760 -drawText 0 0 "Perspective Clipping"
\ No newline at end of file diff --git a/tests/auto/other/lancelot/scripts/perspectives2.qps b/tests/auto/other/lancelot/scripts/perspectives2.qps deleted file mode 100644 index 6762e21af4..0000000000 --- a/tests/auto/other/lancelot/scripts/perspectives2.qps +++ /dev/null @@ -1,309 +0,0 @@ -# Version: 1 - -setRenderHint Antialiasing - -image_load zebra.png zebra_png - -image_convertToFormat zebra_png zebra ARGB32_Premultiplied - -translate 75 100 -# standard draw -begin_block row1 -drawImage zebra -50 -50 - -translate 90 0 -save -rotate_y 50 -drawImage zebra -50 -50 -restore - -translate 65 0 -save -rotate_y 60 -drawImage zebra -50 -50 -restore - -translate 50 0 -save -rotate_y 70 -drawImage zebra -50 -50 -restore - -translate 30 0 -save -rotate_y 80 -drawImage zebra -50 -50 -restore - -translate 24 0 -save -rotate_y 82 -drawImage zebra -50 -50 -restore - -translate 20 0 -save -rotate_y 84 -drawImage zebra -50 -50 -restore - -translate 16 0 -save -rotate_y 86 -drawImage zebra -50 -50 -restore - -translate 12 0 -save -rotate_y 87 -drawImage zebra -50 -50 -restore - -translate 8 0 -save -rotate_y 88 -drawImage zebra -50 -50 -restore - -translate 6 0 -save -rotate_y 89 -drawImage zebra -50 -50 -restore - -translate 6 0 -save -rotate_y 91 -drawImage zebra -50 -50 -restore - -translate 6 0 -save -rotate_y 92 -drawImage zebra -50 -50 -restore - -translate 8 0 -save -rotate_y 93 -drawImage zebra -50 -50 -restore - -translate 12 0 -save -rotate_y 94 -drawImage zebra -50 -50 -restore - -translate 16 0 -save -rotate_y 96 -drawImage zebra -50 -50 -restore - -translate 20 0 -save -rotate_y 98 -drawImage zebra -50 -50 -restore - -translate 24 0 -save -rotate_y 100 -drawImage zebra -50 -50 -restore - -translate 30 0 -save -rotate_y 110 -drawImage zebra -50 -50 -restore - -translate 50 0 -save -rotate_y 120 -drawImage zebra -50 -50 -restore - -translate 65 0 -save -rotate_y 130 -drawImage zebra -50 -50 -restore - -translate 90 0 -save -rotate_y 180 -drawImage zebra -50 -50 -restore -end_block row1 - -resetMatrix -translate 75 280 -setRenderHint SmoothPixmapTransform -repeat_block row1 - -resetMatrix -setPen black -translate 300 20 -drawText 0 0 "Fast Pixmap Transform" -resetMatrix -translate 300 210 -drawText 0 0 "Smooth Pixmap Transform" - -resetMatrix -translate 0 400 - -image_load dome_argb32.png the_pixmap - -image_convertToFormat the_pixmap dome ARGB32 - -setRenderHint SmoothPixmapTransform false - -translate 75 100 -# standard draw -begin_block row2 -drawImage dome -50 -50 - -translate 90 0 -save -rotate_y 50 -drawImage dome -50 -50 -restore - -translate 65 0 -save -rotate_y 60 -drawImage dome -50 -50 -restore - -translate 50 0 -save -rotate_y 70 -drawImage dome -50 -50 -restore - -translate 30 0 -save -rotate_y 80 -drawImage dome -50 -50 -restore - -translate 24 0 -save -rotate_y 82 -drawImage dome -50 -50 -restore - -translate 20 0 -save -rotate_y 84 -drawImage dome -50 -50 -restore - -translate 16 0 -save -rotate_y 86 -drawImage dome -50 -50 -restore - -translate 12 0 -save -rotate_y 87 -drawImage dome -50 -50 -restore - -translate 8 0 -save -rotate_y 88 -drawImage dome -50 -50 -restore - -translate 6 0 -save -rotate_y 89 -drawImage dome -50 -50 -restore - -translate 6 0 -save -rotate_y 91 -drawImage dome -50 -50 -restore - -translate 6 0 -save -rotate_y 92 -drawImage dome -50 -50 -restore - -translate 8 0 -save -rotate_y 93 -drawImage dome -50 -50 -restore - -translate 12 0 -save -rotate_y 94 -drawImage dome -50 -50 -restore - -translate 16 0 -save -rotate_y 96 -drawImage dome -50 -50 -restore - -translate 20 0 -save -rotate_y 98 -drawImage dome -50 -50 -restore - -translate 24 0 -save -rotate_y 100 -drawImage dome -50 -50 -restore - -translate 30 0 -save -rotate_y 110 -drawImage dome -50 -50 -restore - -translate 50 0 -save -rotate_y 120 -drawImage dome -50 -50 -restore - -translate 65 0 -save -rotate_y 130 -drawImage dome -50 -50 -restore - -translate 90 0 -save -rotate_y 180 -drawImage dome -50 -50 -restore -end_block row2 - -resetMatrix -translate 0 400 -translate 75 280 -setRenderHint SmoothPixmapTransform -repeat_block row2 - -resetMatrix -setPen black -translate 0 400 -translate 300 20 -drawText 0 0 "Fast Pixmap Transform" -resetMatrix -translate 0 400 -translate 300 210 -drawText 0 0 "Smooth Pixmap Transform" diff --git a/tests/auto/other/lancelot/scripts/pixmap_rotation.qps b/tests/auto/other/lancelot/scripts/pixmap_rotation.qps deleted file mode 100644 index 8427af85af..0000000000 --- a/tests/auto/other/lancelot/scripts/pixmap_rotation.qps +++ /dev/null @@ -1,31 +0,0 @@ -# Version: 1 -# CheckVsReference: 0% (0 0 440 220) - -translate 120 120 - -begin_block drawing -save - rotate 90 - drawPixmap solid.png 0 0 - - rotate 90 - drawPixmap solid.png 0 0 - - rotate 90 - drawPixmap solid.png 0 0 - - rotate 90 - drawPixmap solid.png 0 0 -restore -end_block - -resetMatrix - -translate 340 120 -setRenderHint SmoothPixmapTransformation -repeat_block drawing - -resetMatrix - -drawText 50 240 "Normal Xform" -drawText 270 240 "Smooth Xform" diff --git a/tests/auto/other/lancelot/scripts/pixmap_rotation2.qps b/tests/auto/other/lancelot/scripts/pixmap_rotation2.qps deleted file mode 100644 index dfb93fe09c..0000000000 --- a/tests/auto/other/lancelot/scripts/pixmap_rotation2.qps +++ /dev/null @@ -1,8 +0,0 @@ -# Version: 1 -# CheckVsReference: 1% - -setRenderHint SmoothPixmapTransformation -translate 400 -120 -rotate 45 -scale 400 400 -drawImage solid2x2.png 0 0 diff --git a/tests/auto/other/lancelot/scripts/pixmap_scaling.qps b/tests/auto/other/lancelot/scripts/pixmap_scaling.qps deleted file mode 100644 index 8a5ab2c60e..0000000000 --- a/tests/auto/other/lancelot/scripts/pixmap_scaling.qps +++ /dev/null @@ -1,224 +0,0 @@ -# Version: 1 -# CheckVsReference: 0% (0 30 600 70) -# CheckVsReference: 0% (290 130 280 60) -# CheckVsReference: 0% (0 180 250 90) - -# Hurra! Force line endings (?) - -translate 5 25 -setFont "arial" 8 - -save - drawText 15 0 "opaque image" - translate 50 50 - save - translate 1 1 - scale 20 20 - drawImage solid2x2.png 0 0 - restore - save - translate -1 1 - scale -20 20 - drawImage solid2x2.png 0 0 - restore - save - translate 1 -1 - scale 20 -20 - drawImage solid2x2.png 0 0 - restore - save - translate -1 -1 - scale -20 -20 - drawImage solid2x2.png 0 0 - restore - - -restore - -save - translate 150 0 - drawText 15 0 "alpha image" - translate 50 50 - save - translate 1 1 - scale 20 20 - drawImage alpha2x2.png 0 0 - restore - save - translate -1 1 - scale -20 20 - drawImage alpha2x2.png 0 0 - restore - save - translate 1 -1 - scale 20 -20 - drawImage alpha2x2.png 0 0 - restore - save - translate -1 -1 - scale -20 -20 - drawImage alpha2x2.png 0 0 - restore -restore - - -save - translate 0 150 - drawText 15 0 "solid pixmap" - translate 50 50 - save - translate 1 1 - scale 20 20 - drawPixmap solid2x2.png 0 0 - restore - save - translate -1 1 - scale -20 20 - drawPixmap solid2x2.png 0 0 - restore - save - translate 1 -1 - scale 20 -20 - drawPixmap solid2x2.png 0 0 - restore - save - translate -1 -1 - scale -20 -20 - drawPixmap solid2x2.png 0 0 - restore -restore - - -save - translate 150 150 - drawText 15 0 "alpha pixmap" - translate 50 50 - save - translate 1 1 - scale 20 20 - drawPixmap alpha2x2.png 0 0 - restore - save - translate -1 1 - scale -20 20 - drawPixmap alpha2x2.png 0 0 - restore - save - translate 1 -1 - scale 20 -20 - drawPixmap alpha2x2.png 0 0 - restore - save - translate -1 -1 - scale -20 -20 - drawPixmap alpha2x2.png 0 0 - restore -restore - - -save - translate 300 10 - save - drawText 0 -10 "subrect solid image" - drawImage solid2x2.png 0 0 50 5 0 0.0 2 0.2 - drawImage solid2x2.png 0 5 50 5 0 0.2 2 0.2 - drawImage solid2x2.png 0 10 50 5 0 0.4 2 0.2 - drawImage solid2x2.png 0 15 50 5 0 0.6 2 0.2 - drawImage solid2x2.png 0 20 50 5 0 0.8 2 0.2 - drawImage solid2x2.png 0 25 50 5 0 1.0 2 0.2 - drawImage solid2x2.png 0 30 50 5 0 1.2 2 0.2 - drawImage solid2x2.png 0 35 50 5 0 1.4 2 0.2 - drawImage solid2x2.png 0 40 50 5 0 1.6 2 0.2 - drawImage solid2x2.png 0 45 50 5 0 1.8 2 0.2 - translate 60 0 - drawImage solid2x2.png 0 0 5 50 0.0 0 0.2 2 - drawImage solid2x2.png 5 0 5 50 0.2 0 0.2 2 - drawImage solid2x2.png 10 0 5 50 0.4 0 0.2 2 - drawImage solid2x2.png 15 0 5 50 0.6 0 0.2 2 - drawImage solid2x2.png 20 0 5 50 0.8 0 0.2 2 - drawImage solid2x2.png 25 0 5 50 1.0 0 0.2 2 - drawImage solid2x2.png 30 0 5 50 1.2 0 0.2 2 - drawImage solid2x2.png 35 0 5 50 1.4 0 0.2 2 - drawImage solid2x2.png 40 0 5 50 1.6 0 0.2 2 - drawImage solid2x2.png 45 0 5 50 1.8 0 0.2 2 - restore - - save - translate 150 0 - drawText 0 -10 "subrect solid image" - drawImage alpha2x2.png 0 0 50 5 0 0.0 2 0.2 - drawImage alpha2x2.png 0 5 50 5 0 0.2 2 0.2 - drawImage alpha2x2.png 0 10 50 5 0 0.4 2 0.2 - drawImage alpha2x2.png 0 15 50 5 0 0.6 2 0.2 - drawImage alpha2x2.png 0 20 50 5 0 0.8 2 0.2 - drawImage alpha2x2.png 0 25 50 5 0 1.0 2 0.2 - drawImage alpha2x2.png 0 30 50 5 0 1.2 2 0.2 - drawImage alpha2x2.png 0 35 50 5 0 1.4 2 0.2 - drawImage alpha2x2.png 0 40 50 5 0 1.6 2 0.2 - drawImage alpha2x2.png 0 45 50 5 0 1.8 2 0.2 - translate 60 0 - drawImage alpha2x2.png 0 0 5 50 0.0 0 0.2 2 - drawImage alpha2x2.png 5 0 5 50 0.2 0 0.2 2 - drawImage alpha2x2.png 10 0 5 50 0.4 0 0.2 2 - drawImage alpha2x2.png 15 0 5 50 0.6 0 0.2 2 - drawImage alpha2x2.png 20 0 5 50 0.8 0 0.2 2 - drawImage alpha2x2.png 25 0 5 50 1.0 0 0.2 2 - drawImage alpha2x2.png 30 0 5 50 1.2 0 0.2 2 - drawImage alpha2x2.png 35 0 5 50 1.4 0 0.2 2 - drawImage alpha2x2.png 40 0 5 50 1.6 0 0.2 2 - drawImage alpha2x2.png 45 0 5 50 1.8 0 0.2 2 - restore - - save - translate 0 100 - drawText 0 -10 "subrect alpha pixmap" - drawPixmap solid2x2.png 0 0 50 5 0 0.0 2 0.2 - drawPixmap solid2x2.png 0 5 50 5 0 0.2 2 0.2 - drawPixmap solid2x2.png 0 10 50 5 0 0.4 2 0.2 - drawPixmap solid2x2.png 0 15 50 5 0 0.6 2 0.2 - drawPixmap solid2x2.png 0 20 50 5 0 0.8 2 0.2 - drawPixmap solid2x2.png 0 25 50 5 0 1.0 2 0.2 - drawPixmap solid2x2.png 0 30 50 5 0 1.2 2 0.2 - drawPixmap solid2x2.png 0 35 50 5 0 1.4 2 0.2 - drawPixmap solid2x2.png 0 40 50 5 0 1.6 2 0.2 - drawPixmap solid2x2.png 0 45 50 5 0 1.8 2 0.2 - translate 60 0 - drawPixmap solid2x2.png 0 0 5 50 0.0 0 0.2 2 - drawPixmap solid2x2.png 5 0 5 50 0.2 0 0.2 2 - drawPixmap solid2x2.png 10 0 5 50 0.4 0 0.2 2 - drawPixmap solid2x2.png 15 0 5 50 0.6 0 0.2 2 - drawPixmap solid2x2.png 20 0 5 50 0.8 0 0.2 2 - drawPixmap solid2x2.png 25 0 5 50 1.0 0 0.2 2 - drawPixmap solid2x2.png 30 0 5 50 1.2 0 0.2 2 - drawPixmap solid2x2.png 35 0 5 50 1.4 0 0.2 2 - drawPixmap solid2x2.png 40 0 5 50 1.6 0 0.2 2 - drawPixmap solid2x2.png 45 0 5 50 1.8 0 0.2 2 - restore - - save - translate 150 100 - drawText 0 -10 "subrect alpha pixmap" - drawPixmap alpha2x2.png 0 0 50 5 0 0.0 2 0.2 - drawPixmap alpha2x2.png 0 5 50 5 0 0.2 2 0.2 - drawPixmap alpha2x2.png 0 10 50 5 0 0.4 2 0.2 - drawPixmap alpha2x2.png 0 15 50 5 0 0.6 2 0.2 - drawPixmap alpha2x2.png 0 20 50 5 0 0.8 2 0.2 - drawPixmap alpha2x2.png 0 25 50 5 0 1.0 2 0.2 - drawPixmap alpha2x2.png 0 30 50 5 0 1.2 2 0.2 - drawPixmap alpha2x2.png 0 35 50 5 0 1.4 2 0.2 - drawPixmap alpha2x2.png 0 40 50 5 0 1.6 2 0.2 - drawPixmap alpha2x2.png 0 45 50 5 0 1.8 2 0.2 - translate 60 0 - drawPixmap alpha2x2.png 0 0 5 50 0.0 0 0.2 2 - drawPixmap alpha2x2.png 5 0 5 50 0.2 0 0.2 2 - drawPixmap alpha2x2.png 10 0 5 50 0.4 0 0.2 2 - drawPixmap alpha2x2.png 15 0 5 50 0.6 0 0.2 2 - drawPixmap alpha2x2.png 20 0 5 50 0.8 0 0.2 2 - drawPixmap alpha2x2.png 25 0 5 50 1.0 0 0.2 2 - drawPixmap alpha2x2.png 30 0 5 50 1.2 0 0.2 2 - drawPixmap alpha2x2.png 35 0 5 50 1.4 0 0.2 2 - drawPixmap alpha2x2.png 40 0 5 50 1.6 0 0.2 2 - drawPixmap alpha2x2.png 45 0 5 50 1.8 0 0.2 2 - restore - -restore
\ No newline at end of file diff --git a/tests/auto/other/lancelot/scripts/pixmap_subpixel.qps b/tests/auto/other/lancelot/scripts/pixmap_subpixel.qps deleted file mode 100644 index d5b7b92fc9..0000000000 --- a/tests/auto/other/lancelot/scripts/pixmap_subpixel.qps +++ /dev/null @@ -1,117 +0,0 @@ -# Version: 1 -# CheckVsReference: 5% - - -translate 50 50 - -# Pixmaps at 0.1 offset, unclipped -begin_block draw_pixmaps -save - drawPixmap border.png 0 0 - translate 20.1 0.1 - drawPixmap border.png 0 0 - translate 20.1 0.1 - drawPixmap border.png 0 0 - translate 20.1 0.1 - drawPixmap border.png 0 0 - translate 20.1 0.1 - drawPixmap border.png 0 0 - translate 20.1 0.1 - drawPixmap border.png 0 0 - translate 20.1 0.1 - drawPixmap border.png 0 0 - translate 20.1 0.1 - drawPixmap border.png 0 0 - translate 20.1 0.1 - drawPixmap border.png 0 0 - translate 20.1 0.1 - drawPixmap border.png 0 0 - translate 20.1 0.1 - - drawPixmap border.png 0 0 - translate 20.1 0.1 - drawPixmap border.png 0 0 - translate 20.1 0.1 - drawPixmap border.png 0 0 - translate 20.1 0.1 - drawPixmap border.png 0 0 - translate 20.1 0.1 - drawPixmap border.png 0 0 - translate 20.1 0.1 - drawPixmap border.png 0 0 - translate 20.1 0.1 - drawPixmap border.png 0 0 - translate 20.1 0.1 - drawPixmap border.png 0 0 - translate 20.1 0.1 - drawPixmap border.png 0 0 - translate 20.1 0.1 - drawPixmap border.png 0 0 - translate 20.1 0.1 -restore -end_block - -# Tiled pixmaps at 0.1 offsets, unclipped -translate 0 50 -begin_block draw_tiled -save - drawTiledPixmap border.png 0 0 16 16 0 0 - translate 20.1 0.1 - drawTiledPixmap border.png 0 0 16 16 0 0 - translate 20.1 0.1 - drawTiledPixmap border.png 0 0 16 16 0 0 - translate 20.1 0.1 - drawTiledPixmap border.png 0 0 16 16 0 0 - translate 20.1 0.1 - drawTiledPixmap border.png 0 0 16 16 0 0 - translate 20.1 0.1 - drawTiledPixmap border.png 0 0 16 16 0 0 - translate 20.1 0.1 - drawTiledPixmap border.png 0 0 16 16 0 0 - translate 20.1 0.1 - drawTiledPixmap border.png 0 0 16 16 0 0 - translate 20.1 0.1 - drawTiledPixmap border.png 0 0 16 16 0 0 - translate 20.1 0.1 - drawTiledPixmap border.png 0 0 16 16 0 0 - translate 20.1 0.1 - - drawTiledPixmap border.png 0 0 16 16 0 0 - translate 20.1 0.1 - drawTiledPixmap border.png 0 0 16 16 0 0 - translate 20.1 0.1 - drawTiledPixmap border.png 0 0 16 16 0 0 - translate 20.1 0.1 - drawTiledPixmap border.png 0 0 16 16 0 0 - translate 20.1 0.1 - drawTiledPixmap border.png 0 0 16 16 0 0 - translate 20.1 0.1 - drawTiledPixmap border.png 0 0 16 16 0 0 - translate 20.1 0.1 - drawTiledPixmap border.png 0 0 16 16 0 0 - translate 20.1 0.1 - drawTiledPixmap border.png 0 0 16 16 0 0 - translate 20.1 0.1 - drawTiledPixmap border.png 0 0 16 16 0 0 - translate 20.1 0.1 - drawTiledPixmap border.png 0 0 16 16 0 0 - translate 20.1 0.1 -restore -end_block - - -path_moveTo clip 0 0 -path_lineTo clip width 0 -path_lineTo clip width 400 -path_lineTo clip 0 height -setClipPath clip - -translate 0 50 -# Pixmaps at 0.1 offset, clipped -repeat_block draw_pixmaps - - -# Tiled pixmaps at 0.1 offsets... -translate 0 50 -repeat_block draw_tiled - diff --git a/tests/auto/other/lancelot/scripts/pixmaps.qps b/tests/auto/other/lancelot/scripts/pixmaps.qps deleted file mode 100644 index 0b4ba2c4fb..0000000000 --- a/tests/auto/other/lancelot/scripts/pixmaps.qps +++ /dev/null @@ -1,106 +0,0 @@ -# Version: 1 -# CheckVsReference: 1% (0 0 690 580) - - -setRenderHint Antialiasing - -setPen #00ff00 - -pixmap_load dome_argb32.png the_pixmap -begin_block draw_stuff - -save - - # standard draw - drawPixmap the_pixmap 0 0 - - # sub recting - translate 120 0 - drawPixmap the_pixmap 0 0 40 40 0 0 40 40 - drawPixmap the_pixmap 60 0 40 40 60 0 40 40 - drawPixmap the_pixmap 0 60 40 40 0 60 40 40 - drawPixmap the_pixmap 60 60 40 40 60 60 40 40 - drawPixmap the_pixmap 0 40 40 20 0 40 40 20 - drawPixmap the_pixmap 60 40 40 20 60 40 40 20 - drawPixmap the_pixmap 40 0 20 100 40 0 20 100 - - # subrecting w/scale - translate 120 0 - drawPixmap the_pixmap 0 0 50 50 0 0 25 25 - drawPixmap the_pixmap 50 0 50 50 25 0 25 25 - drawPixmap the_pixmap 0 50 50 50 0 25 25 25 - drawPixmap the_pixmap 50 50 50 50 25 25 25 25 - - # subrecting w/scale & smooth xform - translate 120 0 - setRenderHint SmoothPixmapTransformation - drawPixmap the_pixmap 0 0 50 50 0 0 25 25 - drawPixmap the_pixmap 50 0 50 50 25 0 25 25 - drawPixmap the_pixmap 0 50 50 50 0 25 25 25 - drawPixmap the_pixmap 50 50 50 50 25 25 25 25 - - - # Rotation w/o smooth xform - translate 120 0 - save - setRenderHint SmoothPixmapTransform off - rotate 10 - drawPixmap the_pixmap 0 0 - restore - - # Rotation w smooth xform - translate 120 0 - save - setRenderHint SmoothPixmapTransform - rotate 10 - drawPixmap the_pixmap 0 0 - restore - -restore - -end_block - - -translate 0 120 -pixmap_load dome_rgb32.png the_pixmap -repeat_block draw_stuff - -translate 0 120 -pixmap_load dome_indexed.png the_pixmap -repeat_block draw_stuff - -translate 0 120 -pixmap_load dome_indexed_mask.png the_pixmap -repeat_block draw_stuff - -translate 0 120 -pixmap_load dome_mono.png the_pixmap -repeat_block draw_stuff - - -resetMatrix -translate 700 60 -setPen black -drawText 0 0 "32 bit w/alpha" -translate 0 120 -drawText 0 0 "32 bit w/o alpha" -translate 0 120 -drawText 0 0 "8 bit indexed" -translate 0 120 -drawText 0 0 "8 bit indexed w/mask" -translate 0 120 -drawText 0 0 "1 bit" -resetMatrix -translate 0 600 -drawText 0 0 "normal" -translate 120 0 -drawText 0 0 "subrect" -translate 120 0 -drawText 0 0 "subrect scale" -translate 120 0 -drawText 0 0 "subrect scale smooth" -translate 120 0 -drawText 0 0 "xform" -translate 120 0 -drawText 0 0 "smooth xform" -translate 120 0
\ No newline at end of file diff --git a/tests/auto/other/lancelot/scripts/porter_duff.qps b/tests/auto/other/lancelot/scripts/porter_duff.qps deleted file mode 100644 index 94e9c68522..0000000000 --- a/tests/auto/other/lancelot/scripts/porter_duff.qps +++ /dev/null @@ -1,251 +0,0 @@ -# Version: 1 -# CheckVsReference: 5% - - -translate 0 50 - -surface_begin 0 0 100 100 - -begin_block predraw -setRenderHint Antialiasing -setPen nopen -setBrush 0x7f000000 -drawEllipse 10 10 80 80 -end_block - -setCompositionMode SourceOver - -begin_block postdraw - - -setBrush 0x1fff0000 -drawRect 0 0 50 50 - -setBrush 0xdf00ff00 -drawRect 50 50 50 50 - -setBrush 0x7f0000ff -drawEllipse 30 30 40 40 - -# a black rectangle around -setCompositionMode SourceOver -setPen black -setBrush nobrush -drawRect 0.5 0.5 99 99 - -end_block -surface_end - - -# Destination over -surface_begin 100 0 100 100 -repeat_block predraw -setCompositionMode DestinationOver -repeat_block postdraw -surface_end - - -# Clear -surface_begin 200 0 100 100 -repeat_block predraw -setCompositionMode Clear -repeat_block postdraw -surface_end - - -# Source -surface_begin 300 0 100 100 -repeat_block predraw -setCompositionMode Source -repeat_block postdraw -surface_end - - -# Destination -surface_begin 400 0 100 100 -repeat_block predraw -setCompositionMode Destination -repeat_block postdraw -surface_end - - -# Source In -surface_begin 500 0 100 100 -repeat_block predraw -setCompositionMode SourceIn -repeat_block postdraw -surface_end - -translate 0 50 - -# Destination In -surface_begin 0 100 100 100 -repeat_block predraw -setCompositionMode DestinationIn -repeat_block postdraw -surface_end - - -# Source Out -surface_begin 100 100 100 100 -repeat_block predraw -setCompositionMode SourceOut -repeat_block postdraw -surface_end - - -# Destination Out -surface_begin 200 100 100 100 -repeat_block predraw -setCompositionMode DestinationOut -repeat_block postdraw -surface_end - - -# SourceAtop -surface_begin 300 100 100 100 -repeat_block predraw -setCompositionMode SourceAtop -repeat_block postdraw -surface_end - - -# DestinationAtop -surface_begin 400 100 100 100 -repeat_block predraw -setCompositionMode DestinationAtop -repeat_block postdraw -surface_end - - -# Xor -surface_begin 500 100 100 100 -repeat_block predraw -setCompositionMode Xor -repeat_block postdraw -surface_end - -translate 0 50 - -# Plus -surface_begin 0 200 100 100 -repeat_block predraw -setCompositionMode Plus -repeat_block postdraw -surface_end - - -# Multiply -surface_begin 100 200 100 100 -repeat_block predraw -setCompositionMode Multiply -repeat_block postdraw -surface_end - - -# Screen -surface_begin 200 200 100 100 -repeat_block predraw -setCompositionMode Screen -repeat_block postdraw -surface_end - - -# Overlay -surface_begin 300 200 100 100 -repeat_block predraw -setCompositionMode Overlay -repeat_block postdraw -surface_end - - -# Darken -surface_begin 400 200 100 100 -repeat_block predraw -setCompositionMode Darken -repeat_block postdraw -surface_end - - -# Lighten -surface_begin 500 200 100 100 -repeat_block predraw -setCompositionMode Lighten -repeat_block postdraw -surface_end - -translate 0 50 - -# ColorDodge -surface_begin 0 300 100 100 -repeat_block predraw -setCompositionMode ColorDodge -repeat_block postdraw -surface_end - - -# ColorBurn -surface_begin 100 300 100 100 -repeat_block predraw -setCompositionMode ColorBurn -repeat_block postdraw -surface_end - - -# HardLight -surface_begin 200 300 100 100 -repeat_block predraw -setCompositionMode HardLight -repeat_block postdraw -surface_end - - -# SoftLight -surface_begin 300 300 100 100 -repeat_block predraw -setCompositionMode SoftLight -repeat_block postdraw -surface_end - - -# Difference -surface_begin 400 300 100 100 -repeat_block predraw -setCompositionMode Difference -repeat_block postdraw -surface_end - - -# Exclusion -surface_begin 500 300 100 100 -repeat_block predraw -setCompositionMode Exclusion -repeat_block postdraw -surface_end - -resetMatrix - -drawText 0 50 "SourceOver" -drawText 100 50 "DestinationOver" -drawText 200 50 "Clear" -drawText 300 50 "Source" -drawText 400 50 "Destination" -drawText 500 50 "SourceIn" -drawText 0 200 "DestinationIn" -drawText 100 200 "SourceOut" -drawText 200 200 "DestinationOut" -drawText 300 200 "SourceAtop" -drawText 400 200 "DestinationAtop" -drawText 500 200 "Xor" -drawText 0 350 "Plus" -drawText 100 350 "Multiply" -drawText 200 350 "Screen" -drawText 300 350 "Overlay" -drawText 400 350 "Darken" -drawText 500 350 "Lighten" -drawText 0 500 "ColorDodge" -drawText 100 500 "ColorBurn" -drawText 200 500 "HardLight" -drawText 300 500 "SoftLight" -drawText 400 500 "Difference" -drawText 500 500 "Exclusion" diff --git a/tests/auto/other/lancelot/scripts/porter_duff2.qps b/tests/auto/other/lancelot/scripts/porter_duff2.qps deleted file mode 100644 index f538371ca1..0000000000 --- a/tests/auto/other/lancelot/scripts/porter_duff2.qps +++ /dev/null @@ -1,261 +0,0 @@ -# Version: 1 -# CheckVsReference: 1% (0 50 600 100) -# CheckVsReference: 1% (0 200 600 100) -# CheckVsReference: 1% (0 350 600 100) -# CheckVsReference: 1% (0 500 600 100) - -translate 0 50 - -surface_begin 0 0 100 100 - -begin_block predraw -setRenderHint Antialiasing -setPen nopen -gradient_clearStops -gradient_appendStop 0 efff0000 -gradient_appendStop 0.5 dfffff00 -gradient_appendStop 1 ef00ff00 - -gradient_setSpread PadSpread -gradient_setLinear 10 10 90 90 -drawEllipse 10 10 80 80 -end_block - -setCompositionMode SourceOver - -begin_block postdraw - -gradient_clearStops -gradient_appendStop 0 afff0000 -gradient_appendStop 0.5 cf0000ff -gradient_appendStop 1 bf00ff00 - -gradient_setSpread PadSpread -gradient_setLinear 0 0 100 0 -drawEllipse 10 10 30 30 -drawEllipse 10 60 30 30 -drawEllipse 60 60 30 30 -drawEllipse 60 10 30 30 -drawEllipse 35 35 30 30 - -# a black rectangle around -setCompositionMode SourceOver -setPen black -setBrush nobrush -drawRect 0.5 0.5 99 99 - -end_block -surface_end - -# Destination over -surface_begin 100 0 100 100 -repeat_block predraw -setCompositionMode DestinationOver -repeat_block postdraw -surface_end - - -# Clear -surface_begin 200 0 100 100 -repeat_block predraw -setCompositionMode Clear -repeat_block postdraw -surface_end - - -# Source -surface_begin 300 0 100 100 -repeat_block predraw -setCompositionMode Source -repeat_block postdraw -surface_end - - -# Destination -surface_begin 400 0 100 100 -repeat_block predraw -setCompositionMode Destination -repeat_block postdraw -surface_end - - -# Source In -surface_begin 500 0 100 100 -repeat_block predraw -setCompositionMode SourceIn -repeat_block postdraw -surface_end - -translate 0 50 - -# Destination In -surface_begin 0 100 100 100 -repeat_block predraw -setCompositionMode DestinationIn -repeat_block postdraw -surface_end - - -# Source Out -surface_begin 100 100 100 100 -repeat_block predraw -setCompositionMode SourceOut -repeat_block postdraw -surface_end - - -# Destination Out -surface_begin 200 100 100 100 -repeat_block predraw -setCompositionMode DestinationOut -repeat_block postdraw -surface_end - - -# SourceAtop -surface_begin 300 100 100 100 -repeat_block predraw -setCompositionMode SourceAtop -repeat_block postdraw -surface_end - - -# DestinationAtop -surface_begin 400 100 100 100 -repeat_block predraw -setCompositionMode DestinationAtop -repeat_block postdraw -surface_end - - -# Xor -surface_begin 500 100 100 100 -repeat_block predraw -setCompositionMode Xor -repeat_block postdraw -surface_end - -translate 0 50 - -# Plus -surface_begin 0 200 100 100 -repeat_block predraw -setCompositionMode Plus -repeat_block postdraw -surface_end - - -# Multiply -surface_begin 100 200 100 100 -repeat_block predraw -setCompositionMode Multiply -repeat_block postdraw -surface_end - - -# Screen -surface_begin 200 200 100 100 -repeat_block predraw -setCompositionMode Screen -repeat_block postdraw -surface_end - - -# Overlay -surface_begin 300 200 100 100 -repeat_block predraw -setCompositionMode Overlay -repeat_block postdraw -surface_end - - -# Darken -surface_begin 400 200 100 100 -repeat_block predraw -setCompositionMode Darken -repeat_block postdraw -surface_end - - -# Lighten -surface_begin 500 200 100 100 -repeat_block predraw -setCompositionMode Lighten -repeat_block postdraw -surface_end - -translate 0 50 - -# ColorDodge -surface_begin 0 300 100 100 -repeat_block predraw -setCompositionMode ColorDodge -repeat_block postdraw -surface_end - - -# ColorBurn -surface_begin 100 300 100 100 -repeat_block predraw -setCompositionMode ColorBurn -repeat_block postdraw -surface_end - - -# HardLight -surface_begin 200 300 100 100 -repeat_block predraw -setCompositionMode HardLight -repeat_block postdraw -surface_end - - -# SoftLight -surface_begin 300 300 100 100 -repeat_block predraw -setCompositionMode SoftLight -repeat_block postdraw -surface_end - - -# Difference -surface_begin 400 300 100 100 -repeat_block predraw -setCompositionMode Difference -repeat_block postdraw -surface_end - - -# Exclusion -surface_begin 500 300 100 100 -repeat_block predraw -setCompositionMode Exclusion -repeat_block postdraw -surface_end - -resetMatrix - -drawText 0 50 "SourceOver" -drawText 100 50 "DestinationOver" -drawText 200 50 "Clear" -drawText 300 50 "Source" -drawText 400 50 "Destination" -drawText 500 50 "SourceIn" -drawText 0 200 "DestinationIn" -drawText 100 200 "SourceOut" -drawText 200 200 "DestinationOut" -drawText 300 200 "SourceAtop" -drawText 400 200 "DestinationAtop" -drawText 500 200 "Xor" -drawText 0 350 "Plus" -drawText 100 350 "Multiply" -drawText 200 350 "Screen" -drawText 300 350 "Overlay" -drawText 400 350 "Darken" -drawText 500 350 "Lighten" -drawText 0 500 "ColorDodge" -drawText 100 500 "ColorBurn" -drawText 200 500 "HardLight" -drawText 300 500 "SoftLight" -drawText 400 500 "Difference" -drawText 500 500 "Exclusion" diff --git a/tests/auto/other/lancelot/scripts/primitives.qps b/tests/auto/other/lancelot/scripts/primitives.qps deleted file mode 100644 index f44ba27566..0000000000 --- a/tests/auto/other/lancelot/scripts/primitives.qps +++ /dev/null @@ -1,184 +0,0 @@ -# Version: 1#Version: 1 -# CheckVsReference: 5% - - -# CheckVsReference: 5% - -setBrush #ff7f7fff -setPen black 1 solidline -translate 20 20 -begin_block testblock -save -drawRect 0 0 10 10 -drawRect 20 0 20 10 -drawRect 0 20 10 20 -drawRect 20 20 20 20 -translate 50 0 -setPen NoPen -drawRect 0 0 10 10 -drawRect 20 0 20 10 -drawRect 0 20 10 20 -drawRect 20 20 20 20 -restore -save -translate 0 50 -drawEllipse 0 0 10 10 -drawEllipse 20 0 20 10 -drawEllipse 0 20 10 20 -drawEllipse 20 20 20 20 -translate 50 0 -setPen NoPen -drawEllipse 0 0 10 10 -drawEllipse 20 0 20 10 -drawEllipse 0 20 10 20 -drawEllipse 20 20 20 20 -restore -save -translate 0 100 -drawPolygon [ 0 0 30 0 30 30 10 30 10 10 40 10 40 40 0 40 ] -save -translate 0 50 -drawPolygon [ 0 0 30 0 30 30 10 30 10 10 40 10 40 40 0 40 ] Winding -translate 0 45 -drawPolyline [ 0 0 50 0 25 25 ] -restore -setPen NoPen -translate 50 0 -drawPolygon [ 0 0 30 0 30 30 10 30 10 10 40 10 40 40 0 40 ] -save -translate 0 50 -drawPolygon [ 0 0 30 0 30 30 10 30 10 10 40 10 40 40 0 40 ] Winding -restore -save -translate -20 100 -drawPie 0 0 50 50 0 1500 -restore -restore -end_block -setPen black 1 SolidLine FlatCap -translate 200 0 -scale 2 1 -rotate 10 -repeat_block testblock -resetMatrix -translate 0 250 -setBrush 7f7f7fff -translate 20 20 -repeat_block testblock -setPen black 1 SolidLine FlatCap -translate 200 0 -scale 2 1 -rotate 10 -repeat_block testblock -resetMatrix -save -setRenderHint LineAntialiasing -setBrush 7f7fff -translate 20 500 -repeat_block testblock -translate 200 0 -scale 2 1 -rotate 10 -repeat_block testblock -restore -setRenderHint LineAntialiasing false -translate 420 20 -begin_block lines -drawLine 0 0 100 0 -drawLine 0 0 100 10 -drawLine 0 0 100 20 -drawLine 0 0 100 30 -drawLine 0 0 100 40 -drawLine 0 0 100 50 -drawLine 0 0 100 60 -drawLine 0 0 100 70 -drawLine 0 0 100 80 -drawLine 0 0 100 90 -drawLine 0 0 100 100 -drawLine 0 0 90 100 -drawLine 0 0 80 100 -drawLine 0 0 70 100 -drawLine 0 0 60 100 -drawLine 0 0 50 100 -drawLine 0 0 40 100 -drawLine 0 0 30 100 -drawLine 0 0 20 100 -drawLine 0 0 10 100 -drawLine 0 0 0 100 -end_block -setRenderHint LineAntialiasing -translate 0 120 -repeat_block lines -translate 0 120 -scale 5 2 -repeat_block lines -resetMatrix -translate 420 500 -begin_block roundedrects -save -drawRoundedRect 0 0 50 30 5 5 -translate 60 0 -drawRoundedRect 0 0 50 30 7.5 7.5 -translate 60 0 -drawRoundedRect 0 0 50 30 10 10 -translate 60 0 -drawRoundedRect 0 0 50 30 12.5 12.5 -translate 60 0 -drawRoundedRect 0 0 50 30 15 15 -restore -save -translate 0 40 -drawRoundedRect 0 0 50 30 20 20 RelativeSize -translate 60 0 -drawRoundedRect 0 0 50 30 40 40 RelativeSize -translate 60 0 -drawRoundedRect 0 0 50 30 60 60 RelativeSize -translate 60 0 -drawRoundedRect 0 0 50 30 80 80 RelativeSize -translate 60 0 -drawRoundedRect 0 0 50 30 100 100 RelativeSize -restore -end_block -translate 0.5 80.5 -repeat_block roundedrects -translate -0.5 79.5 -setRenderHint Antialiasing off -repeat_block roundedrects -resetMatrix -setRenderHint Antialiasing off -setPen black 1 -begin_block drawShapes -translate 550.5 25 -rotate 45 -setBrush nobrush -drawEllipse -10 -10 20 20 -drawLine 10 0 50 0 -drawRect 50 -7 14 14 -resetMatrix -end_block -setPen black 2 -translate 25 0 -repeat_block drawShapes -setPen black 3 -translate 50 0 -repeat_block drawShapes -setPen black 4 -translate 75 0 -repeat_block drawShapes -resetMatrix -setRenderHint Antialiasing off -setPen nopen -translate 550 100 -setBrush #7f7f7fff -drawRect -0.5 -0.5 21 21 -setBrush red -drawEllipse 0 0 20 20 -setBrush nobrush -setPen black -drawEllipse 0 0 20 20 -translate 25 0 -setPen nopen -setBrush #7f7f7fff -drawRect 0 0 20 20 -setBrush red -drawEllipse 0 0 20 20
\ No newline at end of file diff --git a/tests/auto/other/lancelot/scripts/radial_gradients.qps b/tests/auto/other/lancelot/scripts/radial_gradients.qps deleted file mode 100644 index b55df8bde6..0000000000 --- a/tests/auto/other/lancelot/scripts/radial_gradients.qps +++ /dev/null @@ -1,99 +0,0 @@ -# Version: 1 -# CheckVsReference: 5% (0 0 600 400) - -path_addRect path 400 0 80 80 -path_addEllipse path 440 40 60 60 - -setRenderHint Antialiasing - -setPen black - -begin_block gradients -gradient_clearStops -gradient_appendStop 0 red -gradient_appendStop 0.25 orange -gradient_appendStop 0.5 yellow -gradient_appendStop 0.8 green -gradient_appendStop 1 cyan - -gradient_setSpread PadSpread -gradient_setRadial 20 20 50 40 40 -drawRect 0 0 100 100 - -gradient_setSpread ReflectSpread -gradient_setRadial 120 20 50 140 40 -drawEllipse 100 0 100 100 - -gradient_setSpread RepeatSpread -gradient_setRadial 220 20 50 240 40 -drawRoundRect 200 0 100 100 - -gradient_clearStops -gradient_appendStop 0 3f7f7fff -gradient_appendStop 0.5 dfdfffff -gradient_appendStop 1 7f00007f - -gradient_setSpread PadSpread -gradient_setRadial 320 20 50 340 40 -drawPolygon [300 0 390 0 350 99] - -gradient_setSpread ReflectSpread -gradient_setRadial 420 20 50 440 40 -drawPath path - -gradient_setSpread RepeatSpread -gradient_setRadial 520 20 50 540 40 -drawPie 500 0 100 100 720 4320 -end_block - -translate 0 100 -scale 1 2 -repeat_block gradients - -resetMatrix -translate 0 300 -brushTranslate 30 0 -brushScale 0.9 0.9 -brushRotate 20 -repeat_block gradients - -# Some helpful info perhaps? -resetMatrix -setPen black - -drawText 610 50 "No XForm" -drawText 610 200 "scale 1x2" -drawText 610 300 "brush transform" -drawText 10 450 "Pad" -drawText 110 450 "Reflect" -drawText 210 450 "Repeat" -drawText 310 450 "Pad w/alpha" -drawText 410 450 "Reflect w/alpha" -drawText 510 450 "Repeat w/alpha" - -# Radius and focal indicators -setPen 3f000000 -setBrush nobrush - -begin_block ellipse_draw -setClipRect 0 0 100 100 -drawEllipse -30 -30 100 100 -drawEllipse 35 35 11 11 -translate 100 0 -end_block - -repeat_block ellipse_draw -repeat_block ellipse_draw -repeat_block ellipse_draw -repeat_block ellipse_draw -repeat_block ellipse_draw - -resetMatrix -translate 0 100 -scale 1 2 -repeat_block ellipse_draw -repeat_block ellipse_draw -repeat_block ellipse_draw -repeat_block ellipse_draw -repeat_block ellipse_draw -repeat_block ellipse_draw
\ No newline at end of file diff --git a/tests/auto/other/lancelot/scripts/radial_gradients_perspectives.qps b/tests/auto/other/lancelot/scripts/radial_gradients_perspectives.qps deleted file mode 100644 index 4557354dce..0000000000 --- a/tests/auto/other/lancelot/scripts/radial_gradients_perspectives.qps +++ /dev/null @@ -1,62 +0,0 @@ -# Version: 1 - - -setRenderHint Antialiasing - -setPen #00ff00 - -translate 10 10 -# standard draw -begin_block gradient -gradient_clearStops -gradient_appendStop 0 red -gradient_appendStop 0.25 orange -gradient_appendStop 0.5 yellow -gradient_appendStop 0.8 green -gradient_appendStop 1 cyan - -gradient_setSpread PadSpread -gradient_setRadial 110 100 230 230 240 -drawRect 0 0 300 300 -end_block gradient - -# Rotation w/o smooth xform -save -translate 350 0 -save - setRenderHint SmoothPixmapTransform on - mapQuadToQuad 0 0 0 300 300 300 300 0 0 50 0 200 300 300 300 0 - repeat_block gradient -restore -restore - -translate 0 320 - -save - setRenderHint SmoothPixmapTransform on - mapQuadToQuad 0 0 0 300 300 300 300 0 0 0 100 300 200 300 300 0 - repeat_block gradient -restore - -save -translate 350 0 -save - setRenderHint SmoothPixmapTransform on - mapQuadToQuad 0 0 0 300 300 300 300 0 0 0 0 300 300 250 300 50 - repeat_block gradient -restore -restore - - -resetMatrix -setPen black -translate 125 20 -drawText 0 0 "No transform" -translate 350 0 -drawText 0 0 "Left Tilted" -resetMatrix -translate 125 350 -drawText 0 0 "Bottom Tilted" -translate 350 0 -drawText 0 0 "Right Tilted" -translate 120 0
\ No newline at end of file diff --git a/tests/auto/other/lancelot/scripts/rasterops.qps b/tests/auto/other/lancelot/scripts/rasterops.qps deleted file mode 100644 index d0f2da42df..0000000000 --- a/tests/auto/other/lancelot/scripts/rasterops.qps +++ /dev/null @@ -1,87 +0,0 @@ -# Version: 1 -# CheckVsReference: 5% - -setPen NoPen - -setBrush black -drawRect 10 10 60 500 - -setCompositionMode SourceOrDestination -translate 20 20 - -begin_block drawShape - setBrush 0xffff0000 - drawEllipse 5 5 30 30 - setBrush 0xff00ff00 - drawRect 0 0 20 20 - setBrush 0xff0000ff - drawRect 20 20 20 20 -end_block - -begin_block loop - setCompositionMode SourceAndDestination - translate 0 50 -repeat_block drawShape - -setCompositionMode SourceXorDestination -translate 0 50 -repeat_block drawShape - -setCompositionMode NotSourceAndNotDestination -translate 0 50 -repeat_block drawShape - -setCompositionMode NotSourceOrNotDestination -translate 0 50 -repeat_block drawShape - -setCompositionMode NotSourceXorDestination -translate 0 50 -repeat_block drawShape - -setCompositionMode NotSource -translate 0 50 -repeat_block drawShape - -setCompositionMode NotSourceAndDestination -translate 0 50 -repeat_block drawShape - -setCompositionMode SourceAndNotDestination -translate 0 50 -repeat_block drawShape -end_block - -resetMatrix -setCompositionMode Source -setBrush white -drawRect 100 10 60 500 -translate 110 20 -repeat_block loop - -resetMatrix -setCompositionMode Source -translate 190 20 -repeat_block loop - -resetMatrix -setPen black -setCompositionMode SourceOver -translate 250 45 -drawText 20 0 "Or ROP" -translate 0 50 -drawText 20 0 "And ROP" -translate 0 50 -drawText 20 0 "Xor ROP" -translate 0 50 -drawText 20 0 "Nor ROP" -translate 0 50 -drawText 20 0 "Nand ROP" -translate 0 50 -drawText 0 0 "NSrcXorDst ROP" -translate 0 50 -drawText 20 0 "NSrc ROP" -translate 0 50 -drawText 0 0 "NSrcAndDst ROP" -translate 0 50 -drawText 0 0 "SrcAndNDst ROP"
\ No newline at end of file diff --git a/tests/auto/other/lancelot/scripts/richtext.qps b/tests/auto/other/lancelot/scripts/richtext.qps deleted file mode 100644 index 787c97421b..0000000000 --- a/tests/auto/other/lancelot/scripts/richtext.qps +++ /dev/null @@ -1,9 +0,0 @@ -drawTextDocument 10 10 "<img height=50 width=50 align=top src=:/images/border.png /><img height=10 width=10 valign=bottom src=:/images/border.png /><span style='font-size: 100px'>Xy</span>" -drawTextDocument 10 210 "<img height=50 width=50 align=top src=:/images/border.png /><img height=10 width=10 valign=bottom src=:/images/border.png /><span style='font-size: 25px'>Xy</span>" -drawTextDocument 310 210 "<img height=10 width=10 align=top src=:/images/border.png /><img height=50 width=50 valign=bottom src=:/images/border.png /><span style='font-size: 25px'>Xy</span>" -drawTextDocument 10 310 "<img height=50 width=50 align=top src=:/images/border.png /><img height=50 width=50 valign=bottom src=:/images/border.png /><span style='font-size: 25px'>Xy</span>" - -drawTextDocument 10 410 "<img height=10 width=10 align=top src=:/images/border.png /><img height=50 width=50 src=:/images/border.png /><span style='font-size: 25px'>Xy</span>" -drawTextDocument 10 510 "<img height=10 width=10 valign=bottom src=:/images/border.png /><img height=50 width=50 src=:/images/border.png /><span style='font-size: 25px'>Xy</span>" -drawTextDocument 310 410 "<img height=50 width=50 align=top src=:/images/border.png /><img height=10 width=10 src=:/images/border.png /><span style='font-size: 25px'>Xy</span>" -drawTextDocument 310 510 "<img height=50 width=50 valign=bottom src=:/images/border.png /><img height=10 width=10 src=:/images/border.png /><span style='font-size: 25px'>Xy</span>" diff --git a/tests/auto/other/lancelot/scripts/sizes.qps b/tests/auto/other/lancelot/scripts/sizes.qps deleted file mode 100644 index 12b0f4af1e..0000000000 --- a/tests/auto/other/lancelot/scripts/sizes.qps +++ /dev/null @@ -1,90 +0,0 @@ -# Version: 1 -# CheckVsReference: 5% - -setPen NoPen -setBrush black - -translate 10 10 - -begin_block testblock -drawRect 0 0 10 10 -drawRect 20 0 11 11 -drawRect 40 0 12 12 -drawRect 60 0 13 13 -drawRect 80 0 14 14 -drawRect 100 0 15 15 -drawRect 120 0 16 16 -drawRect 140 0 17 17 -drawRect 160 0 18 18 -drawRect 180 0 19 19 - -drawEllipse 0 20 10 10 -drawEllipse 20 20 11 11 -drawEllipse 40 20 12 12 -drawEllipse 60 20 13 13 -drawEllipse 80 20 14 14 -drawEllipse 100 20 15 15 -drawEllipse 120 20 16 16 -drawEllipse 140 20 17 17 -drawEllipse 160 20 18 18 -drawEllipse 180 20 19 19 - -drawRoundRect 0 40 10 10 -drawRoundRect 20 40 11 11 -drawRoundRect 40 40 12 12 -drawRoundRect 60 40 13 13 -drawRoundRect 80 40 14 14 -drawRoundRect 100 40 15 15 -drawRoundRect 120 40 16 16 -drawRoundRect 140 40 17 17 -drawRoundRect 160 40 18 18 -drawRoundRect 180 40 19 19 - -drawPie 0 60 10 10 0 4320 -drawPie 20 60 11 11 0 4320 -drawPie 40 60 12 12 0 4320 -drawPie 60 60 13 13 0 4320 -drawPie 80 60 14 14 0 4320 -drawPie 100 60 15 15 0 4320 -drawPie 120 60 16 16 0 4320 -drawPie 140 60 17 17 0 4320 -drawPie 160 60 18 18 0 4320 -drawPie 180 60 19 19 0 4320 - -drawArc 0 80 10 10 0 4320 -drawArc 20 80 11 11 0 4320 -drawArc 40 80 12 12 0 4320 -drawArc 60 80 13 13 0 4320 -drawArc 80 80 14 14 0 4320 -drawArc 100 80 15 15 0 4320 -drawArc 120 80 16 16 0 4320 -drawArc 140 80 17 17 0 4320 -drawArc 160 80 18 18 0 4320 -drawArc 180 80 19 19 0 4320 - -drawChord 0 100 10 10 0 4320 -drawChord 20 100 11 11 0 4320 -drawChord 40 100 12 12 0 4320 -drawChord 60 100 13 13 0 4320 -drawChord 80 100 14 14 0 4320 -drawChord 100 100 15 15 0 4320 -drawChord 120 100 16 16 0 4320 -drawChord 140 100 17 17 0 4320 -drawChord 160 100 18 18 0 4320 -drawChord 180 100 19 19 0 4320 - -end_block - -setPen red -translate 0 150 -repeat_block testblock - -setRenderHint LineAntialiasing - -setPen nopen -translate 0 150 -repeat_block testblock - -setPen red -translate 0 150 -repeat_block testblock diff --git a/tests/auto/other/lancelot/scripts/statictext.qps b/tests/auto/other/lancelot/scripts/statictext.qps deleted file mode 100644 index c2a30d0864..0000000000 --- a/tests/auto/other/lancelot/scripts/statictext.qps +++ /dev/null @@ -1,175 +0,0 @@ -drawStaticText -5 5 "Text that is drawn outside the bounds..." - -translate 20 20 -begin_block text_drawing -save - setFont "sansserif" 10 normal - drawStaticText 0 20 "sansserif 10pt, normal" - - setFont "sansserif" 12 normal - drawStaticText 0 40 "sansserif 12pt, normal" - - setFont "sansserif" 12 bold - drawStaticText 0 60 "sansserif 12pt, bold" - - setFont "sansserif" 10 bold italic - drawStaticText 0 80 "sansserif 10pt, bold italic" - - - translate 0 100 - setPen #7fff0000 - - setFont "sansserif" 10 normal - drawStaticText 0 20 "alpha sansserif 10pt, normal" - - setFont "sansserif" 12 normal - drawStaticText 0 40 "alpha sansserif 12pt, normal" - - setFont "sansserif" 12 bold - drawStaticText 0 60 "alpha sansserif 12pt, bold" - - setFont "sansserif" 10 bold italic - drawStaticText 0 80 "alpha sansserif 10pt, bold italic" - - - translate 0 100 - setPen black - save - scale 0.9 0.9 - - setFont "sansserif" 10 normal - drawStaticText 0 20 "scaled sansserif 10pt, normal" - - setFont "sansserif" 12 normal - drawStaticText 0 40 "scaled sansserif 12pt, normal" - - setFont "sansserif" 12 bold - drawStaticText 0 60 "scaled sansserif 12pt, bold" - - setFont "sansserif" 10 bold italic - drawStaticText 0 80 "scaled sansserif 10pt, bold italic" - restore - - translate 200 200 - setPen black - save - scale -1 -1 - - setFont "sansserif" 10 normal - drawStaticText 0 20 "flipped sansserif 10pt, normal" - - setFont "sansserif" 12 normal - drawStaticText 0 40 "flipped sansserif 12pt, normal" - - setFont "sansserif" 12 bold - drawStaticText 0 60 "flipped sansserif 12pt, bold" - - setFont "sansserif" 10 bold italic - drawStaticText 0 80 "flipped sansserif 10pt, bold italic" - restore - - translate -200 20 - setPen black - save - translate 200 90 - rotate 185 - - setFont "sansserif" 10 normal - drawStaticText 0 20 "rotated sansserif 10pt, normal" - - setFont "sansserif" 12 normal - drawStaticText 0 40 "rotated sansserif 12pt, normal" - - setFont "sansserif" 12 bold - drawStaticText 0 60 "rotated sansserif 12pt, bold" - - setFont "sansserif" 10 bold italic - drawStaticText 0 80 "rotated sansserif 10pt, bold italic" - restore - - translate 0 100 - gradient_appendStop 0 red - gradient_appendStop 0.5 #00ff00 - gradient_appendStop 1 blue - gradient_setLinear 0 0 200 0 - setPen brush - - setFont "sansserif" 10 normal - drawStaticText 0 0 "gradient sansserif 10pt, normal" - - setFont "sansserif" 12 normal - drawStaticText 0 20 "gradient sansserif 12pt, normal" - - setFont "sansserif" 12 bold - drawStaticText 0 40 "gradient sansserif 12pt, bold" - - setFont "sansserif" 10 bold italic - drawStaticText 0 60 "gradient sansserif 10pt, bold italic" -restore -end_block - -translate 250 0 -drawStaticText 25 640 "clipped to rectangle" -save - setPen #3f000000 - setBrush nobrush - drawRect 20 0 100 620 - setClipRect 20 0 100 620 - setPen black - repeat_block text_drawing -restore - -translate 150 0 -drawStaticText 25 640 "clipped to path" -save - path_moveTo clip 20 0 - path_cubicTo clip 0 200 40 400 20 400 - path_lineTo clip 30 620 - path_lineTo clip 30 0 - path_lineTo clip 40 0 - path_lineTo clip 40 620 - path_lineTo clip 120 620 - path_lineTo clip 120 0 - path_lineTo clip 20 0 - setPen #3f000000 - setBrush nobrush - drawPath clip - setClipPath clip - setPen black - repeat_block text_drawing -restore - -translate 150 0 -save - setPen black - setFont "sansserif" 16 normal - drawStaticText 0 40 "e😃m😇o😍j😜i😸!" -restore - -translate 0 55 -save - setPen black - setFont "sansserif" 12 normal normal default underline - drawStaticText 0 20 "Underlined text drawing" -restore - -translate 0 35 -save - setPen black - setFont "sansserif" 12 normal normal default normal strikeout - drawStaticText 0 20 "Struck out text drawing" -restore - -translate 0 35 -save - setPen black - setFont "sansserif" 12 normal normal default normal normal overline - drawStaticText 0 20 "Overlined text drawing" -restore - -translate 0 35 -save - setPen black - setFont "sansserif" 12 normal normal default underline strikeout overline - drawStaticText 0 20 "All the effects text drawing" -restore diff --git a/tests/auto/other/lancelot/scripts/text.qps b/tests/auto/other/lancelot/scripts/text.qps deleted file mode 100644 index 4d81b3084c..0000000000 --- a/tests/auto/other/lancelot/scripts/text.qps +++ /dev/null @@ -1,199 +0,0 @@ -# Version: 1 - -drawText -5 5 "Text that is drawn outside the bounds..." - -translate 20 20 -begin_block text_drawing -save - setFont "sansserif" 10 normal - drawText 0 20 "sansserif 10pt, normal" - - setFont "sansserif" 12 normal - drawText 0 40 "sansserif 12pt, normal" - - setFont "sansserif" 12 bold - drawText 0 60 "sansserif 12pt, bold" - - setFont "sansserif" 10 bold italic - drawText 0 80 "sansserif 10pt, bold italic" - - - translate 0 100 - setPen #7fff0000 - - setFont "sansserif" 10 normal - drawText 0 20 "alpha sansserif 10pt, normal" - - setFont "sansserif" 12 normal - drawText 0 40 "alpha sansserif 12pt, normal" - - setFont "sansserif" 12 bold - drawText 0 60 "alpha sansserif 12pt, bold" - - setFont "sansserif" 10 bold italic - drawText 0 80 "alpha sansserif 10pt, bold italic" - - - translate 0 100 - setPen black - save - scale 0.9 0.9 - - setFont "sansserif" 10 normal - drawText 0 20 "scaled sansserif 10pt, normal" - - setFont "sansserif" 12 normal - drawText 0 40 "scaled sansserif 12pt, normal" - - setFont "sansserif" 12 bold - drawText 0 60 "scaled sansserif 12pt, bold" - - setFont "sansserif" 10 bold italic - drawText 0 80 "scaled sansserif 10pt, bold italic" - restore - - translate 200 200 - setPen black - save - scale -1 -1 - - setFont "sansserif" 10 normal - drawStaticText 0 20 "flipped sansserif 10pt, normal" - - setFont "sansserif" 12 normal - drawStaticText 0 40 "flipped sansserif 12pt, normal" - - setFont "sansserif" 12 bold - drawStaticText 0 60 "flipped sansserif 12pt, bold" - - setFont "sansserif" 10 bold italic - drawStaticText 0 80 "flipped sansserif 10pt, bold italic" - restore - - translate -200 20 - setPen black - save - translate 200 90 - rotate 185 - - setFont "sansserif" 10 normal - drawText 0 20 "rotated sansserif 10pt, normal" - - setFont "sansserif" 12 normal - drawText 0 40 "rotated sansserif 12pt, normal" - - setFont "sansserif" 12 bold - drawText 0 60 "rotated sansserif 12pt, bold" - - setFont "sansserif" 10 bold italic - drawText 0 80 "rotated sansserif 10pt, bold italic" - restore - - translate 0 100 - gradient_appendStop 0 red - gradient_appendStop 0.5 #00ff00 - gradient_appendStop 1 blue - gradient_setLinear 0 0 200 0 - setPen brush - - setFont "sansserif" 10 normal - drawText 0 0 "gradient sansserif 10pt, normal" - - setFont "sansserif" 12 normal - drawText 0 20 "gradient sansserif 12pt, normal" - - setFont "sansserif" 12 bold - drawText 0 40 "gradient sansserif 12pt, bold" - - setFont "sansserif" 10 bold italic - drawText 0 60 "gradient sansserif 10pt, bold italic" -restore -end_block - -translate 250 0 -drawText 25 640 "clipped to rectangle" -save - setPen #3f000000 - setBrush nobrush - drawRect 20 0 100 620 - setClipRect 20 0 100 620 - setPen black - repeat_block text_drawing -restore - -translate 150 0 -drawText 25 640 "clipped to path" -save - path_moveTo clip 20 0 - path_cubicTo clip 0 200 40 400 20 400 - path_lineTo clip 30 620 - path_lineTo clip 30 0 - path_lineTo clip 40 0 - path_lineTo clip 40 620 - path_lineTo clip 120 620 - path_lineTo clip 120 0 - path_lineTo clip 20 0 - setPen #3f000000 - setBrush nobrush - drawPath clip - setClipPath clip - setPen black - repeat_block text_drawing -restore - -translate 150 0 -save - setPen black - setFont "sansserif" 10 normal - drawText 0 20 "testing glyph cache textures" - - # Important that this gradient doesn't match any earlier - # gradients, so that it's not cached from before. - gradient_clearStops - gradient_appendStop 0 blue - gradient_appendStop 0.5 #00ff00 - gradient_appendStop 1 red - gradient_setLinear 0 0 100 0 - setPen nopen - drawRect 0 30 100 20 - - setPen black - drawText 0 70 "testing glyph cache textures" -restore - -translate 0 75 -save - setPen black - setFont "sansserif" 16 normal - drawText 0 40 "e😃m😇o😍j😜i😸!" -restore - -translate 0 75 -save - setPen black - setFont "sansserif" 12 normal normal default underline - drawText 0 20 "Underlined text drawing" -restore - -translate 0 35 -save - setPen black - setFont "sansserif" 12 normal normal default normal strikeout - drawText 0 20 "Struck out text drawing" -restore - -translate 0 35 -save - setPen black - setFont "sansserif" 12 normal normal default normal normal overline - drawText 0 20 "Overlined text drawing" -restore - -translate 0 35 -save - setPen black - setFont "sansserif" 12 normal normal default underline strikeout overline - drawText 0 20 "All the effects text drawing" -restore - - diff --git a/tests/auto/other/lancelot/scripts/text_perspectives.qps b/tests/auto/other/lancelot/scripts/text_perspectives.qps deleted file mode 100644 index 4c74306265..0000000000 --- a/tests/auto/other/lancelot/scripts/text_perspectives.qps +++ /dev/null @@ -1,102 +0,0 @@ -# Version: 1 - - -setRenderHint Antialiasing - -setPen black - -translate 10 10 -# standard draw -begin_block text -setBrush gray -drawRect 0 0 300 300 - -setFont "times" 3 -drawText 10 10 "Hello World...." - -setFont "times" 4 -drawText 10 20 "Hello World...." - -setFont "times" 5 -drawText 10 30 "Hello World...." - -setFont "times" 6 -drawText 10 40 "Hello World...." - -setFont "times" 7 -drawText 10 50 "Hello World...." - -setFont "times" 8 -drawText 10 60 "Hello World...." - -setFont "times" 9 -drawText 10 70 "Hello World...." - -setFont "times" 10 -drawText 10 80 "Hello World...." - -setFont "times" 16 -drawText 10 100 "Hello World...." - -setFont "times" 17 -drawText 10 120 "Hello World...." - -setFont "times" 18 -drawText 10 140 "Hello World...." - -setFont "times" 20 -drawText 10 160 "Hello World...." - -setFont "times" 22 -drawText 10 180 "Hello World...." - -setFont "times" 24 -drawText 10 205 "Hello World...." - -setFont "times" 26 -drawText 10 230 "Hello World...." - -setFont "times" 32 -drawText 10 260 "Hello World...." -end_block text - -# Rotation w/o smooth xform -save -translate 350 0 -save - setRenderHint SmoothPixmapTransform on - mapQuadToQuad 0 0 0 300 300 300 300 0 0 50 0 200 300 300 300 0 - repeat_block text -restore -restore - -translate 0 320 - -save - setRenderHint SmoothPixmapTransform on - mapQuadToQuad 0 0 0 300 300 300 300 0 0 0 100 300 200 300 300 0 - repeat_block text -restore - -save -translate 350 0 -save - setRenderHint SmoothPixmapTransform on - mapQuadToQuad 0 0 0 300 300 300 300 0 0 0 0 300 300 250 300 50 - repeat_block text -restore -restore - - -resetMatrix -setPen black -translate 125 20 -drawText 0 0 "No transform" -translate 350 0 -drawText 0 0 "Left Tilted" -resetMatrix -translate 125 350 -drawText 0 0 "Bottom Tilted" -translate 350 0 -drawText 0 0 "Right Tilted" -translate 120 0
\ No newline at end of file diff --git a/tests/auto/other/lancelot/scripts/thinlines.qps b/tests/auto/other/lancelot/scripts/thinlines.qps deleted file mode 100644 index dddfff4538..0000000000 --- a/tests/auto/other/lancelot/scripts/thinlines.qps +++ /dev/null @@ -1,79 +0,0 @@ -# Version: 1 -# CheckVsReference: 5% - -drawRect 0 0 800 800 - -path_addRect p 0 0 75 75 -path_addEllipse p 25 25 75 75 - -translate -500 -500 - -begin_block drawing - save - drawLine 0 0 100 100 - - translate 0 100 - drawPath p - - translate 0 110 - drawRect 0 0 100 100 - - translate 0 110 - drawPolyline [0 0 100 0 50 50] - - drawPoint 40 40 - drawPoint 41 40 - drawPoint 42 40 - drawPoint 43 40 - drawPoint 44 40 - drawPoint 45 40 - drawPoint 46 40 - drawPoint 47 40 - drawPoint 48 40 - drawPoint 49 40 - drawPoint 50 40 - - restore -end_block - -begin_block univsnonuni - save - - save - scale 0.7 0.7 - repeat_block drawing - restore - - translate 100 0 - save - scale 0.7 0.8 - repeat_block drawing - restore - - restore -end_block - -resetMatrix -translate 20.5 20.5 - -begin_block row -save - repeat_block univsnonuni - - translate 240 0 - save - rotate 10 - repeat_block univsnonuni - restore - - translate 220 0 - save - rotate_y 30 - repeat_block univsnonuni - restore -restore -end_block - -translate 0 320 -setRenderHint AntiAliasing -repeat_block row diff --git a/tests/auto/other/lancelot/scripts/tiled_pixmap.qps b/tests/auto/other/lancelot/scripts/tiled_pixmap.qps deleted file mode 100644 index 0ce3a7834c..0000000000 --- a/tests/auto/other/lancelot/scripts/tiled_pixmap.qps +++ /dev/null @@ -1,84 +0,0 @@ -# Version: 1 -# CheckVsReference: 5% (0 0 639 638) - - -translate 0 10 -setRenderHint Antialiasing - -pixmap_load dome_argb32 the_pixmap - -begin_block draw_stuff -save - - # Standard draw - drawTiledPixmap the_pixmap 0 0 150 100 0 0 - - # Standard draw with offset - translate 160 0 - drawTiledPixmap the_pixmap 0 0 150 100 25 25 - - # xformed - translate 160 0 - save - translate 10 -10 - rotate 10 - setRenderHint SmoothPixmapTransform false - drawTiledPixmap the_pixmap 0 0 150 100 25 25 - restore - - # xformed with smooth xform - translate 160 0 - save - translate 10 -10 - rotate 10 - setRenderHint SmoothPixmapTransform - drawTiledPixmap the_pixmap 0 0 150 100 25 25 - restore -restore -end_block - -translate 0 120 -pixmap_load dome_rgb32 the_pixmap -repeat_block draw_stuff - - -translate 0 120 -pixmap_load dome_indexed the_pixmap -repeat_block draw_stuff - - -translate 0 120 -pixmap_load dome_indexed_mask the_pixmap -repeat_block draw_stuff - - -translate 0 120 -pixmap_load dome_mono the_pixmap -repeat_block draw_stuff - - -################################################################################ -# Some helpful text... -# - -resetMatrix -translate 650 80 -drawText 0 0 "32 bit w/alpha" -translate 0 120 -drawText 0 0 "32 bit w/o alpha" -translate 0 120 -drawText 0 0 "8 bit indexed" -translate 0 120 -drawText 0 0 "8 bit indexed w/mask" -translate 0 120 -drawText 0 0 "1 bit" - -resetMatrix -translate 10 630 -drawText 0 0 "normal" -translate 160 0 -drawText 0 0 "offset" -translate 160 0 -drawText 0 0 "xformed" -translate 160 0 -drawText 0 0 "smooth xformed" diff --git a/tests/auto/other/lancelot/tst_lancelot.cpp b/tests/auto/other/lancelot/tst_lancelot.cpp deleted file mode 100644 index 7a85e9c370..0000000000 --- a/tests/auto/other/lancelot/tst_lancelot.cpp +++ /dev/null @@ -1,413 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "paintcommands.h" -#include <qbaselinetest.h> -#include <QDir> -#include <QPainter> - -#ifndef QT_NO_OPENGL -#include <QOpenGLFramebufferObjectFormat> -#include <QOpenGLContext> -#include <QOpenGLPaintDevice> -#endif - -#include <algorithm> - -#ifndef GL_RGB10 -#define GL_RGB10 0x8052 -#endif -#ifndef GL_RGB10_A2 -#define GL_RGB10_A2 0x8059 -#endif - -class tst_Lancelot : public QObject -{ -Q_OBJECT - -public: - tst_Lancelot(); - -private: - enum GraphicsEngine { - Raster = 0, - OpenGL = 1 - }; - - void setupTestSuite(const QStringList& blacklist = QStringList()); - void runTestSuite(GraphicsEngine engine, QImage::Format format, const QSurfaceFormat &contextFormat = QSurfaceFormat()); - void paint(QPaintDevice *device, GraphicsEngine engine, QImage::Format format, const QStringList &script, const QString &filePath); - - QStringList qpsFiles; - QHash<QString, QStringList> scripts; - QHash<QString, quint16> scriptChecksums; - QString scriptsDir; - -private slots: - void initTestCase(); - void cleanupTestCase() {} - - void testRasterARGB32PM_data(); - void testRasterARGB32PM(); - void testRasterRGB32_data(); - void testRasterRGB32(); - void testRasterARGB32_data(); - void testRasterARGB32(); - void testRasterRGB16_data(); - void testRasterRGB16(); - void testRasterA2RGB30PM_data(); - void testRasterA2RGB30PM(); - void testRasterBGR30_data(); - void testRasterBGR30(); - void testRasterARGB8565PM_data(); - void testRasterARGB8565PM(); - void testRasterGrayscale8_data(); - void testRasterGrayscale8(); - void testRasterRGBA64PM_data(); - void testRasterRGBA64PM(); - -#ifndef QT_NO_OPENGL - void testOpenGL_data(); - void testOpenGL(); - void testOpenGLBGR30_data(); - void testOpenGLBGR30(); - void testCoreOpenGL_data(); - void testCoreOpenGL(); -private: - bool checkSystemGLSupport(); - bool checkSystemCoreGLSupport(); -#endif -}; - -tst_Lancelot::tst_Lancelot() -{ -} - -void tst_Lancelot::initTestCase() -{ - // Check and setup the environment. We treat failures because of test environment - // (e.g. script files not found) as just warnings, and not QFAILs, to avoid false negatives - // caused by environment or server instability - - QByteArray msg; - if (!QBaselineTest::connectToBaselineServer(&msg)) - QSKIP(msg); - - QString baseDir = QFINDTESTDATA("scripts/text.qps"); - scriptsDir = baseDir.left(baseDir.lastIndexOf('/')) + '/'; - QDir qpsDir(scriptsDir); - qpsFiles = qpsDir.entryList(QStringList() << QLatin1String("*.qps"), QDir::Files | QDir::Readable); - if (qpsFiles.isEmpty()) { - QWARN("No qps script files found in " + qpsDir.path().toLatin1()); - QSKIP("Aborted due to errors."); - } - - std::sort(qpsFiles.begin(), qpsFiles.end()); - foreach (const QString& fileName, qpsFiles) { - QFile file(scriptsDir + fileName); - file.open(QFile::ReadOnly); - QByteArray cont = file.readAll(); - scripts.insert(fileName, QString::fromUtf8(cont).split(QLatin1Char('\n'), Qt::SkipEmptyParts)); - scriptChecksums.insert(fileName, qChecksum(cont)); - } -} - - -void tst_Lancelot::testRasterARGB32PM_data() -{ - setupTestSuite(); -} - - -void tst_Lancelot::testRasterARGB32PM() -{ - runTestSuite(Raster, QImage::Format_ARGB32_Premultiplied); -} - - -void tst_Lancelot::testRasterARGB32_data() -{ - setupTestSuite(); -} - -void tst_Lancelot::testRasterARGB32() -{ - runTestSuite(Raster, QImage::Format_ARGB32); -} - - -void tst_Lancelot::testRasterRGB32_data() -{ - setupTestSuite(); -} - - -void tst_Lancelot::testRasterRGB32() -{ - runTestSuite(Raster, QImage::Format_RGB32); -} - - -void tst_Lancelot::testRasterRGB16_data() -{ - setupTestSuite(); -} - - -void tst_Lancelot::testRasterRGB16() -{ - runTestSuite(Raster, QImage::Format_RGB16); -} - - -void tst_Lancelot::testRasterA2RGB30PM_data() -{ - setupTestSuite(); -} - - -void tst_Lancelot::testRasterA2RGB30PM() -{ - runTestSuite(Raster, QImage::Format_A2RGB30_Premultiplied); -} - - -void tst_Lancelot::testRasterBGR30_data() -{ - setupTestSuite(); -} - - -void tst_Lancelot::testRasterBGR30() -{ - runTestSuite(Raster, QImage::Format_BGR30); -} - - -void tst_Lancelot::testRasterARGB8565PM_data() -{ - setupTestSuite(); -} - -void tst_Lancelot::testRasterARGB8565PM() -{ - runTestSuite(Raster, QImage::Format_ARGB8565_Premultiplied); -} - - -void tst_Lancelot::testRasterGrayscale8_data() -{ - setupTestSuite(); -} - -void tst_Lancelot::testRasterGrayscale8() -{ - runTestSuite(Raster, QImage::Format_Grayscale8); -} - - -void tst_Lancelot::testRasterRGBA64PM_data() -{ - setupTestSuite(); -} - -void tst_Lancelot::testRasterRGBA64PM() -{ - runTestSuite(Raster, QImage::Format_RGBA64_Premultiplied); -} - - -#ifndef QT_NO_OPENGL -bool tst_Lancelot::checkSystemGLSupport() -{ - QWindow win; - win.setSurfaceType(QSurface::OpenGLSurface); - win.create(); - QOpenGLFramebufferObjectFormat fmt; - fmt.setAttachment(QOpenGLFramebufferObject::CombinedDepthStencil); - fmt.setSamples(4); - QOpenGLContext ctx; - if (!ctx.create() || !ctx.makeCurrent(&win)) - return false; - QOpenGLFramebufferObject fbo(800, 800, fmt); - if (!fbo.isValid() || !fbo.bind()) - return false; - - return true; -} - -bool tst_Lancelot::checkSystemCoreGLSupport() -{ - if (QOpenGLContext::openGLModuleType() != QOpenGLContext::LibGL) - return false; - - QSurfaceFormat coreFormat; - coreFormat.setVersion(3, 2); - coreFormat.setProfile(QSurfaceFormat::CoreProfile); - QWindow win; - win.setSurfaceType(QSurface::OpenGLSurface); - win.setFormat(coreFormat); - win.create(); - QOpenGLFramebufferObjectFormat fmt; - fmt.setAttachment(QOpenGLFramebufferObject::CombinedDepthStencil); - fmt.setSamples(4); - QOpenGLContext ctx; - ctx.setFormat(coreFormat); - if (!ctx.create() || !ctx.makeCurrent(&win)) - return false; - QOpenGLFramebufferObject fbo(800, 800, fmt); - if (!fbo.isValid() || !fbo.bind()) - return false; - - return true; -} - -void tst_Lancelot::testOpenGL_data() -{ - if (!checkSystemGLSupport()) - QSKIP("System under test does not meet preconditions for GL testing. Skipping."); - QStringList localBlacklist = QStringList() << QLatin1String("rasterops.qps"); - setupTestSuite(localBlacklist); -} - - -void tst_Lancelot::testOpenGL() -{ - runTestSuite(OpenGL, QImage::Format_RGB32); -} - -void tst_Lancelot::testOpenGLBGR30_data() -{ - tst_Lancelot::testOpenGL_data(); -} - -void tst_Lancelot::testOpenGLBGR30() -{ - runTestSuite(OpenGL, QImage::Format_BGR30); -} - -void tst_Lancelot::testCoreOpenGL_data() -{ - if (!checkSystemCoreGLSupport()) - QSKIP("System under test does not meet preconditions for Core Profile GL testing. Skipping."); - QStringList localBlacklist = QStringList() << QLatin1String("rasterops.qps"); - setupTestSuite(localBlacklist); -} - -void tst_Lancelot::testCoreOpenGL() -{ - QSurfaceFormat coreFormat; - coreFormat.setVersion(3, 2); - coreFormat.setProfile(QSurfaceFormat::CoreProfile); - runTestSuite(OpenGL, QImage::Format_RGB32, coreFormat); -} -#endif - - -void tst_Lancelot::setupTestSuite(const QStringList& blacklist) -{ - QTest::addColumn<QString>("qpsFile"); - foreach (const QString &fileName, qpsFiles) { - if (blacklist.contains(fileName)) - continue; - QBaselineTest::newRow(fileName.toLatin1(), scriptChecksums.value(fileName)) << fileName; - } -} - - -void tst_Lancelot::runTestSuite(GraphicsEngine engine, QImage::Format format, const QSurfaceFormat &contextFormat) -{ - QFETCH(QString, qpsFile); - - QString filePath = scriptsDir + qpsFile; - QStringList script = scripts.value(qpsFile); - QImage rendered; - - if (engine == Raster) { - QImage img(800, 800, format); - paint(&img, engine, format, script, QFileInfo(filePath).absoluteFilePath()); - rendered = img; -#ifndef QT_NO_OPENGL - } else if (engine == OpenGL) { - QWindow win; - win.setSurfaceType(QSurface::OpenGLSurface); - win.setFormat(contextFormat); - win.create(); - QOpenGLContext ctx; - ctx.setFormat(contextFormat); - QVERIFY(ctx.create()); - QVERIFY(ctx.makeCurrent(&win)); - QOpenGLFramebufferObjectFormat fmt; - fmt.setAttachment(QOpenGLFramebufferObject::CombinedDepthStencil); - fmt.setSamples(4); - if (format == QImage::Format_BGR30) - fmt.setInternalTextureFormat(ctx.isOpenGLES() ? GL_RGB10_A2 : GL_RGB10); - QOpenGLFramebufferObject fbo(800, 800, fmt); - fbo.bind(); - QOpenGLPaintDevice pdv(800, 800); - paint(&pdv, engine, format, script, QFileInfo(filePath).absoluteFilePath()); - rendered = fbo.toImage().convertToFormat(format); -#endif - } - - QBASELINE_TEST(rendered); -} - -void tst_Lancelot::paint(QPaintDevice *device, GraphicsEngine engine, QImage::Format format, const QStringList &script, const QString &filePath) -{ - QPainter p(device); - PaintCommands pcmd(script, 800, 800, format); - //pcmd.setShouldDrawText(false); - switch (engine) { - case OpenGL: - pcmd.setType(OpenGLBufferType); // version/profile is communicated through the context's format() - break; - case Raster: // fallthrough - default: - pcmd.setType(ImageType); - break; - } - pcmd.setPainter(&p); - pcmd.setFilePath(filePath); - pcmd.runCommands(); - p.end(); -} - -#define main _realmain -QTEST_MAIN(tst_Lancelot) -#undef main - -int main(int argc, char *argv[]) -{ - qSetGlobalQHashSeed(0); // Avoid rendering variations caused by QHash randomization - - QBaselineTest::handleCmdLineArgs(&argc, &argv); - return _realmain(argc, argv); -} - -#include "tst_lancelot.moc" diff --git a/tests/auto/other/languagechange/CMakeLists.txt b/tests/auto/other/languagechange/CMakeLists.txt index 0275ea05fd..07f3547d58 100644 --- a/tests/auto/other/languagechange/CMakeLists.txt +++ b/tests/auto/other/languagechange/CMakeLists.txt @@ -1,21 +1,22 @@ -# Generated from languagechange.pro. +# Copyright (C) 2022 The Qt Company Ltd. +# SPDX-License-Identifier: BSD-3-Clause ##################################################################### ## 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 - PUBLIC_LIBRARIES + LIBRARIES Qt::CorePrivate Qt::Gui 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 0c435a0cb1..8f99730a19 100644 --- a/tests/auto/other/languagechange/tst_languagechange.cpp +++ b/tests/auto/other/languagechange/tst_languagechange.cpp @@ -1,30 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// 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 5a5d6a175f..a6dc56611b 100644 --- a/tests/auto/other/macgui/BLACKLIST +++ b/tests/auto/other/macgui/BLACKLIST @@ -1,2 +1,2 @@ -[nonModalOrder] -osx +[scrollbarPainting] +macos diff --git a/tests/auto/other/macgui/CMakeLists.txt b/tests/auto/other/macgui/CMakeLists.txt index 348d7f1241..afa3f0b8df 100644 --- a/tests/auto/other/macgui/CMakeLists.txt +++ b/tests/auto/other/macgui/CMakeLists.txt @@ -1,9 +1,16 @@ -# Generated from macgui.pro. +# 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() -if(NOT TARGET Qt::Widgets) # special case +if(NOT TARGET Qt::Widgets) return() endif() @@ -15,18 +22,17 @@ qt_internal_add_test(tst_macgui SOURCES guitest.cpp guitest.h tst_macgui.cpp - PUBLIC_LIBRARIES + 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: ##################################################################### qt_internal_extend_target(tst_macgui CONDITION MACOS - PUBLIC_LIBRARIES + LIBRARIES ${FWApplicationServices} ) diff --git a/tests/auto/other/macgui/guitest.cpp b/tests/auto/other/macgui/guitest.cpp index 2effce7393..fbae891065 100644 --- a/tests/auto/other/macgui/guitest.cpp +++ b/tests/auto/other/macgui/guitest.cpp @@ -1,31 +1,7 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// 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 74f4292a6b..80a2103fc9 100644 --- a/tests/auto/other/macgui/guitest.h +++ b/tests/auto/other/macgui/guitest.h @@ -1,30 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// 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 ab0114fc6c..efcecef9ad 100644 --- a/tests/auto/other/macgui/tst_macgui.cpp +++ b/tests/auto/other/macgui/tst_macgui.cpp @@ -1,30 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #include <QApplication> @@ -94,7 +69,6 @@ void tst_MacGui::scrollbarPainting() QPixmap pixmap = grabWindowContents(&colorWidget); - QEXPECT_FAIL("", "QTBUG-26371", Abort); QVERIFY(isContent(pixmap.toImage(), verticalScrollbar.geometry(), GuiTester::Horizontal)); QVERIFY(isContent(pixmap.toImage(), horizontalScrollbar.geometry(), GuiTester::Vertical)); } @@ -152,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 @@ -194,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 dd049c245a..c44cf61920 100644 --- a/tests/auto/other/macnativeevents/CMakeLists.txt +++ b/tests/auto/other/macnativeevents/CMakeLists.txt @@ -1,4 +1,11 @@ -# Generated from macnativeevents.pro. +# 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() @@ -15,13 +22,8 @@ qt_internal_add_test(tst_macnativeevents qnativeevents.cpp qnativeevents.h qnativeevents_mac.cpp tst_macnativeevents.cpp - DEFINES - QT_DISABLE_DEPRECATED_BEFORE=0 - PUBLIC_LIBRARIES + LIBRARIES ${FWAppKit} 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 52552342e4..a8c662ad93 100644 --- a/tests/auto/other/macnativeevents/expectedeventlist.cpp +++ b/tests/auto/other/macnativeevents/expectedeventlist.cpp @@ -1,30 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// 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 a48581df21..f21b56c9b2 100644 --- a/tests/auto/other/macnativeevents/expectedeventlist.h +++ b/tests/auto/other/macnativeevents/expectedeventlist.h @@ -1,30 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// 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 b2956fa94e..6216c9682f 100644 --- a/tests/auto/other/macnativeevents/nativeeventlist.cpp +++ b/tests/auto/other/macnativeevents/nativeeventlist.cpp @@ -1,30 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// 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 7425414da7..20e91a689a 100644 --- a/tests/auto/other/macnativeevents/nativeeventlist.h +++ b/tests/auto/other/macnativeevents/nativeeventlist.h @@ -1,30 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// 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 970c41bf2e..a516fc28d6 100644 --- a/tests/auto/other/macnativeevents/qnativeevents.cpp +++ b/tests/auto/other/macnativeevents/qnativeevents.cpp @@ -1,30 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// 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 ca0cd47675..cab2472083 100644 --- a/tests/auto/other/macnativeevents/qnativeevents.h +++ b/tests/auto/other/macnativeevents/qnativeevents.h @@ -1,30 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// 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 6d7fbbecc1..a2e1a66c65 100644 --- a/tests/auto/other/macnativeevents/qnativeevents_mac.cpp +++ b/tests/auto/other/macnativeevents/qnativeevents_mac.cpp @@ -1,30 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// 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 79e59e2616..3cb934d7d5 100644 --- a/tests/auto/other/macnativeevents/tst_macnativeevents.cpp +++ b/tests/auto/other/macnativeevents/tst_macnativeevents.cpp @@ -1,30 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #include <QApplication> #include <QWidget> diff --git a/tests/auto/other/macplist/BLACKLIST b/tests/auto/other/macplist/BLACKLIST deleted file mode 100644 index 83ed55936e..0000000000 --- a/tests/auto/other/macplist/BLACKLIST +++ /dev/null @@ -1,2 +0,0 @@ -[test_plist:LSUIElement-as-garbage] -osx diff --git a/tests/auto/other/macplist/CMakeLists.txt b/tests/auto/other/macplist/CMakeLists.txt index 7ebb9d732c..6a98d4dc16 100644 --- a/tests/auto/other/macplist/CMakeLists.txt +++ b/tests/auto/other/macplist/CMakeLists.txt @@ -1,6 +1,13 @@ -# Generated from macplist.pro. +# Copyright (C) 2022 The Qt Company Ltd. +# SPDX-License-Identifier: BSD-3-Clause -if(NOT TARGET Qt::Widgets) # special case +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() add_subdirectory(app) diff --git a/tests/auto/other/macplist/app/CMakeLists.txt b/tests/auto/other/macplist/app/CMakeLists.txt index 127d72b1e4..8af8e9f578 100644 --- a/tests/auto/other/macplist/app/CMakeLists.txt +++ b/tests/auto/other/macplist/app/CMakeLists.txt @@ -1,4 +1,5 @@ -# Generated from app.pro. +# Copyright (C) 2022 The Qt Company Ltd. +# SPDX-License-Identifier: BSD-3-Clause ##################################################################### ## app Binary: @@ -6,10 +7,10 @@ qt_internal_add_executable(app GUI - OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} # special case + OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} SOURCES main.cpp - PUBLIC_LIBRARIES + LIBRARIES Qt::Gui Qt::Widgets ) diff --git a/tests/auto/other/macplist/app/main.cpp b/tests/auto/other/macplist/app/main.cpp index 1d620eb7c6..2f07fe3c25 100644 --- a/tests/auto/other/macplist/app/main.cpp +++ b/tests/auto/other/macplist/app/main.cpp @@ -1,30 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// 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 157df5767f..e55dfb2591 100644 --- a/tests/auto/other/macplist/test/CMakeLists.txt +++ b/tests/auto/other/macplist/test/CMakeLists.txt @@ -1,4 +1,5 @@ -# Generated from test.pro. +# Copyright (C) 2022 The Qt Company Ltd. +# SPDX-License-Identifier: BSD-3-Clause ##################################################################### ## tst_macplist Test: @@ -8,7 +9,7 @@ qt_internal_add_test(tst_macplist OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/../" SOURCES ../tst_macplist.cpp - PUBLIC_LIBRARIES + LIBRARIES Qt::Gui ) diff --git a/tests/auto/other/macplist/tst_macplist.cpp b/tests/auto/other/macplist/tst_macplist.cpp index 10303aed96..12240c45b5 100644 --- a/tests/auto/other/macplist/tst_macplist.cpp +++ b/tests/auto/other/macplist/tst_macplist.cpp @@ -1,30 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// 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 547e4afd7e..6491c510f6 100644 --- a/tests/auto/other/networkselftest/CMakeLists.txt +++ b/tests/auto/other/networkselftest/CMakeLists.txt @@ -1,17 +1,21 @@ -# Generated from networkselftest.pro. +# Copyright (C) 2022 The Qt Company Ltd. +# SPDX-License-Identifier: BSD-3-Clause ##################################################################### ## 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 - PUBLIC_LIBRARIES + 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 f1fd869671..81d3b60248 100644 --- a/tests/auto/other/networkselftest/tst_networkselftest.cpp +++ b/tests/auto/other/networkselftest/tst_networkselftest.cpp @@ -1,30 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #include <QTest> #include <QtNetwork/QtNetwork> @@ -130,8 +105,8 @@ static QString prettyByteArray(const QByteArray &array) { // any control chars? QString result; - result.reserve(array.length() + array.length() / 3); - for (int i = 0; i < array.length(); ++i) { + result.reserve(array.size() + array.size() / 3); + for (int i = 0; i < array.size(); ++i) { char c = array.at(i); switch (c) { case '\n': @@ -233,11 +208,11 @@ static void netChat(int port, const QList<Chat> &chat) switch (it->type) { case Chat::Expect: { qDebug() << i << "Expecting" << prettyByteArray(it->data); - if (!doSocketRead(&socket, it->data.length(), 3 * defaultReadTimeoutMS)) - QFAIL(msgDoSocketReadFailed(serverName, port, i, it->data.length())); + if (!doSocketRead(&socket, it->data.size(), 3 * defaultReadTimeoutMS)) + QFAIL(msgDoSocketReadFailed(serverName, port, i, it->data.size())); // pop that many bytes off the socket - QByteArray received = socket.read(it->data.length()); + QByteArray received = socket.read(it->data.size()); // is it what we expected? QVERIFY2(received == it->data, @@ -251,8 +226,8 @@ static void netChat(int port, const QList<Chat> &chat) qDebug() << i << "Discarding until" << prettyByteArray(it->data); while (true) { // scan the buffer until we have our string - if (!doSocketRead(&socket, it->data.length())) - QFAIL(msgDoSocketReadFailed(serverName, port, i, it->data.length())); + if (!doSocketRead(&socket, it->data.size())) + QFAIL(msgDoSocketReadFailed(serverName, port, i, it->data.size())); QByteArray buffer; buffer.resize(socket.bytesAvailable()); @@ -264,7 +239,7 @@ static void netChat(int port, const QList<Chat> &chat) continue; } - buffer = socket.read(pos + it->data.length()); + buffer = socket.read(pos + it->data.size()); qDebug() << i << "Discarded" << prettyByteArray(buffer); break; } @@ -379,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)); @@ -536,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 ecc95d30b6..d670cec196 100644 --- a/tests/auto/other/qabstractitemmodelutils/dynamictreemodel.cpp +++ b/tests/auto/other/qabstractitemmodelutils/dynamictreemodel.cpp @@ -1,30 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Stephen Kelly <steveire@gmail.com> -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2009 Stephen Kelly <steveire@gmail.com> +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #include "dynamictreemodel.h" @@ -216,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++) @@ -231,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); } @@ -308,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); @@ -334,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 ba566cbbac..bc7db2ad0f 100644 --- a/tests/auto/other/qabstractitemmodelutils/dynamictreemodel.h +++ b/tests/auto/other/qabstractitemmodelutils/dynamictreemodel.h @@ -1,30 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Stephen Kelly <steveire@gmail.com> -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2009 Stephen Kelly <steveire@gmail.com> +// 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 9752b19639..9160bafe52 100644 --- a/tests/auto/other/qaccessibility/CMakeLists.txt +++ b/tests/auto/other/qaccessibility/CMakeLists.txt @@ -1,14 +1,15 @@ -# Generated from qaccessibility.pro. +# Copyright (C) 2022 The Qt Company Ltd. +# SPDX-License-Identifier: BSD-3-Clause -if(NOT QT_FEATURE_accessibility) - return() +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() -# special case begin -if (WIN32 AND NOT TARGET Qt::WindowsUIAutomationSupport) +if(NOT QT_FEATURE_accessibility) return() endif() -# special case end ##################################################################### ## tst_qaccessibility Test: @@ -18,7 +19,7 @@ qt_internal_add_test(tst_qaccessibility SOURCES accessiblewidgets.h tst_qaccessibility.cpp - PUBLIC_LIBRARIES + LIBRARIES Qt::CorePrivate Qt::Gui Qt::GuiPrivate @@ -26,19 +27,16 @@ qt_internal_add_test(tst_qaccessibility Qt::WidgetsPrivate ) -#### Keys ignored in scope 1:.:.:qaccessibility.pro:<TRUE>: -# _REQUIREMENTS = "qtConfig(accessibility)" - ## Scopes: ##################################################################### -qt_internal_extend_target(tst_qaccessibility CONDITION UNIX AND NOT APPLE AND NOT HAIKU AND NOT integity - PUBLIC_LIBRARIES +qt_internal_extend_target(tst_qaccessibility CONDITION UNIX AND NOT APPLE AND NOT HAIKU AND NOT INTEGRITY + LIBRARIES m ) qt_internal_extend_target(tst_qaccessibility CONDITION WIN32 - PUBLIC_LIBRARIES + LIBRARIES ole32 oleacc oleaut32 diff --git a/tests/auto/other/qaccessibility/accessiblewidgets.h b/tests/auto/other/qaccessibility/accessiblewidgets.h index 13ca687dd9..76b1f1f473 100644 --- a/tests/auto/other/qaccessibility/accessiblewidgets.h +++ b/tests/auto/other/qaccessibility/accessiblewidgets.h @@ -1,30 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #ifndef ACCESSIBLEWIDGETS_H @@ -141,7 +116,7 @@ public: int cursorPosition() const override { return textWidget()->cursorPosition; } void setCursorPosition(int position) override { textWidget()->cursorPosition = position; } QString text(int startOffset, int endOffset) const override { return textWidget()->text.mid(startOffset, endOffset); } - int characterCount() const override { return textWidget()->text.length(); } + int characterCount() const override { return textWidget()->text.size(); } QRect characterRect(int) const override { return QRect(); } int offsetAtPoint(const QPoint &) const override { return 0; } void scrollToSubstring(int, int) override {} diff --git a/tests/auto/other/qaccessibility/tst_qaccessibility.cpp b/tests/auto/other/qaccessibility/tst_qaccessibility.cpp index 1d189bdce2..cab88e2fc0 100644 --- a/tests/auto/other/qaccessibility/tst_qaccessibility.cpp +++ b/tests/auto/other/qaccessibility/tst_qaccessibility.cpp @@ -1,50 +1,31 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - +// Copyright (C) 2016 The Qt Company Ltd. +// 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 #include <QTest> +#include <QSignalSpy> #include <QtGui> #include <QtWidgets> #include <math.h> #include <qpa/qplatformnativeinterface.h> #include <qpa/qplatformintegration.h> #include <qpa/qplatformaccessibility.h> +#ifdef Q_OS_WIN +#include <QtCore/private/qfunctions_win_p.h> +#endif #include <QtGui/private/qguiapplication_p.h> #include <QtGui/private/qhighdpiscaling_p.h> +#include <QtWidgets/private/qapplication_p.h> +#include <QtWidgets/private/qdialog_p.h> + #if defined(Q_OS_WIN) && defined(interface) # undef interface #endif @@ -58,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) @@ -185,6 +167,7 @@ public slots: void cleanup(); private slots: void eventTest(); + void eventWithChildTest(); void customWidget(); void deletedWidget(); void subclassedWidget(); @@ -231,18 +214,24 @@ private slots: void listTest(); void treeTest(); void tableTest(); + void rootIndexView(); + void uniqueIdTest(); void calendarWidgetTest(); void dockWidgetTest(); void comboBoxTest(); void accessibleName(); #if QT_CONFIG(shortcut) void labelTest(); + void relationTest(); void accelerators(); #endif void bridgeTest(); void focusChild(); + void messageBoxTest_data(); + void messageBoxTest(); + protected slots: void onClicked(); private: @@ -269,13 +258,21 @@ void tst_QAccessibility::onClicked() click_count++; } +static bool initAccessibility() +{ + QPlatformIntegration *pfIntegration = QGuiApplicationPrivate::platformIntegration(); + if (pfIntegration->accessibility()) { + pfIntegration->accessibility()->setActive(true); + return true; + } + return false; +} + void tst_QAccessibility::initTestCase() { QTestAccessibility::initialize(); - QPlatformIntegration *pfIntegration = QGuiApplicationPrivate::platformIntegration(); - if (!pfIntegration->accessibility()) + if (!initAccessibility()) QSKIP("This platform does not support accessibility"); - pfIntegration->accessibility()->setActive(true); } void tst_QAccessibility::cleanupTestCase() @@ -286,15 +283,26 @@ void tst_QAccessibility::cleanupTestCase() void tst_QAccessibility::init() { QTestAccessibility::clearEvents(); +#ifdef Q_OS_ANDROID + // On Android a11y state is not explicitly set by calling + // QPlatformAccessibility::setActive(), there is another flag that is + // controlled from the Java side. The state of this flag is queried + // during event processing, so a11y state can be reset to false while + // we do QTest::qWait(). + // To overcome the issue in unit-tests, re-enable a11y before each test. + // A more precise fix will require re-enabling it after every qWait() or + // processEvents() call, but the current tests pass with such condition. + initAccessibility(); +#endif } void tst_QAccessibility::cleanup() { const EventList list = QTestAccessibility::events(); if (!list.isEmpty()) { - qWarning("%zd accessibility event(s) were not handled in testfunction '%s':", size_t(list.count()), + qWarning("%zd accessibility event(s) were not handled in testfunction '%s':", size_t(list.size()), QString(QTest::currentTestFunction()).toLatin1().constData()); - for (int i = 0; i < list.count(); ++i) + for (int i = 0; i < list.size(); ++i) qWarning(" %d: Object: %p Event: '%s' Child: %d", i + 1, list.at(i)->object(), qAccessibleEventString(list.at(i)->type()), list.at(i)->child()); } @@ -304,7 +312,8 @@ void tst_QAccessibility::cleanup() void tst_QAccessibility::eventTest() { - QPushButton* button = new QPushButton(0); + auto buttonHolder = std::make_unique<QPushButton>(nullptr); + auto button = buttonHolder.get(); QAccessible::queryAccessibleInterface(button); button->setObjectName(QString("Olaf")); setFrameless(button); @@ -329,83 +338,109 @@ void tst_QAccessibility::eventTest() // some platforms might send other events first, (such as state change event active=1) QVERIFY(QTestAccessibility::containsEvent(&hideEvent)); - delete button; + buttonHolder.reset(); // Make sure that invalid events don't bring down the system // these events can be in user code. - QWidget *widget = new QWidget(); + auto widgetHolder = std::make_unique<QWidget>(); + auto widget = widgetHolder.get(); QAccessibleEvent ev1(widget, QAccessible::Focus); QAccessible::updateAccessibility(&ev1); QAccessibleEvent ev2(widget, QAccessible::Focus); ev2.setChild(7); QAccessible::updateAccessibility(&ev2); - delete widget; + widgetHolder.reset(); - QObject *object = new QObject(); + auto objectHolder = std::make_unique<QObject>(); + auto object = objectHolder.get(); QAccessibleEvent ev3(object, QAccessible::Focus); QAccessible::updateAccessibility(&ev3); - delete object; + objectHolder.reset(); QTestAccessibility::clearEvents(); } +void tst_QAccessibility::eventWithChildTest() +{ + // make sure that QAccessibleEvent created using either of the two QAccessibleEvent + // behaves the same when the same underlying QObject is used + QWidget widget; + QWidget childWidget(&widget); + + // QAccessibleEvent constructor called with the QObject* + QAccessibleEvent event1(&widget, QAccessible::Focus); + + // QAccessibleEvent constructor called with the QAccessibleInterface* for the same QObject* + QAccessibleInterface *iface = QAccessible::queryAccessibleInterface(&widget); + QAccessibleEvent event2(iface, QAccessible::Focus); + + QVERIFY(event1.accessibleInterface() != nullptr); + QVERIFY(event2.accessibleInterface() != nullptr); + QCOMPARE(event1.accessibleInterface(), event2.accessibleInterface()); + + // set same child for both + event1.setChild(0); + event2.setChild(0); + + QVERIFY(event1.accessibleInterface() != nullptr); + QVERIFY(event2.accessibleInterface() != nullptr); + QCOMPARE(event1.accessibleInterface(), event2.accessibleInterface()); +} + void tst_QAccessibility::customWidget() { { - QtTestAccessibleWidget* widget = new QtTestAccessibleWidget(0, "Heinz"); - widget->show(); - QVERIFY(QTest::qWaitForWindowExposed(widget)); + QtTestAccessibleWidget widget(nullptr, "Heinz"); + widget.show(); + QVERIFY(QTest::qWaitForWindowExposed(&widget)); // By default we create QAccessibleWidget - QAccessibleInterface *iface = QAccessible::queryAccessibleInterface(widget); + QAccessibleInterface *iface = QAccessible::queryAccessibleInterface(&widget); QVERIFY(iface != 0); QVERIFY(iface->isValid()); - QCOMPARE(iface->object(), (QObject*)widget); + QCOMPARE(iface->object(), (QObject*)&widget); QCOMPARE(iface->object()->objectName(), QString("Heinz")); - QCOMPARE(iface->rect().height(), widget->height()); + QCOMPARE(iface->rect().height(), widget.height()); QCOMPARE(iface->text(QAccessible::Help), QString()); - QCOMPARE(iface->rect().height(), widget->height()); - delete widget; + QCOMPARE(iface->rect().width(), widget.width()); } { QAccessible::installFactory(QtTestAccessibleWidgetIface::ifaceFactory); - QtTestAccessibleWidget* widget = new QtTestAccessibleWidget(0, "Heinz"); - widget->show(); - QVERIFY(QTest::qWaitForWindowExposed(widget)); - QAccessibleInterface *iface = QAccessible::queryAccessibleInterface(widget); + QtTestAccessibleWidget widget(nullptr, "Heinz"); + widget.show(); + QVERIFY(QTest::qWaitForWindowExposed(&widget)); + QAccessibleInterface *iface = QAccessible::queryAccessibleInterface(&widget); QVERIFY(iface != 0); QVERIFY(iface->isValid()); - QCOMPARE(iface->object(), (QObject*)widget); + QCOMPARE(iface->object(), (QObject*)&widget); QCOMPARE(iface->object()->objectName(), QString("Heinz")); - QCOMPARE(iface->rect().height(), widget->height()); + QCOMPARE(iface->rect().height(), widget.height()); // The help text is only set if our factory works QCOMPARE(iface->text(QAccessible::Help), QString("Help yourself")); - delete widget; } { // A subclass of any class should still get the right QAccessibleInterface - QtTestAccessibleWidgetSubclass* subclassedWidget = new QtTestAccessibleWidgetSubclass(0, "Hans"); - QAccessibleInterface *subIface = QAccessible::queryAccessibleInterface(subclassedWidget); + QtTestAccessibleWidgetSubclass subclassedWidget(nullptr, "Hans"); + QAccessibleInterface *subIface = QAccessible::queryAccessibleInterface(&subclassedWidget); QVERIFY(subIface != 0); QVERIFY(subIface->isValid()); - QCOMPARE(subIface->object(), (QObject*)subclassedWidget); + QCOMPARE(subIface->object(), (QObject*)&subclassedWidget); QCOMPARE(subIface->text(QAccessible::Help), QString("Help yourself")); - delete subclassedWidget; } QTestAccessibility::clearEvents(); } void tst_QAccessibility::deletedWidget() { - QtTestAccessibleWidget *widget = new QtTestAccessibleWidget(0, "Ralf"); + auto widgetHolder = std::make_unique<QtTestAccessibleWidget>(nullptr, "Ralf"); + auto widget = widgetHolder.get(); QAccessible::installFactory(QtTestAccessibleWidgetIface::ifaceFactory); QAccessibleInterface *iface = QAccessible::queryAccessibleInterface(widget); QVERIFY(iface != 0); QVERIFY(iface->isValid()); QCOMPARE(iface->object(), (QObject*)widget); - delete widget; - widget = 0; + widgetHolder.reset(); // fixme: QVERIFY(!iface->isValid()); } @@ -442,7 +477,8 @@ void tst_QAccessibility::statesStructTest() void tst_QAccessibility::sliderTest() { { - QSlider *slider = new QSlider(0); + auto sliderHolder = std::make_unique<QSlider>(nullptr); + auto slider = sliderHolder.get(); setFrameless(slider); slider->setObjectName(QString("Slidy")); slider->show(); @@ -468,8 +504,6 @@ void tst_QAccessibility::sliderTest() QCOMPARE(77, slider->value()); slider->setSingleStep(2); QCOMPARE(valueIface->minimumStepSize().toInt(), 2); - - delete slider; } QTestAccessibility::clearEvents(); } @@ -477,7 +511,8 @@ void tst_QAccessibility::sliderTest() void tst_QAccessibility::navigateHierarchy() { { - QWidget *w = new QWidget(0); + auto widgetHolder = std::make_unique<QWidget>(nullptr); + auto w = widgetHolder.get(); w->setObjectName(QString("Hans")); w->show(); QWidget *w1 = new QWidget(w); @@ -531,8 +566,6 @@ void tst_QAccessibility::navigateHierarchy() QVERIFY(parent != 0); QVERIFY(parent->isValid()); QCOMPARE(parent->object(), (QObject*)w3); - - delete w; } QTestAccessibility::clearEvents(); } @@ -588,7 +621,8 @@ static QWidget *createWidgets() void tst_QAccessibility::accessibleName() { - QWidget *toplevel = createWidgets(); + auto holder = std::unique_ptr<QWidget>(createWidgets()); + auto toplevel = holder.get(); toplevel->show(); QVERIFY(QTest::qWaitForWindowExposed(toplevel)); @@ -607,8 +641,6 @@ void tst_QAccessibility::accessibleName() child->setAccessibleDescription(desc); QCOMPARE(acc->text(QAccessible::Description), desc); } - - delete toplevel; QTestAccessibility::clearEvents(); } @@ -633,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"); @@ -669,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")); @@ -756,7 +788,7 @@ void tst_QAccessibility::textAttributes() QAccessibleInterface *interface = QAccessible::queryAccessibleInterface(&textEdit); QAccessibleTextInterface *textInterface=interface->textInterface(); QVERIFY(textInterface); - QCOMPARE(textInterface->characterCount(), textEdit.toPlainText().length()); + QCOMPARE(textInterface->characterCount(), textEdit.toPlainText().size()); int startOffset = -1; int endOffset = -1; @@ -774,7 +806,8 @@ void tst_QAccessibility::textAttributes() void tst_QAccessibility::hideShowTest() { - QWidget * const window = new QWidget(); + auto windowHolder = std::make_unique<QWidget>(); + QWidget * const window = windowHolder.get(); window->resize(200, 200); QWidget * const child = new QWidget(window); @@ -804,7 +837,7 @@ void tst_QAccessibility::hideShowTest() QVERIFY(QTestAccessibility::containsEvent(&hideChild)); QTestAccessibility::clearEvents(); - delete window; + windowHolder.reset(); QTestAccessibility::clearEvents(); } @@ -814,7 +847,8 @@ void tst_QAccessibility::actionTest() { QCOMPARE(QAccessibleActionInterface::pressAction(), QString(QStringLiteral("Press"))); - QWidget *widget = new QWidget; + auto widgetHolder = std::make_unique<QWidget>(); + auto widget = widgetHolder.get(); widget->setFocusPolicy(Qt::NoFocus); widget->show(); @@ -828,13 +862,12 @@ void tst_QAccessibility::actionTest() QCOMPARE(actions->actionNames(), QStringList()); widget->setFocusPolicy(Qt::StrongFocus); QCOMPARE(actions->actionNames(), QStringList(QAccessibleActionInterface::setFocusAction())); - - delete widget; } QTestAccessibility::clearEvents(); { - QPushButton *button = new QPushButton; + auto buttonHolder = std::make_unique<QPushButton>(); + auto button = buttonHolder.get(); setFrameless(button); button->show(); QVERIFY(QTest::qWaitForWindowExposed(button)); @@ -856,14 +889,15 @@ void tst_QAccessibility::actionTest() actions->doAction(QAccessibleActionInterface::pressAction()); QTest::qWait(500); QCOMPARE(click_count, 1); - - delete button; } QTestAccessibility::clearEvents(); } void tst_QAccessibility::applicationTest() { + if (!QGuiApplicationPrivate::platformIntegration()->hasCapability(QPlatformIntegration::WindowActivation)) + QSKIP("Platform does not support window activation"); + { QLatin1String name = QLatin1String("My Name"); qApp->setApplicationName(name); @@ -887,7 +921,7 @@ void tst_QAccessibility::applicationTest() QWidget widget; widget.show(); - qApp->setActiveWindow(&widget); + QApplicationPrivate::setActiveWindow(&widget); QVERIFY(QTest::qWaitForWindowActive(&widget)); QAccessibleInterface *widgetIface = QAccessible::queryAccessibleInterface(&widget); @@ -906,11 +940,15 @@ void tst_QAccessibility::applicationTest() void tst_QAccessibility::mainWindowTest() { + if (!QGuiApplicationPrivate::platformIntegration()->hasCapability(QPlatformIntegration::WindowActivation)) + QSKIP("Platform does not support window activation"); + { - QMainWindow *mw = new QMainWindow; + auto mwHolder = std::make_unique<QMainWindow>(); + auto mw = mwHolder.get(); mw->resize(300, 200); mw->show(); // triggers layout - qApp->setActiveWindow(mw); + QApplicationPrivate::setActiveWindow(mw); QLatin1String name = QLatin1String("I am the main window"); mw->setWindowTitle(name); @@ -929,8 +967,12 @@ void tst_QAccessibility::mainWindowTest() QCOMPARE(iface->role(), QAccessible::Window); QVERIFY(iface->state().active); - - delete mw; + 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(); @@ -1084,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); @@ -1096,13 +1141,13 @@ void tst_QAccessibility::buttonTest() { // test menu push button - QAction *foo = new QAction("Foo", 0); + QAction *foo = new QAction("Foo", nullptr); foo->setShortcut(QKeySequence("Ctrl+F")); - QMenu *menu = new QMenu(); + auto menu = std::make_unique<QMenu>(); menu->addAction(foo); QPushButton menuButton; setFrameless(&menuButton); - menuButton.setMenu(menu); + menuButton.setMenu(menu.get()); menuButton.show(); QAccessibleInterface *interface = QAccessible::queryAccessibleInterface(&menuButton); QCOMPARE(interface->role(), QAccessible::ButtonMenu); @@ -1111,7 +1156,6 @@ void tst_QAccessibility::buttonTest() // showing the menu enters a new event loop... // interface->actionInterface()->doAction(QAccessibleActionInterface::showMenuAction()); // QTest::qWait(500); - delete menu; } @@ -1121,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; @@ -1209,8 +1259,10 @@ void tst_QAccessibility::buttonTest() void tst_QAccessibility::scrollBarTest() { - QScrollBar *scrollBar = new QScrollBar(Qt::Horizontal); - QAccessibleInterface * const scrollBarInterface = QAccessible::queryAccessibleInterface(scrollBar); + auto scrollBarHolder = std::make_unique<QScrollBar>(Qt::Horizontal); + auto scrollBar = scrollBarHolder.get(); + QAccessibleInterface * const scrollBarInterface = + QAccessible::queryAccessibleInterface(scrollBar); QVERIFY(scrollBarInterface); QVERIFY(scrollBarInterface->state().invisible); scrollBar->resize(200, 50); @@ -1247,14 +1299,13 @@ void tst_QAccessibility::scrollBarTest() const QRect scrollBarRect = scrollBarInterface->rect(); QVERIFY(scrollBarRect.isValid()); - delete scrollBar; - QTestAccessibility::clearEvents(); } void tst_QAccessibility::tabTest() { - QTabBar *tabBar = new QTabBar(); + auto tabBarHolder = std::make_unique<QTabBar>(); + auto tabBar = tabBarHolder.get(); setFrameless(tabBar); tabBar->show(); @@ -1318,13 +1369,13 @@ void tst_QAccessibility::tabTest() tabBar->setCurrentIndex(1); QCOMPARE(interface->text(QAccessible::Name), QLatin1String("AccBar")); - delete tabBar; QTestAccessibility::clearEvents(); } void tst_QAccessibility::tabWidgetTest() { - QTabWidget *tabWidget = new QTabWidget(); + auto tabWidgetHolder = std::make_unique<QTabWidget>(); + auto tabWidget = tabWidgetHolder.get(); tabWidget->show(); // the interface for the tab is just a container for tabbar and stacked widget @@ -1383,9 +1434,7 @@ void tst_QAccessibility::tabWidgetTest() QAccessibleInterface* stackChild1Interface = stackWidgetInterface->child(0); QVERIFY(stackChild1Interface); -#ifndef Q_CC_INTEL QCOMPARE(stackChild1Interface->childCount(), 0); -#endif QCOMPARE(stackChild1Interface->role(), QAccessible::StaticText); QCOMPARE(stackChild1Interface->text(QAccessible::Name), QLatin1String("Page 1")); QCOMPARE(label1, stackChild1Interface->object()); @@ -1393,9 +1442,7 @@ void tst_QAccessibility::tabWidgetTest() // Navigation in stack widgets should be consistent QAccessibleInterface* parent = stackChild1Interface->parent(); QVERIFY(parent); -#ifndef Q_CC_INTEL QCOMPARE(parent->childCount(), 2); -#endif QCOMPARE(parent->role(), QAccessible::LayeredPane); QAccessibleInterface* stackChild2Interface = stackWidgetInterface->child(1); @@ -1407,12 +1454,9 @@ void tst_QAccessibility::tabWidgetTest() parent = stackChild2Interface->parent(); QVERIFY(parent); -#ifndef Q_CC_INTEL QCOMPARE(parent->childCount(), 2); -#endif QCOMPARE(parent->role(), QAccessible::LayeredPane); - delete tabWidget; QTestAccessibility::clearEvents(); } @@ -1612,17 +1656,17 @@ void tst_QAccessibility::menuTest() mw.hide(); // Do not crash if the menu don't have a parent - QMenu *menu = new QMenu; + auto menu = std::make_unique<QMenu>(); menu->addAction(QLatin1String("one")); menu->addAction(QLatin1String("two")); menu->addAction(QLatin1String("three")); - iface = QAccessible::queryAccessibleInterface(menu); + iface = QAccessible::queryAccessibleInterface(menu.get()); iface2 = iface->parent(); QVERIFY(iface2); QCOMPARE(iface2->role(), QAccessible::Application); // caused a *crash* iface2->state(); - delete menu; + menu.reset(); } QTestAccessibility::clearEvents(); @@ -1632,7 +1676,8 @@ void tst_QAccessibility::menuTest() void tst_QAccessibility::spinBoxTest() { - QSpinBox * const spinBox = new QSpinBox(); + auto spinBoxHolder = std::make_unique<QSpinBox>(); + const auto spinBox = spinBoxHolder.get(); setFrameless(spinBox); spinBox->setValue(3); spinBox->show(); @@ -1669,13 +1714,13 @@ void tst_QAccessibility::spinBoxTest() QAccessibleTextInterface *textIface = interface->textInterface(); QVERIFY(textIface); - delete spinBox; QTestAccessibility::clearEvents(); } void tst_QAccessibility::doubleSpinBoxTest() { - QDoubleSpinBox *doubleSpinBox = new QDoubleSpinBox; + auto holder = std::make_unique<QDoubleSpinBox>(); + auto doubleSpinBox = holder.get(); setFrameless(doubleSpinBox); doubleSpinBox->show(); @@ -1696,7 +1741,6 @@ void tst_QAccessibility::doubleSpinBoxTest() QVERIFY(childRect.isValid()); } - delete doubleSpinBox; QTestAccessibility::clearEvents(); } @@ -1757,7 +1801,7 @@ void tst_QAccessibility::textEditTest() QString text = "<p>hello world.<br/>How are you today?</p><p>I'm fine, thanks</p>"; edit.setHtml(text); if (pass == 1) { - QFont font("Helvetica"); + QFont font(QStringList{"Helvetica"}); font.setPointSizeF(12.5); font.setWordSpacing(1.1); edit.document()->setDefaultFont(font); @@ -1922,7 +1966,7 @@ void tst_QAccessibility::mdiAreaTest() mdiArea.addSubWindow(new QWidget, Qt::Dialog)->show(); QList<QMdiSubWindow *> subWindows = mdiArea.subWindowList(); - QCOMPARE(subWindows.count(), subWindowCount); + QCOMPARE(subWindows.size(), subWindowCount); QAccessibleInterface *interface = QAccessible::queryAccessibleInterface(&mdiArea); QVERIFY(interface); @@ -1937,7 +1981,7 @@ void tst_QAccessibility::mdiSubWindowTest() { QMdiArea mdiArea; mdiArea.show(); - qApp->setActiveWindow(&mdiArea); + QApplicationPrivate::setActiveWindow(&mdiArea); QVERIFY(QTest::qWaitForWindowActive(&mdiArea)); @@ -1960,7 +2004,7 @@ void tst_QAccessibility::mdiSubWindowTest() } QList<QMdiSubWindow *> subWindows = mdiArea.subWindowList(); - QCOMPARE(subWindows.count(), subWindowCount); + QCOMPARE(subWindows.size(), subWindowCount); QMdiSubWindow *testWindow = subWindows.at(3); QVERIFY(testWindow); @@ -1979,6 +2023,10 @@ void tst_QAccessibility::mdiSubWindowTest() mdiArea.setActiveSubWindow(testWindow); +#ifdef Q_OS_ANDROID // on Android QMdiSubWindow is maximized by default + testWindow->showNormal(); +#endif + // state QAccessible::State state; state.focusable = true; @@ -2001,7 +2049,7 @@ void tst_QAccessibility::mdiSubWindowTest() testWindow->setEnabled(false); QVERIFY(interface->state().disabled); testWindow->setEnabled(true); - qApp->setActiveWindow(&mdiArea); + QApplicationPrivate::setActiveWindow(&mdiArea); mdiArea.setActiveSubWindow(testWindow); testWindow->setFocus(); QVERIFY(testWindow->isAncestorOf(qApp->focusWidget())); @@ -2043,10 +2091,11 @@ void tst_QAccessibility::mdiSubWindowTest() void tst_QAccessibility::lineEditTest() { - QWidget *toplevel = new QWidget; + auto topLevelHolder = std::make_unique<QWidget>(); + auto toplevel = topLevelHolder.get(); { - QLineEdit *le = new QLineEdit; - QAccessibleInterface *iface(QAccessible::queryAccessibleInterface(le)); + auto le = std::make_unique<QLineEdit>(); + QAccessibleInterface *iface(QAccessible::queryAccessibleInterface(le.get())); QVERIFY(iface); le->show(); @@ -2079,10 +2128,10 @@ void tst_QAccessibility::lineEditTest() QCOMPARE(iface->text(QAccessible::Value), QString()); le->setEchoMode(QLineEdit::Password); QVERIFY(iface->state().passwordEdit); - QCOMPARE(iface->text(QAccessible::Value), QString(secret.length(), QLatin1Char('*'))); + QCOMPARE(iface->text(QAccessible::Value), QString(secret.size(), QLatin1Char('*'))); le->setEchoMode(QLineEdit::PasswordEchoOnEdit); QVERIFY(iface->state().passwordEdit); - QCOMPARE(iface->text(QAccessible::Value), QString(secret.length(), QLatin1Char('*'))); + QCOMPARE(iface->text(QAccessible::Value), QString(secret.size(), QLatin1Char('*'))); le->setEchoMode(QLineEdit::Normal); QVERIFY(!(iface->state().passwordEdit)); QCOMPARE(iface->text(QAccessible::Value), secret); @@ -2115,7 +2164,7 @@ void tst_QAccessibility::lineEditTest() iface->setText(QAccessible::Value, QLatin1String("This text is not a number")); QCOMPARE(le->text(), QLatin1String("500")); - delete le; + le.reset(); delete le2; } @@ -2174,7 +2223,7 @@ void tst_QAccessibility::lineEditTest() QCOMPARE(textIface->textAtOffset(5, QAccessible::ParagraphBoundary,&start,&end), cite); QCOMPARE(start, 0); - QCOMPARE(end, cite.length()); + QCOMPARE(end, cite.size()); QCOMPARE(textIface->textAtOffset(5, QAccessible::LineBoundary,&start,&end), cite); QCOMPARE(textIface->textAtOffset(5, QAccessible::NoBoundary,&start,&end), cite); @@ -2218,8 +2267,8 @@ void tst_QAccessibility::lineEditTest() QVERIFY_EVENT(&sel); lineEdit->selectAll(); - sel.setSelection(0, lineEdit->text().length()); - sel.setCursorPosition(lineEdit->text().length()); + sel.setSelection(0, lineEdit->text().size()); + sel.setCursorPosition(lineEdit->text().size()); QVERIFY_EVENT(&sel); lineEdit->setSelection(10, -4); @@ -2292,7 +2341,6 @@ void tst_QAccessibility::lineEditTest() QAccessibleTextInsertEvent insertO(lineEdit, 4, "O"); QVERIFY(QTestAccessibility::containsEvent(&insertO)); } - delete toplevel; QTestAccessibility::clearEvents(); } @@ -2443,11 +2491,11 @@ void tst_QAccessibility::textInterfaceTest() QFETCH(QString, expectedText); QAccessible::installFactory(CustomTextWidgetIface::ifaceFactory); - CustomTextWidget *w = new CustomTextWidget(); + auto w = std::make_unique<CustomTextWidget>(); w->text = text; w->cursorPosition = cursorPosition; - QAccessibleInterface *iface = QAccessible::queryAccessibleInterface(w); + QAccessibleInterface *iface = QAccessible::queryAccessibleInterface(w.get()); QVERIFY(iface); QCOMPARE(iface->text(QAccessible::Value), text); QAccessibleTextInterface *textIface = iface->textInterface(); @@ -2472,7 +2520,6 @@ void tst_QAccessibility::textInterfaceTest() QCOMPARE(start, expectedStart); QCOMPARE(end, expectedEnd); - delete w; QAccessible::removeFactory(CustomTextWidgetIface::ifaceFactory); QTestAccessibility::clearEvents(); } @@ -2480,7 +2527,8 @@ void tst_QAccessibility::textInterfaceTest() void tst_QAccessibility::groupBoxTest() { { - QGroupBox *groupBox = new QGroupBox(); + auto gbHolder = std::make_unique<QGroupBox>(); + auto groupBox = gbHolder.get(); QAccessibleInterface *iface = QAccessible::queryAccessibleInterface(groupBox); groupBox->setTitle(QLatin1String("Test QGroupBox")); @@ -2505,12 +2553,11 @@ void tst_QAccessibility::groupBoxTest() QPair<QAccessibleInterface*, QAccessible::Relation> relation = relations.first(); QCOMPARE(relation.first->object(), groupBox); QCOMPARE(relation.second, QAccessible::Label); - - delete groupBox; } { - QGroupBox *groupBox = new QGroupBox(); + auto gbHolder = std::make_unique<QGroupBox>(); + auto groupBox = gbHolder.get(); QAccessibleInterface *iface = QAccessible::queryAccessibleInterface(groupBox); QVERIFY(!iface->state().checkable); groupBox->setCheckable(true); @@ -2534,8 +2581,6 @@ void tst_QAccessibility::groupBoxTest() QVERIFY(state.checked); QAccessibleStateChangeEvent ev2(groupBox, st); QVERIFY_EVENT(&ev2); - - delete groupBox; } } @@ -2579,7 +2624,7 @@ void tst_QAccessibility::dialogButtonBoxTest() std::sort(buttons.begin(), buttons.end(), accessibleInterfaceLeftOf); - for (int i = 0; i < buttons.count(); ++i) + for (int i = 0; i < buttons.size(); ++i) actualOrder << buttons.at(i)->text(QAccessible::Name); QStringList expectedOrder; @@ -2631,7 +2676,7 @@ void tst_QAccessibility::dialogButtonBoxTest() std::sort(buttons.begin(), buttons.end(), accessibleInterfaceAbove); - for (int i = 0; i < buttons.count(); ++i) + for (int i = 0; i < buttons.size(); ++i) actualOrder << buttons.at(i)->text(QAccessible::Name); QStringList expectedOrder; @@ -2807,7 +2852,8 @@ void tst_QAccessibility::scrollAreaTest() void tst_QAccessibility::listTest() { { - QListWidget *listView = new QListWidget; + auto lvHolder = std::make_unique<QListWidget>(); + auto listView = lvHolder.get(); listView->addItem("Oslo"); listView->addItem("Berlin"); listView->addItem("Brisbane"); @@ -2840,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 @@ -2891,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); @@ -2923,19 +2976,17 @@ void tst_QAccessibility::listTest() // list: Oslo, Helsinki // verify that it doesn't return an invalid item from the cache QVERIFY(table2->cellAt(2,0) == 0); - - delete listView; } QTestAccessibility::clearEvents(); } void tst_QAccessibility::treeTest() { - QTreeWidget *treeView = new QTreeWidget; + auto treeView = std::make_unique<QTreeWidget>(); // Empty model (do not crash, etc) treeView->setColumnCount(0); - QAccessibleInterface *iface = QAccessible::queryAccessibleInterface(treeView); + QAccessibleInterface *iface = QAccessible::queryAccessibleInterface(treeView.get()); QCOMPARE(iface->child(0), static_cast<QAccessibleInterface*>(0)); treeView->setColumnCount(2); @@ -3068,7 +3119,6 @@ void tst_QAccessibility::treeTest() QCOMPARE(table2->columnDescription(0), QString("Artist")); QCOMPARE(table2->columnDescription(1), QString("Work")); - delete treeView; QTestAccessibility::clearEvents(); } @@ -3079,7 +3129,8 @@ void tst_QAccessibility::treeTest() // v3 (12) | 0.2 (13) | 1.2 (14) | 2.2 (15) void tst_QAccessibility::tableTest() { - QTableWidget *tableView = new QTableWidget(3, 3); + auto tvHolder = std::make_unique<QTableWidget>(3, 3); + auto tableView = tvHolder.get(); tableView->setColumnCount(3); QStringList hHeader; hHeader << "h1" << "h2" << "h3"; @@ -3359,11 +3410,75 @@ void tst_QAccessibility::tableTest() tableView->horizontalHeader()->setVisible(false); } - delete tableView; + tvHolder.reset(); QVERIFY(!QAccessible::accessibleInterface(id00)); 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 + // that has just been created is removed from the cache and deleted before the next + // accessible interface is registered. + // For example for AT-SPI, that would result in the same object path being used, and thus + // data from the old and new interface can get confused due to caching. + QWidget widget1; + QAccessibleInterface *iface1 = QAccessible::queryAccessibleInterface(&widget1); + QAccessible::Id id1 = QAccessible::uniqueId(iface1); + QAccessible::deleteAccessibleInterface(id1); + + QWidget widget2; + QAccessibleInterface *iface2 = QAccessible::queryAccessibleInterface(&widget2); + QAccessible::Id id2 = QAccessible::uniqueId(iface2); + + QVERIFY(id1 != id2); +} + void tst_QAccessibility::calendarWidgetTest() { #if QT_CONFIG(calendarwidget) @@ -3391,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; @@ -3401,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; @@ -3449,7 +3564,8 @@ void tst_QAccessibility::dockWidgetTest() { #if QT_CONFIG(dockwidget) // Set up a proper main window with two dock widgets - QMainWindow *mw = new QMainWindow(); + auto mwHolder = std::make_unique<QMainWindow>(); + auto mw = mwHolder.get(); QFrame *central = new QFrame(mw); mw->setCentralWidget(central); QMenuBar *mb = new QMenuBar(mw); @@ -3578,7 +3694,6 @@ void tst_QAccessibility::dockWidgetTest() QAccessibleInterface *dock3Widget = accDock3->child(0); QCOMPARE(dock3Widget->text(QAccessible::Name), pb3->text()); - delete mw; QTestAccessibility::clearEvents(); #endif // QT_CONFIG(dockwidget) } @@ -3603,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")); @@ -3613,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()); @@ -3643,11 +3766,75 @@ 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() { - QWidget *window = new QWidget; + auto windowHolder = std::make_unique<QWidget>(); + auto window = windowHolder.get(); QString text = "Hello World"; QLabel *label = new QLabel(text, window); setFrameless(label); @@ -3664,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); @@ -3673,15 +3862,25 @@ 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.count(), 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); + } - delete window; + windowHolder.reset(); QTestAccessibility::clearEvents(); QPixmap testPixmap(50, 50); @@ -3707,7 +3906,8 @@ void tst_QAccessibility::labelTest() void tst_QAccessibility::accelerators() { - QWidget *window = new QWidget; + auto windowHolder = std::make_unique<QWidget>(); + auto window = windowHolder.get(); QHBoxLayout *lay = new QHBoxLayout(window); QLabel *label = new QLabel(tr("&Line edit"), window); QLineEdit *le = new QLineEdit(window); @@ -3741,7 +3941,7 @@ void tst_QAccessibility::accelerators() QCoreApplication::processEvents(); #endif QTest::qWait(100); - delete window; + windowHolder.reset(); QTestAccessibility::clearEvents(); } @@ -3774,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); @@ -3822,14 +4023,14 @@ void tst_QAccessibility::bridgeTest() POINT pt{nativePos.x(), nativePos.y()}; // Initialize COM stuff. - HRESULT hr = CoInitialize(nullptr); - QVERIFY(SUCCEEDED(hr)); + QComHelper comHelper; + QVERIFY(comHelper.isValid()); // Get UI Automation interface. const GUID CLSID_CUIAutomation_test{0xff48dba4, 0x60ef, 0x4201, {0xaa,0x87, 0x54,0x10,0x3e,0xef,0x59,0x4e}}; IUIAutomation *automation = nullptr; - hr = CoCreateInstance(CLSID_CUIAutomation_test, nullptr, CLSCTX_INPROC_SERVER, IID_PPV_ARGS(&automation)); + HRESULT hr = CoCreateInstance(CLSID_CUIAutomation_test, nullptr, CLSCTX_INPROC_SERVER, IID_PPV_ARGS(&automation)); QVERIFY(SUCCEEDED(hr)); // Get button element from UI Automation using point. @@ -3847,7 +4048,12 @@ void tst_QAccessibility::bridgeTest() RECT rect; hr = buttonElement->get_CurrentBoundingRectangle(&rect); QVERIFY(SUCCEEDED(hr)); - QCOMPARE(buttonRect, QRect(rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top)); + const QRect boundingRect(rect.left, rect.top, rect.right - rect.left + 1, rect.bottom - rect.top + 1); + const QRectF nativeRect = QHighDpi::toNativePixels(QRectF(buttonRect), window.windowHandle()); + const QRect truncRect(int(nativeRect.left()), int(nativeRect.top()), + int(nativeRect.right()) - int(nativeRect.left()) + 1, + int(nativeRect.bottom()) - int(nativeRect.top()) + 1); + QCOMPARE(truncRect, boundingRect); buttonElement->Release(); @@ -3906,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)); @@ -3927,9 +4228,6 @@ void tst_QAccessibility::bridgeTest() controlWalker->Release(); windowElement->Release(); automation->Release(); - CoUninitialize(); - - QTestAccessibility::clearEvents(); #endif } @@ -4020,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"); @@ -4053,9 +4354,6 @@ void tst_QAccessibility::focusChild() QCOMPARE(iface2->focusChild(), iface2); QCOMPARE(QAccessible::queryAccessibleInterface(&mainWindow)->focusChild(), iface2); - delete widget1; - delete widget2; - delete centralWidget; QTestAccessibility::clearEvents(); } @@ -4072,7 +4370,6 @@ void tst_QAccessibility::focusChild() widget->setFocus(); QCOMPARE(iface->focusChild(), QAccessible::queryAccessibleInterface(widget)->child(1)); - delete widget; QAccessible::removeFactory(FocusChildTestAccessibleWidget::ifaceFactory); QTestAccessibility::clearEvents(); } @@ -4095,11 +4392,256 @@ void tst_QAccessibility::focusChild() QCOMPARE(iface->focusChild()->text(QAccessible::Name), QStringLiteral("Second tab")); QCOMPARE(iface->focusChild()->role(), QAccessible::PageTab); - delete tabBar; QTestAccessibility::clearEvents(); } + + { + auto tableView = std::make_unique<QTableWidget>(3, 3); + + QSignalSpy spy(tableView.get(), SIGNAL(currentCellChanged(int,int,int,int))); + + tableView->setColumnCount(3); + QStringList hHeader; + hHeader << "h1" << "h2" << "h3"; + tableView->setHorizontalHeaderLabels(hHeader); + + QStringList vHeader; + vHeader << "v1" << "v2" << "v3"; + tableView->setVerticalHeaderLabels(vHeader); + + for (int i = 0; i < 9; ++i) { + QTableWidgetItem *item = new QTableWidgetItem; + item->setText(QString::number(i/3) + QString(".") + QString::number(i%3)); + tableView->setItem(i/3, i%3, item); + } + + tableView->resize(600, 600); + tableView->show(); + QVERIFY(QTest::qWaitForWindowExposed(tableView.get())); + + tableView->setFocus(); + + QAccessibleInterface *iface = QAccessible::queryAccessibleInterface(tableView.get()); + QVERIFY(iface); + + spy.clear(); + tableView->setCurrentCell(2, 1); + QTRY_COMPARE(spy.size(), 1); + + QAccessibleInterface *child = iface->focusChild(); + QVERIFY(child); + QCOMPARE(child->text(QAccessible::Name), QStringLiteral("2.1")); + + spy.clear(); + tableView->setCurrentCell(1, 2); + QTRY_COMPARE(spy.size(), 1); + + child = iface->focusChild(); + QVERIFY(child); + QCOMPARE(child->text(QAccessible::Name), QStringLiteral("1.2")); + } + + { + auto treeView = std::make_unique<QTreeWidget>(); + + QSignalSpy spy(treeView.get(), SIGNAL(currentItemChanged(QTreeWidgetItem*,QTreeWidgetItem*))); + + treeView->setColumnCount(2); + QTreeWidgetItem *header = new QTreeWidgetItem; + header->setText(0, "Artist"); + header->setText(1, "Work"); + treeView->setHeaderItem(header); + + QTreeWidgetItem *root1 = new QTreeWidgetItem; + root1->setText(0, "Spain"); + treeView->addTopLevelItem(root1); + + QTreeWidgetItem *item1 = new QTreeWidgetItem; + item1->setText(0, "Picasso"); + item1->setText(1, "Guernica"); + root1->addChild(item1); + + QTreeWidgetItem *item2 = new QTreeWidgetItem; + item2->setText(0, "Tapies"); + item2->setText(1, "Ambrosia"); + root1->addChild(item2); + + QTreeWidgetItem *root2 = new QTreeWidgetItem; + root2->setText(0, "Austria"); + treeView->addTopLevelItem(root2); + + QTreeWidgetItem *item3 = new QTreeWidgetItem; + item3->setText(0, "Klimt"); + item3->setText(1, "The Kiss"); + root2->addChild(item3); + + treeView->resize(400, 400); + treeView->show(); + QVERIFY(QTest::qWaitForWindowExposed(treeView.get())); + + treeView->setFocus(); + + QAccessibleInterface *iface = QAccessible::queryAccessibleInterface(treeView.get()); + QVERIFY(iface); + + spy.clear(); + treeView->setCurrentItem(item2); + QTRY_COMPARE(spy.size(), 1); + + QAccessibleInterface *child = iface->focusChild(); + QVERIFY(child); + QCOMPARE(child->text(QAccessible::Name), QStringLiteral("Tapies")); + + spy.clear(); + treeView->setCurrentItem(item3); + QTRY_COMPARE(spy.size(), 1); + + child = iface->focusChild(); + QVERIFY(child); + QCOMPARE(child->text(QAccessible::Name), QStringLiteral("Klimt")); + } + { + QWidget window; + // takes the initial focus + QLineEdit lineEdit; + QComboBox comboBox; + comboBox.addItems({"One", "Two", "Three"}); + QComboBox editableComboBox; + editableComboBox.setEditable(true); + editableComboBox.addItems({"A", "B", "C"}); + QVBoxLayout vbox; + vbox.addWidget(&lineEdit); + vbox.addWidget(&comboBox); + vbox.addWidget(&editableComboBox); + window.setLayout(&vbox); + + window.show(); + QVERIFY(QTest::qWaitForWindowExposed(&window)); + QTestAccessibility::clearEvents(); + QAccessibleInterface *iface = nullptr; + + comboBox.setFocus(); + { + QAccessibleEvent focusEvent(&comboBox, QAccessible::Focus); + QVERIFY(QTestAccessibility::containsEvent(&focusEvent)); + } + iface = QAccessible::queryAccessibleInterface(&comboBox); + QVERIFY(iface); + QCOMPARE(iface->focusChild(), nullptr); + + editableComboBox.setFocus(); + // Qt updates about the editable combobox, not the lineedit, as the + // combobox is the lineedit's focus proxy. + { + QAccessibleEvent focusEvent(&editableComboBox, QAccessible::Focus); + QVERIFY(QTestAccessibility::containsEvent(&focusEvent)); + } + iface = QAccessible::queryAccessibleInterface(&editableComboBox); + QVERIFY(iface); + QVERIFY(iface->focusChild()); + QCOMPARE(iface->focusChild()->role(), QAccessible::EditableText); + } +} + +void tst_QAccessibility::messageBoxTest_data() +{ + QTest::addColumn<QMessageBox::Icon>("icon"); + QTest::addColumn<QMessageBox::StandardButtons>("buttons"); + QTest::addColumn<QString>("title"); + QTest::addColumn<QString>("text"); + QTest::addColumn<QString>("infoText"); + QTest::addColumn<QString>("details"); + QTest::addColumn<bool>("checkbox"); + QTest::addColumn<bool>("textInteractive"); + + QTest::addRow("Information") << QMessageBox::Information + << QMessageBox::StandardButtons(QMessageBox::Ok) + << "Information" + << "Here, have some information." + << QString() + << QString() + << false + << false; + + QTest::addRow("Warning") << QMessageBox::Warning + << QMessageBox::StandardButtons(QMessageBox::Ok | QMessageBox::Cancel) + << "Warning" + << "This is a dangerous operation!" + << "Ok or Cancel?" + << QString() + << true + << false; + + QTest::addRow("Error") << QMessageBox::Critical + << QMessageBox::StandardButtons(QMessageBox::Abort | QMessageBox::Retry | QMessageBox::Ignore) + << "Error" + << "Operation failed for http://example.com" + << "You have to decide what to do" + << "Detailed log output" + << false + << true; } +void tst_QAccessibility::messageBoxTest() +{ + QFETCH(QMessageBox::Icon, icon); + QFETCH(QMessageBox::StandardButtons, buttons); + QFETCH(QString, title); + QFETCH(QString, text); + QFETCH(QString, infoText); + QFETCH(QString, details); + QFETCH(bool, checkbox); + QFETCH(bool, textInteractive); + + QMessageBox box(icon, title, text, buttons); + + QAccessibleInterface *iface = QAccessible::queryAccessibleInterface(&box); + QVERIFY(iface); + QCOMPARE(iface->role(), QAccessible::AlertMessage); +#ifndef Q_OS_DARWIN // macOS message boxes show no title + QCOMPARE(iface->text(QAccessible::Name), title); +#endif + QCOMPARE(iface->text(QAccessible::Value), text); + + int expectedChildCount = 3; + QCOMPARE(iface->childCount(), expectedChildCount); + + if (textInteractive) + box.setTextInteractionFlags(Qt::TextBrowserInteraction); + + if (!infoText.isEmpty()) { + box.setInformativeText(infoText); + QCOMPARE(iface->childCount(), ++expectedChildCount); + } + QCOMPARE(iface->text(QAccessible::Help), infoText); + + if (!details.isEmpty()) { + box.setDetailedText(details); + QCOMPARE(iface->childCount(), ++expectedChildCount); + } + if (checkbox) { + box.setCheckBox(new QCheckBox("Don't show again")); + QCOMPARE(iface->childCount(), ++expectedChildCount); + } + + QTestAccessibility::clearEvents(); + + QDialogPrivate *boxPrivate = static_cast<QDialogPrivate *>(QDialogPrivate::get(&box)); + if (!boxPrivate->canBeNativeDialog()) { + // platforms that use a native message box will not emit accessibility events + box.show(); + + QAccessibleEvent showEvent(&box, QAccessible::DialogStart); + QVERIFY(QTestAccessibility::containsEvent(&showEvent)); + + box.hide(); + + QAccessibleEvent hideEvent(&box, QAccessible::DialogEnd); + QVERIFY(QTestAccessibility::containsEvent(&hideEvent)); + } + + QTestAccessibility::clearEvents(); +} QTEST_MAIN(tst_QAccessibility) #include "tst_qaccessibility.moc" diff --git a/tests/auto/other/qaccessibilitylinux/CMakeLists.txt b/tests/auto/other/qaccessibilitylinux/CMakeLists.txt index ba6443d364..5c85827a3b 100644 --- a/tests/auto/other/qaccessibilitylinux/CMakeLists.txt +++ b/tests/auto/other/qaccessibilitylinux/CMakeLists.txt @@ -1,10 +1,16 @@ -# Generated from qaccessibilitylinux.pro. -# special case begin +# 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() endif() -# special case end ##################################################################### ## tst_qaccessibilitylinux Test: @@ -15,7 +21,7 @@ qt_internal_add_test(tst_qaccessibilitylinux tst_qaccessibilitylinux.cpp DBUS_INTERFACE_SOURCES ../../../../src/platformsupport/linuxaccessibility/dbusxml/Bus.xml - PUBLIC_LIBRARIES + LIBRARIES Qt::DBus Qt::Gui Qt::GuiPrivate @@ -23,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 f776e87692..18bcdeca29 100644 --- a/tests/auto/other/qaccessibilitylinux/tst_qaccessibilitylinux.cpp +++ b/tests/auto/other/qaccessibilitylinux/tst_qaccessibilitylinux.cpp @@ -1,30 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #include <QTest> #include <QtGui> @@ -80,7 +55,7 @@ class tst_QAccessibilityLinux : public QObject public: tst_QAccessibilityLinux() : m_window(0), root(0), rootApplication(0), mainWindow(0) { - qputenv("QT_LINUX_ACCESSIBILITY_ALWAYS_ON", QByteArrayLiteral("1")); + qputenv("QT_LINUX_ACCESSIBILITY_ALWAYS_ON", "1"); dbus = new DBusConnection(); } ~tst_QAccessibilityLinux() @@ -128,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; @@ -179,6 +154,7 @@ void tst_QAccessibilityLinux::initTestCase() QVERIFY(!address.isEmpty()); m_window = new AccessibleTestWindow(); + m_window->setObjectName("mainWindow"_L1); m_window->show(); QVERIFY(QTest::qWaitForWindowExposed(m_window)); @@ -236,8 +212,11 @@ bool hasState(QDBusInterface *interface, AtspiStateType state) void tst_QAccessibilityLinux::testLabel() { QLabel *l = new QLabel(m_window); + l->setObjectName("theObjectName"_L1); l->setText("Hello A11y"); m_window->addWidget(l); + auto a11yEmpty = new QLabel(m_window); + m_window->addWidget(l); // Application QCOMPARE(getParent(mainWindow), QLatin1String(ATSPI_DBUS_PATH_ROOT)); @@ -249,6 +228,8 @@ void tst_QAccessibilityLinux::testLabel() QCOMPARE(getChildren(labelInterface).count(), 0); QCOMPARE(labelInterface->call(QDBus::Block, "GetRoleName").arguments().first().toString(), QLatin1String("label")); QCOMPARE(labelInterface->call(QDBus::Block, "GetRole").arguments().first().toUInt(), 29u); + QCOMPARE(labelInterface->call(QDBus::Block, "GetAccessibleId").arguments().first().toString(), + "mainWindow.theObjectName"_L1); QCOMPARE(getParent(labelInterface), mainWindow->path()); QVERIFY(!hasState(labelInterface, ATSPI_STATE_EDITABLE)); QVERIFY(hasState(labelInterface, ATSPI_STATE_READ_ONLY)); @@ -256,7 +237,12 @@ void tst_QAccessibilityLinux::testLabel() l->setText("New text"); QCOMPARE(labelInterface->property("Name").toString(), l->text()); + auto *a11yEmptyInterface = getInterface(children.at(1), "org.a11y.atspi.Accessible"); + QCOMPARE(a11yEmptyInterface->call(QDBus::Block, "GetAccessibleId").arguments().first().toString(), + "mainWindow.QLabel"_L1); + m_window->clearChildren(); + delete a11yEmptyInterface; delete labelInterface; } diff --git a/tests/auto/other/qaccessibilitymac/CMakeLists.txt b/tests/auto/other/qaccessibilitymac/CMakeLists.txt index 6dd30a6fa1..66896ed384 100644 --- a/tests/auto/other/qaccessibilitymac/CMakeLists.txt +++ b/tests/auto/other/qaccessibilitymac/CMakeLists.txt @@ -1,32 +1,22 @@ -# Generated from qaccessibilitymac.pro. +# 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() -##################################################################### -## tst_qaccessibilitymac Test: -##################################################################### - qt_internal_add_test(tst_qaccessibilitymac SOURCES - tst_qaccessibilitymac.cpp - tst_qaccessibilitymac_helpers.h - PUBLIC_LIBRARIES + tst_qaccessibilitymac.mm + LIBRARIES Qt::Gui Qt::Widgets -) - -#### Keys ignored in scope 1:.:.:qaccessibilitymac.pro:<TRUE>: -# _REQUIREMENTS = "mac" - -## Scopes: -##################################################################### - -qt_internal_extend_target(tst_qaccessibilitymac CONDITION APPLE - SOURCES - tst_qaccessibilitymac_helpers.mm - PUBLIC_LIBRARIES ${FWAppKit} ${FWApplicationServices} ${FWSecurity} diff --git a/tests/auto/other/qaccessibilitymac/tst_qaccessibilitymac.cpp b/tests/auto/other/qaccessibilitymac/tst_qaccessibilitymac.cpp deleted file mode 100644 index 404129e284..0000000000 --- a/tests/auto/other/qaccessibilitymac/tst_qaccessibilitymac.cpp +++ /dev/null @@ -1,150 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include <QApplication> -#include <QtWidgets> -#include <QTest> -#include <QtCore/qcoreapplication.h> - -#include "tst_qaccessibilitymac_helpers.h" - -QT_USE_NAMESPACE - - -class AccessibleTestWindow : public QWidget -{ - Q_OBJECT -public: - AccessibleTestWindow() - { - new QHBoxLayout(this); - } - - void addWidget(QWidget* widget) - { - layout()->addWidget(widget); - widget->show(); - QVERIFY(QTest::qWaitForWindowExposed(widget)); - } - - void clearChildren() - { - qDeleteAll(children()); - new QHBoxLayout(this); - } -}; - -class tst_QAccessibilityMac : public QObject -{ -Q_OBJECT -private slots: - void init(); - void cleanup(); - - void singleWidgetTest(); - void lineEditTest(); - void hierarchyTest(); - void notificationsTest(); - void checkBoxTest(); - -private: - AccessibleTestWindow *m_window; -}; - - -void tst_QAccessibilityMac::init() -{ - m_window = new AccessibleTestWindow(); - m_window->setWindowTitle("Test window"); - m_window->show(); - m_window->resize(400, 400); - - QVERIFY(QTest::qWaitForWindowExposed(m_window)); -} - -void tst_QAccessibilityMac::cleanup() -{ - delete m_window; -} - -void tst_QAccessibilityMac::singleWidgetTest() -{ - delete m_window; - m_window = 0; - - QVERIFY(singleWidget()); -} - -void tst_QAccessibilityMac::lineEditTest() -{ - QLineEdit *lineEdit = new QLineEdit(m_window); - lineEdit->setText("a11y test QLineEdit"); - m_window->addWidget(lineEdit); - QVERIFY(QTest::qWaitForWindowExposed(m_window)); - QCoreApplication::processEvents(); - - QVERIFY(testLineEdit()); -} - -void tst_QAccessibilityMac::hierarchyTest() -{ - QWidget *w = new QWidget(m_window); - m_window->addWidget(w); - - w->setLayout(new QVBoxLayout()); - QPushButton *b = new QPushButton(w); - w->layout()->addWidget(b); - b->setText("I am a button"); - - QPushButton *b2 = new QPushButton(w); - w->layout()->addWidget(b2); - b2->setText("Button 2"); - - QVERIFY(QTest::qWaitForWindowExposed(m_window)); - QCoreApplication::processEvents(); - QVERIFY(testHierarchy(w)); -} - -void tst_QAccessibilityMac::notificationsTest() -{ - QVERIFY(notifications(m_window)); -} - -void tst_QAccessibilityMac::checkBoxTest() -{ - QCheckBox *cb = new QCheckBox(m_window); - cb->setText("Great option"); - m_window->addWidget(cb); - QVERIFY(QTest::qWaitForWindowExposed(m_window)); - QCoreApplication::processEvents(); - - QVERIFY(testCheckBox()); -} - -QTEST_MAIN(tst_QAccessibilityMac) -#include "tst_qaccessibilitymac.moc" diff --git a/tests/auto/other/qaccessibilitymac/tst_qaccessibilitymac_helpers.mm b/tests/auto/other/qaccessibilitymac/tst_qaccessibilitymac.mm index a40ebaa252..4bedd07e15 100644 --- a/tests/auto/other/qaccessibilitymac/tst_qaccessibilitymac_helpers.mm +++ b/tests/auto/other/qaccessibilitymac/tst_qaccessibilitymac.mm @@ -1,35 +1,14 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only + +#include <QApplication> +#include <QtWidgets> +#include <QTest> +#include <QtCore/qcoreapplication.h> // some versions of CALayer.h use 'slots' as an identifier #define QT_NO_KEYWORDS -#include "tst_qaccessibilitymac_helpers.h" #include <QtWidgets/qapplication.h> #include <QtWidgets/qlineedit.h> #include <QtWidgets/qpushbutton.h> @@ -80,16 +59,10 @@ QDebug operator<<(QDebug dbg, AXErrorTag err) return dbg; } -#define EXPECT(cond) \ - if (!(cond)) { \ - qWarning("Failure in %s, line: %d", __FILE__ , __LINE__); \ - return false; \ - } \ - - @interface TestAXObject : NSObject { AXUIElementRef reference; + bool axError; } @property (readonly) NSString *role; @property (readonly) NSString *title; @@ -105,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]); @@ -137,6 +112,28 @@ QDebug operator<<(QDebug dbg, AXErrorTag err) return list; } +- (NSArray *)tableRows +{ + NSArray *arr; + AXUIElementCopyAttributeValues( + reference, + kAXRowsAttribute, + 0, 100, /*min, max*/ + (CFArrayRef *) &arr); + return arr; +} + +- (NSArray *)tableColumns +{ + NSArray *arr; + AXUIElementCopyAttributeValues( + reference, + kAXColumnsAttribute, + 0, 100, /*min, max*/ + (CFArrayRef *) &arr); + return arr; +} + - (AXUIElementRef) findDirectChildByRole: (CFStringRef) role { TestAXObject *result = nil; @@ -231,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; @@ -278,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); @@ -317,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); } @@ -329,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); } } @@ -365,66 +362,140 @@ QDebug operator<<(QDebug dbg, AXErrorTag err) @end +QVector<int> notificationList; + +void observerCallback(AXObserverRef /*observer*/, AXUIElementRef /*element*/, CFStringRef notification, void *) +{ + if ([(NSString*)notification isEqualToString: NSAccessibilityFocusedUIElementChangedNotification]) + notificationList.append(QAccessible::Focus); + else if ([(NSString*)notification isEqualToString: NSAccessibilityValueChangedNotification]) + notificationList.append(QAccessible::ValueChanged); + else + notificationList.append(-1); +} -bool singleWidget() +class AccessibleTestWindow : public QWidget { + Q_OBJECT +public: + AccessibleTestWindow() + { + new QHBoxLayout(this); + } + + void addWidget(QWidget* widget) + { + layout()->addWidget(widget); + widget->show(); + QVERIFY(QTest::qWaitForWindowExposed(widget)); + } + + void clearChildren() + { + qDeleteAll(children()); + new QHBoxLayout(this); + } +}; + +class tst_QAccessibilityMac : public QObject +{ +Q_OBJECT +private Q_SLOTS: + void init(); + void cleanup(); + + void singleWidgetTest(); + void lineEditTest(); + void hierarchyTest(); + void notificationsTest(); + void checkBoxTest(); + void tableViewTest(); + void treeViewTest(); + +private: + AccessibleTestWindow *m_window; +}; + + +void tst_QAccessibilityMac::init() +{ + m_window = new AccessibleTestWindow(); + m_window->setWindowTitle(QString("Test window - %1").arg(QTest::currentTestFunction())); + m_window->show(); + m_window->resize(400, 400); + + QVERIFY(QTest::qWaitForWindowExposed(m_window)); +} + +void tst_QAccessibilityMac::cleanup() +{ + delete m_window; +} + +void tst_QAccessibilityMac::singleWidgetTest() +{ + delete m_window; + m_window = 0; + QLineEdit *le = new QLineEdit(); le->setText("button"); le->show(); - EXPECT(QTest::qWaitForWindowExposed(le)); + QVERIFY(QTest::qWaitForWindowExposed(le)); QCoreApplication::processEvents(); TestAXObject *appObject = [TestAXObject getApplicationAXObject]; - EXPECT(appObject); + QVERIFY(appObject); - NSArray *windows = [appObject windowList]; - EXPECT([windows count] == 1); + QTRY_VERIFY(appObject.windowList.count == 1); - AXUIElementRef windowRef = (AXUIElementRef) [windows objectAtIndex: 0]; - EXPECT(windowRef != nil); + AXUIElementRef windowRef = (AXUIElementRef) [appObject.windowList objectAtIndex: 0]; + QVERIFY(windowRef != nil); TestAXObject *window = [[TestAXObject alloc] initWithAXUIElementRef: windowRef]; AXUIElementRef lineEditRef = [window findDirectChildByRole: kAXTextFieldRole]; - EXPECT(lineEditRef != nil); + QVERIFY(lineEditRef != nil); TestAXObject *lineEdit = [[TestAXObject alloc] initWithAXUIElementRef: lineEditRef]; - EXPECT([[lineEdit value] isEqualToString:@"button"]); + QVERIFY([[lineEdit value] isEqualToString:@"button"]); // Access invalid reference, should return empty value delete le; QCoreApplication::processEvents(); TestAXObject *lineEditInvalid = [[TestAXObject alloc] initWithAXUIElementRef: lineEditRef]; - EXPECT([[lineEditInvalid value] length] == 0); - - return true; + QVERIFY([[lineEditInvalid value] length] == 0); } -bool testLineEdit() +void tst_QAccessibilityMac::lineEditTest() { + QLineEdit *lineEdit = new QLineEdit(m_window); + lineEdit->setText("a11y test QLineEdit"); + m_window->addWidget(lineEdit); + QVERIFY(QTest::qWaitForWindowExposed(m_window)); + QCoreApplication::processEvents(); + TestAXObject *appObject = [TestAXObject getApplicationAXObject]; - EXPECT(appObject); + QVERIFY(appObject); - NSArray *windowList = [appObject windowList]; // one window - EXPECT([windowList count] == 1); - AXUIElementRef windowRef = (AXUIElementRef) [windowList objectAtIndex: 0]; - EXPECT(windowRef != nil); + QTRY_VERIFY(appObject.windowList.count == 1); + AXUIElementRef windowRef = (AXUIElementRef) [appObject.windowList objectAtIndex: 0]; + QVERIFY(windowRef != nil); TestAXObject *window = [[TestAXObject alloc] initWithAXUIElementRef: windowRef]; - EXPECT([window rect].size.width == 400); + QVERIFY([window rect].size.width == 400); // height of window includes title bar - EXPECT([window rect].size.height >= 400); + QVERIFY([window rect].size.height >= 400); - EXPECT([window.title isEqualToString:@"Test window"]); + QVERIFY([window.title isEqualToString:@"Test window - lineEditTest"]); // children of window: - AXUIElementRef lineEdit = [window findDirectChildByRole: kAXTextFieldRole]; - EXPECT(lineEdit != nil); + AXUIElementRef lineEditElement = [window findDirectChildByRole: kAXTextFieldRole]; + QVERIFY(lineEditElement != nil); - TestAXObject *le = [[TestAXObject alloc] initWithAXUIElementRef: lineEdit]; + TestAXObject *le = [[TestAXObject alloc] initWithAXUIElementRef: lineEditElement]; NSString *value = @"a11y test QLineEdit"; - EXPECT([le.value isEqualToString:value]); - EXPECT(value.length <= NSIntegerMax); - EXPECT(le.numberOfCharacters == static_cast<NSInteger>(value.length)); + QVERIFY([le.value isEqualToString:value]); + QVERIFY(value.length <= NSIntegerMax); + QVERIFY(le.numberOfCharacters == static_cast<NSInteger>(value.length)); const NSRange ranges[] = { { 0, 0}, { 0, 1}, @@ -439,82 +510,81 @@ bool testLineEdit() NSString *expectedSubstring = [value substringWithRange:range]; NSString *actualSubstring = [le stringForRange:range]; NSString *actualAttributedSubstring = [le attributedStringForRange:range].string; - EXPECT([actualSubstring isEqualTo:expectedSubstring]); - EXPECT([actualAttributedSubstring isEqualTo:expectedSubstring]); + QVERIFY([actualSubstring isEqualTo:expectedSubstring]); + QVERIFY([actualAttributedSubstring isEqualTo:expectedSubstring]); } - return true; } -bool testHierarchy(QWidget *w) +void tst_QAccessibilityMac::hierarchyTest() { + QWidget *w = new QWidget(m_window); + m_window->addWidget(w); + + w->setLayout(new QVBoxLayout()); + QPushButton *b = new QPushButton(w); + w->layout()->addWidget(b); + b->setText("I am a button"); + + QPushButton *b2 = new QPushButton(w); + w->layout()->addWidget(b2); + b2->setText("Button 2"); + + QVERIFY(QTest::qWaitForWindowExposed(m_window)); + QCoreApplication::processEvents(); + TestAXObject *appObject = [TestAXObject getApplicationAXObject]; - EXPECT(appObject); + QVERIFY(appObject); - NSArray *windowList = [appObject windowList]; // one window - EXPECT([windowList count] == 1); - AXUIElementRef windowRef = (AXUIElementRef) [windowList objectAtIndex: 0]; - EXPECT(windowRef != nil); + QTRY_VERIFY(appObject.windowList.count == 1); + AXUIElementRef windowRef = (AXUIElementRef) [appObject.windowList objectAtIndex: 0]; + QVERIFY(windowRef != nil); TestAXObject *window = [[TestAXObject alloc] initWithAXUIElementRef: windowRef]; // Because the plain widget is filtered out of the hierarchy, we expect the button // to be a direct child of the window AXUIElementRef buttonRef = [window findDirectChildByRole: kAXButtonRole]; - EXPECT(buttonRef != nil); + QVERIFY(buttonRef != nil); TestAXObject *buttonObject = [[TestAXObject alloc] initWithAXUIElementRef: buttonRef]; TestAXObject *parentObject = [[TestAXObject alloc] initWithAXUIElementRef: [buttonObject parent]]; // check that the parent is a window - EXPECT([[parentObject role] isEqualToString: NSAccessibilityWindowRole]); + QVERIFY([[parentObject role] isEqualToString: NSAccessibilityWindowRole]); // test the focus // child 0 is the layout, then button1 and 2 QPushButton *button1 = qobject_cast<QPushButton*>(w->children().at(1)); - EXPECT(button1); + QVERIFY(button1); QPushButton *button2 = qobject_cast<QPushButton*>(w->children().at(2)); - EXPECT(button2); + QVERIFY(button2); button2->setFocus(); AXUIElementRef systemWideElement = AXUIElementCreateSystemWide(); AXUIElementRef focussedElement = NULL; AXError error = AXUIElementCopyAttributeValue(systemWideElement, (CFStringRef)NSAccessibilityFocusedUIElementAttribute, (CFTypeRef*)&focussedElement); - EXPECT(!error); - EXPECT(focussedElement); + QVERIFY(!error); + QVERIFY(focussedElement); TestAXObject *focusButton2 = [[TestAXObject alloc] initWithAXUIElementRef: focussedElement]; - EXPECT([[focusButton2 role] isEqualToString: NSAccessibilityButtonRole]); - EXPECT([[focusButton2 title] isEqualToString: @"Button 2"]); + QVERIFY([[focusButton2 role] isEqualToString: NSAccessibilityButtonRole]); + QVERIFY([[focusButton2 title] isEqualToString: @"Button 2"]); button1->setFocus(); error = AXUIElementCopyAttributeValue(systemWideElement, (CFStringRef)NSAccessibilityFocusedUIElementAttribute, (CFTypeRef*)&focussedElement); - EXPECT(!error); - EXPECT(focussedElement); + QVERIFY(!error); + QVERIFY(focussedElement); TestAXObject *focusButton1 = [[TestAXObject alloc] initWithAXUIElementRef: focussedElement]; - EXPECT([[focusButton1 role] isEqualToString: NSAccessibilityButtonRole]); - EXPECT([[focusButton1 title] isEqualToString: @"I am a button"]); - - return true; + QVERIFY([[focusButton1 role] isEqualToString: NSAccessibilityButtonRole]); + QVERIFY([[focusButton1 title] isEqualToString: @"I am a button"]); } -QVector<int> notificationList; - -void observerCallback(AXObserverRef /*observer*/, AXUIElementRef /*element*/, CFStringRef notification, void *) -{ - if ([(NSString*)notification isEqualToString: NSAccessibilityFocusedUIElementChangedNotification]) - notificationList.append(QAccessible::Focus); - else if ([(NSString*)notification isEqualToString: NSAccessibilityValueChangedNotification]) - notificationList.append(QAccessible::ValueChanged); - else - notificationList.append(-1); -} - - -bool notifications(QWidget *w) +void tst_QAccessibilityMac::notificationsTest() { + auto *w = m_window; QLineEdit *le1 = new QLineEdit(w); QLineEdit *le2 = new QLineEdit(w); w->layout()->addWidget(le1); @@ -524,77 +594,215 @@ bool notifications(QWidget *w) QTest::qWait(100); TestAXObject *appObject = [TestAXObject getApplicationAXObject]; - EXPECT(appObject); + QVERIFY(appObject); - NSArray *windowList = [appObject windowList]; // one window - EXPECT([windowList count] == 1); - AXUIElementRef windowRef = (AXUIElementRef) [windowList objectAtIndex: 0]; - EXPECT(windowRef != nil); + QTRY_VERIFY(appObject.windowList.count == 1); + AXUIElementRef windowRef = (AXUIElementRef) [appObject.windowList objectAtIndex: 0]; + QVERIFY(windowRef != nil); TestAXObject *window = [[TestAXObject alloc] initWithAXUIElementRef: windowRef]; AXUIElementRef lineEdit1 = [window findDirectChildByRole: kAXTextFieldRole]; - EXPECT(lineEdit1 != nil); + QVERIFY(lineEdit1 != nil); AXObserverRef observer = 0; AXError err = AXObserverCreate(getpid(), observerCallback, &observer); - EXPECT(!err); + QVERIFY(!err); AXObserverAddNotification(observer, appObject.ref, kAXFocusedUIElementChangedNotification, 0); AXObserverAddNotification(observer, lineEdit1, kAXValueChangedNotification, 0); CFRunLoopAddSource( [[NSRunLoop currentRunLoop] getCFRunLoop], AXObserverGetRunLoopSource(observer), kCFRunLoopDefaultMode); - EXPECT(notificationList.length() == 0); + QVERIFY(notificationList.length() == 0); le2->setFocus(); - QCoreApplication::processEvents(); - EXPECT(notificationList.length() == 1); - EXPECT(notificationList.at(0) == QAccessible::Focus); + QTRY_VERIFY(notificationList.length() == 1); + QTRY_VERIFY(notificationList.at(0) == QAccessible::Focus); le1->setFocus(); - QCoreApplication::processEvents(); - EXPECT(notificationList.length() == 2); - EXPECT(notificationList.at(1) == QAccessible::Focus); + QTRY_VERIFY(notificationList.length() == 2); + QTRY_VERIFY(notificationList.at(1) == QAccessible::Focus); le1->setText("hello"); - QCoreApplication::processEvents(); - EXPECT(notificationList.length() == 3); - EXPECT(notificationList.at(2) == QAccessible::ValueChanged); + QTRY_VERIFY(notificationList.length() == 3); + QTRY_VERIFY(notificationList.at(2) == QAccessible::ValueChanged); le1->setText("foo"); - QCoreApplication::processEvents(); - EXPECT(notificationList.length() == 4); - EXPECT(notificationList.at(3) == QAccessible::ValueChanged); - - return true; + QTRY_VERIFY(notificationList.length() == 4); + QTRY_VERIFY(notificationList.at(3) == QAccessible::ValueChanged); } -bool testCheckBox() +void tst_QAccessibilityMac::checkBoxTest() { + QCheckBox *ckBox = new QCheckBox(m_window); + ckBox->setText("Great option"); + m_window->addWidget(ckBox); + QVERIFY(QTest::qWaitForWindowExposed(m_window)); + QCoreApplication::processEvents(); + TestAXObject *appObject = [TestAXObject getApplicationAXObject]; - EXPECT(appObject); + QVERIFY(appObject); - NSArray *windowList = [appObject windowList]; // one window - EXPECT([windowList count] == 1); - AXUIElementRef windowRef = (AXUIElementRef) [windowList objectAtIndex: 0]; - EXPECT(windowRef != nil); + QTRY_VERIFY(appObject.windowList.count == 1); + AXUIElementRef windowRef = (AXUIElementRef) [appObject.windowList objectAtIndex: 0]; + QVERIFY(windowRef != nil); TestAXObject *window = [[TestAXObject alloc] initWithAXUIElementRef: windowRef]; // children of window: AXUIElementRef checkBox = [window findDirectChildByRole: kAXCheckBoxRole]; - EXPECT(checkBox != nil); + QVERIFY(checkBox != nil); TestAXObject *cb = [[TestAXObject alloc] initWithAXUIElementRef: checkBox]; // here start actual checkbox tests - EXPECT([cb valueNumber] == 0); - EXPECT([cb.title isEqualToString:@"Great option"]); + QVERIFY([cb valueNumber] == 0); + QVERIFY([cb.title isEqualToString:@"Great option"]); // EXPECT(cb.description == nil); // currently returns "" instead of nil - EXPECT([cb.actions containsObject:(NSString*)kAXPressAction]); + QVERIFY([cb.actions containsObject:(NSString*)kAXPressAction]); [cb performAction:kAXPressAction]; - EXPECT([cb valueNumber] == 1); + QVERIFY([cb valueNumber] == 1); [cb performAction:kAXPressAction]; - EXPECT([cb valueNumber] == 0); + QVERIFY([cb valueNumber] == 0); - return true; + ckBox->setCheckState(Qt::PartiallyChecked); + QVERIFY([cb valueNumber] == 2); } + +void tst_QAccessibilityMac::tableViewTest() +{ + QTableWidget *tw = new QTableWidget(3, 2, m_window); + struct Person + { + const char *name; + const char *address; + }; + const Person contents[] = { { "Socrates", "Greece" }, + { "Confucius", "China" }, + { "Kant", "Preussia" } + }; + for (int i = 0; i < int(sizeof(contents) / sizeof(Person)); ++i) { + Person p = contents[i]; + QTableWidgetItem *name = new QTableWidgetItem(QString::fromLatin1(p.name)); + tw->setItem(i, 0, name); + QTableWidgetItem *address = new QTableWidgetItem(QString::fromLatin1(p.address)); + tw->setItem(i, 1, address); + } + 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 tableView = [window findDirectChildByRole:kAXTableRole]; + QVERIFY(tableView != nil); + + TestAXObject *tv = [[TestAXObject alloc] initWithAXUIElementRef:tableView]; + + // here start actual tableview tests + // Should have 2 columns + const unsigned int columnCount = 2; + NSArray *columnArray = [tv tableColumns]; + QCOMPARE([columnArray count], columnCount); + + // should have 3 rows + const unsigned int rowCount = 3; + NSArray *rowArray = [tv tableRows]; + QCOMPARE([rowArray count], rowCount); + + // The individual cells are children of the rows + TestAXObject *row = [[TestAXObject alloc] initWithAXUIElementRef:(AXUIElementRef)rowArray[0]]; + TestAXObject *cell = [[TestAXObject alloc] initWithAXUIElementRef:(AXUIElementRef)[row childList][0]]; + QVERIFY([cell.title isEqualToString:@"Socrates"]); + row = [[TestAXObject alloc] initWithAXUIElementRef:(AXUIElementRef)rowArray[2]]; + cell = [[TestAXObject alloc] initWithAXUIElementRef:(AXUIElementRef)[row childList][1]]; + QVERIFY([cell.title isEqualToString:@"Preussia"]); + + // both rows and columns are direct children of the table + NSArray *childList = [tv childList]; + QCOMPARE([childList count], columnCount + rowCount); + for (id child in childList) { + TestAXObject *childObject = [[TestAXObject alloc] initWithAXUIElementRef:(AXUIElementRef)child]; + QVERIFY([childObject.role isEqualToString:NSAccessibilityRowRole] || + [childObject.role isEqualToString:NSAccessibilityColumnRole]); + } +} + +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/qaccessibilitymac/tst_qaccessibilitymac_helpers.h b/tests/auto/other/qaccessibilitymac/tst_qaccessibilitymac_helpers.h deleted file mode 100644 index 75b2d39a00..0000000000 --- a/tests/auto/other/qaccessibilitymac/tst_qaccessibilitymac_helpers.h +++ /dev/null @@ -1,40 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -#include <QtCore/QString> -#include <QtCore/QPair> -#include <QtWidgets/QWidget> - -#pragma once // Yeah, it's deprecated in general, but it's standard practice for Mac OS X. - -QT_USE_NAMESPACE - -bool testLineEdit(); -bool testHierarchy(QWidget *w); -bool singleWidget(); -bool notifications(QWidget *w); -bool testCheckBox(); diff --git a/tests/auto/other/qcomplextext/CMakeLists.txt b/tests/auto/other/qcomplextext/CMakeLists.txt index 3a86e9096b..74996c7ad7 100644 --- a/tests/auto/other/qcomplextext/CMakeLists.txt +++ b/tests/auto/other/qcomplextext/CMakeLists.txt @@ -1,16 +1,23 @@ -# Generated from qcomplextext.pro. +# Copyright (C) 2022 The Qt Company Ltd. +# SPDX-License-Identifier: BSD-3-Clause ##################################################################### ## 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") qt_internal_add_test(tst_qcomplextext SOURCES tst_qcomplextext.cpp - PUBLIC_LIBRARIES + LIBRARIES Qt::CorePrivate Qt::Gui Qt::GuiPrivate diff --git a/tests/auto/other/qcomplextext/bidireorderstring.h b/tests/auto/other/qcomplextext/bidireorderstring.h index b537bf45e4..831fd34883 100644 --- a/tests/auto/other/qcomplextext/bidireorderstring.h +++ b/tests/auto/other/qcomplextext/bidireorderstring.h @@ -1,30 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// 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 453dc23bcd..b8014126ed 100644 --- a/tests/auto/other/qcomplextext/tst_qcomplextext.cpp +++ b/tests/auto/other/qcomplextext/tst_qcomplextext.cpp @@ -1,30 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #include <QTest> #include <QtGui/QtGui> @@ -109,7 +84,7 @@ void tst_QComplexText::bidiReorderString() if (si.analysis.bidiLevel % 2) { // reverse sub QChar *a = sub.data(); - QChar *b = a + sub.length() - 1; + QChar *b = a + sub.size() - 1; while (a < b) { QChar tmp = *a; *a = *b; @@ -118,7 +93,7 @@ void tst_QComplexText::bidiReorderString() --b; } a = (QChar *)sub.unicode(); - b = a + sub.length(); + b = a + sub.size(); while (a<b) { *a = a->mirroredChar(); ++a; @@ -340,7 +315,7 @@ static void testBidiString(const QString &data, int paragraphDirection, if (si.analysis.bidiLevel % 2) { // reverse sub QChar *a = sub.data(); - QChar *b = a + sub.length() - 1; + QChar *b = a + sub.size() - 1; while (a < b) { QChar tmp = *a; *a = *b; @@ -349,7 +324,7 @@ static void testBidiString(const QString &data, int paragraphDirection, --b; } a = (QChar *)sub.unicode(); - b = a + sub.length(); + b = a + sub.size(); // while (a<b) { // *a = a->mirroredChar(); // ++a; @@ -372,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()) { @@ -466,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 d7f8d5982a..61682af4e7 100644 --- a/tests/auto/other/qfocusevent/CMakeLists.txt +++ b/tests/auto/other/qfocusevent/CMakeLists.txt @@ -1,14 +1,22 @@ -# Generated from qfocusevent.pro. +# Copyright (C) 2022 The Qt Company Ltd. +# SPDX-License-Identifier: BSD-3-Clause ##################################################################### ## 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 - PUBLIC_LIBRARIES + LIBRARIES Qt::Gui Qt::GuiPrivate Qt::Widgets + Qt::WidgetsPrivate ) diff --git a/tests/auto/other/qfocusevent/tst_qfocusevent.cpp b/tests/auto/other/qfocusevent/tst_qfocusevent.cpp index 08dcceb39b..8297b53ea1 100644 --- a/tests/auto/other/qfocusevent/tst_qfocusevent.cpp +++ b/tests/auto/other/qfocusevent/tst_qfocusevent.cpp @@ -1,30 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #include <QTest> @@ -41,6 +16,8 @@ #include <qpa/qplatformintegration.h> #include <private/qguiapplication_p.h> +#include <QtWidgets/private/qapplication_p.h> + QT_FORWARD_DECLARE_CLASS(QWidget) class FocusLineEdit : public QLineEdit @@ -137,7 +114,7 @@ void tst_QFocusEvent::initWidget() { // On X11 we have to ensure the event was processed before doing any checking, on Windows // this is processed straight away. - QApplication::setActiveWindow(testFocusWidget); + QApplicationPrivate::setActiveWindow(testFocusWidget); childFocusWidgetOne->setFocus(); // The first lineedit should have focus QVERIFY(QTest::qWaitForWindowActive(testFocusWidget)); QTRY_VERIFY(childFocusWidgetOne->hasFocus()); @@ -335,7 +312,6 @@ void tst_QFocusEvent::checkReason_ActiveWindow() QVERIFY(QTest::qWaitForWindowExposed(d)); d->activateWindow(); // ### CDE - QApplication::setActiveWindow(d); QVERIFY(QTest::qWaitForWindowActive(d)); QTRY_VERIFY(childFocusWidgetOne->focusOutEventRecieved); @@ -344,7 +320,7 @@ void tst_QFocusEvent::checkReason_ActiveWindow() #if defined(Q_OS_WIN) if (QSysInfo::kernelVersion() == "10.0.15063") { // Activate window of testFocusWidget, focus in that window goes to childFocusWidgetOne - QWARN("Windows 10 Creators Update (10.0.15063) requires explicit activateWindow()"); + qWarning("Windows 10 Creators Update (10.0.15063) requires explicit activateWindow()"); testFocusWidget->activateWindow(); } #endif @@ -357,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 - QWARN("Platforms offscreen and minimal require explicit activateWindow()"); + qWarning("Platforms offscreen, minimal and macOS require explicit activateWindow()"); testFocusWidget->activateWindow(); } @@ -369,6 +346,42 @@ void tst_QFocusEvent::checkReason_ActiveWindow() QVERIFY( childFocusWidgetOne->hasFocus() ); QVERIFY( childFocusWidgetOne->focusInEventRecieved ); QCOMPARE( childFocusWidgetOne->focusInEventReason, (int)Qt::ActiveWindowFocusReason); + + const bool windowActivationReasonFail = + QGuiApplication::platformName().toLower() == "minimal"; + + struct Window : public QWindow + { + Qt::FocusReason lastReason = Qt::NoFocusReason; + protected: + void focusInEvent(QFocusEvent *event) override + { + lastReason = event->reason(); + } + void focusOutEvent(QFocusEvent *event) override + { + lastReason = event->reason(); + } + }; + + Window window; + window.show(); + window.requestActivate(); + QVERIFY(QTest::qWaitForWindowActive(&window)); + + if (windowActivationReasonFail) + QEXPECT_FAIL("", "Platform doesn't set window activation reason for QWindow", Continue); + QCOMPARE(window.lastReason, Qt::ActiveWindowFocusReason); + window.lastReason = Qt::NoFocusReason; + + Window window2; + window2.show(); + window2.requestActivate(); + QVERIFY(QTest::qWaitForWindowActive(&window2)); + + if (windowActivationReasonFail) + QEXPECT_FAIL("", "Platform doesn't set window activation reason for QWindow", Continue); + QCOMPARE(window.lastReason, Qt::ActiveWindowFocusReason); } diff --git a/tests/auto/other/qnetworkaccessmanager_and_qprogressdialog/CMakeLists.txt b/tests/auto/other/qnetworkaccessmanager_and_qprogressdialog/CMakeLists.txt index e4041de233..313d9464a3 100644 --- a/tests/auto/other/qnetworkaccessmanager_and_qprogressdialog/CMakeLists.txt +++ b/tests/auto/other/qnetworkaccessmanager_and_qprogressdialog/CMakeLists.txt @@ -1,14 +1,22 @@ -# Generated from qnetworkaccessmanager_and_qprogressdialog.pro. +# Copyright (C) 2022 The Qt Company Ltd. +# SPDX-License-Identifier: BSD-3-Clause ##################################################################### ## 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 - PUBLIC_LIBRARIES + LIBRARIES Qt::Gui Qt::Network Qt::Widgets + QT_TEST_SERVER_LIST "apache2" ) 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 a321900df2..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,30 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #include <QTest> @@ -68,13 +43,13 @@ public: public slots: void go() { - QNetworkRequest request(QUrl("http://" + QtNetworkSettings::serverName() + "/qtest/bigfile")); + QNetworkRequest request(QUrl("http://" + QtNetworkSettings::httpServerName() + "/qtest/bigfile")); if (zeroCopy) request.setAttribute(QNetworkRequest::MaximumDownloadBufferSizeAttribute, 10*1024*1024); QNetworkReply *reply = netmanager.get( QNetworkRequest( - QUrl("http://" + QtNetworkSettings::serverName() + "/qtest/bigfile") + QUrl("http://" + QtNetworkSettings::httpServerName() + "/qtest/bigfile") )); connect(reply, SIGNAL(downloadProgress(qint64,qint64)), this, SLOT(dataReadProgress(qint64,qint64))); @@ -117,8 +92,13 @@ tst_QNetworkAccessManager_And_QProgressDialog::tst_QNetworkAccessManager_And_QPr void tst_QNetworkAccessManager_And_QProgressDialog::initTestCase() { +#ifdef QT_TEST_SERVER + if (!QtNetworkSettings::verifyConnection(QtNetworkSettings::httpServerName(), 80)) + QSKIP("No network test server available"); +#else if (!QtNetworkSettings::verifyTestNetworkSettings()) QSKIP("No network test server available"); +#endif } void tst_QNetworkAccessManager_And_QProgressDialog::downloadCheck_data() diff --git a/tests/auto/other/qobjectrace/CMakeLists.txt b/tests/auto/other/qobjectrace/CMakeLists.txt index 8069b40ad7..6516c9ee73 100644 --- a/tests/auto/other/qobjectrace/CMakeLists.txt +++ b/tests/auto/other/qobjectrace/CMakeLists.txt @@ -1,13 +1,19 @@ -# Generated from qobjectrace.pro. +# Copyright (C) 2022 The Qt Company Ltd. +# SPDX-License-Identifier: BSD-3-Clause ##################################################################### ## qobjectrace Test: ##################################################################### -qt_internal_add_test(qobjectrace +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 - ../../../shared/emulationdetector.h tst_qobjectrace.cpp - INCLUDE_DIRECTORIES - ../../../shared + LIBRARIES + Qt::TestPrivate ) diff --git a/tests/auto/other/qobjectrace/tst_qobjectrace.cpp b/tests/auto/other/qobjectrace/tst_qobjectrace.cpp index cdf51f5d0c..af6634f253 100644 --- a/tests/auto/other/qobjectrace/tst_qobjectrace.cpp +++ b/tests/auto/other/qobjectrace/tst_qobjectrace.cpp @@ -1,36 +1,13 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2022 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #include <QtCore> #include <QTest> -#include "emulationdetector.h" +#include <QtTest/private/qemulationdetector_p.h> + +#include <optional> enum { OneMinute = 60 * 1000, TwoMinutes = OneMinute * 2 }; @@ -44,11 +21,20 @@ struct Functor class tst_QObjectRace: public QObject { Q_OBJECT +public: + tst_QObjectRace() + : ThreadCount(QThread::idealThreadCount()) + {} + private slots: void moveToThreadRace(); void destroyRace(); void blockingQueuedDestroyRace(); void disconnectRace(); + void disconnectRace2(); + +private: + const int ThreadCount; }; class RaceObject : public QObject @@ -132,8 +118,7 @@ void tst_QObjectRace::moveToThreadRace() { RaceObject *object = new RaceObject; - enum { ThreadCount = 6 }; - RaceThread *threads[ThreadCount]; + QVarLengthArray<RaceThread *, 16> threads(ThreadCount); for (int i = 0; i < ThreadCount; ++i) { threads[i] = new RaceThread; threads[i]->setObject(object); @@ -260,13 +245,13 @@ public: void tst_QObjectRace::destroyRace() { - if (EmulationDetector::isRunningArmOnX86()) + if (QTestPrivate::isRunningArmOnX86()) QSKIP("Test is too slow to run on emulator"); - enum { ThreadCount = 10, ObjectCountPerThread = 2777, - ObjectCount = ThreadCount * ObjectCountPerThread }; + constexpr int ObjectCountPerThread = 2777; + const int ObjectCount = ThreadCount * ObjectCountPerThread; - MyObject *objects[ObjectCount]; + QVarLengthArray<MyObject *, ObjectCountPerThread * 10> objects(ObjectCount); for (int i = 0; i < ObjectCount; ++i) objects[i] = new MyObject; @@ -283,10 +268,10 @@ void tst_QObjectRace::destroyRace() objects[((i+5)*79) % ObjectCount], Functor() ); } - DestroyThread *threads[ThreadCount]; + QVarLengthArray<DestroyThread *, 16> threads(ThreadCount); for (int i = 0; i < ThreadCount; ++i) { threads[i] = new DestroyThread; - threads[i]->setObjects(objects + i*ObjectCountPerThread, ObjectCountPerThread); + threads[i]->setObjects(objects.data() + i*ObjectCountPerThread, ObjectCountPerThread); } for (int i = 0; i < ThreadCount; ++i) @@ -324,8 +309,7 @@ public slots: break; } - Q_UNREACHABLE(); - return false; + Q_UNREACHABLE_RETURN(false); } private: @@ -334,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; @@ -346,17 +327,13 @@ void tst_QObjectRace::blockingQueuedDestroyRace() while (iteration++ < MinIterations || !timer.hasExpired()) { // Manually allocate some storage, and create a receiver in there - std::aligned_storage< - sizeof(BlockingQueuedDestroyRaceObject), - alignof(BlockingQueuedDestroyRaceObject) - >::type storage; + std::optional<BlockingQueuedDestroyRaceObject> receiver; - auto *receiver = reinterpret_cast<BlockingQueuedDestroyRaceObject *>(&storage); - new (receiver) BlockingQueuedDestroyRaceObject(BlockingQueuedDestroyRaceObject::Behavior::Normal); + receiver.emplace(BlockingQueuedDestroyRaceObject::Behavior::Normal); // Connect it to the sender via BlockingQueuedConnection QVERIFY(connect(&sender, &BlockingQueuedDestroyRaceObject::aSignal, - receiver, &BlockingQueuedDestroyRaceObject::aSlot, + &*receiver, &BlockingQueuedDestroyRaceObject::aSlot, Qt::BlockingQueuedConnection)); const auto emitUntilDestroyed = [&sender] { @@ -378,17 +355,14 @@ void tst_QObjectRace::blockingQueuedDestroyRace() // - the metacall event to be posted to a destroyed object; // - the metacall event to be posted to the wrong object. // In both cases we hope to catch the race by crashing. - receiver->~BlockingQueuedDestroyRaceObject(); - new (receiver) BlockingQueuedDestroyRaceObject(BlockingQueuedDestroyRaceObject::Behavior::Crash); + receiver.reset(); + receiver.emplace(BlockingQueuedDestroyRaceObject::Behavior::Crash); // Flush events QTest::qWait(0); thread->wait(); - - receiver->~BlockingQueuedDestroyRaceObject(); } -#endif } static QAtomicInteger<unsigned> countedStructObjectsCount; @@ -505,7 +479,7 @@ public: void tst_QObjectRace::disconnectRace() { - enum { ThreadCount = 20, TimeLimit = 3000 }; + enum { TimeLimit = 3000 }; QCOMPARE(countedStructObjectsCount.loadRelaxed(), 0u); @@ -515,7 +489,7 @@ void tst_QObjectRace::disconnectRace() senderThread->start(); sender->moveToThread(senderThread.data()); - DisconnectRaceThread *threads[ThreadCount]; + QVarLengthArray<DisconnectRaceThread *, 16> threads(ThreadCount); for (int i = 0; i < ThreadCount; ++i) { threads[i] = new DisconnectRaceThread(sender.data(), !(i % 10)); threads[i]->start(); @@ -541,7 +515,7 @@ void tst_QObjectRace::disconnectRace() senderThread->start(); sender->moveToThread(senderThread.data()); - DeleteReceiverRaceReceiverThread *threads[ThreadCount]; + QVarLengthArray<DeleteReceiverRaceReceiverThread *, 16> threads(ThreadCount); for (int i = 0; i < ThreadCount; ++i) { threads[i] = new DeleteReceiverRaceReceiverThread(sender.data()); threads[i]->start(); @@ -562,5 +536,53 @@ void tst_QObjectRace::disconnectRace() QCOMPARE(countedStructObjectsCount.loadRelaxed(), 0u); } +void tst_QObjectRace::disconnectRace2() +{ + enum { IterationCount = 100, ConnectionCount = 100, YieldCount = 100 }; + + QAtomicPointer<MyObject> ptr; + QSemaphore createSemaphore(0); + QSemaphore proceedSemaphore(0); + + std::unique_ptr<QThread> t1(QThread::create([&]() { + for (int i = 0; i < IterationCount; ++i) { + MyObject sender; + ptr.storeRelease(&sender); + createSemaphore.release(); + proceedSemaphore.acquire(); + ptr.storeRelaxed(nullptr); + for (int i = 0; i < YieldCount; ++i) + QThread::yieldCurrentThread(); + } + })); + t1->start(); + + + std::unique_ptr<QThread> t2(QThread::create([&]() { + auto connections = std::make_unique<QMetaObject::Connection[]>(ConnectionCount); + for (int i = 0; i < IterationCount; ++i) { + MyObject receiver; + MyObject *sender = nullptr; + + createSemaphore.acquire(); + + while (!(sender = ptr.loadAcquire())) + ; + + for (int i = 0; i < ConnectionCount; ++i) + connections[i] = QObject::connect(sender, &MyObject::signal1, &receiver, &MyObject::slot1); + + proceedSemaphore.release(); + + for (int i = 0; i < ConnectionCount; ++i) + QObject::disconnect(connections[i]); + } + })); + t2->start(); + + t1->wait(); + t2->wait(); +} + QTEST_MAIN(tst_QObjectRace) #include "tst_qobjectrace.moc" diff --git a/tests/auto/other/qprocess_and_guieventloop/CMakeLists.txt b/tests/auto/other/qprocess_and_guieventloop/CMakeLists.txt index 126feeeb2d..3383677009 100644 --- a/tests/auto/other/qprocess_and_guieventloop/CMakeLists.txt +++ b/tests/auto/other/qprocess_and_guieventloop/CMakeLists.txt @@ -1,13 +1,21 @@ -# Generated from qprocess_and_guieventloop.pro. +# Copyright (C) 2022 The Qt Company Ltd. +# SPDX-License-Identifier: BSD-3-Clause ##################################################################### ## 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 - PUBLIC_LIBRARIES + LIBRARIES 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 2d67e32d4a..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,30 +1,6 @@ -/**************************************************************************** -** -** Copyright (C) 2016 Intel Corporation. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2021 The Qt Company Ltd. +// Copyright (C) 2016 Intel Corporation. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #include <QtGui/QGuiApplication> #include <QTest> @@ -41,7 +17,7 @@ private slots: void tst_QProcess_and_GuiEventLoop::waitForAndEventLoop() { -#if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_EMBEDDED) +#ifdef Q_OS_ANDROID QSKIP("Not supported on Android"); #else @@ -59,20 +35,20 @@ void tst_QProcess_and_GuiEventLoop::waitForAndEventLoop() qApp->processEvents(QEventLoop::AllEvents, 100); // we mustn't have read anything in the event loop - QCOMPARE(spy.count(), 0); + QCOMPARE(spy.size(), 0); // ensure the process hasn't died QVERIFY(!process.waitForFinished(250)); // we mustn't have read anything during waitForFinished either - QCOMPARE(spy.count(), 0); + QCOMPARE(spy.size(), 0); // release the child for the second write process.write("\n"); QVERIFY(process.waitForFinished(5000)); QCOMPARE(int(process.exitStatus()), int(QProcess::NormalExit)); QCOMPARE(process.exitCode(), 0); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); QCOMPARE(process.readAll().trimmed(), msg); #endif } 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 87a5e14fc3..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 @@ -1,4 +1,5 @@ -# Generated from write-read-write.pro. +# Copyright (C) 2022 The Qt Company Ltd. +# SPDX-License-Identifier: BSD-3-Clause ##################################################################### ## write-read-write Binary: @@ -8,6 +9,4 @@ qt_internal_add_executable(write-read-write OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/" SOURCES main.cpp - PUBLIC_LIBRARIES - Qt::Gui ) 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 5e75f7db3c..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,30 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 Intel Corporation. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 Intel Corporation. +// 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 8ee04910e7..a405f54151 100644 --- a/tests/auto/other/qsharedpointer_and_qwidget/CMakeLists.txt +++ b/tests/auto/other/qsharedpointer_and_qwidget/CMakeLists.txt @@ -1,15 +1,20 @@ -# Generated from qsharedpointer_and_qwidget.pro. +# Copyright (C) 2022 The Qt Company Ltd. +# SPDX-License-Identifier: BSD-3-Clause ##################################################################### ## 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 - DEFINES - SRCDIR=\\\"${CMAKE_CURRENT_SOURCE_DIR}/\\\" - PUBLIC_LIBRARIES + LIBRARIES Qt::Gui Qt::Widgets ) 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 38fc547335..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,30 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// 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 7851bf8dcc..4007cc7db8 100644 --- a/tests/auto/other/qvariant_common/tst_qvariant_common.h +++ b/tests/auto/other/qvariant_common/tst_qvariant_common.h @@ -1,30 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #ifndef TST_QVARIANT_COMMON #define TST_QVARIANT_COMMON @@ -72,11 +47,9 @@ protected: } QtMessageHandler oldMsgHandler; - static int currentId; - static bool ok; + inline static int currentId = {}; + inline static bool ok = {}; }; -bool MessageHandler::ok; -int MessageHandler::currentId; #define TST_QVARIANT_CANCONVERT_DATATABLE_HEADERS \ QTest::addColumn<QVariant>("val"); \ @@ -146,6 +119,13 @@ int MessageHandler::currentId; 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); \ @@ -162,7 +142,7 @@ int MessageHandler::currentId; 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 eac31444c7..02a3464ec7 100644 --- a/tests/auto/other/sessionmanagement_macos/tst_sessionmanagement_macos.mm +++ b/tests/auto/other/sessionmanagement_macos/tst_sessionmanagement_macos.mm @@ -1,30 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2019 Samuel Gaist <samuel.gaist@idiap.ch> -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2019 Samuel Gaist <samuel.gaist@idiap.ch> +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #include <QTest> diff --git a/tests/auto/other/toolsupport/BLACKLIST b/tests/auto/other/toolsupport/BLACKLIST deleted file mode 100644 index 6a4d5aece5..0000000000 --- a/tests/auto/other/toolsupport/BLACKLIST +++ /dev/null @@ -1,3 +0,0 @@ -# QTBUG-87396 -[offsets] -android diff --git a/tests/auto/other/toolsupport/CMakeLists.txt b/tests/auto/other/toolsupport/CMakeLists.txt index 686d702a23..5b2cc0c0e2 100644 --- a/tests/auto/other/toolsupport/CMakeLists.txt +++ b/tests/auto/other/toolsupport/CMakeLists.txt @@ -1,12 +1,19 @@ -# Generated from toolsupport.pro. +# Copyright (C) 2022 The Qt Company Ltd. +# SPDX-License-Identifier: BSD-3-Clause ##################################################################### ## 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 - PUBLIC_LIBRARIES + LIBRARIES Qt::CorePrivate ) diff --git a/tests/auto/other/toolsupport/tst_toolsupport.cpp b/tests/auto/other/toolsupport/tst_toolsupport.cpp index 8860cd7840..965b55977c 100644 --- a/tests/auto/other/toolsupport/tst_toolsupport.cpp +++ b/tests/auto/other/toolsupport/tst_toolsupport.cpp @@ -1,30 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2015 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #include <QTest> @@ -36,6 +11,10 @@ // the TypeInformationVersion field in src/corelib/global/qhooks.cpp // in the same commit as the modification to the private class. // +// Please also notify downstream users of the information checked here +// such as Qt Creator developers, of such a change by putting them +// on Cc: on the respective change on gerrit. +// // Don't do this at home. This is test code, not production. @@ -59,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 @@ -97,31 +77,36 @@ void tst_toolsupport::offsets_data() { QTestData &data = QTest::newRow("sizeof(QObjectData)") << sizeof(QObjectData); + // Please heed the comment at the top of this file when changing this line: data << 44 << 80; // vptr + 2 ptr + (2*ptr + int) + 2 int + ptr } { QTestData &data = QTest::newRow("sizeof(QObjectPrivate::ExtraData)") << sizeof(QObjectPrivate::ExtraData); - data << 60 << 120; // 4 * QList + 1 * QString + // Please heed the comment at the top of this file when changing this line: + data << 64 << 128; // 4 * QList + 1 * QString + ptr } #if RUN_MEMBER_OFFSET_TEST { QTestData &data = QTest::newRow("QObjectPrivate::extraData") << pmm_to_offsetof(&QObjectPrivate::extraData); + // Please heed the comment at the top of this file when changing this line: data << 44 << 80; // sizeof(QObjectData) } { QTestData &data = QTest::newRow("QFileInfoPrivate::fileEntry") << pmm_to_offsetof(&QFileInfoPrivate::fileEntry); + // Please heed the comment at the top of this file when changing this line: data << 4 << 8; } { QTestData &data = QTest::newRow("QFileSystemEntry::filePath") << pmm_to_offsetof(&QFileSystemEntry::m_filePath); + // Please heed the comment at the top of this file when changing this line: data << 0 << 0; } @@ -129,17 +114,19 @@ void tst_toolsupport::offsets_data() { QTestData &data = QTest::newRow("QFilePrivate::fileName") << pmm_to_offsetof(&QFilePrivate::fileName); -#ifdef Q_PROCESSOR_X86 + // Please heed the comment at the top of this file when changing one of these lines: +#ifdef Q_PROCESSOR_X86_32 // x86 32-bit has weird alignment rules. Refer to QtPrivate::AlignOf in // qglobal.h for more details. - data << 188 << 304; + data << 264 << -1; #else - data << 196 << 304; + data << 300 << 424; #endif } #endif { + // Please heed the comment at the top of this file when changing one of these lines: QTest::newRow("QDateTimePrivate::m_msecs") << pmm_to_offsetof(&QDateTimePrivate::m_msecs) << 8 << 8; QTest::newRow("QDateTimePrivate::m_status") diff --git a/tests/auto/other/xkbkeyboard/CMakeLists.txt b/tests/auto/other/xkbkeyboard/CMakeLists.txt index 206f128cf8..06e471c68b 100644 --- a/tests/auto/other/xkbkeyboard/CMakeLists.txt +++ b/tests/auto/other/xkbkeyboard/CMakeLists.txt @@ -1,13 +1,20 @@ -# Generated from xkbkeyboard.pro. +# Copyright (C) 2022 The Qt Company Ltd. +# SPDX-License-Identifier: BSD-3-Clause ##################################################################### ## 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 - PUBLIC_LIBRARIES + LIBRARIES Qt::CorePrivate Qt::GuiPrivate ) diff --git a/tests/auto/other/xkbkeyboard/tst_xkbkeyboard.cpp b/tests/auto/other/xkbkeyboard/tst_xkbkeyboard.cpp index 6a3fe73829..323693bb84 100644 --- a/tests/auto/other/xkbkeyboard/tst_xkbkeyboard.cpp +++ b/tests/auto/other/xkbkeyboard/tst_xkbkeyboard.cpp @@ -1,30 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2019 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2019 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #include <QtCore> #include <QtGui> |