aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/quick
diff options
context:
space:
mode:
authorAndy Shaw <andy.shaw@qt.io>2018-02-20 06:36:59 +0100
committerAndy Shaw <andy.shaw@qt.io>2018-02-21 10:33:52 +0000
commit602a6589a1c8d52a3a1d9075528bc16d6e527818 (patch)
treedf57b9847f20dd70e001dba0647dc880d11973f2 /tests/auto/quick
parent15416b1ffc6ce83a11bfe5d05e97ecdc45d3411c (diff)
Image: respect aspect ratio of an SVG when width or height is zero
This amends f42f1366dcd4b070c69c9e7fe42a704ef23da14d Task-number: QTBUG-65789 Change-Id: I1db05259f0aeb3310bbaf5ea03be52cbd243d115 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Diffstat (limited to 'tests/auto/quick')
-rw-r--r--tests/auto/quick/qquickimage/tst_qquickimage.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/tests/auto/quick/qquickimage/tst_qquickimage.cpp b/tests/auto/quick/qquickimage/tst_qquickimage.cpp
index 783e4aab4c..ec0ec6c2b6 100644
--- a/tests/auto/quick/qquickimage/tst_qquickimage.cpp
+++ b/tests/auto/quick/qquickimage/tst_qquickimage.cpp
@@ -418,6 +418,11 @@ void tst_qquickimage::svg()
QCOMPARE(obj->width(), 200.0);
QCOMPARE(obj->height(), 200.0);
+ obj->setSourceSize(QSize(100,0));
+ QCOMPARE(obj->width(), 100.0);
+ // Due to aspect ratio calculations we can't get a precise
+ // check for all setups, so we allow a small margin of error
+ QVERIFY(qAbs(obj->height() - 141) < 1);
delete obj;
}