Merge lp:~aacid/unity8/clickScopeForceArtShapeSize into lp:unity8

Proposed by Albert Astals Cid
Status: Superseded
Proposed branch: lp:~aacid/unity8/clickScopeForceArtShapeSize
Merge into: lp:unity8
Diff against target: 371 lines (+37/-63)
18 files modified
plugins/Dash/CardCreator.js (+2/-8)
qml/Dash/CardTool.qml (+1/-1)
qml/Dash/GenericScopeView.qml (+4/-0)
tests/plugins/Dash/cardcreator/1.res (+4/-10)
tests/plugins/Dash/cardcreator/1.tst (+1/-1)
tests/plugins/Dash/cardcreator/2.tst (+1/-1)
tests/plugins/Dash/cardcreator/3.res (+4/-10)
tests/plugins/Dash/cardcreator/3.tst (+1/-1)
tests/plugins/Dash/cardcreator/4.tst (+1/-1)
tests/plugins/Dash/cardcreator/5.res (+6/-12)
tests/plugins/Dash/cardcreator/5.tst (+1/-1)
tests/plugins/Dash/cardcreator/6.res (+2/-8)
tests/plugins/Dash/cardcreator/6.tst (+1/-1)
tests/plugins/Dash/cardcreator/7.res (+1/-1)
tests/plugins/Dash/cardcreator/7.tst (+1/-1)
tests/qmltests/Dash/CardHelpers.js (+1/-2)
tests/qmltests/Dash/tst_Card.qml (+3/-3)
tests/qmltests/Dash/tst_GenericScopeView.qml (+2/-1)
To merge this branch: bzr merge lp:~aacid/unity8/clickScopeForceArtShapeSize
Reviewer Review Type Date Requested Status
PS Jenkins bot (community) continuous-integration Needs Fixing
Unity Team Pending
Review via email: mp+228505@code.launchpad.net

This proposal has been superseded by a proposal from 2014-08-05.

Commit message

Hardcode art shape size for click scope local and predefined categories

While at it, drop the fillmode of cards

Description of the change

* Are there any related MPs required for this MP to build/function as expected?
https://code.launchpad.net/~unity-team/unity-scopes-shell/drop-fill-mode/+merge/228492

 * Did you perform an exploratory manual test run of your code change and any related functionality?
Yes

 * Did you make sure that your branch does not contain spurious tags?
Yes

 * If you changed the packaging (debian), did you subscribe the ubuntu-unity team to this MP?
N/A

 * If you changed the UI, has there been a design review?
N/A

To post a comment you must log in.
1088. By Albert Astals Cid

Fix creator expected code

1089. By Albert Astals Cid

We don't support fill-mode anymore

1090. By Albert Astals Cid

spacing

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
1091. By Albert Astals Cid

More stable tests

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
1092. By Albert Astals Cid

Merge

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
1093. By Albert Astals Cid

Merge

1094. By Albert Astals Cid

Merge again

1095. By Albert Astals Cid

Pass the test

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
1096. By Albert Astals Cid

Merge

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
1097. By Albert Astals Cid

The comment was upsetting people

Unmerged revisions

1097. By Albert Astals Cid

