on xenial help sign in
Fix header width.
commitc5fce112a16796cae7f0b355d1709437e4e52f63 authorMichał Sawicz <michal.sawicz@canonical.com> dateFri 6 Dec 2013, 15:53 (13 years ago) parent6bd97f8
2 files changed+22−1
Dash/CardHeader.qml+3−1 tests/qmltests/Dash/tst_CardHeader.qml+19
Dash/CardHeader.qml+3−1
@@ -15,6 +15,7 @@ Item {
1515
1616 Row {
1717 id: row
18+ objectName: "outerRow"
1819
1920 anchors { top: parent.top; left: parent.left; right: parent.right; margins: spacing }
2021 spacing: units.gu(1)
@@ -34,7 +35,8 @@ Item {
3435 }
3536
3637 Column {
37− width: parent.width - x - row.spacing
38+ objectName: "column"
39+ width: parent.width - x
3840
3941 Label {
4042 id: titleLabel
tests/qmltests/Dash/tst_CardHeader.qml+19
@@ -31,6 +31,8 @@ Rectangle {
3131 property Item subtitleLabel: findChild(cardHeader, "subtitleLabel")
3232 property Item prices: findChild(cardHeader, "prices")
3333 property Item oldPriceLabel: findChild(cardHeader, "oldPriceLabel")
34+ property Item outerRow: findChild(cardHeader, "outerRow")
35+ property Item column: findChild(cardHeader, "column")
3436
3537 function initTestCase() {
3638 verify(testCase.mascot !== undefined, "Couldn't find mascot object.");
@@ -101,5 +103,22 @@ Rectangle {
101103 compare(testCase.oldPriceLabel.horizontalAlignment, data.oldAlign, "Old price label is aligned wrong.")
102104 }
103105 }
106+
107+ function test_dimensions_data() {
108+ return [
109+ { tag: "Column width", object: column, width: cardHeader.width - testCase.outerRow.spacing * 2 },
110+ { tag: "Column width", object: column, width: cardHeader.width - mascot.width - testCase.outerRow.spacing * 3, mascot: "artwork/avatar.png" }
111+ ]
112+ }
113+
114+ function test_dimensions(data) {
115+ if (data.hasOwnProperty("mascot")) {
116+ cardHeader.mascot = data.mascot;
117+ }
118+
119+ if (data.hasOwnProperty("width")) {
120+ tryCompare(data.object, "width", data.width);
121+ }
122+ }
104123 }
105124}