From 9064de5692c83139aa3730ac6f8684c9402ae5db Mon Sep 17 00:00:00 2001 From: Andrew den Exter Date: Mon, 28 May 2012 16:38:35 +1000 Subject: Fix scaling of svgz images. Force scaling of svgz images to source size as is done for svg. This also removes a work around for QTBUG-9053 which has now been resolved. Task-number: QTBUG-9053 Change-Id: I3aa898f74960ceb2e515bdb3aa44aa5a1a7a64d2 Reviewed-by: Yann Bodson --- tests/auto/quick/qquickimage/data/heart.svgz | Bin 0 -> 1505 bytes tests/auto/quick/qquickimage/tst_qquickimage.cpp | 18 +++++++++++++++--- 2 files changed, 15 insertions(+), 3 deletions(-) create mode 100644 tests/auto/quick/qquickimage/data/heart.svgz (limited to 'tests/auto/quick/qquickimage') diff --git a/tests/auto/quick/qquickimage/data/heart.svgz b/tests/auto/quick/qquickimage/data/heart.svgz new file mode 100644 index 0000000000..c1cb1109fa Binary files /dev/null and b/tests/auto/quick/qquickimage/data/heart.svgz differ diff --git a/tests/auto/quick/qquickimage/tst_qquickimage.cpp b/tests/auto/quick/qquickimage/tst_qquickimage.cpp index aa64490162..5e55793d36 100644 --- a/tests/auto/quick/qquickimage/tst_qquickimage.cpp +++ b/tests/auto/quick/qquickimage/tst_qquickimage.cpp @@ -84,6 +84,7 @@ private slots: void smooth(); void mirror(); void svg(); + void svg_data(); void geometry(); void geometry_data(); void big(); @@ -144,7 +145,8 @@ void tst_qquickimage::imageSource_data() QTest::newRow("remote redirected") << SERVER_ADDR "/oldcolors.png" << 120.0 << 120.0 << true << false << false << ""; if (QImageReader::supportedImageFormats().contains("svg")) QTest::newRow("remote svg") << SERVER_ADDR "/heart.svg" << 550.0 << 500.0 << true << false << false << ""; - + if (QImageReader::supportedImageFormats().contains("svgz")) + QTest::newRow("remote svgz") << SERVER_ADDR "/heart.svgz" << 550.0 << 500.0 << true << false << false << ""; QTest::newRow("remote not found") << SERVER_ADDR "/no-such-file.png" << 0.0 << 0.0 << true << false << true << "file::2:1: QML Image: Error downloading " SERVER_ADDR "/no-such-file.png - server replied: Not found"; @@ -359,12 +361,22 @@ void tst_qquickimage::mirror() } } +void tst_qquickimage::svg_data() +{ + QTest::addColumn("src"); + QTest::addColumn("format"); + + QTest::newRow("svg") << testFileUrl("heart.svg").toString() << QByteArray("svg"); + QTest::newRow("svgz") << testFileUrl("heart.svgz").toString() << QByteArray("svgz"); +} + void tst_qquickimage::svg() { - if (!QImageReader::supportedImageFormats().contains("svg")) + QFETCH(QString, src); + QFETCH(QByteArray, format); + if (!QImageReader::supportedImageFormats().contains(format)) QSKIP("svg support not available"); - QString src = testFileUrl("heart.svg").toString(); QString componentStr = "import QtQuick 2.0\nImage { source: \"" + src + "\"; sourceSize.width: 300; sourceSize.height: 300 }"; QQmlComponent component(&engine); component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); -- cgit v1.2.3