The comment was upsetting people

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'plugins/Dash/CardCreator.js'
--- plugins/Dash/CardCreator.js 2014-07-28 09:28:50 +0000
+++ plugins/Dash/CardCreator.js 2014-08-05 18:01:59 +0000
@@ -71,19 +71,14 @@
71 visible: image.status == Image.Ready; \n\71 visible: image.status == Image.Ready; \n\
72 readonly property real fixedArtShapeSizeAspect: (root.fixedArtShapeSize.height > 0 && root.fixedArtShapeSize.width > 0) ? root.fixedArtShapeSize.width / root.fixedArtShapeSize.height : -1; \n\72 readonly property real fixedArtShapeSizeAspect: (root.fixedArtShapeSize.height > 0 && root.fixedArtShapeSize.width > 0) ? root.fixedArtShapeSize.width / root.fixedArtShapeSize.height : -1; \n\
73 readonly property real aspect: fixedArtShapeSizeAspect > 0 ? fixedArtShapeSizeAspect : components !== undefined ? components["art"]["aspect-ratio"] : 1; \n\73 readonly property real aspect: fixedArtShapeSizeAspect > 0 ? fixedArtShapeSizeAspect : components !== undefined ? components["art"]["aspect-ratio"] : 1; \n\
74 readonly property bool aspectSmallerThanImageAspect: aspect < image.aspect; \n\
75 Component.onCompleted: { updateWidthHeightBindings(); if (artShapeBorderSource !== undefined) borderSource = artShapeBorderSource; } \n\74 Component.onCompleted: { updateWidthHeightBindings(); if (artShapeBorderSource !== undefined) borderSource = artShapeBorderSource; } \n\
76 onAspectSmallerThanImageAspectChanged: updateWidthHeightBindings(); \n\
77 Connections { target: root; onFixedArtShapeSizeChanged: updateWidthHeightBindings(); } \n\75 Connections { target: root; onFixedArtShapeSizeChanged: updateWidthHeightBindings(); } \n\
78 function updateWidthHeightBindings() { \n\76 function updateWidthHeightBindings() { \n\
79 if (root.fixedArtShapeSize.height > 0 && root.fixedArtShapeSize.width > 0) { \n\77 if (root.fixedArtShapeSize.height > 0 && root.fixedArtShapeSize.width > 0) { \n\
80 width = root.fixedArtShapeSize.width; \n\78 width = root.fixedArtShapeSize.width; \n\
81 height = root.fixedArtShapeSize.height; \n\79 height = root.fixedArtShapeSize.height; \n\
82 } else if (aspectSmallerThanImageAspect) { \n\80 } else { \n\
83 width = Qt.binding(function() { return !visible ? 0 : image.width }); \n\81 width = Qt.binding(function() { return !visible ? 0 : image.width }); \n\
84 height = Qt.binding(function() { return !visible ? 0 : image.fillMode === Image.PreserveAspectCrop ? image.height : width / image.aspect }); \n\
85 } else { \n\
86 width = Qt.binding(function() { return !visible ? 0 : image.fillMode === Image.PreserveAspectCrop ? image.width : height * image.aspect }); \n\
87 height = Qt.binding(function() { return !visible ? 0 : image.height }); \n\82 height = Qt.binding(function() { return !visible ? 0 : image.height }); \n\
88 } \n\83 } \n\
89 } \n\84 } \n\
@@ -92,8 +87,7 @@
92 source: cardData && cardData["art"] || ""; \n\87 source: cardData && cardData["art"] || ""; \n\
93 cache: true; \n\88 cache: true; \n\
94 asynchronous: root.asynchronous; \n\89 asynchronous: root.asynchronous; \n\
95 fillMode: components && components["art"]["fill-mode"] === "fit" ? Image.PreserveAspectFit: Image.PreserveAspectCrop; \n\90 fillMode: Image.PreserveAspectCrop; \n\
96 readonly property real aspect: implicitWidth / implicitHeight; \n\
97 width: %2; \n\91 width: %2; \n\
98 height: %3; \n\92 height: %3; \n\
99 } \n\93 } \n\
10094
=== modified file 'qml/Dash/CardTool.qml'
--- qml/Dash/CardTool.qml 2014-07-28 11:59:50 +0000
+++ qml/Dash/CardTool.qml 2014-08-05 18:01:59 +0000
@@ -126,7 +126,7 @@
126 type:real \brief Height of the card's header.126 type:real \brief Height of the card's header.
127 */127 */
128 readonly property int headerHeight: cardLoader.item ? cardLoader.item.headerHeight : 0128 readonly property int headerHeight: cardLoader.item ? cardLoader.item.headerHeight : 0
129 readonly property size artShapeSize: cardLoader.item ? cardLoader.item.artShapeSize : 0129 property size artShapeSize: cardLoader.item ? cardLoader.item.artShapeSize : 0
130130
131 /*!131 /*!
132 \brief Desired alignment of header components.132 \brief Desired alignment of header components.
133133
=== modified file 'qml/Dash/GenericScopeView.qml'
--- qml/Dash/GenericScopeView.qml 2014-07-29 11:35:10 +0000
+++ qml/Dash/GenericScopeView.qml 2014-08-05 18:01:59 +0000
@@ -211,6 +211,10 @@
211 baseItem.expand(shouldExpand, false /*animate*/);211 baseItem.expand(shouldExpand, false /*animate*/);
212 }212 }
213 updateDelegateCreationRange();213 updateDelegateCreationRange();
214 if (scope && scope.id === "clickscope" && (categoryId === "predefined" || categoryId === "local")) {
215 // Yeah, hackish :/
216 cardTool.artShapeSize = Qt.size(units.gu(8), units.gu(7.5));
217 }
214 item.cardTool = cardTool;218 item.cardTool = cardTool;
215 }219 }
216220
217221
=== modified file 'tests/plugins/Dash/cardcreator/1.res'
--- tests/plugins/Dash/cardcreator/1.res 2014-07-24 10:03:58 +0000
+++ tests/plugins/Dash/cardcreator/1.res 2014-08-05 18:01:59 +0000
@@ -33,20 +33,15 @@
33 visible: image.status == Image.Ready; 33 visible: image.status == Image.Ready;
34 readonly property real fixedArtShapeSizeAspect: (root.fixedArtShapeSize.height > 0 && root.fixedArtShapeSize.width > 0) ? root.fixedArtShapeSize.width / root.fixedArtShapeSize.height : -1; 34 readonly property real fixedArtShapeSizeAspect: (root.fixedArtShapeSize.height > 0 && root.fixedArtShapeSize.width > 0) ? root.fixedArtShapeSize.width / root.fixedArtShapeSize.height : -1;
35 readonly property real aspect: fixedArtShapeSizeAspect > 0 ? fixedArtShapeSizeAspect : components !== undefined ? components["art"]["aspect-ratio"] : 1; 35 readonly property real aspect: fixedArtShapeSizeAspect > 0 ? fixedArtShapeSizeAspect : components !== undefined ? components["art"]["aspect-ratio"] : 1;
36 readonly property bool aspectSmallerThanImageAspect: aspect < image.aspect; 36 Component.onCompleted: { updateWidthHeightBindings(); if (artShapeBorderSource !== undefined) borderSource = artShapeBorderSource; }
37 Component.onCompleted: { updateWidthHeightBindings(); if (artShapeBorderSource !== undefined) borderSource = artShapeBorderSource; }
38 onAspectSmallerThanImageAspectChanged: updateWidthHeightBindings();
39 Connections { target: root; onFixedArtShapeSizeChanged: updateWidthHeightBindings(); } 37 Connections { target: root; onFixedArtShapeSizeChanged: updateWidthHeightBindings(); }
40 function updateWidthHeightBindings() { 38 function updateWidthHeightBindings() {
41 if (root.fixedArtShapeSize.height > 0 && root.fixedArtShapeSize.width > 0) { 39 if (root.fixedArtShapeSize.height > 0 && root.fixedArtShapeSize.width > 0) {
42 width = root.fixedArtShapeSize.width; 40 width = root.fixedArtShapeSize.width;
43 height = root.fixedArtShapeSize.height; 41 height = root.fixedArtShapeSize.height;
44 } else if (aspectSmallerThanImageAspect) {
45 width = Qt.binding(function() { return !visible ? 0 : image.width });
46 height = Qt.binding(function() { return !visible ? 0 : image.fillMode === Image.PreserveAspectCrop ? image.height : width / image.aspect });
47 } else { 42 } else {
48 width = Qt.binding(function() { return !visible ? 0 : image.fillMode === Image.PreserveAspectCrop ? image.width : height * image.aspect }); 43 width = Qt.binding(function() { return !visible ? 0 : image.width });
49 height = Qt.binding(function() { return !visible ? 0 : image.height }); 44 height = Qt.binding(function() { return !visible ? 0 : image.height });
50 } 45 }
51 } 46 }
52 image: Image { 47 image: Image {
@@ -54,8 +49,7 @@
54 source: cardData && cardData["art"] || ""; 49 source: cardData && cardData["art"] || "";
55 cache: true; 50 cache: true;
56 asynchronous: root.asynchronous; 51 asynchronous: root.asynchronous;
57 fillMode: components && components["art"]["fill-mode"] === "fit" ? Image.PreserveAspectFit: Image.PreserveAspectCrop; 52 fillMode: Image.PreserveAspectCrop;
58 readonly property real aspect: implicitWidth / implicitHeight;
59 width: root.width; 53 width: root.width;
60 height: width / artShape.aspect; 54 height: width / artShape.aspect;
61 } 55 }
6256
=== modified file 'tests/plugins/Dash/cardcreator/1.tst'
--- tests/plugins/Dash/cardcreator/1.tst 2014-05-06 10:06:54 +0000
+++ tests/plugins/Dash/cardcreator/1.tst 2014-08-05 18:01:59 +0000
@@ -1,3 +1,3 @@
1template: {"card-layout":"vertical","card-size":"small","category-layout":"grid","collapsed-rows":2}1template: {"card-layout":"vertical","card-size":"small","category-layout":"grid","collapsed-rows":2}
2components: {"art":{"aspect-ratio":1.6,"field":"art","fill-mode":"fit"},"title":{"field":"title"}}2components: {"art":{"aspect-ratio":1.6,"field":"art"},"title":{"field":"title"}}
3result: 1.res3result: 1.res
44
=== modified file 'tests/plugins/Dash/cardcreator/2.tst'
--- tests/plugins/Dash/cardcreator/2.tst 2014-05-06 10:10:10 +0000
+++ tests/plugins/Dash/cardcreator/2.tst 2014-08-05 18:01:59 +0000
@@ -1,3 +1,3 @@
1template: {"card-background":{"elements":["#E9E9E9"],"type":"color"},"card-layout":"vertical","card-size":"medium","category-layout":"grid","collapsed-rows":2}1template: {"card-background":{"elements":["#E9E9E9"],"type":"color"},"card-layout":"vertical","card-size":"medium","category-layout":"grid","collapsed-rows":2}
2components: {"art":{"aspect-ratio":1,"fill-mode":"crop"},"background":{"field":"background"},"mascot":{"field":"icon"},"subtitle":{"field":"author"},"title":{"field":"title"}}2components: {"art":{"aspect-ratio":1},"background":{"field":"background"},"mascot":{"field":"icon"},"subtitle":{"field":"author"},"title":{"field":"title"}}
3result: 2.res3result: 2.res
44
=== modified file 'tests/plugins/Dash/cardcreator/3.res'
--- tests/plugins/Dash/cardcreator/3.res 2014-07-24 10:03:58 +0000
+++ tests/plugins/Dash/cardcreator/3.res 2014-08-05 18:01:59 +0000
@@ -25,7 +25,7 @@
25 objectName: "artShapeLoader"; 25 objectName: "artShapeLoader";
26 active: cardData && cardData["art"] || false; 26 active: cardData && cardData["art"] || false;
27 asynchronous: root.asynchronous; 27 asynchronous: root.asynchronous;
28 visible: status == Loader.Ready; 28 visible: status == Loader.Ready;
29 sourceComponent: UbuntuShape { 29 sourceComponent: UbuntuShape {
30 id: artShape; 30 id: artShape;
31 objectName: "artShape"; 31 objectName: "artShape";
@@ -33,20 +33,15 @@
33 visible: image.status == Image.Ready; 33 visible: image.status == Image.Ready;
34 readonly property real fixedArtShapeSizeAspect: (root.fixedArtShapeSize.height > 0 && root.fixedArtShapeSize.width > 0) ? root.fixedArtShapeSize.width / root.fixedArtShapeSize.height : -1; 34 readonly property real fixedArtShapeSizeAspect: (root.fixedArtShapeSize.height > 0 && root.fixedArtShapeSize.width > 0) ? root.fixedArtShapeSize.width / root.fixedArtShapeSize.height : -1;
35 readonly property real aspect: fixedArtShapeSizeAspect > 0 ? fixedArtShapeSizeAspect : components !== undefined ? components["art"]["aspect-ratio"] : 1; 35 readonly property real aspect: fixedArtShapeSizeAspect > 0 ? fixedArtShapeSizeAspect : components !== undefined ? components["art"]["aspect-ratio"] : 1;
36 readonly property bool aspectSmallerThanImageAspect: aspect < image.aspect;
37 Component.onCompleted: { updateWidthHeightBindings(); if (artShapeBorderSource !== undefined) borderSource = artShapeBorderSource; } 36 Component.onCompleted: { updateWidthHeightBindings(); if (artShapeBorderSource !== undefined) borderSource = artShapeBorderSource; }
38 onAspectSmallerThanImageAspectChanged: updateWidthHeightBindings();
39 Connections { target: root; onFixedArtShapeSizeChanged: updateWidthHeightBindings(); } 37 Connections { target: root; onFixedArtShapeSizeChanged: updateWidthHeightBindings(); }
40 function updateWidthHeightBindings() { 38 function updateWidthHeightBindings() {
41 if (root.fixedArtShapeSize.height > 0 && root.fixedArtShapeSize.width > 0) { 39 if (root.fixedArtShapeSize.height > 0 && root.fixedArtShapeSize.width > 0) {
42 width = root.fixedArtShapeSize.width; 40 width = root.fixedArtShapeSize.width;
43 height = root.fixedArtShapeSize.height; 41 height = root.fixedArtShapeSize.height;
44 } else if (aspectSmallerThanImageAspect) {
45 width = Qt.binding(function() { return !visible ? 0 : image.width });
46 height = Qt.binding(function() { return !visible ? 0 : image.fillMode === Image.PreserveAspectCrop ? image.height : width / image.aspect });
47 } else { 42 } else {
48 width = Qt.binding(function() { return !visible ? 0 : image.fillMode === Image.PreserveAspectCrop ? image.width : height * image.aspect }); 43 width = Qt.binding(function() { return !visible ? 0 : image.width });
49 height = Qt.binding(function() { return !visible ? 0 : image.height }); 44 height = Qt.binding(function() { return !visible ? 0 : image.height });
50 } 45 }
51 } 46 }
52 image: Image { 47 image: Image {
@@ -54,8 +49,7 @@
54 source: cardData && cardData["art"] || ""; 49 source: cardData && cardData["art"] || "";
55 cache: true; 50 cache: true;
56 asynchronous: root.asynchronous; 51 asynchronous: root.asynchronous;
57 fillMode: components && components["art"]["fill-mode"] === "fit" ? Image.PreserveAspectFit: Image.PreserveAspectCrop; 52 fillMode: Image.PreserveAspectCrop;
58 readonly property real aspect: implicitWidth / implicitHeight;
59 width: root.width; 53 width: root.width;
60 height: width / artShape.aspect; 54 height: width / artShape.aspect;
61 } 55 }
6256
=== modified file 'tests/plugins/Dash/cardcreator/3.tst'
--- tests/plugins/Dash/cardcreator/3.tst 2014-05-06 10:10:10 +0000
+++ tests/plugins/Dash/cardcreator/3.tst 2014-08-05 18:01:59 +0000
@@ -1,3 +1,3 @@
1template: {"card-layout":"vertical","card-size":"small","category-layout":"grid","collapsed-rows":2}1template: {"card-layout":"vertical","card-size":"small","category-layout":"grid","collapsed-rows":2}
2components: {"art":{"aspect-ratio":0.75,"field":"art","fill-mode":"crop"},"subtitle":{"field":"price"},"title":{"field":"title"}}2components: {"art":{"aspect-ratio":0.75,"field":"art"},"subtitle":{"field":"price"},"title":{"field":"title"}}
3result: 3.res3result: 3.res
44
=== modified file 'tests/plugins/Dash/cardcreator/4.tst'
--- tests/plugins/Dash/cardcreator/4.tst 2014-05-06 10:06:54 +0000
+++ tests/plugins/Dash/cardcreator/4.tst 2014-08-05 18:01:59 +0000
@@ -1,3 +1,3 @@
1template: {"card-layout":"horizontal","card-size":"large","category-layout":"grid","collapsed-rows":2}1template: {"card-layout":"horizontal","card-size":"large","category-layout":"grid","collapsed-rows":2}
2components: {"art":{"aspect-ratio":1,"fill-mode":"crop"},"mascot":{"field":"mascot"},"subtitle":{"field":"domain"},"title":{"field":"title"}}2components: {"art":{"aspect-ratio":1},"mascot":{"field":"mascot"},"subtitle":{"field":"domain"},"title":{"field":"title"}}
3result: 4.res3result: 4.res
44
=== modified file 'tests/plugins/Dash/cardcreator/5.res'
--- tests/plugins/Dash/cardcreator/5.res 2014-07-24 10:03:58 +0000
+++ tests/plugins/Dash/cardcreator/5.res 2014-08-05 18:01:59 +0000
@@ -25,7 +25,7 @@
25 objectName: "artShapeLoader"; 25 objectName: "artShapeLoader";
26 active: cardData && cardData["art"] || false; 26 active: cardData && cardData["art"] || false;
27 asynchronous: root.asynchronous; 27 asynchronous: root.asynchronous;
28 visible: status == Loader.Ready; 28 visible: status == Loader.Ready;
29 sourceComponent: UbuntuShape { 29 sourceComponent: UbuntuShape {
30 id: artShape; 30 id: artShape;
31 objectName: "artShape"; 31 objectName: "artShape";
@@ -33,20 +33,15 @@
33 visible: image.status == Image.Ready; 33 visible: image.status == Image.Ready;
34 readonly property real fixedArtShapeSizeAspect: (root.fixedArtShapeSize.height > 0 && root.fixedArtShapeSize.width > 0) ? root.fixedArtShapeSize.width / root.fixedArtShapeSize.height : -1; 34 readonly property real fixedArtShapeSizeAspect: (root.fixedArtShapeSize.height > 0 && root.fixedArtShapeSize.width > 0) ? root.fixedArtShapeSize.width / root.fixedArtShapeSize.height : -1;
35 readonly property real aspect: fixedArtShapeSizeAspect > 0 ? fixedArtShapeSizeAspect : components !== undefined ? components["art"]["aspect-ratio"] : 1; 35 readonly property real aspect: fixedArtShapeSizeAspect > 0 ? fixedArtShapeSizeAspect : components !== undefined ? components["art"]["aspect-ratio"] : 1;
36 readonly property bool aspectSmallerThanImageAspect: aspect < image.aspect;
37 Component.onCompleted: { updateWidthHeightBindings(); if (artShapeBorderSource !== undefined) borderSource = artShapeBorderSource; } 36 Component.onCompleted: { updateWidthHeightBindings(); if (artShapeBorderSource !== undefined) borderSource = artShapeBorderSource; }
38 onAspectSmallerThanImageAspectChanged: updateWidthHeightBindings();
39 Connections { target: root; onFixedArtShapeSizeChanged: updateWidthHeightBindings(); } 37 Connections { target: root; onFixedArtShapeSizeChanged: updateWidthHeightBindings(); }
40 function updateWidthHeightBindings() { 38 function updateWidthHeightBindings() {
41 if (root.fixedArtShapeSize.height > 0 && root.fixedArtShapeSize.width > 0) { 39 if (root.fixedArtShapeSize.height > 0 && root.fixedArtShapeSize.width > 0) {
42 width = root.fixedArtShapeSize.width; 40 width = root.fixedArtShapeSize.width;
43 height = root.fixedArtShapeSize.height; 41 height = root.fixedArtShapeSize.height;
44 } else if (aspectSmallerThanImageAspect) {
45 width = Qt.binding(function() { return !visible ? 0 : image.width });
46 height = Qt.binding(function() { return !visible ? 0 : image.fillMode === Image.PreserveAspectCrop ? image.height : width / image.aspect });
47 } else { 42 } else {
48 width = Qt.binding(function() { return !visible ? 0 : image.fillMode === Image.PreserveAspectCrop ? image.width : height * image.aspect }); 43 width = Qt.binding(function() { return !visible ? 0 : image.width });
49 height = Qt.binding(function() { return !visible ? 0 : image.height }); 44 height = Qt.binding(function() { return !visible ? 0 : image.height });
50 } 45 }
51 } 46 }
52 image: Image { 47 image: Image {
@@ -54,13 +49,12 @@
54 source: cardData && cardData["art"] || ""; 49 source: cardData && cardData["art"] || "";
55 cache: true; 50 cache: true;
56 asynchronous: root.asynchronous; 51 asynchronous: root.asynchronous;
57 fillMode: components && components["art"]["fill-mode"] === "fit" ? Image.PreserveAspectFit: Image.PreserveAspectCrop; 52 fillMode: Image.PreserveAspectCrop;
58 readonly property real aspect: implicitWidth / implicitHeight;
59 width: root.width; 53 width: root.width;
60 height: width / artShape.aspect; 54 height: width / artShape.aspect;
61 } 55 }
62 } 56 }
63 } 57 }
64 }58 }
65Loader { 59Loader {
66 id: overlayLoader; 60 id: overlayLoader;
@@ -69,7 +63,7 @@
69 right: artShapeHolder.right; 63 right: artShapeHolder.right;
70 bottom: artShapeHolder.bottom; 64 bottom: artShapeHolder.bottom;
71 } 65 }
72 active: artShapeLoader.active && artShapeLoader.item && artShapeLoader.item.image.status === Image.Ready || false; 66 active: artShapeLoader.active && artShapeLoader.item && artShapeLoader.item.image.status === Image.Ready || false;
73 asynchronous: root.asynchronous; 67 asynchronous: root.asynchronous;
74 visible: showHeader && status == Loader.Ready; 68 visible: showHeader && status == Loader.Ready;
75 sourceComponent: ShaderEffect { 69 sourceComponent: ShaderEffect {
7670
=== modified file 'tests/plugins/Dash/cardcreator/5.tst'
--- tests/plugins/Dash/cardcreator/5.tst 2014-05-06 11:16:46 +0000
+++ tests/plugins/Dash/cardcreator/5.tst 2014-08-05 18:01:59 +0000
@@ -1,3 +1,3 @@
1template: {"card-layout":"vertical","card-size":"medium","category-layout":"carousel","collapsed-rows":2,"overlay":true}1template: {"card-layout":"vertical","card-size":"medium","category-layout":"carousel","collapsed-rows":2,"overlay":true}
2components: {"art":{"aspect-ratio":1,"field":"art","fill-mode":"crop"},"subtitle":{"field":"artist"},"title":{"field":"title"}}2components: {"art":{"aspect-ratio":1,"field":"art"},"subtitle":{"field":"artist"},"title":{"field":"title"}}
3result: 5.res3result: 5.res
44
=== modified file 'tests/plugins/Dash/cardcreator/6.res'
--- tests/plugins/Dash/cardcreator/6.res 2014-07-10 18:03:16 +0000
+++ tests/plugins/Dash/cardcreator/6.res 2014-08-05 18:01:59 +0000
@@ -33,19 +33,14 @@
33 visible: image.status == Image.Ready;33 visible: image.status == Image.Ready;
34 readonly property real fixedArtShapeSizeAspect: (root.fixedArtShapeSize.height > 0 && root.fixedArtShapeSize.width > 0) ? root.fixedArtShapeSize.width / root.fixedArtShapeSize.height : -1;34 readonly property real fixedArtShapeSizeAspect: (root.fixedArtShapeSize.height > 0 && root.fixedArtShapeSize.width > 0) ? root.fixedArtShapeSize.width / root.fixedArtShapeSize.height : -1;
35 readonly property real aspect: fixedArtShapeSizeAspect > 0 ? fixedArtShapeSizeAspect : components !== undefined ? components["art"]["aspect-ratio"] : 1;35 readonly property real aspect: fixedArtShapeSizeAspect > 0 ? fixedArtShapeSizeAspect : components !== undefined ? components["art"]["aspect-ratio"] : 1;
36 readonly property bool aspectSmallerThanImageAspect: aspect < image.aspect;
37 Component.onCompleted: { updateWidthHeightBindings(); if (artShapeBorderSource !== undefined) borderSource = artShapeBorderSource; }36 Component.onCompleted: { updateWidthHeightBindings(); if (artShapeBorderSource !== undefined) borderSource = artShapeBorderSource; }
38 onAspectSmallerThanImageAspectChanged: updateWidthHeightBindings();
39 Connections { target: root; onFixedArtShapeSizeChanged: updateWidthHeightBindings(); }37 Connections { target: root; onFixedArtShapeSizeChanged: updateWidthHeightBindings(); }
40 function updateWidthHeightBindings() {38 function updateWidthHeightBindings() {
41 if (root.fixedArtShapeSize.height > 0 && root.fixedArtShapeSize.width > 0) {39 if (root.fixedArtShapeSize.height > 0 && root.fixedArtShapeSize.width > 0) {
42 width = root.fixedArtShapeSize.width;40 width = root.fixedArtShapeSize.width;
43 height = root.fixedArtShapeSize.height;41 height = root.fixedArtShapeSize.height;
44 } else if (aspectSmallerThanImageAspect) {42 } else {
45 width = Qt.binding(function() { return !visible ? 0 : image.width });43 width = Qt.binding(function() { return !visible ? 0 : image.width });
46 height = Qt.binding(function() { return !visible ? 0 : image.fillMode === Image.PreserveAspectCrop ? image.height : width / image.aspect });
47 } else {
48 width = Qt.binding(function() { return !visible ? 0 : image.fillMode === Image.PreserveAspectCrop ? image.width : height * image.aspect });
49 height = Qt.binding(function() { return !visible ? 0 : image.height });44 height = Qt.binding(function() { return !visible ? 0 : image.height });
50 }45 }
51 }46 }
@@ -54,8 +49,7 @@
54 source: cardData && cardData["art"] || "";49 source: cardData && cardData["art"] || "";
55 cache: true;50 cache: true;
56 asynchronous: root.asynchronous;51 asynchronous: root.asynchronous;
57 fillMode: components && components["art"]["fill-mode"] === "fit" ? Image.PreserveAspectFit: Image.PreserveAspectCrop;52 fillMode: Image.PreserveAspectCrop;
58 readonly property real aspect: implicitWidth / implicitHeight;
59 width: root.width;53 width: root.width;
60 height: width / artShape.aspect;54 height: width / artShape.aspect;
61 }55 }
6256
=== modified file 'tests/plugins/Dash/cardcreator/6.tst'
--- tests/plugins/Dash/cardcreator/6.tst 2014-07-08 09:50:44 +0000
+++ tests/plugins/Dash/cardcreator/6.tst 2014-08-05 18:01:59 +0000
@@ -1,3 +1,3 @@
1template: {"card-layout":"vertical","card-size":"small","category-layout":"grid","collapsed-rows":2}1template: {"card-layout":"vertical","card-size":"small","category-layout":"grid","collapsed-rows":2}
2components: {"art":{"aspect-ratio":1.6,"field":"art","fill-mode":"fit"}}2components: {"art":{"aspect-ratio":1.6,"field":"art"}}
3result: 6.res3result: 6.res
44
=== modified file 'tests/plugins/Dash/cardcreator/7.res'
--- tests/plugins/Dash/cardcreator/7.res 2014-07-24 10:03:58 +0000
+++ tests/plugins/Dash/cardcreator/7.res 2014-08-05 18:01:59 +0000
@@ -116,7 +116,7 @@
116 objectName: "attributesRow"; 116 objectName: "attributesRow";
117 anchors { left: parent.left; right: parent.right } 117 anchors { left: parent.left; right: parent.right }
118 color: backgroundLoader.active && backgroundLoader.item && backgroundLoader.item.luminance < 0.7 ? "white" : (root.scopeStyle ? root.scopeStyle.foreground : "grey"); 118 color: backgroundLoader.active && backgroundLoader.item && backgroundLoader.item.luminance < 0.7 ? "white" : (root.scopeStyle ? root.scopeStyle.foreground : "grey");
119 model: cardData["attributes"] 119 model: cardData && cardData["attributes"] || undefined;
120 }120 }
121 121
122 ]122 ]
123123
=== modified file 'tests/plugins/Dash/cardcreator/7.tst'
--- tests/plugins/Dash/cardcreator/7.tst 2014-07-25 15:11:33 +0000
+++ tests/plugins/Dash/cardcreator/7.tst 2014-08-05 18:01:59 +0000
@@ -1,3 +1,3 @@
1template: {"card-background":{"elements":["#E9E9E9"],"type":"color"},"card-layout":"vertical","card-size":"medium","category-layout":"grid","collapsed-rows":2}1template: {"card-background":{"elements":["#E9E9E9"],"type":"color"},"card-layout":"vertical","card-size":"medium","category-layout":"grid","collapsed-rows":2}
2components: {"art":{"aspect-ratio":1,"fill-mode":"crop"},"background":{"field":"background"},"mascot":{"field":"icon"},"subtitle":{"field":"author"},"title":{"field":"title"},"attributes":{"field":"attributes","max-count":2}}2components: {"art":{"aspect-ratio":1},"background":{"field":"background"},"mascot":{"field":"icon"},"subtitle":{"field":"author"},"title":{"field":"title"},"attributes":{"field":"attributes","max-count":2}}
3result: 7.res3result: 7.res
44
=== modified file 'tests/qmltests/Dash/CardHelpers.js'
--- tests/qmltests/Dash/CardHelpers.js 2014-07-25 15:11:33 +0000
+++ tests/qmltests/Dash/CardHelpers.js 2014-08-05 18:01:59 +0000
@@ -31,8 +31,7 @@
31 "components": { \31 "components": { \
32 "title": null, \32 "title": null, \
33 "art": { \33 "art": { \
34 "aspect-ratio": 1.0, \34 "aspect-ratio": 1.0 \
35 "fill-mode": "crop" \
36 }, \35 }, \
37 "subtitle": null, \36 "subtitle": null, \
38 "mascot": null, \37 "mascot": null, \
3938
=== modified file 'tests/qmltests/Dash/tst_Card.qml'
--- tests/qmltests/Dash/tst_Card.qml 2014-07-31 16:49:38 +0000
+++ tests/qmltests/Dash/tst_Card.qml 2014-08-05 18:01:59 +0000
@@ -55,8 +55,8 @@
55 "layout": { "components": Helpers.update(JSON.parse(Helpers.fullMapping), { "art": { "aspect-ratio": 2 } }) }55 "layout": { "components": Helpers.update(JSON.parse(Helpers.fullMapping), { "art": { "aspect-ratio": 2 } }) }
56 },56 },
57 {57 {
58 "name": "Art, title - fitted",58 "name": "Art, title - tall",
59 "layout": { "components": Helpers.update(JSON.parse(Helpers.fullMapping), { "art": { "fill-mode": "fit" } }) }59 "layout": { "components": Helpers.update(JSON.parse(Helpers.fullMapping), { "art": { "aspect-ratio": 0.7 } }) }
60 },60 },
61 {61 {
62 "name": "Art, header, summary - horizontal",62 "name": "Art, header, summary - horizontal",
@@ -269,7 +269,7 @@
269 { tag: "Small", width: units.gu(12), index: 1 },269 { tag: "Small", width: units.gu(12), index: 1 },
270 { tag: "Large", width: units.gu(38), index: 2 },270 { tag: "Large", width: units.gu(38), index: 2 },
271 { tag: "Wide", height: units.gu(19), size: "large", index: 3 },271 { tag: "Wide", height: units.gu(19), size: "large", index: 3 },
272 { tag: "Fit", height: units.gu(38), size: "large", width: units.gu(19), index: 4 },272 { tag: "Tall", height: units.gu(38) / 0.7, size: "large", width: units.gu(38), index: 4 },
273 { tag: "VerticalWidth", width: function() { return headerRow.width + units.gu(1) * 2 }, index: 0 },273 { tag: "VerticalWidth", width: function() { return headerRow.width + units.gu(1) * 2 }, index: 0 },
274 { tag: "HorizontalHeight", height: function() { return headerRow.height + units.gu(1) * 2 }, index: 5 },274 { tag: "HorizontalHeight", height: function() { return headerRow.height + units.gu(1) * 2 }, index: 5 },
275 { tag: "HorizontalWidth", width: function() { return headerRow.x - units.gu(1) }, index: 5 },275 { tag: "HorizontalWidth", width: function() { return headerRow.x - units.gu(1) }, index: 5 },
276276
=== modified file 'tests/qmltests/Dash/tst_GenericScopeView.qml'
--- tests/qmltests/Dash/tst_GenericScopeView.qml 2014-07-24 20:40:57 +0000
+++ tests/qmltests/Dash/tst_GenericScopeView.qml 2014-08-05 18:01:59 +0000
@@ -129,8 +129,9 @@
129 var initialHeight = category.height;129 var initialHeight = category.height;
130 mouseClick(seeAll, seeAll.width / 2, seeAll.height / 2);130 mouseClick(seeAll, seeAll.width / 2, seeAll.height / 2);
131 verify(category.expanded);131 verify(category.expanded);
132 tryCompareFunction(function() { return category.height > initialHeight; }, true);132 tryCompare(category, "height", category.item.expandedHeight + seeAll.height);
133133
134 waitForRendering(seeAll);
134 mouseClick(seeAll, seeAll.width / 2, seeAll.height / 2);135 mouseClick(seeAll, seeAll.width / 2, seeAll.height / 2);
135 verify(!category.expanded);136 verify(!category.expanded);
136 }137 }

Subscribers

People subscribed via source and target branches