on xenial help sign in
Fix CardHeader title font weight.
69812eaMichał Sawicz
qml/Dash/Card.qml+2
@@ -160,6 +160,8 @@ Item {
160 title: cardData && cardData["title"] || ""
160 title: cardData && cardData["title"] || ""
161 subtitle: cardData && cardData["subtitle"] || ""
161 subtitle: cardData && cardData["subtitle"] || ""
162
162
163+ titleWeight: components && components["subtitle"] ? Font.DemiBold : Font.Normal
164+
163 opacity: showHeader ? 1 : 0
165 opacity: showHeader ? 1 : 0
164
166
165 Behavior on opacity { NumberAnimation { duration: UbuntuAnimation.SnapDuration } }
167 Behavior on opacity { NumberAnimation { duration: UbuntuAnimation.SnapDuration } }
qml/Dash/CardHeader.qml+2
@@ -26,6 +26,8 @@ Item {
26 property alias oldPrice: oldPriceLabel.text
26 property alias oldPrice: oldPriceLabel.text
27 property alias altPrice: altPriceLabel.text
27 property alias altPrice: altPriceLabel.text
28
28
29+ property alias titleWeight: titleLabel.font.weight
30+
29 // FIXME: Saviq, used to scale fonts down in Carousel
31 // FIXME: Saviq, used to scale fonts down in Carousel
30 property real fontScale: 1.0
32 property real fontScale: 1.0
31
33
tests/qmltests/Dash/tst_Card.qml+14
@@ -182,6 +182,7 @@ Rectangle {
182 when: windowShown
182 when: windowShown
183
183
184 property Item header: findChild(card, "cardHeader")
184 property Item header: findChild(card, "cardHeader")
185+ property Item title: findChild(header, "titleLabel")
185 property Item art: findChild(card, "artShape")
186 property Item art: findChild(card, "artShape")
186 property Item artImage: findChild(card, "artImage")
187 property Item artImage: findChild(card, "artImage")
187 property Item summary: findChild(card, "summaryLabel")
188 property Item summary: findChild(card, "summaryLabel")
@@ -413,5 +414,18 @@ Rectangle {
413 tryCompare(backgroundImage, "source", data.image);
414 tryCompare(backgroundImage, "source", data.image);
414 }
415 }
415 }
416 }
417+
418+ function test_font_weights_data() {
419+ return [
420+ { tag: "Title only", index: 8, weight: Font.Normal },
421+ { tag: "Title, subtitle", index: 0, weight: Font.DemiBold },
422+ ]
423+ }
424+
425+ function test_font_weights(data) {
426+ selector.selectedIndex = data.index;
427+
428+ tryCompare(testCase.title.font, "weight", data.weight);
429+ }
416 }
430 }
417}
431}