Merge lp:~mzanetti/unity8/fix-lazyImage1-test into lp:~paulliu/unity8/fix-lazyimage1

Proposed by Michael Zanetti
Status: Merged
Merged at revision: 776
Proposed branch: lp:~mzanetti/unity8/fix-lazyImage1-test
Merge into: lp:~paulliu/unity8/fix-lazyimage1
Diff against target: 33 lines (+8/-2)
2 files modified
qml/Components/LazyImage.qml (+2/-2)
tests/qmltests/Components/tst_LazyImage.qml (+6/-0)
To merge this branch: bzr merge lp:~mzanetti/unity8/fix-lazyImage1-test
Reviewer Review Type Date Requested Status
Unity Team Pending
Review via email: mp+212131@code.launchpad.net

This proposal supersedes a proposal from 2014-03-21.

Commit message

add a test for the lazyImage sourceSize fix by Paul

To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'qml/Components/LazyImage.qml'
2--- qml/Components/LazyImage.qml 2014-03-19 13:45:01 +0000
3+++ qml/Components/LazyImage.qml 2014-03-21 10:51:01 +0000
4@@ -99,10 +99,10 @@
5 horizontalAlignment: Image.AlignHCenter
6 verticalAlignment: Image.AlignVCenter
7 sourceSize.width: root.scaleTo == "width" ? root.width
8- : root.scaleTo == "fit" && root.width < root.height ? root.width
9+ : root.scaleTo == "fit" && root.width <= root.height ? root.width
10 : 0
11 sourceSize.height: root.scaleTo == "height" ? root.height
12- : root.scaleTo == "fit" && root.height < root.width ? root.height
13+ : root.scaleTo == "fit" && root.height <= root.width ? root.height
14 : 0
15 }
16 }
17
18=== modified file 'tests/qmltests/Components/tst_LazyImage.qml'
19--- tests/qmltests/Components/tst_LazyImage.qml 2014-02-28 15:15:31 +0000
20+++ tests/qmltests/Components/tst_LazyImage.qml 2014-03-21 10:51:01 +0000
21@@ -168,6 +168,12 @@
22 compare(data.image.initialHeight, data.initialHeight);
23 compare(data.image.initialWidth, data.initialWidth);
24
25+ // check the sourceSize
26+ var sourceHeight = (data.image.scaleTo === "height" || (data.image.scaleTo === "fit" && data.height <= data.width)) ? data.height : 0
27+ var sourceWidth = (data.image.scaleTo === "width" || (data.image.scaleTo === "fit" && data.width <= data.height)) ? data.width : 0
28+ compare(data.image.sourceSize.height, sourceHeight);
29+ compare(data.image.sourceSize.width, sourceWidth);
30+
31 // check the shape dimensions
32 var shape = findChild(data.image, "shape");
33 compare(shape.width, data.imageWidth);

Subscribers

People subscribed via source and target branches

to all changes: