aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/qml/qqmlfileselector
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/qml/qqmlfileselector')
-rw-r--r--tests/auto/qml/qqmlfileselector/data/qmldirtest/main.qml13
-rw-r--r--tests/auto/qml/qqmlfileselector/data/qmldirtest/qml/+linux/MyButton.qml7
-rw-r--r--tests/auto/qml/qqmlfileselector/data/qmldirtest/qml/+macos/MyButton.qml7
-rw-r--r--tests/auto/qml/qqmlfileselector/data/qmldirtest/qml/MyButton.qml7
-rw-r--r--tests/auto/qml/qqmlfileselector/data/qmldirtest/qmldir5
-rw-r--r--tests/auto/qml/qqmlfileselector/tst_qqmlfileselector.cpp19
6 files changed, 57 insertions, 1 deletions
diff --git a/tests/auto/qml/qqmlfileselector/data/qmldirtest/main.qml b/tests/auto/qml/qqmlfileselector/data/qmldirtest/main.qml
new file mode 100644
index 0000000000..d6dd2c9b90
--- /dev/null
+++ b/tests/auto/qml/qqmlfileselector/data/qmldirtest/main.qml
@@ -0,0 +1,13 @@
+import QtQuick
+import qmldirtest
+
+Window {
+ width: 640
+ height: 480
+ visible: true
+ property color color: mybutton.color
+
+ MyButton {
+ id: mybutton
+ }
+}
diff --git a/tests/auto/qml/qqmlfileselector/data/qmldirtest/qml/+linux/MyButton.qml b/tests/auto/qml/qqmlfileselector/data/qmldirtest/qml/+linux/MyButton.qml
new file mode 100644
index 0000000000..cc6eb967da
--- /dev/null
+++ b/tests/auto/qml/qqmlfileselector/data/qmldirtest/qml/+linux/MyButton.qml
@@ -0,0 +1,7 @@
+import QtQuick
+
+Rectangle {
+ width: 300
+ height: 50
+ color: "blue"
+}
diff --git a/tests/auto/qml/qqmlfileselector/data/qmldirtest/qml/+macos/MyButton.qml b/tests/auto/qml/qqmlfileselector/data/qmldirtest/qml/+macos/MyButton.qml
new file mode 100644
index 0000000000..5bf632c48d
--- /dev/null
+++ b/tests/auto/qml/qqmlfileselector/data/qmldirtest/qml/+macos/MyButton.qml
@@ -0,0 +1,7 @@
+import QtQuick
+
+Rectangle {
+ width: 300
+ height: 50
+ color: "yellow"
+}
diff --git a/tests/auto/qml/qqmlfileselector/data/qmldirtest/qml/MyButton.qml b/tests/auto/qml/qqmlfileselector/data/qmldirtest/qml/MyButton.qml
new file mode 100644
index 0000000000..32db428c4f
--- /dev/null
+++ b/tests/auto/qml/qqmlfileselector/data/qmldirtest/qml/MyButton.qml
@@ -0,0 +1,7 @@
+import QtQuick
+
+Rectangle {
+ width: 300
+ height: 50
+ color: "green"
+}
diff --git a/tests/auto/qml/qqmlfileselector/data/qmldirtest/qmldir b/tests/auto/qml/qqmlfileselector/data/qmldirtest/qmldir
new file mode 100644
index 0000000000..ac68d9097d
--- /dev/null
+++ b/tests/auto/qml/qqmlfileselector/data/qmldirtest/qmldir
@@ -0,0 +1,5 @@
+module qmldirtest
+MyButton 1.0 qml/MyButton.qml
+MyButton 1.0 qml/+linux/MyButton.qml
+MyButton 1.0 qml/+macos/MyButton.qml
+
diff --git a/tests/auto/qml/qqmlfileselector/tst_qqmlfileselector.cpp b/tests/auto/qml/qqmlfileselector/tst_qqmlfileselector.cpp
index 4c99bcf9c8..fe55d8b056 100644
--- a/tests/auto/qml/qqmlfileselector/tst_qqmlfileselector.cpp
+++ b/tests/auto/qml/qqmlfileselector/tst_qqmlfileselector.cpp
@@ -47,7 +47,7 @@ private slots:
void basicTest();
void basicTestCached();
void applicationEngineTest();
-
+ void qmldirCompatibility();
};
void tst_qqmlfileselector::basicTest()
@@ -95,6 +95,23 @@ void tst_qqmlfileselector::applicationEngineTest()
QCOMPARE(object->property("value").toString(), QString("selected"));
}
+void tst_qqmlfileselector::qmldirCompatibility()
+{
+ QQmlApplicationEngine engine;
+ engine.addImportPath(dataDirectory());
+ engine.load(testFileUrl("qmldirtest/main.qml"));
+ QVERIFY(!engine.rootObjects().isEmpty());
+ QObject *object = engine.rootObjects().at(0);
+ auto color = object->property("color").value<QColor>();
+#if defined(Q_OS_LINUX) && !defined(Q_OS_ANDROID)
+ QCOMPARE(color, QColorConstants::Svg::blue);
+#elif defined(Q_OS_DARWIN)
+ QCOMPARE(color, QColorConstants::Svg::yellow);
+#else
+ QCOMPARE(color, QColorConstants::Svg::green);
+#endif
+}
+
QTEST_MAIN(tst_qqmlfileselector)
#include "tst_qqmlfileselector.moc"