aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto
diff options
context:
space:
mode:
authorJ-P Nurmi <jpnurmi@qt.io>2016-10-25 21:21:53 +0200
committerJ-P Nurmi <jpnurmi@qt.io>2016-10-25 21:27:02 +0200
commiteb9bde6d803b1b46ff3bd63fd1a6b40758cd7f4f (patch)
tree267db1fcbd31d5d2b0202b1dc4463037ff9227aa /tests/auto
parent1d8bf6d1f4ef0aa84ca7e4c1233bedeee0f606f9 (diff)
parent791d521a3008695f834d5aa8c9bb61f9075b37a8 (diff)
Merge remote-tracking branch 'origin/5.8' into dev
Diffstat (limited to 'tests/auto')
-rw-r--r--tests/auto/controls/data/tst_dialog.qml79
-rw-r--r--tests/auto/controls/data/tst_page.qml100
-rw-r--r--tests/auto/controls/data/tst_swipedelegate.qml8
-rw-r--r--tests/auto/qquickstyle/qquickstyle.pro1
-rw-r--r--tests/auto/qquickstyle/tst_qquickstyle.cpp27
-rw-r--r--tests/auto/qquickstyleselector/data/Control.qml2
-rw-r--r--tests/auto/qquickstyleselector/data/FallbackStyle/Button.qml2
-rw-r--r--tests/auto/qquickstyleselector/data/FallbackStyle/Label.qml2
-rw-r--r--tests/auto/qquickstyleselector/data/Label.qml2
-rw-r--r--tests/auto/qquickstyleselector/tst_qquickstyleselector.cpp75
10 files changed, 287 insertions, 11 deletions
diff --git a/tests/auto/controls/data/tst_dialog.qml b/tests/auto/controls/data/tst_dialog.qml
index 44c6e1b8..d4cbc222 100644
--- a/tests/auto/controls/data/tst_dialog.qml
+++ b/tests/auto/controls/data/tst_dialog.qml
@@ -215,4 +215,83 @@ TestCase {
control.destroy()
}
+
+ function test_layout() {
+ var control = dialog.createObject(testCase, {width: 100, height: 100})
+ verify(control)
+
+ control.open()
+ waitForRendering(control.contentItem)
+ verify(control.visible)
+
+ compare(control.width, 100)
+ compare(control.height, 100)
+ compare(control.contentItem.width, control.availableWidth)
+ compare(control.contentItem.height, control.availableHeight)
+
+ control.header = buttonBox.createObject(control.contentItem)
+ compare(control.header.width, control.width)
+ verify(control.header.height > 0)
+ compare(control.contentItem.width, control.availableWidth)
+ compare(control.contentItem.height, control.availableHeight - control.header.height)
+
+ control.footer = buttonBox.createObject(control.contentItem)
+ compare(control.footer.width, control.width)
+ verify(control.footer.height > 0)
+ compare(control.contentItem.width, control.availableWidth)
+ compare(control.contentItem.height, control.availableHeight - control.header.height - control.footer.height)
+
+ control.topPadding = 9
+ control.leftPadding = 2
+ control.rightPadding = 6
+ control.bottomPadding = 7
+
+ compare(control.header.x, 0)
+ compare(control.header.y, 0)
+ compare(control.header.width, control.width)
+ verify(control.header.height > 0)
+
+ compare(control.footer.x, 0)
+ compare(control.footer.y, control.height - control.footer.height)
+ compare(control.footer.width, control.width)
+ verify(control.footer.height > 0)
+
+ compare(control.contentItem.x, control.leftPadding)
+ compare(control.contentItem.y, control.topPadding + control.header.height)
+ compare(control.contentItem.width, control.availableWidth)
+ compare(control.contentItem.height, control.availableHeight - control.header.height - control.footer.height)
+
+ control.header.visible = false
+ compare(control.contentItem.x, control.leftPadding)
+ compare(control.contentItem.y, control.topPadding)
+ compare(control.contentItem.width, control.availableWidth)
+ compare(control.contentItem.height, control.availableHeight - control.footer.height)
+
+ control.footer.visible = false
+ compare(control.contentItem.x, control.leftPadding)
+ compare(control.contentItem.y, control.topPadding)
+ compare(control.contentItem.width, control.availableWidth)
+ compare(control.contentItem.height, control.availableHeight)
+
+ control.contentItem.implicitWidth = 50
+ control.contentItem.implicitHeight = 60
+ compare(control.implicitWidth, control.contentItem.implicitWidth + control.leftPadding + control.rightPadding)
+ compare(control.implicitHeight, control.contentItem.implicitHeight + control.topPadding + control.bottomPadding)
+
+ control.header.visible = true
+ compare(control.implicitHeight, control.contentItem.implicitHeight + control.topPadding + control.bottomPadding
+ + control.header.implicitHeight)
+
+ control.footer.visible = true
+ compare(control.implicitHeight, control.contentItem.implicitHeight + control.topPadding + control.bottomPadding
+ + control.header.implicitHeight + control.footer.implicitHeight)
+
+ control.header.implicitWidth = 150
+ compare(control.implicitWidth, control.header.implicitWidth)
+
+ control.footer.implicitWidth = 160
+ compare(control.implicitWidth, control.footer.implicitWidth)
+
+ control.destroy()
+ }
}
diff --git a/tests/auto/controls/data/tst_page.qml b/tests/auto/controls/data/tst_page.qml
index 3cd6b7b8..a1cdbf8e 100644
--- a/tests/auto/controls/data/tst_page.qml
+++ b/tests/auto/controls/data/tst_page.qml
@@ -56,6 +56,40 @@ TestCase {
}
Component {
+ id: oneChildPage
+ Page {
+ Item {
+ implicitWidth: 100
+ implicitHeight: 30
+ }
+ }
+ }
+
+ Component {
+ id: twoChildrenPage
+ Page {
+ Item {
+ implicitWidth: 100
+ implicitHeight: 30
+ }
+ Item {
+ implicitWidth: 200
+ implicitHeight: 60
+ }
+ }
+ }
+
+ Component {
+ id: contentPage
+ Page {
+ contentItem: Item {
+ implicitWidth: 100
+ implicitHeight: 30
+ }
+ }
+ }
+
+ Component {
id: toolBar
ToolBar { }
}
@@ -71,6 +105,53 @@ TestCase {
control.destroy()
}
+ function test_empty() {
+ var control = page.createObject(testCase)
+ verify(control)
+
+ verify(control.contentItem)
+ compare(control.contentWidth, 0)
+ compare(control.contentHeight, 0)
+
+ control.destroy()
+ }
+
+ function test_oneChild() {
+ var control = oneChildPage.createObject(testCase)
+ verify(control)
+
+ compare(control.contentWidth, 100)
+ compare(control.contentHeight, 30)
+ compare(control.implicitWidth, 100 + control.leftPadding + control.rightPadding)
+ compare(control.implicitHeight, 30 + control.topPadding + control.bottomPadding)
+
+ control.destroy()
+ }
+
+ function test_twoChildren() {
+ var control = twoChildrenPage.createObject(testCase)
+ verify(control)
+
+ compare(control.contentWidth, 0)
+ compare(control.contentHeight, 0)
+ compare(control.implicitWidth, control.leftPadding + control.rightPadding)
+ compare(control.implicitHeight, control.topPadding + control.bottomPadding)
+
+ control.destroy()
+ }
+
+ function test_contentItem() {
+ var control = contentPage.createObject(testCase)
+ verify(control)
+
+ compare(control.contentWidth, 100)
+ compare(control.contentHeight, 30)
+ compare(control.implicitWidth, 100 + control.leftPadding + control.rightPadding)
+ compare(control.implicitHeight, 30 + control.topPadding + control.bottomPadding)
+
+ control.destroy()
+ }
+
function test_layout() {
var control = page.createObject(testCase, {width: 100, height: 100})
verify(control)
@@ -124,6 +205,25 @@ TestCase {
compare(control.contentItem.width, control.availableWidth)
compare(control.contentItem.height, control.availableHeight)
+ control.contentItem.implicitWidth = 50
+ control.contentItem.implicitHeight = 60
+ compare(control.implicitWidth, control.contentItem.implicitWidth + control.leftPadding + control.rightPadding)
+ compare(control.implicitHeight, control.contentItem.implicitHeight + control.topPadding + control.bottomPadding)
+
+ control.header.visible = true
+ compare(control.implicitHeight, control.contentItem.implicitHeight + control.topPadding + control.bottomPadding
+ + control.header.implicitHeight + control.spacing)
+
+ control.footer.visible = true
+ compare(control.implicitHeight, control.contentItem.implicitHeight + control.topPadding + control.bottomPadding
+ + control.header.implicitHeight + control.footer.implicitHeight + 2 * control.spacing)
+
+ control.header.implicitWidth = 150
+ compare(control.implicitWidth, control.header.implicitWidth + control.leftPadding + control.rightPadding)
+
+ control.footer.implicitWidth = 160
+ compare(control.implicitWidth, control.footer.implicitWidth + control.leftPadding + control.rightPadding)
+
control.destroy()
}
}
diff --git a/tests/auto/controls/data/tst_swipedelegate.qml b/tests/auto/controls/data/tst_swipedelegate.qml
index d30ade48..bcf25f28 100644
--- a/tests/auto/controls/data/tst_swipedelegate.qml
+++ b/tests/auto/controls/data/tst_swipedelegate.qml
@@ -311,7 +311,7 @@ TestCase {
var control = swipeDelegateComponent.createObject(testCase);
verify(control);
- var overDragDistance = dragDistance * 1.1;
+ var overDragDistance = Math.round(dragDistance * 1.1);
var completedSpy = signalSpyComponent.createObject(control, { target: control.swipe, signalName: "completed" });
verify(completedSpy);
@@ -456,7 +456,7 @@ TestCase {
var control = swipeDelegateComponent.createObject(testCase);
verify(control);
- var distance = dragDistance * 1.1;
+ var distance = Math.round(dragDistance * 1.1);
if (distance >= control.width / 2)
skip("This test requires a startDragDistance that is less than half the width of the control");
@@ -881,7 +881,7 @@ TestCase {
control.swipe.left = smallLeftComponent;
// Ensure that the position is scaled to the width of the currently visible delegate.
- var overDragDistance = dragDistance * 1.1;
+ var overDragDistance = Math.round(dragDistance * 1.1);
mousePress(control, control.width / 2, control.height / 2, Qt.LeftButton);
mouseMove(control, control.width / 2 + overDragDistance, control.height / 2, Qt.LeftButton);
verify(control.swipe.leftItem);
@@ -940,7 +940,7 @@ TestCase {
mousePress(control, control.swipe.leftItem.width, control.height / 2, Qt.LeftButton);
compare(leftVisibleSpy.count, 0);
compare(rightVisibleSpy.count, 0);
- var newX = control.swipe.leftItem.width - dragDistance * 1.1;
+ var newX = control.swipe.leftItem.width - Math.round(dragDistance * 1.1);
mouseMove(control, newX, control.height / 2, Qt.LeftButton, Qt.LeftButton);
compare(leftVisibleSpy.count, 0);
compare(rightVisibleSpy.count, 0);
diff --git a/tests/auto/qquickstyle/qquickstyle.pro b/tests/auto/qquickstyle/qquickstyle.pro
index b6173c1b..5514685a 100644
--- a/tests/auto/qquickstyle/qquickstyle.pro
+++ b/tests/auto/qquickstyle/qquickstyle.pro
@@ -5,3 +5,4 @@ SOURCES += tst_qquickstyle.cpp
osx:CONFIG -= app_bundle
QT += quickcontrols2 testlib
+QT_PRIVATE += core-private gui-private quickcontrols2-private
diff --git a/tests/auto/qquickstyle/tst_qquickstyle.cpp b/tests/auto/qquickstyle/tst_qquickstyle.cpp
index 11ff58e7..15edc67b 100644
--- a/tests/auto/qquickstyle/tst_qquickstyle.cpp
+++ b/tests/auto/qquickstyle/tst_qquickstyle.cpp
@@ -38,15 +38,28 @@
#include <QtQml/qqmlengine.h>
#include <QtQml/qqmlcomponent.h>
#include <QtQuickControls2/qquickstyle.h>
+#include <QtQuickControls2/private/qquickstyle_p.h>
+#include <QtGui/private/qguiapplication_p.h>
class tst_QQuickStyle : public QObject
{
Q_OBJECT
private slots:
+ void init();
void lookup();
+ void commandLineArgument();
+ void environmentVariables();
};
+void tst_QQuickStyle::init()
+{
+ QQuickStylePrivate::reset();
+ QGuiApplicationPrivate::styleOverride.clear();
+ qunsetenv("QT_QUICK_CONTROLS_STYLE");
+ qunsetenv("QT_QUICK_CONTROLS_FALLBACK_STYLE");
+}
+
void tst_QQuickStyle::lookup()
{
QVERIFY(QQuickStyle::name().isEmpty());
@@ -67,6 +80,20 @@ void tst_QQuickStyle::lookup()
QVERIFY(!QQuickStyle::path().isEmpty());
}
+void tst_QQuickStyle::commandLineArgument()
+{
+ QGuiApplicationPrivate::styleOverride = "CmdLineArgStyle";
+ QCOMPARE(QQuickStyle::name(), QString("CmdLineArgStyle"));
+}
+
+void tst_QQuickStyle::environmentVariables()
+{
+ qputenv("QT_QUICK_CONTROLS_STYLE", "EnvVarStyle");
+ qputenv("QT_QUICK_CONTROLS_FALLBACK_STYLE", "EnvVarFallbackStyle");
+ QCOMPARE(QQuickStyle::name(), QString("EnvVarStyle"));
+ QCOMPARE(QQuickStylePrivate::fallbackStyle(), QString("EnvVarFallbackStyle"));
+}
+
QTEST_MAIN(tst_QQuickStyle)
#include "tst_qquickstyle.moc"
diff --git a/tests/auto/qquickstyleselector/data/Control.qml b/tests/auto/qquickstyleselector/data/Control.qml
new file mode 100644
index 00000000..697662f6
--- /dev/null
+++ b/tests/auto/qquickstyleselector/data/Control.qml
@@ -0,0 +1,2 @@
+import QtQuick.Templates 2.1 as T
+T.Control { }
diff --git a/tests/auto/qquickstyleselector/data/FallbackStyle/Button.qml b/tests/auto/qquickstyleselector/data/FallbackStyle/Button.qml
new file mode 100644
index 00000000..ee17c230
--- /dev/null
+++ b/tests/auto/qquickstyleselector/data/FallbackStyle/Button.qml
@@ -0,0 +1,2 @@
+import QtQuick.Templates 2.1 as T
+T.Button { }
diff --git a/tests/auto/qquickstyleselector/data/FallbackStyle/Label.qml b/tests/auto/qquickstyleselector/data/FallbackStyle/Label.qml
new file mode 100644
index 00000000..8879d93f
--- /dev/null
+++ b/tests/auto/qquickstyleselector/data/FallbackStyle/Label.qml
@@ -0,0 +1,2 @@
+import QtQuick.Templates 2.1 as T
+T.Label { }
diff --git a/tests/auto/qquickstyleselector/data/Label.qml b/tests/auto/qquickstyleselector/data/Label.qml
new file mode 100644
index 00000000..8879d93f
--- /dev/null
+++ b/tests/auto/qquickstyleselector/data/Label.qml
@@ -0,0 +1,2 @@
+import QtQuick.Templates 2.1 as T
+T.Label { }
diff --git a/tests/auto/qquickstyleselector/tst_qquickstyleselector.cpp b/tests/auto/qquickstyleselector/tst_qquickstyleselector.cpp
index 6c2aebe4..1e7d7add 100644
--- a/tests/auto/qquickstyleselector/tst_qquickstyleselector.cpp
+++ b/tests/auto/qquickstyleselector/tst_qquickstyleselector.cpp
@@ -36,6 +36,7 @@
#include <QtTest/qtest.h>
#include <QtQuickControls2/qquickstyle.h>
+#include <QtQuickControls2/private/qquickstyle_p.h>
#include <QtQuickControls2/private/qquickstyleselector_p.h>
#include "../shared/util.h"
@@ -44,24 +45,82 @@ class tst_QQuickStyleSelector : public QQmlDataTest
Q_OBJECT
private slots:
+ void initTestCase();
+
void select_data();
void select();
};
+void tst_QQuickStyleSelector::initTestCase()
+{
+ QQmlDataTest::initTestCase();
+ QQuickStylePrivate::init(dataDirectoryUrl());
+}
+
void tst_QQuickStyleSelector::select_data()
{
QTest::addColumn<QString>("file");
QTest::addColumn<QString>("style");
QTest::addColumn<QString>("path");
+ QTest::addColumn<QString>("fallback");
QTest::addColumn<QString>("expected");
- QTest::newRow("empty") << "Button.qml" << "" << dataDirectory() << testFileUrl("Button.qml").toString();
- QTest::newRow("no such dir") << "Button.qml" << "Foo" << dataDirectory() << testFileUrl("Button.qml").toString();
- QTest::newRow("no such file") << "Foo.qml" << "FileSystemStyle" << dataDirectory() << testFileUrl("Foo.qml").toString();
- QTest::newRow("relative/path/to/FileSystemStyle") << "Button.qml" << "FileSystemStyle" << "data" << testFileUrl("FileSystemStyle/Button.qml").toString();
- QTest::newRow("/absolute/path/to/FileSystemStyle") << "Button.qml" << "FileSystemStyle" << dataDirectory() << testFileUrl("FileSystemStyle/Button.qml").toString();
- QTest::newRow(":/ResourceStyle") << "Button.qml" << "ResourceStyle" << ":/" << "qrc:/ResourceStyle/Button.qml";
- QTest::newRow("qrc:/ResourceStyle") << "Button.qml" << "ResourceStyle" << "qrc:/" << "qrc:/ResourceStyle/Button.qml";
+ // Control.qml exists only in the default style
+ QTest::newRow("control") << "Control.qml" << "" << "data" << "" << testFileUrl("Control.qml").toString();
+ QTest::newRow("/control") << "Control.qml" << "" << dataDirectory() << "" << testFileUrl("Control.qml").toString();
+ QTest::newRow("fs/control") << "Control.qml" << "FileSystemStyle" << "data" << "" << testFileUrl("Control.qml").toString();
+ QTest::newRow("/fs/control") << "Control.qml" << "FileSystemStyle" << dataDirectory() << "" << testFileUrl("Control.qml").toString();
+ QTest::newRow(":/control") << "Control.qml" << "ResourceStyle" << ":/" << "" << testFileUrl("Control.qml").toString();
+ QTest::newRow("qrc:/control") << "Control.qml" << "ResourceStyle" << "qrc:/" << "" << testFileUrl("Control.qml").toString();
+ QTest::newRow("nosuch/control") << "Control.qml" << "NoSuchStyle" << "data" << "" << testFileUrl("Control.qml").toString();
+ QTest::newRow("/nosuch/control") << "Control.qml" << "NoSuchStyle" << dataDirectory() << "" << testFileUrl("Control.qml").toString();
+
+ QTest::newRow("control->base") << "Control.qml" << "" << "data" << "FallbackStyle" << testFileUrl("Control.qml").toString();
+ QTest::newRow("/control->base") << "Control.qml" << "" << dataDirectory() << "FallbackStyle" << testFileUrl("Control.qml").toString();
+ QTest::newRow("fs/control->base") << "Control.qml" << "FileSystemStyle" << "data" << "FallbackStyle" << testFileUrl("Control.qml").toString();
+ QTest::newRow("/fs/control->base") << "Control.qml" << "FileSystemStyle" << dataDirectory() << "FallbackStyle" << testFileUrl("Control.qml").toString();
+ QTest::newRow(":/control->base") << "Control.qml" << "ResourceStyle" << ":/" << "FallbackStyle" << testFileUrl("Control.qml").toString();
+ QTest::newRow("qrc:/control->base") << "Control.qml" << "ResourceStyle" << "qrc:/" << "FallbackStyle" << testFileUrl("Control.qml").toString();
+ QTest::newRow("nosuch/control->base") << "Control.qml" << "NoSuchStyle" << "data" << "FallbackStyle" << testFileUrl("Control.qml").toString();
+ QTest::newRow("/nosuch/control->base") << "Control.qml" << "NoSuchStyle" << dataDirectory() << "FallbackStyle" << testFileUrl("Control.qml").toString();
+
+ // Label.qml exists in the default and fallback styles
+ QTest::newRow("label") << "Label.qml" << "" << "data" << "" << testFileUrl("Label.qml").toString();
+ QTest::newRow("/label") << "Label.qml" << "" << dataDirectory() << "" << testFileUrl("Label.qml").toString();
+ QTest::newRow("fs/label") << "Label.qml" << "FileSystemStyle" << "data" << "" << testFileUrl("Label.qml").toString();
+ QTest::newRow("/fs/label") << "Label.qml" << "FileSystemStyle" << dataDirectory() << "" << testFileUrl("Label.qml").toString();
+ QTest::newRow(":/label") << "Label.qml" << "ResourceStyle" << ":/" << "" << testFileUrl("Label.qml").toString();
+ QTest::newRow("qrc:/label") << "Label.qml" << "ResourceStyle" << "qrc:/" << "" << testFileUrl("Label.qml").toString();
+ QTest::newRow("nosuch/label") << "Label.qml" << "NoSuchStyle" << "data" << "" << testFileUrl("Label.qml").toString();
+ QTest::newRow("/nosuch/label") << "Label.qml" << "NoSuchStyle" << dataDirectory() << "" << testFileUrl("Label.qml").toString();
+
+ QTest::newRow("label->base") << "Label.qml" << "" << "data" << "FallbackStyle" << testFileUrl("FallbackStyle/Label.qml").toString();
+ QTest::newRow("/label->base") << "Label.qml" << "" << dataDirectory() << "FallbackStyle" << testFileUrl("Label.qml").toString();
+ QTest::newRow("fs/label->base") << "Label.qml" << "FileSystemStyle" << "data" << "FallbackStyle" << testFileUrl("FallbackStyle/Label.qml").toString();
+ QTest::newRow("/fs/label->base") << "Label.qml" << "FileSystemStyle" << dataDirectory() << "FallbackStyle" << testFileUrl("FallbackStyle/Label.qml").toString();
+ QTest::newRow(":/label->base") << "Label.qml" << "ResourceStyle" << ":/" << "FallbackStyle" << testFileUrl("FallbackStyle/Label.qml").toString();
+ QTest::newRow("qrc:/label->base") << "Label.qml" << "ResourceStyle" << "qrc:/" << "FallbackStyle" << testFileUrl("FallbackStyle/Label.qml").toString();
+ QTest::newRow("nosuch/label->base") << "Label.qml" << "NoSuchStyle" << "data" << "FallbackStyle" << testFileUrl("FallbackStyle/Label.qml").toString();
+ QTest::newRow("/nosuch/label->base") << "Label.qml" << "NoSuchStyle" << dataDirectory() << "FallbackStyle" << testFileUrl("FallbackStyle/Label.qml").toString();
+
+ // Button.qml exists in all styles including the fs and qrc styles
+ QTest::newRow("button") << "Button.qml" << "" << "data" << "" << testFileUrl("Button.qml").toString();
+ QTest::newRow("/button") << "Button.qml" << "" << dataDirectory() << "" << testFileUrl("Button.qml").toString();
+ QTest::newRow("fs/button") << "Button.qml" << "FileSystemStyle" << "data" << "" << testFileUrl("FileSystemStyle/Button.qml").toString();
+ QTest::newRow("/fs/button") << "Button.qml" << "FileSystemStyle" << dataDirectory() << "" << testFileUrl("FileSystemStyle/Button.qml").toString();
+ QTest::newRow(":/button") << "Button.qml" << "ResourceStyle" << ":/" << "" << "qrc:/ResourceStyle/Button.qml";
+ QTest::newRow("qrc:/button") << "Button.qml" << "ResourceStyle" << "qrc:/" << "" << "qrc:/ResourceStyle/Button.qml";
+ QTest::newRow("nosuch/button") << "Button.qml" << "NoSuchStyle" << "data" << "" << testFileUrl("Button.qml").toString();
+ QTest::newRow("/nosuch/button") << "Button.qml" << "NoSuchStyle" << dataDirectory() << "" << testFileUrl("Button.qml").toString();
+
+ QTest::newRow("button->base") << "Button.qml" << "" << "data" << "FallbackStyle" << testFileUrl("FallbackStyle/Button.qml").toString();
+ QTest::newRow("/button->base") << "Button.qml" << "" << dataDirectory() << "FallbackStyle" << testFileUrl("Button.qml").toString();
+ QTest::newRow("fs/button->base") << "Button.qml" << "FileSystemStyle" << "data" << "FallbackStyle" << testFileUrl("FileSystemStyle/Button.qml").toString();
+ QTest::newRow("/fs/button->base") << "Button.qml" << "FileSystemStyle" << dataDirectory() << "FallbackStyle" << testFileUrl("FileSystemStyle/Button.qml").toString();
+ QTest::newRow(":/button->base") << "Button.qml" << "ResourceStyle" << ":/" << "FallbackStyle" << "qrc:/ResourceStyle/Button.qml";
+ QTest::newRow("qrc:/button->base") << "Button.qml" << "ResourceStyle" << "qrc:/" << "FallbackStyle" << "qrc:/ResourceStyle/Button.qml";
+ QTest::newRow("nosuch/button->base") << "Button.qml" << "NoSuchStyle" << "data" << "FallbackStyle" << testFileUrl("FallbackStyle/Button.qml").toString();
+ QTest::newRow("/nosuch/button->base") << "Button.qml" << "NoSuchStyle" << dataDirectory() << "FallbackStyle" << testFileUrl("FallbackStyle/Button.qml").toString();
}
void tst_QQuickStyleSelector::select()
@@ -69,9 +128,11 @@ void tst_QQuickStyleSelector::select()
QFETCH(QString, file);
QFETCH(QString, style);
QFETCH(QString, path);
+ QFETCH(QString, fallback);
QFETCH(QString, expected);
QQuickStyle::setStyle(QDir(path).filePath(style));
+ QQuickStyle::setFallbackStyle(fallback);
QQuickStyleSelector selector;
selector.setBaseUrl(dataDirectoryUrl());