on xenial help sign in
Fixed tests
commitba394b625daa978184328cc4cbc78f13b613571d authorAndrea Cimitan <andrea.cimitan@gmail.com> dateThu 31 Jul 2014, 15:56 (12 years ago) parent3cdb6bc
7 files changed+113−87
plugins/Dash/CardCreator.js+6−4 tests/plugins/Dash/cardcreator/1.res+6−6 tests/plugins/Dash/cardcreator/2.res+24−20 tests/plugins/Dash/cardcreator/3.res+12−12 tests/plugins/Dash/cardcreator/4.res+22−14 tests/plugins/Dash/cardcreator/5.res+13−13 tests/plugins/Dash/cardcreator/7.res+30−18
plugins/Dash/CardCreator.js+6−4
@@ -153,7 +153,7 @@ var kHeaderRowCodeTemplate = 'Row { \n\
153153 anchors { %1 } \n\
154154 anchors.right: parent.right; \n\
155155 anchors.margins: margins; \n\
156− anchors.rightMargin: units.gu(0); \n\
156+ anchors.rightMargin: 0; \n\
157157 data: [ \n\
158158 %2 \n\
159159 ] \n\
@@ -459,8 +459,8 @@ function cardString(template, components) {
459459 var titleAnchors;
460460 var subtitleAnchors;
461461 var attributesAnchors;
462− var titleRightAnchor;
463462 var titleContainerAnchors;
463+ var titleRightAnchor;
464464
465465 // GOOD LUCK!
466466
@@ -475,9 +475,11 @@ function cardString(template, components) {
475475 }
476476 }
477477 if (hasEmblem) {
478− titleRightAnchor = 'right: emblemImage.left;\n';
478+ titleRightAnchor = 'right: emblemImage.left; \n\
479+ rightMargin: units.gu(0.5); \n';
479480 } else {
480− titleRightAnchor = 'right: parent.right;\n';
481+ titleRightAnchor = 'right: parent.right; \n\
482+ rightMargin: units.gu(1); \n';
481483 }
482484
483485 if (hasEmblem || (hasMascot && (hasSubtitle || hasAttributes))) {
tests/plugins/Dash/cardcreator/1.res+6−6
@@ -67,12 +67,12 @@ Label {
6767 id: titleLabel;
6868 objectName: "titleLabel";
6969 anchors { right: parent.right;
70−rightMargin: units.gu(1);
71−left: parent.left;
72−top: artShapeHolder.bottom;
73− topMargin: units.gu(1);
74−leftMargin: units.gu(1);
75− }
70+ rightMargin: units.gu(1);
71+ left: parent.left;
72+ top: artShapeHolder.bottom;
73+ topMargin: units.gu(1);
74+ leftMargin: units.gu(1);
75+ }
7676 elide: Text.ElideRight;
7777 fontSize: "small";
7878 wrapMode: Text.Wrap;
tests/plugins/Dash/cardcreator/2.res+24−20
@@ -55,12 +55,14 @@ Row {
5555 spacing: margins;
5656 height: root.fixedHeaderHeight != -1 ? root.fixedHeaderHeight : implicitHeight;
5757 anchors { top: parent.top;
58− topMargin: units.gu(1);
59−left: parent.left;
60− }
58+ topMargin: units.gu(1);
59+ left: parent.left;
60+ }
6161 anchors.right: parent.right;
6262 anchors.margins: margins;
63− data: [ Image {
63+ anchors.rightMargin: 0;
64+ data: [
65+Image {
6466 id: mascotImage;
6567 objectName: "mascotImage";
6668 anchors { verticalCenter: parent.verticalCenter; }
@@ -74,16 +76,19 @@ left: parent.left;
7476 verticalAlignment: Image.AlignVCenter;
7577 visible: showHeader;
7678 }
77−
78− ,
79− Column {
80− anchors.verticalCenter: parent.verticalCenter;
81− spacing: units.dp(2);
82− width: parent.width - x;
83− data: [ Label {
79+,Item {
80+ id: headerTitleContainer;
81+ anchors { verticalCenter: parent.verticalCenter; }
82+ width: parent.width - x;
83+ implicitHeight: titleLabel.height + subtitleLabel.height;
84+ data: [
85+ Label {
8486 id: titleLabel;
8587 objectName: "titleLabel";
86− anchors { left: parent.left; right: parent.right }
88+ anchors { right: parent.right;
89+ rightMargin: units.gu(1);
90+ left: parent.left;
91+ top: parent.top; }
8792 elide: Text.ElideRight;
8893 fontSize: "small";
8994 wrapMode: Text.Wrap;
@@ -95,16 +100,15 @@ left: parent.left;
95100 font.weight: components && components["subtitle"] ? Font.DemiBold : Font.Normal;
96101 horizontalAlignment: root.headerAlignment;
97102 }
98−]
99−}
100−]
101−}
102−
103− ,
104− Label {
103+ ,Label {
105104 id: subtitleLabel;
106105 objectName: "subtitleLabel";
107− anchors { left: parent.left; right: parent.right }
106+ anchors { right: parent.right;
107+ left: parent.left;
108+ rightMargin: units.gu(1);
109+ top: titleLabel.bottom;
110+ }
111+ anchors.topMargin: units.dp(2);
108112 elide: Text.ElideRight;
109113 fontSize: "small";
110114 font.pixelSize: Math.round(FontUtils.sizeToPixels(fontSize) * fontScale);
tests/plugins/Dash/cardcreator/3.res+12−12
@@ -67,12 +67,12 @@ Label {
6767 id: titleLabel;
6868 objectName: "titleLabel";
6969 anchors { right: parent.right;
70−rightMargin: units.gu(1);
71−left: parent.left;
72−top: artShapeHolder.bottom;
73− topMargin: units.gu(1);
74−leftMargin: units.gu(1);
75− }
70+ rightMargin: units.gu(1);
71+ left: parent.left;
72+ top: artShapeHolder.bottom;
73+ topMargin: units.gu(1);
74+ leftMargin: units.gu(1);
75+ }
7676 elide: Text.ElideRight;
7777 fontSize: "small";
7878 wrapMode: Text.Wrap;
@@ -88,12 +88,12 @@ Label {
8888 id: subtitleLabel;
8989 objectName: "subtitleLabel";
9090 anchors { left: titleLabel.left;
91− leftMargin: titleLabel.leftMargin;
92− right: titleLabel.right;
93− rightMargin: titleLabel.rightMargin;
94− top: titleLabel.bottom;
95− topMargin: units.dp(2);
96− }
91+ leftMargin: titleLabel.leftMargin;
92+ rightMargin: units.gu(1);
93+ right: titleLabel.right;
94+ top: titleLabel.bottom;
95+ }
96+ anchors.topMargin: units.dp(2);
9797 elide: Text.ElideRight;
9898 fontSize: "small";
9999 font.pixelSize: Math.round(FontUtils.sizeToPixels(fontSize) * fontScale);
tests/plugins/Dash/cardcreator/4.res+22−14
@@ -27,7 +27,9 @@ Row {
2727}
2828 anchors.right: parent.right;
2929 anchors.margins: margins;
30−data: [ Loader {
30+ anchors.rightMargin: 0;
31+data: [
32+Loader {
3133 id: mascotShapeLoader;
3234 objectName: "mascotShapeLoader";
3335 asynchronous: root.asynchronous;
@@ -39,8 +41,7 @@ data: [ Loader {
3941 anchors { verticalCenter: parent.verticalCenter; }
4042 }
4143
42−,
43−Image {
44+,Image {
4445 id: mascotImage;
4546 objectName: "mascotImage";
4647 anchors { verticalCenter: parent.verticalCenter; }
@@ -55,15 +56,19 @@ Image {
5556 visible: false;
5657 }
5758
58−,
59−Column {
60− anchors.verticalCenter: parent.verticalCenter;
61− spacing: units.dp(2);
62− width: parent.width - x;
63−data: [ Label {
59+,Item {
60+ id: headerTitleContainer;
61+ anchors { verticalCenter: parent.verticalCenter; }
62+ width: parent.width - x;
63+ implicitHeight: titleLabel.height + subtitleLabel.height;
64+ data: [
65+Label {
6466 id: titleLabel;
6567 objectName: "titleLabel";
66− anchors { left: parent.left; right: parent.right }
68+ anchors { right: parent.right;
69+ rightMargin: units.gu(1);
70+ left: parent.left;
71+ top: parent.top; }
6772 elide: Text.ElideRight;
6873 fontSize: "small";
6974 wrapMode: Text.Wrap;
@@ -75,12 +80,15 @@ data: [ Label {
7580 font.weight: components && components["subtitle"] ? Font.DemiBold : Font.Normal;
7681 horizontalAlignment: root.headerAlignment;
7782 }
78−,
79−Label {
83+,Label {
8084 id: subtitleLabel;
8185 objectName: "subtitleLabel";
82− anchors { left: parent.left; right: parent.right }
83−
86+ anchors { right: parent.right;
87+ left: parent.left;
88+ rightMargin: units.gu(1);
89+ top: titleLabel.bottom;
90+ }
91+ anchors.topMargin: units.dp(2);
8492 elide: Text.ElideRight;
8593 fontSize: "small";
8694 font.pixelSize: Math.round(FontUtils.sizeToPixels(fontSize) * fontScale);
tests/plugins/Dash/cardcreator/5.res+13−13
@@ -106,13 +106,13 @@ readonly property int headerHeight: titleLabel.height + subtitleLabel.height + s
106106Label {
107107 id: titleLabel;
108108 objectName: "titleLabel";
109− anchors { left: parent.left;
110− leftMargin: units.gu(1);
111− right: parent.right;
112− rightMargin: units.gu(1);
113− top: overlayLoader.top;
114− topMargin: units.gu(1);
115− }
109+ anchors { right: parent.right;
110+ rightMargin: units.gu(1);
111+ left: parent.left;
112+ leftMargin: units.gu(1);
113+ top: overlayLoader.top;
114+ topMargin: units.gu(1);
115+ }
116116 elide: Text.ElideRight;
117117 fontSize: "small";
118118 wrapMode: Text.Wrap;
@@ -128,12 +128,12 @@ Label {
128128 id: subtitleLabel;
129129 objectName: "subtitleLabel";
130130 anchors { left: titleLabel.left;
131− leftMargin: titleLabel.leftMargin;
132− right: titleLabel.right;
133− rightMargin: titleLabel.rightMargin;
134− top: titleLabel.bottom;
135− topMargin: units.dp(2);
136− }
131+ leftMargin: titleLabel.leftMargin;
132+ rightMargin: units.gu(1);
133+ right: titleLabel.right;
134+ top: titleLabel.bottom;
135+ }
136+ anchors.topMargin: units.dp(2);
137137 elide: Text.ElideRight;
138138 fontSize: "small";
139139 font.pixelSize: Math.round(FontUtils.sizeToPixels(fontSize) * fontScale);
tests/plugins/Dash/cardcreator/7.res+30−18
@@ -55,12 +55,14 @@ Row {
5555 spacing: margins;
5656 height: root.fixedHeaderHeight != -1 ? root.fixedHeaderHeight : implicitHeight;
5757 anchors { top: parent.top;
58− topMargin: units.gu(1);
59−left: parent.left;
60− }
58+ topMargin: units.gu(1);
59+ left: parent.left;
60+ }
6161 anchors.right: parent.right;
6262 anchors.margins: margins;
63− data: [ Image {
63+ anchors.rightMargin: 0;
64+ data: [
65+Image {
6466 id: mascotImage;
6567 objectName: "mascotImage";
6668 anchors { verticalCenter: parent.verticalCenter; }
@@ -75,16 +77,19 @@ left: parent.left;
7577 visible: showHeader;
7678 }
7779
78− ,
79− Column {
80− anchors.verticalCenter: parent.verticalCenter;
81− spacing: units.dp(2);
82− width: parent.width - x;
83− data: [
84− Label {
80+,Item {
81+ id: headerTitleContainer;
82+ anchors { verticalCenter: parent.verticalCenter; }
83+ width: parent.width - x;
84+ implicitHeight: titleLabel.height + subtitleLabel.height + attributesRow.height;
85+ data: [
86+ Label {
8587 id: titleLabel;
8688 objectName: "titleLabel";
87− anchors { left: parent.left; right: parent.right }
89+ anchors { right: parent.right;
90+ rightMargin: units.gu(1);
91+ left: parent.left;
92+ top: parent.top; }
8893 elide: Text.ElideRight;
8994 fontSize: "small";
9095 wrapMode: Text.Wrap;
@@ -96,11 +101,15 @@ left: parent.left;
96101 font.weight: components && components["subtitle"] ? Font.DemiBold : Font.Normal;
97102 horizontalAlignment: root.headerAlignment;
98103 }
99−,
100−Label {
104+,Label {
101105 id: subtitleLabel;
102106 objectName: "subtitleLabel";
103− anchors { left: parent.left; right: parent.right }
107+ anchors { right: parent.right;
108+ left: parent.left;
109+ rightMargin: units.gu(1);
110+ top: titleLabel.bottom;
111+ }
112+ anchors.topMargin: units.dp(2);
104113 elide: Text.ElideRight;
105114 fontSize: "small";
106115 font.pixelSize: Math.round(FontUtils.sizeToPixels(fontSize) * fontScale);
@@ -110,11 +119,14 @@ Label {
110119 font.weight: Font.Light;
111120 horizontalAlignment: root.headerAlignment;
112121 }
113−,
114−CardAttributes {
122+,CardAttributes {
115123 id: attributesRow;
116124 objectName: "attributesRow";
117− anchors { left: parent.left; right: parent.right }
125+ anchors { right: parent.right;
126+ left: parent.left;
127+ rightMargin: units.gu(1);
128+ top: subtitleLabel.bottom;
129+ }
118130 color: backgroundLoader.active && backgroundLoader.item && backgroundLoader.item.luminance < 0.7 ? "white" : (root.scopeStyle ? root.scopeStyle.foreground : "grey");
119131 model: cardData["attributes"];
120132 }