on xenial help sign in
Improve InitTestCase robustness and add trailing commas to reduce diffs later.
405f43bMichał Sawicz
qml/Dash/CardHeader.qml+2−1
@@ -56,9 +56,9 @@ Item {
56
56
57 Label {
57 Label {
58 id: titleLabel
58 id: titleLabel
59+ objectName: "titleLabel"
59 anchors { left: parent.left; right: parent.right }
60 anchors { left: parent.left; right: parent.right }
60 elide: Text.ElideRight
61 elide: Text.ElideRight
61− objectName: "titleLabel"
62 font.weight: Font.DemiBold
62 font.weight: Font.DemiBold
63 wrapMode: Text.Wrap
63 wrapMode: Text.Wrap
64 maximumLineCount: 2
64 maximumLineCount: 2
@@ -66,6 +66,7 @@ Item {
66
66
67 Label {
67 Label {
68 id: subtitleLabel
68 id: subtitleLabel
69+ objectName: "subtitleLabel"
69 anchors { left: parent.left; right: parent.right }
70 anchors { left: parent.left; right: parent.right }
70 elide: Text.ElideRight
71 elide: Text.ElideRight
71 visible: titleLabel.text && text
72 visible: titleLabel.text && text
tests/qmltests/Dash/tst_Card.qml+6−3
@@ -193,7 +193,10 @@ Rectangle {
193 property Item summary: findChild(card, "summaryLabel")
193 property Item summary: findChild(card, "summaryLabel")
194
194
195 function initTestCase() {
195 function initTestCase() {
196− verify(testCase.header !== undefined, "Couldn't find header object.");
196+ verify(typeof testCase.header === "object", "Couldn't find header object.");
197+ verify(typeof testCase.art === "object", "Couldn't find art object.");
198+ verify(typeof testCase.artImage === "object", "Couldn't find artImage object.");
199+ verify(typeof testCase.summary === "object", "Couldn't find summary object.");
197 }
200 }
198
201
199 function cleanup() {
202 function cleanup() {
@@ -320,7 +323,7 @@ Rectangle {
320 function test_art_layout_data() {
323 function test_art_layout_data() {
321 return [
324 return [
322 { tag: "Vertical", left: function() { return 0 }, index: 0},
325 { tag: "Vertical", left: function() { return 0 }, index: 0},
323− { tag: "Horizontal", left: function() { return art.width }, index: 5 }
326+ { tag: "Horizontal", left: function() { return art.width }, index: 5 },
324 ];
327 ];
325 }
328 }
326
329
@@ -335,7 +338,7 @@ Rectangle {
335 { tag: "Vertical", top: function() { return art.y + art.height },
338 { tag: "Vertical", top: function() { return art.y + art.height },
336 left: function() { return art.x }, index: 0 },
339 left: function() { return art.x }, index: 0 },
337 { tag: "Horizontal", top: function() { return art.y },
340 { tag: "Horizontal", top: function() { return art.y },
338− left: function() { return art.x + art.width }, index: 5 }
341+ left: function() { return art.x + art.width }, index: 5 },
339 ]
342 ]
340 }
343 }
341
344
tests/qmltests/Dash/tst_CardHeader.qml+8−8
@@ -52,11 +52,11 @@ Rectangle {
52 property Item column: findChild(cardHeader, "column")
52 property Item column: findChild(cardHeader, "column")
53
53
54 function initTestCase() {
54 function initTestCase() {
55− verify(testCase.mascot !== undefined, "Couldn't find mascot object.");
55+ verify(typeof testCase.mascot === "object", "Couldn't find mascot object.");
56− verify(testCase.titleLabel !== undefined, "Couldn't find titleLabel object.");
56+ verify(typeof testCase.titleLabel === "object", "Couldn't find titleLabel object.");
57− verify(testCase.subtitleLabel !== undefined, "Couldn't find subtitleLabel object.");
57+ verify(typeof testCase.subtitleLabel === "object", "Couldn't find subtitleLabel object.");
58− verify(testCase.prices !== undefined, "Couldn't find prices object.");
58+ verify(typeof testCase.prices === "object", "Couldn't find prices object.");
59− verify(testCase.oldPriceLabel !== undefined, "Couldn't find oldPriceLabel object.");
59+ verify(typeof testCase.oldPriceLabel === "object", "Couldn't find oldPriceLabel object.");
60 }
60 }
61
61
62 function cleanup() {
62 function cleanup() {
@@ -86,7 +86,7 @@ Rectangle {
86 { tag: "Empty", visible: false },
86 { tag: "Empty", visible: false },
87 { tag: "Title only", title: "Foo", visible: true },
87 { tag: "Title only", title: "Foo", visible: true },
88 { tag: "Subtitle only", subtitle: "Bar", visible: false },
88 { tag: "Subtitle only", subtitle: "Bar", visible: false },
89− { tag: "Both", title: "Foo", subtitle: "Bar", visible: true }
89+ { tag: "Both", title: "Foo", subtitle: "Bar", visible: true },
90 ]
90 ]
91 }
91 }
92
92
@@ -104,7 +104,7 @@ Rectangle {
104 { tag: "Main and Alt", main: "$1.25", alt: "€1.00", visible: true },
104 { tag: "Main and Alt", main: "$1.25", alt: "€1.00", visible: true },
105 { tag: "Main and Old", main: "$1.25", old: "$2.00", visible: true, oldAlign: Text.AlignRight },
105 { tag: "Main and Old", main: "$1.25", old: "$2.00", visible: true, oldAlign: Text.AlignRight },
106 { tag: "Alt and Old", alt: "€1.00", old: "$2.00", visible: false },
106 { tag: "Alt and Old", alt: "€1.00", old: "$2.00", visible: false },
107− { tag: "All", main: "$1.25", alt: "€1.00", old: "$2.00", visible: true, oldAlign: Text.AlignHCenter }
107+ { tag: "All", main: "$1.25", alt: "€1.00", old: "$2.00", visible: true, oldAlign: Text.AlignHCenter },
108 ]
108 ]
109 }
109 }
110
110
@@ -122,7 +122,7 @@ Rectangle {
122 return [
122 return [
123 { tag: "Column width", object: column, width: cardHeader.width - testCase.outerRow.spacing * 2 },
123 { tag: "Column width", object: column, width: cardHeader.width - testCase.outerRow.spacing * 2 },
124 { tag: "Column width", object: column, width: cardHeader.width - mascot.width - testCase.outerRow.spacing * 3, mascot: "artwork/avatar.png" },
124 { tag: "Column width", object: column, width: cardHeader.width - mascot.width - testCase.outerRow.spacing * 3, mascot: "artwork/avatar.png" },
125− { tag: "Header height", object: cardHeader, height: function() { return subtitleLabel.y + subtitleLabel.height + outerRow.spacing * 2 } }
125+ { tag: "Header height", object: cardHeader, height: function() { return subtitleLabel.y + subtitleLabel.height + outerRow.spacing * 2 } },
126 ]
126 ]
127 }
127 }
128
128