Merge lp:~saviq/unity8/lazyimage-crop into lp:unity8

Proposed by Michał Sawicz
Status: Work in progress
Proposed branch: lp:~saviq/unity8/lazyimage-crop
Merge into: lp:unity8
Diff against target: 123 lines (+37/-9)
2 files modified
qml/Components/LazyImage.qml (+6/-6)
tests/qmltests/Components/tst_LazyImage.qml (+31/-3)
To merge this branch: bzr merge lp:~saviq/unity8/lazyimage-crop
Reviewer Review Type Date Requested Status
PS Jenkins bot (community) continuous-integration Needs Fixing
Michael Zanetti Pending
Review via email: mp+203897@code.launchpad.net

Commit message

Add crop mode to LazyImage.

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :

FAILED: Continuous integration, rev:663
http://jenkins.qa.ubuntu.com/job/unity8-ci/2168/
Executed test runs:
    UNSTABLE: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-trusty/2739
    FAILURE: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-trusty-touch/2503/console
    UNSTABLE: http://jenkins.qa.ubuntu.com/job/unity-phablet-qmluitests-trusty/1041
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-trusty-amd64-ci/690
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-trusty-armhf-ci/692
        deb: http://jenkins.qa.ubuntu.com/job/unity8-trusty-armhf-ci/692/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-trusty-i386-ci/690
    UNSTABLE: http://jenkins.qa.ubuntu.com/job/autopilot-testrunner-otto-trusty/2398
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-amd64/2741
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-amd64/2741/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-armhf/2504
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-armhf/2504/artifact/work/output/*zip*/output.zip
    FAILURE: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-runner-mako/4938/console
    SUCCESS: http://s-jenkins.ubuntu-ci:8080/job/touch-flash-device/3471

Click here to trigger a rebuild:
http://s-jenkins.ubuntu-ci:8080/job/unity8-ci/2168/rebuild

review: Needs Fixing (continuous-integration)

Unmerged revisions

663. By Michał Sawicz

