From f0c227f8a9a5c5e3ed83f86702626092457175aa Mon Sep 17 00:00:00 2001 From: Mitch Curtis Date: Tue, 17 Feb 2015 13:53:44 +0100 Subject: Merge Extras' styling system into Controls'. - Removes the duplicated style settings functionality in Extras and simplifies the installed styles directory structure. - Extras' Base style is now part of Controls' Base style, eliminating the need for a separate QtQuick.Extras.Styles import. The cost of doing this should be negligible: a few QML files and two images. If we didn't merge Extras' Baste style into Controls', we'd need extras-specific code in qquickcontrolssettings, as the default style search path is: qml/QtQuick/Controls/Styles/ Whereas the Extras Base style would be in: qml/QtQuick/Extras/Styles/ The Extras Base style can't go into Controls' Base style directory, either, because otherwise we'd have two qmldir files there. The Flat style doesn't have this problem because it is all contained in one plugin and gets installed into its own Flat/ folder. - Documentation now lists the Extras controls as \since QtQuick.Extras 1.4. - Adds the customcontrolsstyle auto test to ensure that custom styling is tested. Change-Id: I19ca7a8b7e1c1daa85b272f4ccf9a2f05c76e0d9 Reviewed-by: Caroline Chao Reviewed-by: J-P Nurmi --- tests/auto/auto.pro | 2 +- .../auto/customcontrolsstyle/Style/ButtonStyle.qml | 47 +++++++++ .../customcontrolsstyle/customcontrolsstyle.pro | 18 ++++ .../customcontrolsstyle/data/TestComponent.qml | 57 ++++++++++ tests/auto/customcontrolsstyle/style.qrc | 5 + .../tst_customcontrolsstyle.cpp | 117 +++++++++++++++++++++ tests/auto/extras/data/PieMenu3Items.qml | 2 +- tests/auto/extras/data/PieMenu3ItemsKeepOpen.qml | 2 +- tests/auto/extras/data/PieMenu3ItemsLongPress.qml | 2 +- tests/auto/extras/data/PieMenuBoundingItem.qml | 2 +- .../extras/data/PieMenuRotatedBoundingItem.qml | 2 +- .../auto/extras/data/PieMenuVisibleButNoParent.qml | 2 +- .../auto/extras/data/PieMenuVisibleOnCompleted.qml | 2 +- tests/auto/extras/data/TumblerDatePicker.qml | 2 +- tests/auto/extras/data/tst_circulargauge.qml | 4 +- .../auto/extras/data/tst_circulartickmarklabel.qml | 2 +- tests/auto/extras/data/tst_common.qml | 6 +- tests/auto/extras/data/tst_delaybutton.qml | 30 +++--- tests/auto/extras/data/tst_dial.qml | 22 ++-- tests/auto/extras/data/tst_gauge.qml | 4 +- tests/auto/extras/data/tst_picture.qml | 15 +-- tests/auto/extras/data/tst_piemenu.qml | 4 +- tests/auto/extras/data/tst_statusindicator.qml | 21 ++-- tests/auto/extras/data/tst_togglebutton.qml | 4 +- tests/auto/extras/data/tst_tumbler.qml | 15 +-- .../statusindicator/LotsOfIndicatorsActive.qml | 2 +- .../statusindicator/LotsOfIndicatorsInactive.qml | 2 +- 27 files changed, 324 insertions(+), 69 deletions(-) create mode 100644 tests/auto/customcontrolsstyle/Style/ButtonStyle.qml create mode 100644 tests/auto/customcontrolsstyle/customcontrolsstyle.pro create mode 100644 tests/auto/customcontrolsstyle/data/TestComponent.qml create mode 100644 tests/auto/customcontrolsstyle/style.qrc create mode 100644 tests/auto/customcontrolsstyle/tst_customcontrolsstyle.cpp (limited to 'tests') diff --git a/tests/auto/auto.pro b/tests/auto/auto.pro index 86de357d..3cdd46fd 100644 --- a/tests/auto/auto.pro +++ b/tests/auto/auto.pro @@ -1,4 +1,4 @@ TEMPLATE = subdirs SUBDIRS += testplugin controls activeFocusOnTab applicationwindow dialogs \ - extras paint qquicktreemodeladaptor + extras paint qquicktreemodeladaptor customcontrolsstyle controls.depends = testplugin diff --git a/tests/auto/customcontrolsstyle/Style/ButtonStyle.qml b/tests/auto/customcontrolsstyle/Style/ButtonStyle.qml new file mode 100644 index 00000000..4b755686 --- /dev/null +++ b/tests/auto/customcontrolsstyle/Style/ButtonStyle.qml @@ -0,0 +1,47 @@ +/**************************************************************************** +** +** 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:LGPL3$ +** 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 http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPLv3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or later as published by the Free +** Software Foundation and appearing in the file LICENSE.GPL included in +** the packaging of this file. Please review the following information to +** ensure the GNU General Public License version 2.0 requirements will be +** met: http://www.gnu.org/licenses/gpl-2.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.4 +import QtQuick.Controls 1.4 +import QtQuick.Controls.Styles 1.4 + +ButtonStyle { + background: Rectangle { + implicitWidth: 200 + implicitHeight: 50 + color: "red" + } +} diff --git a/tests/auto/customcontrolsstyle/customcontrolsstyle.pro b/tests/auto/customcontrolsstyle/customcontrolsstyle.pro new file mode 100644 index 00000000..d3bcae47 --- /dev/null +++ b/tests/auto/customcontrolsstyle/customcontrolsstyle.pro @@ -0,0 +1,18 @@ +CONFIG += testcase +TARGET = tst_customcontrolsstyle +SOURCES += tst_customcontrolsstyle.cpp + +include (../shared/util.pri) + +osx:CONFIG -= app_bundle + +CONFIG += parallel_test +QT += core-private qml-private quick-private testlib + +TESTDATA = data/* + +OTHER_FILES += \ + data/TestComponent.qml + +RESOURCES += \ + style.qrc diff --git a/tests/auto/customcontrolsstyle/data/TestComponent.qml b/tests/auto/customcontrolsstyle/data/TestComponent.qml new file mode 100644 index 00000000..e32a3308 --- /dev/null +++ b/tests/auto/customcontrolsstyle/data/TestComponent.qml @@ -0,0 +1,57 @@ +/**************************************************************************** +** +** 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:LGPL3$ +** 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 http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPLv3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or later as published by the Free +** Software Foundation and appearing in the file LICENSE.GPL included in +** the packaging of this file. Please review the following information to +** ensure the GNU General Public License version 2.0 requirements will be +** met: http://www.gnu.org/licenses/gpl-2.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtTest 1.0 +import QtQuick 2.4 +import QtQuick.Controls 1.4 +import QtQuick.Controls.Private 1.0 +import QtQuick.Window 2.0 + +Window { + visible: true + width: 400 + height: 400 + + Button { + id: button + } + + function buttonStyleComponent() { + return Settings.styleComponent(Settings.style, "Button.qml", button); + } + + property string styleName: Settings.styleName +} diff --git a/tests/auto/customcontrolsstyle/style.qrc b/tests/auto/customcontrolsstyle/style.qrc new file mode 100644 index 00000000..37cfbbd7 --- /dev/null +++ b/tests/auto/customcontrolsstyle/style.qrc @@ -0,0 +1,5 @@ + + + Style/ButtonStyle.qml + + diff --git a/tests/auto/customcontrolsstyle/tst_customcontrolsstyle.cpp b/tests/auto/customcontrolsstyle/tst_customcontrolsstyle.cpp new file mode 100644 index 00000000..a4a7b24f --- /dev/null +++ b/tests/auto/customcontrolsstyle/tst_customcontrolsstyle.cpp @@ -0,0 +1,117 @@ +/**************************************************************************** +** +** 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:LGPL3$ +** 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 http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPLv3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or later as published by the Free +** Software Foundation and appearing in the file LICENSE.GPL included in +** the packaging of this file. Please review the following information to +** ensure the GNU General Public License version 2.0 requirements will be +** met: http://www.gnu.org/licenses/gpl-2.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include +#include +#include +#include +#include +#include +#include +#include "../shared/util.h" + +class tst_customcontrolsstyle : public QQmlDataTest +{ + Q_OBJECT + +public: + tst_customcontrolsstyle() {} + +private slots: + void initTestCase(); + + void style_data(); + void style(); +}; + +void tst_customcontrolsstyle::initTestCase() +{ + QQmlDataTest::initTestCase(); +} + +void tst_customcontrolsstyle::style_data() +{ + QTest::addColumn("specifiedStyle"); + QTest::addColumn("expectedStyleName"); + + QTest::newRow("NonExistentStyle") << QString::fromLatin1("NonExistentStyle") << QString::fromLatin1("Base"); + QTest::newRow("CustomFileSystemStyle") << directory() + QString::fromLatin1("/Style") << QString::fromLatin1("Style"); + QTest::newRow("CustomQrcStyle") << QString::fromLatin1(":/Style") << QString::fromLatin1("Style"); +} + +void tst_customcontrolsstyle::style() +{ + QFETCH(QString, specifiedStyle); + QFETCH(QString, expectedStyleName); + + qputenv("QT_QUICK_CONTROLS_STYLE", specifiedStyle.toLocal8Bit()); + + const bool expectBase = expectedStyleName == QLatin1String("Base"); + + if (specifiedStyle != expectedStyleName && expectBase) { + QString regexStr = QString::fromLatin1("WARNING: Cannot find style \"%1\" - fallback: .*%2").arg(specifiedStyle).arg("Base"); + QTest::ignoreMessage(QtWarningMsg, QRegularExpression(regexStr)); + } + + QQmlEngine engine; + + QQmlComponent component(&engine, testFileUrl("TestComponent.qml")); + QTRY_COMPARE(component.status(), QQmlComponent::Ready); + + QScopedPointer object(component.create()); + QVERIFY(object); + + QCOMPARE(object->property("styleName").toString(), expectedStyleName); + + QVariant returnedValue; + QMetaObject::invokeMethod(object.data(), "buttonStyleComponent", Q_RETURN_ARG(QVariant, returnedValue)); + + QVERIFY(returnedValue.isValid()); + QVERIFY(returnedValue.canConvert()); + QVERIFY(returnedValue.value()); + + QQuickWindow *window = qobject_cast(object.data()); + QVERIFY(QTest::qWaitForWindowExposed(window)); + + if (!expectBase) { + QImage windowImage = window->grabWindow(); + QCOMPARE(windowImage.pixel(0, 0), QColor(Qt::red).rgb()); + } +} + +QTEST_MAIN(tst_customcontrolsstyle) + +#include "tst_customcontrolsstyle.moc" diff --git a/tests/auto/extras/data/PieMenu3Items.qml b/tests/auto/extras/data/PieMenu3Items.qml index f9349e63..8e8396eb 100644 --- a/tests/auto/extras/data/PieMenu3Items.qml +++ b/tests/auto/extras/data/PieMenu3Items.qml @@ -1,6 +1,6 @@ import QtQuick 2.2 import QtQuick.Controls 1.1 -import QtQuick.Extras 1.3 +import QtQuick.Extras 1.4 Rectangle { id: rect diff --git a/tests/auto/extras/data/PieMenu3ItemsKeepOpen.qml b/tests/auto/extras/data/PieMenu3ItemsKeepOpen.qml index ffbfa20a..c2c0dce4 100644 --- a/tests/auto/extras/data/PieMenu3ItemsKeepOpen.qml +++ b/tests/auto/extras/data/PieMenu3ItemsKeepOpen.qml @@ -1,6 +1,6 @@ import QtQuick 2.2 import QtQuick.Controls 1.1 -import QtQuick.Extras 1.3 +import QtQuick.Extras 1.4 Rectangle { id: rect diff --git a/tests/auto/extras/data/PieMenu3ItemsLongPress.qml b/tests/auto/extras/data/PieMenu3ItemsLongPress.qml index fddc5460..5503c8d4 100644 --- a/tests/auto/extras/data/PieMenu3ItemsLongPress.qml +++ b/tests/auto/extras/data/PieMenu3ItemsLongPress.qml @@ -1,6 +1,6 @@ import QtQuick 2.2 import QtQuick.Controls 1.1 -import QtQuick.Extras 1.3 +import QtQuick.Extras 1.4 Rectangle { id: rect diff --git a/tests/auto/extras/data/PieMenuBoundingItem.qml b/tests/auto/extras/data/PieMenuBoundingItem.qml index 3daf0f19..cb6f1e89 100644 --- a/tests/auto/extras/data/PieMenuBoundingItem.qml +++ b/tests/auto/extras/data/PieMenuBoundingItem.qml @@ -1,6 +1,6 @@ import QtQuick 2.2 import QtQuick.Controls 1.1 -import QtQuick.Extras 1.3 +import QtQuick.Extras 1.4 Rectangle { id: root diff --git a/tests/auto/extras/data/PieMenuRotatedBoundingItem.qml b/tests/auto/extras/data/PieMenuRotatedBoundingItem.qml index 2df592ab..b1095158 100644 --- a/tests/auto/extras/data/PieMenuRotatedBoundingItem.qml +++ b/tests/auto/extras/data/PieMenuRotatedBoundingItem.qml @@ -1,6 +1,6 @@ import QtQuick 2.2 import QtQuick.Controls 1.1 -import QtQuick.Extras 1.3 +import QtQuick.Extras 1.4 Rectangle { id: root diff --git a/tests/auto/extras/data/PieMenuVisibleButNoParent.qml b/tests/auto/extras/data/PieMenuVisibleButNoParent.qml index 582e168a..609539e7 100644 --- a/tests/auto/extras/data/PieMenuVisibleButNoParent.qml +++ b/tests/auto/extras/data/PieMenuVisibleButNoParent.qml @@ -1,5 +1,5 @@ import QtQuick 2.2 -import QtQuick.Extras 1.3 +import QtQuick.Extras 1.4 Rectangle { width: 400 diff --git a/tests/auto/extras/data/PieMenuVisibleOnCompleted.qml b/tests/auto/extras/data/PieMenuVisibleOnCompleted.qml index aa9cc18c..55ba328c 100644 --- a/tests/auto/extras/data/PieMenuVisibleOnCompleted.qml +++ b/tests/auto/extras/data/PieMenuVisibleOnCompleted.qml @@ -1,5 +1,5 @@ import QtQuick 2.2 -import QtQuick.Extras 1.3 +import QtQuick.Extras 1.4 Rectangle { width: 400 diff --git a/tests/auto/extras/data/TumblerDatePicker.qml b/tests/auto/extras/data/TumblerDatePicker.qml index 9872fc00..9a5ad480 100644 --- a/tests/auto/extras/data/TumblerDatePicker.qml +++ b/tests/auto/extras/data/TumblerDatePicker.qml @@ -1,6 +1,6 @@ import QtQuick 2.3 import QtQuick.Controls 1.2 -import QtQuick.Extras 1.3 +import QtQuick.Extras 1.4 Tumbler { id: tumbler diff --git a/tests/auto/extras/data/tst_circulargauge.qml b/tests/auto/extras/data/tst_circulargauge.qml index 16c0815f..1fb47982 100644 --- a/tests/auto/extras/data/tst_circulargauge.qml +++ b/tests/auto/extras/data/tst_circulargauge.qml @@ -46,7 +46,7 @@ TestCase { height: 400 function test_instance() { - var gauge = Qt.createQmlObject('import QtQuick.Extras 1.3; CircularGauge { }', testcase, ''); + var gauge = Qt.createQmlObject('import QtQuick.Extras 1.4; CircularGauge { }', testcase, ''); verify (gauge, "CircularGauge: failed to create an instance") verify(gauge.__style) gauge.destroy() @@ -73,7 +73,7 @@ TestCase { } function test_tickmarksVisible() { - var gauge = Qt.createQmlObject("import QtQuick.Extras 1.3; CircularGauge { }", testcase, ""); + var gauge = Qt.createQmlObject("import QtQuick.Extras 1.4; CircularGauge { }", testcase, ""); verify(gauge, "CircularGauge: failed to create an instance"); gauge.__style.tickmark = tickmark; diff --git a/tests/auto/extras/data/tst_circulartickmarklabel.qml b/tests/auto/extras/data/tst_circulartickmarklabel.qml index 2521cbe9..731e15d1 100644 --- a/tests/auto/extras/data/tst_circulartickmarklabel.qml +++ b/tests/auto/extras/data/tst_circulartickmarklabel.qml @@ -49,7 +49,7 @@ TestCase { property var label: null function init() { - label = Qt.createQmlObject("import QtQuick.Extras 1.3; import QtQuick.Extras.Private 1.0; CircularTickmarkLabel {}", testcase, ""); + label = Qt.createQmlObject("import QtQuick.Extras 1.4; import QtQuick.Extras.Private 1.0; CircularTickmarkLabel {}", testcase, ""); verify(label, "CircularTickmarkLabel: failed to create an instance"); verify(label.__style); } diff --git a/tests/auto/extras/data/tst_common.qml b/tests/auto/extras/data/tst_common.qml index 1a7fe990..f0c3e428 100644 --- a/tests/auto/extras/data/tst_common.qml +++ b/tests/auto/extras/data/tst_common.qml @@ -53,11 +53,11 @@ TestCase { { tag: "DelayButton" }, { tag: "Dial" }, { tag: "Gauge" }, - { tag: "PieMenu", qml: "import QtQuick.Controls 1.1; import QtQuick.Extras 1.3;" + { tag: "PieMenu", qml: "import QtQuick.Controls 1.1; import QtQuick.Extras 1.4;" + "PieMenu { visible: true; MenuItem { text: 'foo' } }"}, { tag: "StatusIndicator" }, { tag: "ToggleButton" }, - { tag: "Tumbler", qml: "import QtQuick.Extras 1.3; Tumbler { TumblerColumn { model: 10 } }" } + { tag: "Tumbler", qml: "import QtQuick.Extras 1.4; Tumbler { TumblerColumn { model: 10 } }" } ]; } @@ -66,7 +66,7 @@ TestCase { } function test_resize(data) { - var qml = data.qml ? data.qml : "import QtQuick.Extras 1.3; " + data.tag + " { }"; + var qml = data.qml ? data.qml : "import QtQuick.Extras 1.4; " + data.tag + " { }"; control = Qt.createQmlObject(qml, testCase, ""); var resizeAnimation = Qt.createQmlObject("import QtQuick 2.2; NumberAnimation {}", testCase, ""); diff --git a/tests/auto/extras/data/tst_delaybutton.qml b/tests/auto/extras/data/tst_delaybutton.qml index 59e602a1..9fc736c0 100644 --- a/tests/auto/extras/data/tst_delaybutton.qml +++ b/tests/auto/extras/data/tst_delaybutton.qml @@ -46,12 +46,13 @@ TestCase { height: 400 function test_instance() { - var button = Qt.createQmlObject('import QtQuick.Extras 1.3; DelayButton { }', testcase, '') + var button = Qt.createQmlObject('import QtQuick.Extras 1.4; DelayButton { }', testcase, '') verify (button, "DelayButton: failed to create an instance") verify(button.__style) verify(!button.checked) verify(!button.pressed) - button.destroy() + // QTBUG-44664 +// button.destroy() } SignalSpy { @@ -68,7 +69,7 @@ TestCase { } function test_activation(data) { - var button = Qt.createQmlObject('import QtQuick.Extras 1.3; DelayButton { }', testcase, '') + var button = Qt.createQmlObject('import QtQuick.Extras 1.4; DelayButton { }', testcase, '') verify (button, "DelayButton: failed to create an instance") button.delay = data.delay @@ -89,7 +90,8 @@ TestCase { verify(!button.pressed) compare(activationSpy.count, 1) - button.destroy() + // QTBUG-44664 +// button.destroy() } SignalSpy { @@ -98,7 +100,7 @@ TestCase { } function test_progress() { - var button = Qt.createQmlObject('import QtQuick.Extras 1.3; DelayButton { delay: 1 }', testcase, '') + var button = Qt.createQmlObject('import QtQuick.Extras 1.4; DelayButton { delay: 1 }', testcase, '') verify (button, "DelayButton: failed to create an instance") progressSpy.target = button @@ -109,7 +111,8 @@ TestCase { tryCompare(button, "progress", 1.0) verify(progressSpy.count > 0) - button.destroy() + // QTBUG-44664 +// button.destroy() } SignalSpy { @@ -126,7 +129,7 @@ TestCase { } function test_checked(data) { - var button = Qt.createQmlObject('import QtQuick.Extras 1.3; DelayButton { }', testcase, '') + var button = Qt.createQmlObject('import QtQuick.Extras 1.4; DelayButton { }', testcase, '') verify (button, "DelayButton: failed to create an instance") button.delay = data.delay @@ -164,11 +167,12 @@ TestCase { verify(!button.checked) compare(checkSpy.count, checkCount) - button.destroy() + // QTBUG-44664 +// button.destroy() } function test_programmaticCheck() { - var button = Qt.createQmlObject("import QtQuick.Extras 1.3; DelayButton {}", testcase, ""); + var button = Qt.createQmlObject("import QtQuick.Extras 1.4; DelayButton {}", testcase, ""); verify(button, "DelayButton: failed to create an instance"); checkSpy.clear(); @@ -181,14 +185,16 @@ TestCase { button.checked = false; compare(button.progress, 0); - button.destroy(); + // QTBUG-44664 +// button.destroy(); } function test_largeText() { // Should be no binding loop warnings. - var button = Qt.createQmlObject("import QtQuick.Extras 1.3; DelayButton { " + var button = Qt.createQmlObject("import QtQuick.Extras 1.4; DelayButton { " + "anchors.centerIn: parent; text: 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' }", testcase, ""); verify(button, "DelayButton: failed to create an instance"); - button.destroy(); + // QTBUG-44664 +// button.destroy(); } } diff --git a/tests/auto/extras/data/tst_dial.qml b/tests/auto/extras/data/tst_dial.qml index 02e6eaa3..3c508184 100644 --- a/tests/auto/extras/data/tst_dial.qml +++ b/tests/auto/extras/data/tst_dial.qml @@ -47,7 +47,7 @@ TestCase { height: 400 function test_instance() { - var dial = Qt.createQmlObject('import QtQuick.Extras 1.3; Dial { }', testcase, ''); + var dial = Qt.createQmlObject('import QtQuick.Extras 1.4; Dial { }', testcase, ''); verify (dial, "Dial: failed to create an instance") verify(dial.__style) compare(dial.value, 0.0) @@ -62,7 +62,7 @@ TestCase { } function test_minimumValue() { - var dial = Qt.createQmlObject('import QtQuick.Extras 1.3; Dial { }', testcase, ''); + var dial = Qt.createQmlObject('import QtQuick.Extras 1.4; Dial { }', testcase, ''); verify (dial, "Dial: failed to create an instance") dial.minimumValue = 5 dial.maximumValue = 10 @@ -73,7 +73,7 @@ TestCase { } function test_maximumValue() { - var dial = Qt.createQmlObject('import QtQuick.Extras 1.3; Dial { }', testcase, ''); + var dial = Qt.createQmlObject('import QtQuick.Extras 1.4; Dial { }', testcase, ''); verify (dial, "Dial: failed to create an instance") dial.minimumValue = 5 dial.maximumValue = 10 @@ -87,7 +87,7 @@ TestCase { var scope = Qt.createQmlObject('import QtQuick 2.2; FocusScope { focus: false }', testcase, '') verify(!scope.activeFocus) - var dial = Qt.createQmlObject('import QtQuick.Extras 1.3; Dial { }', scope, '') + var dial = Qt.createQmlObject('import QtQuick.Extras 1.4; Dial { }', scope, '') verify (dial, "Dial: failed to create an instance") verify(!dial.activeFocusOnPress) verify(!dial.activeFocus) @@ -119,7 +119,7 @@ TestCase { } function test_pressed() { - var dial = Qt.createQmlObject('import QtQuick.Extras 1.3; Dial { }', testcase, '') + var dial = Qt.createQmlObject('import QtQuick.Extras 1.4; Dial { }', testcase, '') verify (dial, "Dial: failed to create an instance") pressSpy.target = dial @@ -143,7 +143,7 @@ TestCase { } function test_hovered() { - var dial = Qt.createQmlObject('import QtQuick.Extras 1.3; Dial { }', testcase, '') + var dial = Qt.createQmlObject('import QtQuick.Extras 1.4; Dial { }', testcase, '') verify (dial, "Dial: failed to create an instance") hoverSpy.target = dial @@ -175,7 +175,7 @@ TestCase { } function test_dragging(data) { - var dial = Qt.createQmlObject('import QtQuick.Extras 1.3; Dial { }', testcase, '') + var dial = Qt.createQmlObject('import QtQuick.Extras 1.4; Dial { }', testcase, '') verify(dial, "Dial: failed to create an instance") dial.minimumValue = data.min dial.maximumValue = data.max @@ -211,7 +211,7 @@ TestCase { } function test_outerRadius() { - var dial = Qt.createQmlObject("import QtQuick.Extras 1.3; Dial { }", testcase, ""); + var dial = Qt.createQmlObject("import QtQuick.Extras 1.4; Dial { }", testcase, ""); verify(dial, "Dial: failed to create an instance"); // Implicit width and height are identical. compare(dial.__style.outerRadius, dial.width / 2); @@ -250,7 +250,7 @@ TestCase { } function test_tickmarksVisible() { - var dial = Qt.createQmlObject("import QtQuick.Extras 1.3; Dial { }", testcase, ""); + var dial = Qt.createQmlObject("import QtQuick.Extras 1.4; Dial { }", testcase, ""); verify(dial, "Dial: failed to create an instance"); dial.__style.minorTickmarkCount = 4; @@ -291,7 +291,7 @@ TestCase { parentEventSpy.target = focusScope; parentEventSpy.signalName = "receivedKeyPress"; - var dial = Qt.createQmlObject("import QtQuick.Extras 1.3; Dial { }", focusScope, ""); + var dial = Qt.createQmlObject("import QtQuick.Extras 1.4; Dial { }", focusScope, ""); verify(dial, "Dial: failed to create an instance"); compare(dial.activeFocusOnTab, true); compare(dial.value, 0); @@ -343,7 +343,7 @@ TestCase { } function test_dragToSet() { - var dial = Qt.createQmlObject("import QtQuick.Extras 1.3; Dial { }", testcase, ""); + var dial = Qt.createQmlObject("import QtQuick.Extras 1.4; Dial { }", testcase, ""); verify(dial, "Dial: failed to create an instance"); dial.__style.__dragToSet = false; diff --git a/tests/auto/extras/data/tst_gauge.qml b/tests/auto/extras/data/tst_gauge.qml index 08fdf53f..ba065232 100644 --- a/tests/auto/extras/data/tst_gauge.qml +++ b/tests/auto/extras/data/tst_gauge.qml @@ -36,7 +36,7 @@ import QtTest 1.0 import QtQuick 2.2 -import QtQuick.Extras.Styles 1.3 +import QtQuick.Controls.Styles 1.4 import "TestUtils.js" as TestUtils TestCase { @@ -69,7 +69,7 @@ TestCase { } function init() { - gauge = Qt.createQmlObject("import QtQuick.Extras 1.3; Gauge { }", testcase, ""); + gauge = Qt.createQmlObject("import QtQuick.Extras 1.4; Gauge { }", testcase, ""); verify(gauge, "Gauge: failed to create an instance"); verify(gauge.__style); } diff --git a/tests/auto/extras/data/tst_picture.qml b/tests/auto/extras/data/tst_picture.qml index bfdcc557..5ddc4406 100644 --- a/tests/auto/extras/data/tst_picture.qml +++ b/tests/auto/extras/data/tst_picture.qml @@ -36,7 +36,7 @@ import QtTest 1.0 import QtQuick 2.4 -import QtQuick.Extras 1.3 +import QtQuick.Extras 1.4 import QtQuick.Extras.Private 1.0 TestCase { @@ -69,7 +69,7 @@ TestCase { } function test_instance() { - picture = Qt.createQmlObject("import QtQuick.Extras 1.3; Picture { }", testCase, ""); + picture = Qt.createQmlObject("import QtQuick.Extras 1.4; Picture { }", testCase, ""); verify(picture, "Picture: failed to create an instance"); } @@ -93,7 +93,7 @@ TestCase { } function test_source(data) { - picture = Qt.createQmlObject("import QtQuick.Extras 1.3; Picture {}", testCase, ""); + picture = Qt.createQmlObject("import QtQuick.Extras 1.4; Picture {}", testCase, ""); verify(picture, "Picture: failed to create an instance"); picture.source = data.tag; picture.width = data.implicitSize.width; @@ -120,14 +120,17 @@ TestCase { } function test_color(data) { - picture = Qt.createQmlObject("import QtQuick.Extras 1.3; Picture {}", testCase, ""); + picture = Qt.createQmlObject("import QtQuick.Extras 1.4; Picture {}", testCase, ""); verify(picture, "Picture: failed to create an instance"); picture.width = pictureDotDatImplicitSize.width; picture.height = pictureDotDatImplicitSize.height; picture.source = "picture.dat"; picture.color = data.color; - waitForRendering(picture); + // For some reason we need two waits here, otherwise the color detected is *sometimes* white instead of black. + // Also, we use an explicit, shorter timeout, otherwise the default (5000 ms) seems to be exhausted. + waitForRendering(picture, 200); + waitForRendering(picture, 200); var pictureImage = grabImage(picture); @@ -144,7 +147,7 @@ TestCase { } function test_size() { - picture = Qt.createQmlObject("import QtQuick.Extras 1.3; Picture {}", testCase, ""); + picture = Qt.createQmlObject("import QtQuick.Extras 1.4; Picture {}", testCase, ""); verify(picture, "Picture: failed to create an instance"); compare(picture.implicitWidth, fontMetrics.height * 4); diff --git a/tests/auto/extras/data/tst_piemenu.qml b/tests/auto/extras/data/tst_piemenu.qml index fa109a1a..d90aebab 100644 --- a/tests/auto/extras/data/tst_piemenu.qml +++ b/tests/auto/extras/data/tst_piemenu.qml @@ -37,7 +37,7 @@ import QtTest 1.0 import QtQuick 2.1 import QtQuick.Controls 1.1 -import QtQuick.Extras 1.3 +import QtQuick.Extras 1.4 import QtQuick.Extras.Private 1.0 import QtQuick.Extras.Private.CppUtils 1.0 @@ -94,7 +94,7 @@ Item { } function test_instance() { - var pieMenu = Qt.createQmlObject("import QtQuick.Extras 1.3; PieMenu { }", container, ""); + var pieMenu = Qt.createQmlObject("import QtQuick.Extras 1.4; PieMenu { }", container, ""); verify(pieMenu, "PieMenu: failed to create an instance"); verify(pieMenu.__style); compare(pieMenu.triggerMode, TriggerMode.TriggerOnClick); diff --git a/tests/auto/extras/data/tst_statusindicator.qml b/tests/auto/extras/data/tst_statusindicator.qml index e9fa6ac9..da38f9fc 100644 --- a/tests/auto/extras/data/tst_statusindicator.qml +++ b/tests/auto/extras/data/tst_statusindicator.qml @@ -36,8 +36,9 @@ import QtTest 1.0 import QtQuick 2.1 -import QtQuick.Extras 1.3 -import QtQuick.Extras.Private 1.0 +import QtQuick.Controls 1.4 +import QtQuick.Controls.Private 1.0 +import QtQuick.Extras 1.4 TestCase { id: testCase @@ -55,13 +56,13 @@ TestCase { } function test_instance() { - indicator = Qt.createQmlObject("import QtQuick.Extras 1.3; StatusIndicator { }", testCase, ""); + indicator = Qt.createQmlObject("import QtQuick.Extras 1.4; StatusIndicator { }", testCase, ""); verify(indicator, "StatusIndicator: failed to create an instance") verify(indicator.__style); } function test_active_data() { - if (StyleSettings.styleName === "Flat") { + if (Settings.styleName === "Flat") { return [ { tag: "active", active: true, expectedColor: { r: 18, g: 136, b: 203 } }, { tag: "inactive", active: false, expectedColor: { r: 179, g: 179, b: 179 } } @@ -75,13 +76,13 @@ TestCase { } function test_active(data) { - indicator = Qt.createQmlObject("import QtQuick.Extras 1.3; StatusIndicator { }", testCase, ""); + indicator = Qt.createQmlObject("import QtQuick.Extras 1.4; StatusIndicator { }", testCase, ""); verify(indicator); compare(indicator.active, false); indicator.active = data.active; // Color is slightly different on some platforms/machines, like Windows. - var lenience = StyleSettings.styleName === "Flat" ? 0 : 2; + var lenience = Settings.styleName === "Flat" ? 0 : 2; waitForRendering(indicator); var image = grabImage(indicator); @@ -91,9 +92,9 @@ TestCase { } function test_color() { - var flatStyle = StyleSettings.styleName === "Flat"; + var flatStyle = Settings.styleName === "Flat"; - indicator = Qt.createQmlObject("import QtQuick.Extras 1.3; StatusIndicator { }", testCase, ""); + indicator = Qt.createQmlObject("import QtQuick.Extras 1.4; StatusIndicator { }", testCase, ""); verify(indicator); compare(indicator.color, flatStyle ? "#1288cb" : "#ff0000"); @@ -113,10 +114,10 @@ TestCase { } function test_baseStyleHasOuterShadow() { - if (StyleSettings.styleName !== "Base") + if (Settings.styleName !== "Base") return; - indicator = Qt.createQmlObject("import QtQuick.Extras 1.3; StatusIndicator { }", testCase, ""); + indicator = Qt.createQmlObject("import QtQuick.Extras 1.4; StatusIndicator { }", testCase, ""); verify(indicator); // There should be a "shadow" here... diff --git a/tests/auto/extras/data/tst_togglebutton.qml b/tests/auto/extras/data/tst_togglebutton.qml index 46b87f93..b68f6ca3 100644 --- a/tests/auto/extras/data/tst_togglebutton.qml +++ b/tests/auto/extras/data/tst_togglebutton.qml @@ -46,7 +46,7 @@ TestCase { height: 400 function test_instance() { - var button = Qt.createQmlObject('import QtQuick.Extras 1.3; ToggleButton { }', testcase, ''); + var button = Qt.createQmlObject('import QtQuick.Extras 1.4; ToggleButton { }', testcase, ''); verify (button, "ToggleButton: failed to create an instance") verify(button.__style) verify(button.checkable) @@ -57,7 +57,7 @@ TestCase { function test_largeText() { // Should be no binding loop warnings. - var button = Qt.createQmlObject("import QtQuick.Extras 1.3; ToggleButton { " + var button = Qt.createQmlObject("import QtQuick.Extras 1.4; ToggleButton { " + "anchors.centerIn: parent; text: 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' }", testcase, ""); verify(button, "ToggleButton: failed to create an instance"); waitForRendering(button); diff --git a/tests/auto/extras/data/tst_tumbler.qml b/tests/auto/extras/data/tst_tumbler.qml index 936269c8..0f1a29fd 100644 --- a/tests/auto/extras/data/tst_tumbler.qml +++ b/tests/auto/extras/data/tst_tumbler.qml @@ -36,9 +36,10 @@ import QtTest 1.0 import QtQuick 2.1 -import QtQuick.Extras 1.3 -import QtQuick.Extras.Styles 1.3 -import QtQuick.Extras.Private 1.0 +import QtQuick.Controls 1.4 +import QtQuick.Controls.Styles 1.4 +import QtQuick.Controls.Private 1.0 +import QtQuick.Extras 1.4 import "TestUtils.js" as TestUtils Item { @@ -75,7 +76,7 @@ Item { } function init() { - tumbler = Qt.createQmlObject("import QtQuick.Extras 1.3; Tumbler { }", container, ""); + tumbler = Qt.createQmlObject("import QtQuick.Extras 1.4; Tumbler { }", container, ""); verify(tumbler, "Tumbler: failed to create an instance"); } @@ -165,7 +166,7 @@ Item { tumbler.getColumn(0).visible = false; verify(!tumbler.__viewAt(0).visible); - if (StyleSettings.styleName === "Base") + if (Settings.styleName === "Base") verify(!tumbler.__viewAt(0).parent.separator.visible); } @@ -243,7 +244,7 @@ Item { // Somehow it works with the Base style. It could be rewritten to use an // equal amount of items for the model and visibleItemCount, judging from // the snippet in QTBUG-40298. - if (StyleSettings.styleName === "Flat") + if (Settings.styleName === "Flat") skip("Not a valid test case as the model count is less than the visibleItemCount"); tumbler.height = 120; @@ -308,7 +309,7 @@ Item { var pos = Qt.point(columnXCenter(0), tumbler.__style.padding.top); mouseDrag(tumbler, pos.x, pos.y, 0, tumbler.height - tumbler.__style.padding.bottom, Qt.LeftButton, Qt.NoModifier, 300); - tryCompare(tumbler.__viewAt(0), "offset", StyleSettings.styleName === "Flat" ? 6.0 : 4.0); + tryCompare(tumbler.__viewAt(0), "offset", Settings.styleName === "Flat" ? 6.0 : 4.0); tumbler.height += 100; var padding = tumbler.__style.padding; diff --git a/tests/benchmarks/statusindicator/LotsOfIndicatorsActive.qml b/tests/benchmarks/statusindicator/LotsOfIndicatorsActive.qml index ff8424f2..6e515334 100644 --- a/tests/benchmarks/statusindicator/LotsOfIndicatorsActive.qml +++ b/tests/benchmarks/statusindicator/LotsOfIndicatorsActive.qml @@ -35,7 +35,7 @@ ****************************************************************************/ import QtQuick 2.2 -import QtQuick.Extras 1.3 +import QtQuick.Extras 1.4 Rectangle { id: root diff --git a/tests/benchmarks/statusindicator/LotsOfIndicatorsInactive.qml b/tests/benchmarks/statusindicator/LotsOfIndicatorsInactive.qml index dd5a19a2..fe0f5424 100644 --- a/tests/benchmarks/statusindicator/LotsOfIndicatorsInactive.qml +++ b/tests/benchmarks/statusindicator/LotsOfIndicatorsInactive.qml @@ -35,7 +35,7 @@ ****************************************************************************/ import QtQuick 2.2 -import QtQuick.Extras 1.3 +import QtQuick.Extras 1.4 Rectangle { id: root -- cgit v1.2.1