on xenial help sign in
Fix card title font weight.
e634da8Michał Karnicki
qml/Dash/Card.qml+2
@@ -128,6 +128,8 @@ Item {
128 title: cardData && cardData["title"] || ""
128 title: cardData && cardData["title"] || ""
129 subtitle: cardData && cardData["subtitle"] || ""
129 subtitle: cardData && cardData["subtitle"] || ""
130
130
131+ titleWeight: components && components["subtitle"] ? Font.DemiBold : Font.Normal
132+
131 opacity: showHeader ? 1 : 0
133 opacity: showHeader ? 1 : 0
132
134
133 Behavior on opacity { NumberAnimation { duration: UbuntuAnimation.SnapDuration } }
135 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
@@ -167,6 +167,7 @@ Rectangle {
167 when: windowShown
167 when: windowShown
168
168
169 property Item header: findChild(card, "cardHeader")
169 property Item header: findChild(card, "cardHeader")
170+ property Item title: findChild(header, "titleLabel")
170 property Item art: findChild(card, "artShape")
171 property Item art: findChild(card, "artShape")
171 property Item artImage: findChild(card, "artImage")
172 property Item artImage: findChild(card, "artImage")
172 property Item summary: findChild(card, "summaryLabel")
173 property Item summary: findChild(card, "summaryLabel")
@@ -354,5 +355,18 @@ Rectangle {
354 compare(testCase.art.height, 0);
355 compare(testCase.art.height, 0);
355 compare(testCase.art.width, 0);
356 compare(testCase.art.width, 0);
356 }
357 }
358+
359+ function test_font_weights_data() {
360+ return [
361+ { tag: "Title only", index: 8, weight: Font.Normal },
362+ { tag: "Title, subtitle", index: 0, weight: Font.DemiBold },
363+ ]
364+ }
365+
366+ function test_font_weights(data) {
367+ selector.selectedIndex = data.index;
368+
369+ tryCompare(testCase.title.font, "weight", data.weight);
370+ }
357 }
371 }
358}
372}