on xenial help sign in
Fix card title font weight.
commite634da866f4f2383bc0eeb8026af7c4bbfefa772 authorMichał Karnicki <michal.karnicki@canonical.com> dateFri 21 Feb 2014, 11:50 (13 years ago) parenta61bf6f
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
@@ -128,6 +128,8 @@ Item {
128128 title: cardData && cardData["title"] || ""
129129 subtitle: cardData && cardData["subtitle"] || ""
130130
131+ titleWeight: components && components["subtitle"] ? Font.DemiBold : Font.Normal
132+
131133 opacity: showHeader ? 1 : 0
132134
133135 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
@@ -167,6 +167,7 @@ Rectangle {
167167 when: windowShown
168168
169169 property Item header: findChild(card, "cardHeader")
170+ property Item title: findChild(header, "titleLabel")
170171 property Item art: findChild(card, "artShape")
171172 property Item artImage: findChild(card, "artImage")
172173 property Item summary: findChild(card, "summaryLabel")
@@ -354,5 +355,18 @@ Rectangle {
354355 compare(testCase.art.height, 0);
355356 compare(testCase.art.width, 0);
356357 }
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+ }
357371 }
358372}