Add crop mode to LazyImage.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'qml/Components/LazyImage.qml'
--- qml/Components/LazyImage.qml 2013-10-14 22:13:48 +0000
+++ qml/Components/LazyImage.qml 2014-01-30 09:21:51 +0000
@@ -27,8 +27,8 @@
27 // TODO convert into enums when available in QML27 // TODO convert into enums when available in QML
28 property string scaleTo28 property string scaleTo
2929
30 property real initialWidth: scaleTo == "width" || scaleTo == "fit" ? width : units.gu(10)30 property real initialWidth: scaleTo == "width" || scaleTo == "fit" || scaleTo == "crop" ? width : units.gu(10)
31 property real initialHeight: scaleTo == "height" || scaleTo == "fit" ? height : units.gu(10)31 property real initialHeight: scaleTo == "height" || scaleTo == "fit" || scaleTo == "crop" ? height : units.gu(10)
3232
33 property alias sourceSize: image.sourceSize33 property alias sourceSize: image.sourceSize
34 property alias fillMode: image.fillMode34 property alias fillMode: image.fillMode
@@ -93,7 +93,7 @@
93 property url nextSource93 property url nextSource
94 property string format: image.implicitWidth > image.implicitHeight ? "landscape" : "portrait"94 property string format: image.implicitWidth > image.implicitHeight ? "landscape" : "portrait"
9595
96 fillMode: Image.PreserveAspectFit96 fillMode: root.scaleTo == "crop" ? Image.PreserveAspectCrop : Image.PreserveAspectFit
97 asynchronous: true97 asynchronous: true
98 cache: false98 cache: false
99 horizontalAlignment: Image.AlignHCenter99 horizontalAlignment: Image.AlignHCenter
@@ -126,9 +126,9 @@
126 PropertyChanges { target: root; implicitWidth: shape.width; implicitHeight: shape.height }126 PropertyChanges { target: root; implicitWidth: shape.width; implicitHeight: shape.height }
127 PropertyChanges { target: placeholder; opacity: 0 }127 PropertyChanges { target: placeholder; opacity: 0 }
128 PropertyChanges { target: shape; opacity: 1128 PropertyChanges { target: shape; opacity: 1
129 width: root.scaleTo == "width" || (root.scaleTo == "fit" && image.format == "landscape") ? root.width129 width: root.scaleTo == "width" || root.scaleTo == "crop" || (root.scaleTo == "fit" && image.format == "landscape") ? root.width
130 : root.scaleTo == "" ? image.implicitWidth : image.implicitWidth * height / image.implicitHeight130 : root.scaleTo == "" ? image.implicitWidth : image.implicitWidth * height / image.implicitHeight
131 height: root.scaleTo == "height" || (root.scaleTo == "fit" && image.format == "portrait") ? root.height131 height: root.scaleTo == "height" || root.scaleTo == "crop" || (root.scaleTo == "fit" && image.format == "portrait") ? root.height
132 : root.scaleTo == "" ? image.implicitHeight : image.implicitHeight * width / image.implicitWidth132 : root.scaleTo == "" ? image.implicitHeight : image.implicitHeight * width / image.implicitWidth
133 }133 }
134 },134 },
135135
=== modified file 'tests/qmltests/Components/tst_LazyImage.qml'
--- tests/qmltests/Components/tst_LazyImage.qml 2013-12-17 16:04:47 +0000
+++ tests/qmltests/Components/tst_LazyImage.qml 2014-01-30 09:21:51 +0000
@@ -27,15 +27,21 @@
2727
28 Rectangle {28 Rectangle {
29 id: baseRect29 id: baseRect
30 color: "grey"
31 anchors.fill: parent
32 }
33
34 Flickable {
30 anchors {35 anchors {
31 fill: parent36 fill: parent
37 margins: units.gu(3)
32 rightMargin: 2 * parent.width / 338 rightMargin: 2 * parent.width / 3
33 }39 }
3440
35 color: "grey"41 contentHeight: column.height
3642
37 Column {43 Column {
38 anchors { fill: parent; margins: units.gu(5) }44 id: column
3945
40 Label {46 Label {
41 height: units.gu(4)47 height: units.gu(4)
@@ -87,6 +93,20 @@
87 width: units.gu(12)93 width: units.gu(12)
88 scaleTo: "fit"94 scaleTo: "fit"
89 }95 }
96
97 Label {
98 height: units.gu(4)
99 text: "Crop"
100 color: "white"
101 verticalAlignment: Text.AlignBottom
102 }
103
104 LazyImage {
105 id: lazy5
106 height: units.gu(12)
107 width: units.gu(12)
108 scaleTo: "crop"
109 }
90 }110 }
91 }111 }
92112
@@ -109,6 +129,7 @@
109 ImageControls { id: controls2; image: lazy2 }129 ImageControls { id: controls2; image: lazy2 }
110 ImageControls { id: controls3; image: lazy3 }130 ImageControls { id: controls3; image: lazy3 }
111 ImageControls { id: controls4; image: lazy4 }131 ImageControls { id: controls4; image: lazy4 }
132 ImageControls { id: controls5; image: lazy5 }
112 }133 }
113 }134 }
114135
@@ -123,6 +144,8 @@
123 tryCompare(lazy2, "height", units.gu(10));144 tryCompare(lazy2, "height", units.gu(10));
124 controls3.blank();145 controls3.blank();
125 tryCompare(lazy3, "width", units.gu(10));146 tryCompare(lazy3, "width", units.gu(10));
147 controls4.blank();
148 controls5.blank();
126 }149 }
127150
128 function test_lazyimage_data() {151 function test_lazyimage_data() {
@@ -147,6 +170,11 @@
147 {tag: "Fit Square", image: lazy4, func: controls4.square, transition: "readyTransition", width: units.gu(12), height: units.gu(12), imageWidth: units.gu(12), imageHeight: units.gu(12), initialWidth: units.gu(12), initialHeight: units.gu(12)},170 {tag: "Fit Square", image: lazy4, func: controls4.square, transition: "readyTransition", width: units.gu(12), height: units.gu(12), imageWidth: units.gu(12), imageHeight: units.gu(12), initialWidth: units.gu(12), initialHeight: units.gu(12)},
148 {tag: "Fit Portrait", image: lazy4, func: controls4.portrait, transition: "readyTransition", width: units.gu(12), height: units.gu(12), imageWidth: units.gu(6), imageHeight: units.gu(12), initialWidth: units.gu(12), initialHeight: units.gu(12)},171 {tag: "Fit Portrait", image: lazy4, func: controls4.portrait, transition: "readyTransition", width: units.gu(12), height: units.gu(12), imageWidth: units.gu(6), imageHeight: units.gu(12), initialWidth: units.gu(12), initialHeight: units.gu(12)},
149 {tag: "Fit Bad path", image: lazy4, func: controls4.badpath, transition: "genericTransition", width: units.gu(12), height: units.gu(12), imageWidth: units.gu(12), imageHeight: units.gu(12), initialWidth: units.gu(12), initialHeight: units.gu(12), placeholder: true, error: true},172 {tag: "Fit Bad path", image: lazy4, func: controls4.badpath, transition: "genericTransition", width: units.gu(12), height: units.gu(12), imageWidth: units.gu(12), imageHeight: units.gu(12), initialWidth: units.gu(12), initialHeight: units.gu(12), placeholder: true, error: true},
173 {tag: "Crop Blank", image: lazy5, func: controls5.blank, width: units.gu(12), height: units.gu(12), imageWidth: units.gu(12), imageHeight: units.gu(12), initialWidth: units.gu(12), initialHeight: units.gu(12), placeholder: true},
174 {tag: "Crop Wide", image: lazy5, func: controls5.wide, width: units.gu(12), height: units.gu(12), imageWidth: units.gu(12), imageHeight: units.gu(12), initialWidth: units.gu(12), initialHeight: units.gu(12)},
175 {tag: "Crop Square", image: lazy5, func: controls5.square, width: units.gu(12), height: units.gu(12), imageWidth: units.gu(12), imageHeight: units.gu(12), initialWidth: units.gu(12), initialHeight: units.gu(12)},
176 {tag: "Crop Portrait", image: lazy5, func: controls5.portrait, width: units.gu(12), height: units.gu(12), imageWidth: units.gu(12), imageHeight: units.gu(12), initialWidth: units.gu(12), initialHeight: units.gu(12)},
177 {tag: "Crop Bad path", image: lazy5, func: controls5.badpath, width: units.gu(12), height: units.gu(12), imageWidth: units.gu(12), imageHeight: units.gu(12), initialWidth: units.gu(12), initialHeight: units.gu(12), placeholder: true, error: true},
150 ]178 ]
151 }179 }
152180
@@ -175,7 +203,7 @@
175203
176 // check the placeholder204 // check the placeholder
177 var placeholder = findChild(data.image, "placeholder");205 var placeholder = findChild(data.image, "placeholder");
178 compare(placeholder.visible, data.placeholder ? true : false);206 tryCompare(placeholder, "visible", data.placeholder ? true : false);
179207
180 // check the error image208 // check the error image
181 var error = findChild(data.image, "errorImage");209 var error = findChild(data.image, "errorImage");

Subscribers

People subscribed via source and target branches