Merge lp:~zsombi/ubuntu-ui-toolkit/label-fontsize-fix into lp:ubuntu-ui-toolkit/staging

Proposed by Zsombor Egri
Status: Merged
Approved by: Cris Dywan
Approved revision: 1327
Merged at revision: 1330
Proposed branch: lp:~zsombi/ubuntu-ui-toolkit/label-fontsize-fix
Merge into: lp:ubuntu-ui-toolkit/staging
Diff against target: 77 lines (+34/-29)
1 file modified
tests/unit/tst_components/tst_label.qml (+34/-29)
To merge this branch: bzr merge lp:~zsombi/ubuntu-ui-toolkit/label-fontsize-fix
Reviewer Review Type Date Requested Status
PS Jenkins bot continuous-integration Approve
Cris Dywan Approve
Review via email: mp+241957@code.launchpad.net

Commit message

Fixing typo in the Label test case. Refactoring tests to use data driven test.

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Cris Dywan (kalikiana) wrote :

Nice clean-up!!!! And good job spotting the silly typo :-d

review: Approve
Revision history for this message
PS Jenkins bot (ps-jenkins) :
review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'tests/unit/tst_components/tst_label.qml'
2--- tests/unit/tst_components/tst_label.qml 2014-10-08 09:57:38 +0000
3+++ tests/unit/tst_components/tst_label.qml 2014-11-17 13:31:22 +0000
4@@ -21,39 +21,44 @@
5 TestCase {
6 name: "LabelAPI"
7
8+ function cleanup() {
9+ textCustom.fontSize = "medium";
10+ textCustom.font.weight = Font.Light;
11+ }
12+
13 function test_0_defaults() {
14 compare(textCustom.font.family, "Ubuntu", "Default font family");
15 compare(textCustom.font.weight, Font.Light, "Default font weight");
16- }
17-
18- function test_fontSize() {
19 compare(textCustom.fontSize,"medium","fontSize is 'medium' by default")
20-
21- var fontSizes = ["xx-small", "x-small", "small", "medium", "large", "x-large", "xx-large" ]
22-
23- for (var i=0;i<fontSizes.length;i++)
24- {
25-
26- var newFontSize = fontSizes[i]
27- textCustom.fontSize = newFontSize
28- if (newFontSize == 'xx-small')
29- expectFail("","https://bugs.launchpad.net/tavastia/+bug/1076771")
30- compare(textCustom.newFontSize, newFontSize, "Can set/get " + newFontSize)
31- }
32- }
33-
34- function test_fontWeight() {
35- compare(textCustom.font.weight, Font.Light, "font.weight is 'light' by default")
36-
37- var fontWeights = [ Font.Light, Font.Normal, Font.DemiBold, Font.Bold, Font.Black ]
38-
39- for (var i in fontWeights)
40- {
41- var newFontWeight = fontWeights[i]
42- textCustom.font.weight = newFontWeight
43-
44- compare(textCustom.font.weight, newFontWeight, "can set/get " + newFontWeight)
45- }
46+ }
47+
48+ function test_fontSize_data() {
49+ return [
50+ {tag: "xx-small"},
51+ {tag: "x-small"},
52+ {tag: "small"},
53+ {tag: "medium"},
54+ {tag: "large"},
55+ {tag: "x-large"},
56+ ];
57+ }
58+ function test_fontSize(data) {
59+ textCustom.fontSize = data.tag;
60+ compare(textCustom.fontSize, data.tag, "Can set/get " + data.tag)
61+ }
62+
63+ function test_fontWeight_data() {
64+ return [
65+ {tag: "Light", weight: Font.Light},
66+ {tag: "Normal", weight: Font.Normal},
67+ {tag: "DemiBold", weight: Font.DemiBold},
68+ {tag: "Bold", weight: Font.Bold},
69+ {tag: "Black", weight: Font.Black},
70+ ];
71+ }
72+ function test_fontWeight(data) {
73+ textCustom.font.weight = data.weight
74+ compare(textCustom.font.weight, data.weight, "can set/get " + data.weight);
75 }
76
77 function test_boldWeightConflict() {

Subscribers

People subscribed via source and target branches