From 2a7b8930f447aa2100e58abf6ebf208064ec0f2f Mon Sep 17 00:00:00 2001 From: Richard Moe Gustavsen Date: Fri, 4 Sep 2020 10:38:35 +0200 Subject: auto tests: remove all versioning from the test data The problem is that QtQuick.Controls.macos is only available with revision 6.0. And when importing e.g QtQuick.Controls 2.15, we try to load a style with the same revision. But it simply doesn't exist. So remove all versioning from the tests to also support testing newer styles. Change-Id: I666a93ab03ec4c5dcf2055a363547f8cdac8d25e Reviewed-by: Mitch Curtis --- tests/auto/designer/tst_designer.cpp | 4 ++-- tests/auto/focus/tst_focus.cpp | 6 +++--- tests/auto/font/tst_font.cpp | 4 ++-- tests/auto/palette/tst_palette.cpp | 4 ++-- tests/auto/pressandhold/tst_pressandhold.cpp | 12 ++++++------ .../qquickapplicationwindow/tst_qquickapplicationwindow.cpp | 6 +++--- tests/auto/qquickmaterialstyle/data/tst_material.qml | 2 +- tests/auto/qquickpopup/tst_qquickpopup.cpp | 6 +++--- tests/auto/qquickstyle/tst_qquickstyle.cpp | 4 ++-- tests/auto/revisions/tst_revisions.cpp | 2 +- tests/auto/styleimports/ResourceStyle/Button.qml | 2 +- tests/auto/styleimports/data/Action.qml | 2 +- tests/auto/styleimports/data/Button.qml | 2 +- tests/auto/styleimports/data/FileSystemStyle/Button.qml | 2 +- tests/auto/styleimports/data/Label.qml | 2 +- tests/auto/styleimports/data/PlatformStyle/+linux/Button.qml | 2 +- tests/auto/styleimports/data/PlatformStyle/+macos/Button.qml | 2 +- .../auto/styleimports/data/PlatformStyle/+windows/Button.qml | 2 +- tests/auto/styleimports/data/PlatformStyle/Button.qml | 2 +- tests/auto/styleimports/tst_styleimports.cpp | 2 +- tests/benchmarks/objectcount/tst_objectcount.cpp | 2 +- tests/manual/gifs/gifrecorder.cpp | 2 +- 22 files changed, 37 insertions(+), 37 deletions(-) diff --git a/tests/auto/designer/tst_designer.cpp b/tests/auto/designer/tst_designer.cpp index 0d8bc73b..ed02b49b 100644 --- a/tests/auto/designer/tst_designer.cpp +++ b/tests/auto/designer/tst_designer.cpp @@ -96,8 +96,8 @@ void tst_Designer::test_controls() { QFETCH(QString, type); - const QByteArray before("import QtQuick 2.10\n" - "import QtQuick.Controls 2.3\n" + const QByteArray before("import QtQuick\n" + "import QtQuick.Controls\n" "Item {\n"); QByteArray source = before; diff --git a/tests/auto/focus/tst_focus.cpp b/tests/auto/focus/tst_focus.cpp index b1b23244..8117d90d 100644 --- a/tests/auto/focus/tst_focus.cpp +++ b/tests/auto/focus/tst_focus.cpp @@ -144,7 +144,7 @@ void tst_focus::policy() QQmlEngine engine; QQmlComponent component(&engine); - component.setData(QString("import QtQuick.Controls 2.1; ApplicationWindow { width: 100; height: 100; %1 { anchors.fill: parent } }").arg(name).toUtf8(), QUrl()); + component.setData(QString("import QtQuick.Controls; ApplicationWindow { width: 100; height: 100; %1 { anchors.fill: parent } }").arg(name).toUtf8(), QUrl()); QScopedPointer window(qobject_cast(component.create())); QVERIFY(window); @@ -253,7 +253,7 @@ void tst_focus::reason() QQmlEngine engine; QQmlComponent component(&engine); - component.setData(QString("import QtQuick.Controls 2.1; ApplicationWindow { width: 100; height: 100; %1 { anchors.fill: parent } }").arg(name).toUtf8(), QUrl()); + component.setData(QString("import QtQuick.Controls; ApplicationWindow { width: 100; height: 100; %1 { anchors.fill: parent } }").arg(name).toUtf8(), QUrl()); QScopedPointer window(qobject_cast(component.create())); QVERIFY(window.data()); @@ -337,7 +337,7 @@ void tst_focus::scope() QQmlEngine engine; QQmlComponent component(&engine); - component.setData(QString("import QtQuick 2.9; import QtQuick.Controls 2.2; ApplicationWindow { property alias child: child; width: 100; height: 100; %1 { anchors.fill: parent; Item { id: child; width: 10; height: 10 } } }").arg(name).toUtf8(), QUrl()); + component.setData(QString("import QtQuick; import QtQuick.Controls; ApplicationWindow { property alias child: child; width: 100; height: 100; %1 { anchors.fill: parent; Item { id: child; width: 10; height: 10 } } }").arg(name).toUtf8(), QUrl()); QScopedPointer window(qobject_cast(component.create())); QVERIFY2(window, qPrintable(component.errorString())); diff --git a/tests/auto/font/tst_font.cpp b/tests/auto/font/tst_font.cpp index b9371c12..2bee1dce 100644 --- a/tests/auto/font/tst_font.cpp +++ b/tests/auto/font/tst_font.cpp @@ -73,7 +73,7 @@ static QFont testFont() { QQmlEngine engine; QQmlComponent component(&engine); - component.setData("import QtQuick 2.0; import QtQuick.Controls 2.0; Text { }", QUrl()); + component.setData("import QtQuick; import QtQuick.Controls; Text { }", QUrl()); QScopedPointer object(component.create()); Q_ASSERT_X(!object.isNull(), "testFont", qPrintable(component.errorString())); @@ -298,7 +298,7 @@ void tst_font::defaultFont() QQmlEngine engine; QQmlComponent component(&engine); - component.setData(QString("import QtQuick.Controls 2.2; %1 { }").arg(control).toUtf8(), QUrl()); + component.setData(QString("import QtQuick.Controls; %1 { }").arg(control).toUtf8(), QUrl()); // The call to setData() above causes QQuickDefaultTheme to be set as the current theme, // so we must make sure we only set our theme afterwards. diff --git a/tests/auto/palette/tst_palette.cpp b/tests/auto/palette/tst_palette.cpp index 9d635ff7..814d5a11 100644 --- a/tests/auto/palette/tst_palette.cpp +++ b/tests/auto/palette/tst_palette.cpp @@ -85,7 +85,7 @@ void tst_palette::initTestCase() // style's theme instead of the platform's theme. QQmlEngine engine; QQmlComponent component(&engine); - component.setData("import QtQuick.Controls 2.3; Control { }", QUrl()); + component.setData("import QtQuick.Controls; Control { }", QUrl()); delete component.create(); } @@ -292,7 +292,7 @@ void tst_palette::defaultPalette() QQmlEngine engine; QQmlComponent component(&engine); - component.setData(QString("import QtQuick.Controls 2.3; %1 { }").arg(control).toUtf8(), QUrl()); + component.setData(QString("import QtQuick.Controls; %1 { }").arg(control).toUtf8(), QUrl()); // The call to setData() above causes QQuickDefaultTheme to be set as the current theme, // so we must make sure we only set our theme afterwards. diff --git a/tests/auto/pressandhold/tst_pressandhold.cpp b/tests/auto/pressandhold/tst_pressandhold.cpp index e4914a19..1bfed129 100644 --- a/tests/auto/pressandhold/tst_pressandhold.cpp +++ b/tests/auto/pressandhold/tst_pressandhold.cpp @@ -67,10 +67,10 @@ void tst_PressAndHold::pressAndHold_data() QTest::addColumn("data"); QTest::addColumn("signal"); - QTest::newRow("Button") << QByteArray("import QtQuick.Controls 2.1; Button { text: 'Button' }") << QByteArray(SIGNAL(pressAndHold())); - QTest::newRow("SwipeDelegate") << QByteArray("import QtQuick.Controls 2.1; SwipeDelegate { text: 'SwipeDelegate' }") << QByteArray(SIGNAL(pressAndHold())); - QTest::newRow("TextField") << QByteArray("import QtQuick.Controls 2.1; TextField { text: 'TextField' }") << QByteArray(SIGNAL(pressAndHold(QQuickMouseEvent*))); - QTest::newRow("TextArea") << QByteArray("import QtQuick.Controls 2.1; TextArea { text: 'TextArea' }") << QByteArray(SIGNAL(pressAndHold(QQuickMouseEvent*))); + QTest::newRow("Button") << QByteArray("import QtQuick.Controls; Button { text: 'Button' }") << QByteArray(SIGNAL(pressAndHold())); + QTest::newRow("SwipeDelegate") << QByteArray("import QtQuick.Controls; SwipeDelegate { text: 'SwipeDelegate' }") << QByteArray(SIGNAL(pressAndHold())); + QTest::newRow("TextField") << QByteArray("import QtQuick.Controls; TextField { text: 'TextField' }") << QByteArray(SIGNAL(pressAndHold(QQuickMouseEvent*))); + QTest::newRow("TextArea") << QByteArray("import QtQuick.Controls; TextArea { text: 'TextArea' }") << QByteArray(SIGNAL(pressAndHold(QQuickMouseEvent*))); } void tst_PressAndHold::pressAndHold() @@ -144,8 +144,8 @@ void tst_PressAndHold::keepSelection_data() { QTest::addColumn("data"); - QTest::newRow("TextField") << QByteArray("import QtQuick.Controls 2.1; TextField { text: 'TextField' }"); - QTest::newRow("TextArea") << QByteArray("import QtQuick.Controls 2.1; TextArea { text: 'TextArea' }"); + QTest::newRow("TextField") << QByteArray("import QtQuick.Controls; TextField { text: 'TextField' }"); + QTest::newRow("TextArea") << QByteArray("import QtQuick.Controls; TextArea { text: 'TextArea' }"); } void tst_PressAndHold::keepSelection() diff --git a/tests/auto/qquickapplicationwindow/tst_qquickapplicationwindow.cpp b/tests/auto/qquickapplicationwindow/tst_qquickapplicationwindow.cpp index 347c955e..c57cf92e 100644 --- a/tests/auto/qquickapplicationwindow/tst_qquickapplicationwindow.cpp +++ b/tests/auto/qquickapplicationwindow/tst_qquickapplicationwindow.cpp @@ -548,7 +548,7 @@ void tst_QQuickApplicationWindow::defaultFont() QQmlEngine engine; QQmlComponent component(&engine); - component.setData("import QtQuick.Controls 2.1; ApplicationWindow { }", QUrl()); + component.setData("import QtQuick.Controls; ApplicationWindow { }", QUrl()); QScopedPointer window; window.reset(static_cast(component.create())); @@ -748,7 +748,7 @@ void tst_QQuickApplicationWindow::clearFocusOnDestruction() { if (QOperatingSystemVersion::current() <= QOperatingSystemVersion::Windows7) QSKIP("Test requires a version of Windows newer than 7: QTBUG-84443"); - if (!canImportModule("import QtGraphicalEffects 1.15; DropShadow {}")) + if (!canImportModule("import QtGraphicalEffects; DropShadow {}")) QSKIP("Test requires QtGraphicalEffects"); QQmlEngine engine; @@ -862,7 +862,7 @@ void tst_QQuickApplicationWindow::componentComplete() QQmlEngine engine; QQmlComponent component(&engine); - component.setData("import QtQuick.Controls 2.2; ApplicationWindow { }", QUrl()); + component.setData("import QtQuick.Controls; ApplicationWindow { }", QUrl()); FriendlyApplicationWindow *qmlWindow = static_cast(component.beginCreate(engine.rootContext())); QVERIFY(qmlWindow); diff --git a/tests/auto/qquickmaterialstyle/data/tst_material.qml b/tests/auto/qquickmaterialstyle/data/tst_material.qml index c0a3891f..02b71305 100644 --- a/tests/auto/qquickmaterialstyle/data/tst_material.qml +++ b/tests/auto/qquickmaterialstyle/data/tst_material.qml @@ -55,7 +55,7 @@ import QtQuick.Templates as T import QtQuick.Controls import QtQuick.Controls.Material -import org.qtproject.Test 1.0 +import org.qtproject.Test TestCase { id: testCase diff --git a/tests/auto/qquickpopup/tst_qquickpopup.cpp b/tests/auto/qquickpopup/tst_qquickpopup.cpp index 714dad78..c74e43fe 100644 --- a/tests/auto/qquickpopup/tst_qquickpopup.cpp +++ b/tests/auto/qquickpopup/tst_qquickpopup.cpp @@ -1007,7 +1007,7 @@ void tst_QQuickPopup::componentComplete() QQmlEngine engine; QQmlComponent component(&engine); - component.setData("import QtQuick.Controls 2.2; Popup { }", QUrl()); + component.setData("import QtQuick.Controls; Popup { }", QUrl()); FriendlyPopup *qmlPopup = static_cast(component.beginCreate(engine.rootContext())); QVERIFY(qmlPopup); @@ -1279,7 +1279,7 @@ void tst_QQuickPopup::toolTipCrashOnClose() { if (QOperatingSystemVersion::current() <= QOperatingSystemVersion::Windows7) QSKIP("Test requires a version of Windows newer than 7: QTBUG-84443"); - if (!canImportModule("import QtGraphicalEffects 1.15; DropShadow {}")) + if (!canImportModule("import QtGraphicalEffects; DropShadow {}")) QSKIP("Test requires QtGraphicalEffects"); QQuickApplicationHelper helper(this, "toolTipCrashOnClose.qml"); @@ -1300,7 +1300,7 @@ void tst_QQuickPopup::setOverlayParentToNull() { if (QOperatingSystemVersion::current() <= QOperatingSystemVersion::Windows7) QSKIP("Test requires a version of Windows newer than 7: QTBUG-84443"); - if (!canImportModule("import QtGraphicalEffects 1.15; DropShadow {}")) + if (!canImportModule("import QtGraphicalEffects; DropShadow {}")) QSKIP("Test requires QtGraphicalEffects"); QQuickApplicationHelper helper(this, "toolTipCrashOnClose.qml"); diff --git a/tests/auto/qquickstyle/tst_qquickstyle.cpp b/tests/auto/qquickstyle/tst_qquickstyle.cpp index e675d335..c9b7fdbd 100644 --- a/tests/auto/qquickstyle/tst_qquickstyle.cpp +++ b/tests/auto/qquickstyle/tst_qquickstyle.cpp @@ -78,7 +78,7 @@ void tst_QQuickStyle::loadControls() QQmlEngine engine; engine.addImportPath(dataDirectory()); QQmlComponent component(&engine); - component.setData("import QtQuick 2.0; import QtQuick.Controls 2.1; Control { }", QUrl()); + component.setData("import QtQuick; import QtQuick.Controls; Control { }", QUrl()); QScopedPointer object(component.create()); QVERIFY2(!object.isNull(), qPrintable(component.errorString())); @@ -131,7 +131,7 @@ void tst_QQuickStyle::configurationFile() QQmlEngine engine; engine.addImportPath(":/data"); QQmlComponent labelComponent(&engine); - labelComponent.setData("import QtQuick 2.0; import QtQuick.Controls 2.12; Label {}", QUrl()); + labelComponent.setData("import QtQuick; import QtQuick.Controls; Label {}", QUrl()); QScopedPointer object(labelComponent.create()); QVERIFY2(!object.isNull(), qPrintable(labelComponent.errorString())); diff --git a/tests/auto/revisions/tst_revisions.cpp b/tests/auto/revisions/tst_revisions.cpp index 67f890bb..8eeec016 100644 --- a/tests/auto/revisions/tst_revisions.cpp +++ b/tests/auto/revisions/tst_revisions.cpp @@ -66,7 +66,7 @@ void tst_revisions::revisions() QQmlEngine engine; QQmlComponent component(&engine); - component.setData(QString("import QtQuick 2.0; \ + component.setData(QString("import QtQuick; \ import QtQuick.Templates 2.%1 as T; \ import QtQuick.Controls 2.%1; \ import QtQuick.Controls.impl 2.%1; \ diff --git a/tests/auto/styleimports/ResourceStyle/Button.qml b/tests/auto/styleimports/ResourceStyle/Button.qml index 2b9e5bb7..656b27a7 100644 --- a/tests/auto/styleimports/ResourceStyle/Button.qml +++ b/tests/auto/styleimports/ResourceStyle/Button.qml @@ -1,4 +1,4 @@ -import QtQuick.Templates 2.15 as T +import QtQuick.Templates as T T.Button { objectName: "ResourceStyle" } diff --git a/tests/auto/styleimports/data/Action.qml b/tests/auto/styleimports/data/Action.qml index 62501292..f49c6ff4 100644 --- a/tests/auto/styleimports/data/Action.qml +++ b/tests/auto/styleimports/data/Action.qml @@ -1,4 +1,4 @@ -import QtQuick.Templates 2.15 as T +import QtQuick.Templates as T T.Action { objectName: "data" } diff --git a/tests/auto/styleimports/data/Button.qml b/tests/auto/styleimports/data/Button.qml index f67719e3..85367472 100644 --- a/tests/auto/styleimports/data/Button.qml +++ b/tests/auto/styleimports/data/Button.qml @@ -1,4 +1,4 @@ -import QtQuick.Templates 2.15 as T +import QtQuick.Templates as T T.Button { objectName: "data" } diff --git a/tests/auto/styleimports/data/FileSystemStyle/Button.qml b/tests/auto/styleimports/data/FileSystemStyle/Button.qml index a5719dd8..a5078b14 100644 --- a/tests/auto/styleimports/data/FileSystemStyle/Button.qml +++ b/tests/auto/styleimports/data/FileSystemStyle/Button.qml @@ -1,4 +1,4 @@ -import QtQuick.Templates 2.15 as T +import QtQuick.Templates as T T.Button { objectName: "FileSystemStyle" } diff --git a/tests/auto/styleimports/data/Label.qml b/tests/auto/styleimports/data/Label.qml index b6d434ad..3959dae8 100644 --- a/tests/auto/styleimports/data/Label.qml +++ b/tests/auto/styleimports/data/Label.qml @@ -1,4 +1,4 @@ -import QtQuick.Templates 2.15 as T +import QtQuick.Templates as T T.Label { objectName: "data" } diff --git a/tests/auto/styleimports/data/PlatformStyle/+linux/Button.qml b/tests/auto/styleimports/data/PlatformStyle/+linux/Button.qml index 74e2a6f4..15c04d77 100644 --- a/tests/auto/styleimports/data/PlatformStyle/+linux/Button.qml +++ b/tests/auto/styleimports/data/PlatformStyle/+linux/Button.qml @@ -1,4 +1,4 @@ -import QtQuick.Templates 2.15 as T +import QtQuick.Templates as T T.Button { objectName: "PlatformStyle/+linux" } diff --git a/tests/auto/styleimports/data/PlatformStyle/+macos/Button.qml b/tests/auto/styleimports/data/PlatformStyle/+macos/Button.qml index 47fd788b..6c07ec02 100644 --- a/tests/auto/styleimports/data/PlatformStyle/+macos/Button.qml +++ b/tests/auto/styleimports/data/PlatformStyle/+macos/Button.qml @@ -1,4 +1,4 @@ -import QtQuick.Templates 2.15 as T +import QtQuick.Templates as T T.Button { objectName: "PlatformStyle/+macos" } diff --git a/tests/auto/styleimports/data/PlatformStyle/+windows/Button.qml b/tests/auto/styleimports/data/PlatformStyle/+windows/Button.qml index e5b56653..6a94679c 100644 --- a/tests/auto/styleimports/data/PlatformStyle/+windows/Button.qml +++ b/tests/auto/styleimports/data/PlatformStyle/+windows/Button.qml @@ -1,4 +1,4 @@ -import QtQuick.Templates 2.15 as T +import QtQuick.Templates as T T.Button { objectName: "PlatformStyle/+windows" } diff --git a/tests/auto/styleimports/data/PlatformStyle/Button.qml b/tests/auto/styleimports/data/PlatformStyle/Button.qml index fd1dc83d..fce35efd 100644 --- a/tests/auto/styleimports/data/PlatformStyle/Button.qml +++ b/tests/auto/styleimports/data/PlatformStyle/Button.qml @@ -1,4 +1,4 @@ -import QtQuick.Templates 2.15 as T +import QtQuick.Templates as T T.Button { objectName: "PlatformStyle/Button.qml" } diff --git a/tests/auto/styleimports/tst_styleimports.cpp b/tests/auto/styleimports/tst_styleimports.cpp index 7639db0e..239f5783 100644 --- a/tests/auto/styleimports/tst_styleimports.cpp +++ b/tests/auto/styleimports/tst_styleimports.cpp @@ -155,7 +155,7 @@ void tst_StyleImports::select() engine.addImportPath(dataDirectory()); QQmlComponent component(&engine); const QString controlName = file.mid(0, file.indexOf(QLatin1Char('.'))); - component.setData(QString::fromLatin1("import QtQuick 2.15; import QtQuick.Controls 2.15; %1 { }").arg(controlName).toUtf8(), QUrl()); + component.setData(QString::fromLatin1("import QtQuick; import QtQuick.Controls; %1 { }").arg(controlName).toUtf8(), QUrl()); const bool nonExistentStyle = style == QLatin1String("NoSuchStyle"); if (nonExistentStyle) diff --git a/tests/benchmarks/objectcount/tst_objectcount.cpp b/tests/benchmarks/objectcount/tst_objectcount.cpp index cb5a0956..626bb572 100644 --- a/tests/benchmarks/objectcount/tst_objectcount.cpp +++ b/tests/benchmarks/objectcount/tst_objectcount.cpp @@ -81,7 +81,7 @@ void tst_ObjectCount::init() // warmup QQmlComponent component(&engine); - component.setData("import QtQuick 2.0; import QtQuick.Controls 2.1; Item { Button {} }", QUrl()); + component.setData("import QtQuick; import QtQuick.Controls; Item { Button {} }", QUrl()); delete component.create(); } diff --git a/tests/manual/gifs/gifrecorder.cpp b/tests/manual/gifs/gifrecorder.cpp index a7a5b9d6..4bc7c9cd 100644 --- a/tests/manual/gifs/gifrecorder.cpp +++ b/tests/manual/gifs/gifrecorder.cpp @@ -252,7 +252,7 @@ void GifRecorder::waitForFinish() if (mHighQuality) { // Indicate the end of recording and the beginning of conversion. QQmlComponent busyComponent(&mEngine); - busyComponent.setData("import QtQuick 2.6; import QtQuick.Controls 2.1; Rectangle { anchors.fill: parent; " \ + busyComponent.setData("import QtQuick; import QtQuick.Controls; Rectangle { anchors.fill: parent; " \ "BusyIndicator { width: 32; height: 32; anchors.centerIn: parent } }", QUrl()); QCOMPARE(busyComponent.status(), QQmlComponent::Ready); QQuickItem *busyRect = qobject_cast(busyComponent.create()); -- cgit v1.2.3