on xenial help sign in
Fix CardHeader title font weight.
commit69812eae1607d2c02e1c48407bb20d74d8ada4d7 authorMichał Sawicz <michal.sawicz@canonical.com> dateFri 28 Feb 2014, 10:46 (13 years ago) parentf4d6fadecc1779
3 files changed+18
qml/Dash/Card.qml+2 qml/Dash/CardHeader.qml+2 tests/qmltests/Dash/tst_Card.qml+14
qml/Dash/Card.qml+2
@@ -160,6 +160,8 @@ Item {
160160 title: cardData && cardData["title"] || ""
161161 subtitle: cardData && cardData["subtitle"] || ""
162162
163+ titleWeight: components && components["subtitle"] ? Font.DemiBold : Font.Normal
164+
163165 opacity: showHeader ? 1 : 0
164166
165167 Behavior on opacity { NumberAnimation { duration: UbuntuAnimation.SnapDuration } }
qml/Dash/CardHeader.qml+2
@@ -26,6 +26,8 @@ Item {
2626 property alias oldPrice: oldPriceLabel.text
2727 property alias altPrice: altPriceLabel.text
2828
29+ property alias titleWeight: titleLabel.font.weight
30+
2931 // FIXME: Saviq, used to scale fonts down in Carousel
3032 property real fontScale: 1.0
3133
tests/qmltests/Dash/tst_Card.qml+14
@@ -182,6 +182,7 @@ Rectangle {
182182 when: windowShown
183183
184184 property Item header: findChild(card, "cardHeader")
185+ property Item title: findChild(header, "titleLabel")
185186 property Item art: findChild(card, "artShape")
186187 property Item artImage: findChild(card, "artImage")
187188 property Item summary: findChild(card, "summaryLabel")
@@ -413,5 +414,18 @@ Rectangle {
413414 tryCompare(backgroundImage, "source", data.image);
414415 }
415416 }
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+ }
416430 }
417431}