aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/quick/qquickimage
diff options
context:
space:
mode:
authorEirik Aavitsland <eirik.aavitsland@qt.io>2018-02-07 15:12:57 +0100
committerEirik Aavitsland <eirik.aavitsland@qt.io>2018-02-13 09:07:54 +0000
commit25a2270e42192affe5a14582f29ae3e861c93e15 (patch)
treeac5659c9555496c8daa8e98a323034b0495c791b /tests/auto/quick/qquickimage
parent22d43f74e264626d0c28654c42c91839f9de45b5 (diff)
Fix: Make Image element support detection of suitable file extension
If the source is a non-existent local file or resource, then instead of giving up directly, check if there exists a file/resource with the same name and a known supported image/texture file extension (suffix). [ChangeLog][QtQuick][Image] Support detection of suitable file extension Task-number: QTBUG-66127 Change-Id: I4c0edb639017e8707eed8e532ba55d29917751cb Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'tests/auto/quick/qquickimage')
-rw-r--r--tests/auto/quick/qquickimage/data/pattern.pkmbin0 -> 2064 bytes
-rw-r--r--tests/auto/quick/qquickimage/tst_qquickimage.cpp8
2 files changed, 8 insertions, 0 deletions
diff --git a/tests/auto/quick/qquickimage/data/pattern.pkm b/tests/auto/quick/qquickimage/data/pattern.pkm
new file mode 100644
index 0000000000..d986e89b2d
--- /dev/null
+++ b/tests/auto/quick/qquickimage/data/pattern.pkm
Binary files differ
diff --git a/tests/auto/quick/qquickimage/tst_qquickimage.cpp b/tests/auto/quick/qquickimage/tst_qquickimage.cpp
index 256e667980..f458bdcf5b 100644
--- a/tests/auto/quick/qquickimage/tst_qquickimage.cpp
+++ b/tests/auto/quick/qquickimage/tst_qquickimage.cpp
@@ -152,6 +152,14 @@ void tst_qquickimage::imageSource_data()
QTest::newRow("remote svgz") << "/heart.svgz" << 595.0 << 841.0 << true << false << false << "";
QTest::newRow("remote not found") << "/no-such-file.png" << 0.0 << 0.0 << true
<< false << true << "<Unknown File>:2:1: QML Image: Error transferring {{ServerBaseUrl}}/no-such-file.png - server replied: Not found";
+ QTest::newRow("extless") << testFileUrl("colors").toString() << 120.0 << 120.0 << false << false << true << "";
+ QTest::newRow("extless no cache") << testFileUrl("colors").toString() << 120.0 << 120.0 << false << false << false << "";
+ QTest::newRow("extless async") << testFileUrl("colors1").toString() << 120.0 << 120.0 << false << true << true << "";
+ QTest::newRow("extless not found") << testFileUrl("no-such-file").toString() << 0.0 << 0.0 << false
+ << false << true << "<Unknown File>:2:1: QML Image: Cannot open: " + testFileUrl("no-such-file").toString();
+ // Test that pkm is preferred over png. As pattern.pkm has different size than pattern.png, these tests verify that the right file has been loaded
+ QTest::newRow("extless prefer-tex") << testFileUrl("pattern").toString() << 64.0 << 64.0 << false << false << true << "";
+ QTest::newRow("extless prefer-tex async") << testFileUrl("pattern").toString() << 64.0 << 64.0 << false << true << true << "";
}