diff options
author | Liang Qi <liang.qi@qt.io> | 2016-05-10 21:11:23 +0200 |
---|---|---|
committer | Liang Qi <liang.qi@qt.io> | 2016-05-10 21:11:23 +0200 |
commit | c6713e212ef0b97c45d6466b73220567e94a05f1 (patch) | |
tree | 8774d26bf05f2087c510d16da42bfd0dc59a54b1 /tests/auto | |
parent | ce97d9c8ef4e6f8cb2166065b6732cad3cccf604 (diff) | |
parent | 0e00f9fa1cbdbdd2128f2ca31172d88f701ecb59 (diff) | |
download | qtquickcontrols-c6713e212ef0b97c45d6466b73220567e94a05f1.tar.gz |
Merge remote-tracking branch 'origin/5.6' into 5.7
Conflicts:
examples/quickcontrols/extras/flat/main.cpp
src/controls/Private/qquickcontrolsettings.cpp
Change-Id: I9eb9342a2ee994611f3cb18daab6dd89eb924ccc
Diffstat (limited to 'tests/auto')
-rw-r--r-- | tests/auto/controls/data/tst_treeview.qml | 1 | ||||
-rw-r--r-- | tests/auto/dialogs/data/DialogImplicitSize.qml | 60 | ||||
-rw-r--r-- | tests/auto/dialogs/data/DialogMinimumSize.qml | 63 | ||||
-rw-r--r-- | tests/auto/dialogs/dialogs.pro | 2 | ||||
-rw-r--r-- | tests/auto/dialogs/tst_dialogs.cpp | 61 | ||||
-rw-r--r-- | tests/auto/extras/data/tst_circulartickmarklabel.qml | 2 | ||||
-rw-r--r-- | tests/auto/extras/data/tst_common.qml | 19 | ||||
-rw-r--r-- | tests/auto/extras/data/tst_delaybutton.qml | 2 | ||||
-rw-r--r-- | tests/auto/extras/data/tst_dial.qml | 12 | ||||
-rw-r--r-- | tests/auto/extras/data/tst_gauge.qml | 4 | ||||
-rw-r--r-- | tests/auto/extras/data/tst_picture.qml | 2 | ||||
-rw-r--r-- | tests/auto/extras/data/tst_statusindicator.qml | 2 | ||||
-rw-r--r-- | tests/auto/extras/data/tst_togglebutton.qml | 2 | ||||
-rw-r--r-- | tests/auto/testplugin/testplugin.h | 2 | ||||
-rw-r--r-- | tests/auto/testplugin/testplugin.pro | 9 |
15 files changed, 221 insertions, 22 deletions
diff --git a/tests/auto/controls/data/tst_treeview.qml b/tests/auto/controls/data/tst_treeview.qml index c6d4935b..dad10a6b 100644 --- a/tests/auto/controls/data/tst_treeview.qml +++ b/tests/auto/controls/data/tst_treeview.qml @@ -761,6 +761,7 @@ Item { } function test_indexAt() { + skip("Fails because of bug QTBUG-47523") if (Settings.hasTouchScreen) skip("Fails with touch screens"); var component = Qt.createComponent("treeview/treeview_1.qml") diff --git a/tests/auto/dialogs/data/DialogImplicitSize.qml b/tests/auto/dialogs/data/DialogImplicitSize.qml new file mode 100644 index 00000000..8239c451 --- /dev/null +++ b/tests/auto/dialogs/data/DialogImplicitSize.qml @@ -0,0 +1,60 @@ +/**************************************************************************** +** +** 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:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of The Qt Company Ltd nor the names of its +** contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.3 +import QtQuick.Controls 1.2 +import QtQuick.Dialogs 1.2 + +Dialog { + visible: true + title: "Blue sky dialog" + standardButtons: buttonsFromTest + + Rectangle { + color: "lightskyblue" + implicitWidth: 400 + implicitHeight: 150 + Text { + text: "Hello blue sky!" + color: "navy" + anchors.centerIn: parent + } + } +} diff --git a/tests/auto/dialogs/data/DialogMinimumSize.qml b/tests/auto/dialogs/data/DialogMinimumSize.qml new file mode 100644 index 00000000..7f5baa63 --- /dev/null +++ b/tests/auto/dialogs/data/DialogMinimumSize.qml @@ -0,0 +1,63 @@ +/**************************************************************************** +** +** 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:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of The Qt Company Ltd nor the names of its +** contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.3 +import QtQuick.Controls 1.2 +import QtQuick.Dialogs 1.2 + +Dialog { + visible: true + title: "Blue sky dialog" + width: 400 + height: 300 + + Rectangle { + objectName: "userContent" + anchors.fill: parent + implicitWidth: 10 + implicitHeight: 10 + color: "lightskyblue" + Text { + text: "Hello blue sky!" + color: "navy" + anchors.centerIn: parent + } + } +} diff --git a/tests/auto/dialogs/dialogs.pro b/tests/auto/dialogs/dialogs.pro index d8e15dea..bb47b496 100644 --- a/tests/auto/dialogs/dialogs.pro +++ b/tests/auto/dialogs/dialogs.pro @@ -2,6 +2,8 @@ CONFIG += testcase TARGET = tst_dialogs SOURCES += tst_dialogs.cpp +INCLUDEPATH += $$PWD/../../../src/dialogs + include (../shared/util.pri) osx:CONFIG -= app_bundle diff --git a/tests/auto/dialogs/tst_dialogs.cpp b/tests/auto/dialogs/tst_dialogs.cpp index afe4ca0d..1f139966 100644 --- a/tests/auto/dialogs/tst_dialogs.cpp +++ b/tests/auto/dialogs/tst_dialogs.cpp @@ -28,6 +28,10 @@ #include <qtest.h> #include "../shared/util.h" +#include "qquickabstractdialog_p.h" +#include <QtQml/QQmlComponent> +#include <QtQml/QQmlContext> +#include <QtQml/QQmlEngine> #include <QtQuick/QQuickItem> #include <QtQuick/QQuickView> #include <QSignalSpy> @@ -43,6 +47,11 @@ private slots: QQmlDataTest::initTestCase(); } + //Dialog + void dialogImplicitWidth_data(); + void dialogImplicitWidth(); + void dialogContentResize(); + // FileDialog void fileDialogDefaultModality(); void fileDialogNonModal(); @@ -51,6 +60,58 @@ private slots: private: }; +void tst_dialogs::dialogImplicitWidth_data() +{ + QTest::addColumn<int>("standardButtons"); + QTest::addColumn<int>("minimumHeight"); + + QTest::newRow("No buttons") << + int(QQuickAbstractDialog::NoButton) << + 150; + QTest::newRow("OK button") << + int(QQuickAbstractDialog::Ok) << + 160; +} + +void tst_dialogs::dialogImplicitWidth() +{ + QFETCH(int, standardButtons); + QFETCH(int, minimumHeight); + + /* This is the outerSpacing from DefaultDialogWrapper.qml, + * which is always present */ + int heightMargins = 12 * 2; + QQmlEngine engine; + engine.rootContext()->setContextProperty("buttonsFromTest", standardButtons); + QQmlComponent component(&engine); + component.loadUrl(testFileUrl("DialogImplicitSize.qml")); + QObject *created = component.create(); + QScopedPointer<QObject> cleanup(created); + QVERIFY(created); + + QTRY_VERIFY(created->property("width").toInt() >= 400); + QTRY_VERIFY(created->property("height").toInt() >= minimumHeight + heightMargins); +} + +void tst_dialogs::dialogContentResize() +{ + QQmlEngine engine; + QQmlComponent component(&engine); + component.loadUrl(testFileUrl("DialogMinimumSize.qml")); + QObject *created = component.create(); + QScopedPointer<QObject> cleanup(created); + QVERIFY(created); + + QTRY_COMPARE(created->property("width").toInt(), 400); + QTRY_COMPARE(created->property("height").toInt(), 300); + + // Check that the content item has been sized up from its implicit size + QQuickItem *userContent = created->findChild<QQuickItem*>("userContent"); + QVERIFY(userContent); + QVERIFY(userContent->width() > 350); + QVERIFY(userContent->height() > 200); +} + void tst_dialogs::fileDialogDefaultModality() { QQuickView *window = new QQuickView; diff --git a/tests/auto/extras/data/tst_circulartickmarklabel.qml b/tests/auto/extras/data/tst_circulartickmarklabel.qml index ecf4f661..deddc9b7 100644 --- a/tests/auto/extras/data/tst_circulartickmarklabel.qml +++ b/tests/auto/extras/data/tst_circulartickmarklabel.qml @@ -55,7 +55,7 @@ import "TestUtils.js" as TestUtils TestCase { id: testcase name: "Tests_CircularTickmarkLabel" - visible: windowShown + visible: true when: windowShown width: 400 height: 400 diff --git a/tests/auto/extras/data/tst_common.qml b/tests/auto/extras/data/tst_common.qml index 3a2d3fc1..dc554735 100644 --- a/tests/auto/extras/data/tst_common.qml +++ b/tests/auto/extras/data/tst_common.qml @@ -54,7 +54,7 @@ import QtQuick 2.1 TestCase { id: testCase name: "Tests_Common" - visible: windowShown + visible: true when: windowShown width: 400 height: 400 @@ -67,23 +67,29 @@ TestCase { { tag: "DelayButton" }, { tag: "Dial" }, { tag: "Gauge" }, - { 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.4; Tumbler { TumblerColumn { model: 10 } }" } + { tag: "Tumbler", qml: "import QtQuick.Extras 1.4; Tumbler { TumblerColumn { model: 10 } }" }, + { tag: "PieMenu", qml: "import QtQuick.Controls 1.1; import QtQuick.Extras 1.4;" + + "PieMenu { visible: true; MenuItem { text: 'foo' } }"} ]; } + function init() { + if (Qt.platform.os === "windows") + skip("QTBUG-53123"); + } + function cleanup() { - control.destroy(); + if (control) + control.destroy(); } function test_resize(data) { 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, ""); + var resizeAnimation = Qt.createQmlObject("import QtQuick 2.2; NumberAnimation {}", control, ""); resizeAnimation.target = control; resizeAnimation.properties = "width,height"; resizeAnimation.duration = 100; @@ -91,6 +97,5 @@ TestCase { resizeAnimation.start(); // Shouldn't get any warnings. tryCompare(resizeAnimation, "running", false); - resizeAnimation.destroy(); } } diff --git a/tests/auto/extras/data/tst_delaybutton.qml b/tests/auto/extras/data/tst_delaybutton.qml index fc7d90ff..5475037e 100644 --- a/tests/auto/extras/data/tst_delaybutton.qml +++ b/tests/auto/extras/data/tst_delaybutton.qml @@ -54,7 +54,7 @@ import QtQuick 2.1 TestCase { id: testcase name: "Tests_DelayButton" - visible: windowShown + visible: true when: windowShown width: 400 height: 400 diff --git a/tests/auto/extras/data/tst_dial.qml b/tests/auto/extras/data/tst_dial.qml index f9c23dad..a519eb5b 100644 --- a/tests/auto/extras/data/tst_dial.qml +++ b/tests/auto/extras/data/tst_dial.qml @@ -55,7 +55,7 @@ import "TestUtils.js" as TestUtils TestCase { id: testcase name: "Tests_Dial" - visible: windowShown + visible: true when: windowShown width: 400 height: 400 @@ -378,4 +378,14 @@ TestCase { dial.destroy(); } + + function test_valueToAngle() { + var dial = Qt.createQmlObject("import QtQuick.Extras 1.4; Dial { }", testcase, ""); + verify(dial, "Dial: failed to create an instance"); + + compare(dial.__style.valueToAngle(0.0), dial.__panel.circularTickmarkLabel.minimumValueAngle); + compare(dial.__style.valueToAngle(1.0), dial.__panel.circularTickmarkLabel.maximumValueAngle); + + dial.destroy(); + } } diff --git a/tests/auto/extras/data/tst_gauge.qml b/tests/auto/extras/data/tst_gauge.qml index 7258dcd6..6fdd6be6 100644 --- a/tests/auto/extras/data/tst_gauge.qml +++ b/tests/auto/extras/data/tst_gauge.qml @@ -56,9 +56,9 @@ import "TestUtils.js" as TestUtils TestCase { id: testcase name: "Tests_Gauge" - visible: windowShown + visible: true when: windowShown - width: 60 + width: 200 height: 200 property var gauge diff --git a/tests/auto/extras/data/tst_picture.qml b/tests/auto/extras/data/tst_picture.qml index 115be774..e11d28fb 100644 --- a/tests/auto/extras/data/tst_picture.qml +++ b/tests/auto/extras/data/tst_picture.qml @@ -56,7 +56,7 @@ import QtQuick.Extras.Private 1.0 TestCase { id: testCase name: "Tests_Picture" - visible: windowShown + visible: true when: windowShown width: 400 height: 400 diff --git a/tests/auto/extras/data/tst_statusindicator.qml b/tests/auto/extras/data/tst_statusindicator.qml index f1621a87..257ec715 100644 --- a/tests/auto/extras/data/tst_statusindicator.qml +++ b/tests/auto/extras/data/tst_statusindicator.qml @@ -57,7 +57,7 @@ import QtQuick.Extras 1.4 TestCase { id: testCase name: "Tests_StatusIndicator" - visible: windowShown + visible: true when: windowShown width: 400 height: 400 diff --git a/tests/auto/extras/data/tst_togglebutton.qml b/tests/auto/extras/data/tst_togglebutton.qml index 4b887c83..8fd62515 100644 --- a/tests/auto/extras/data/tst_togglebutton.qml +++ b/tests/auto/extras/data/tst_togglebutton.qml @@ -54,7 +54,7 @@ import QtQuick 2.1 TestCase { id: testcase name: "Tests_ToggleButton" - visible: windowShown + visible: true when: windowShown width: 400 height: 400 diff --git a/tests/auto/testplugin/testplugin.h b/tests/auto/testplugin/testplugin.h index 8f310372..05ce0765 100644 --- a/tests/auto/testplugin/testplugin.h +++ b/tests/auto/testplugin/testplugin.h @@ -35,7 +35,7 @@ class TestPlugin : public QQmlExtensionPlugin { Q_OBJECT - Q_PLUGIN_METADATA(IID "org.qt-project.playground.qtquickcontrols.QQmlExtensionInterface" FILE "testplugin.json") + Q_PLUGIN_METADATA(IID QQmlExtensionInterface_iid FILE "testplugin.json") public: void registerTypes(const char *uri); void initializeEngine(QQmlEngine *engine, const char *uri); diff --git a/tests/auto/testplugin/testplugin.pro b/tests/auto/testplugin/testplugin.pro index dfdd1a81..7e16087a 100644 --- a/tests/auto/testplugin/testplugin.pro +++ b/tests/auto/testplugin/testplugin.pro @@ -29,10 +29,7 @@ DESTDIR = $$TARGETPATH !equals(PWD, $$OUT_PWD) { # move qmldir alongside the plugin if shadow build - qmldirfile.input = QMLDIR - qmldirfile.output = $$DESTDIR/qmldir - qmldirfile.variable_out = PRE_TARGETDEPS - qmldirfile.commands = $$QMAKE_COPY ${QMAKE_FILE_IN} ${QMAKE_FILE_OUT} - qmldirfile.CONFIG = no_link no_clean - QMAKE_EXTRA_COMPILERS += qmldirfile + qmldirfile.files = $$QMLDIR + qmldirfile.path = $$DESTDIR + COPIES += qmldirfile } |