on xenial help sign in
Add unit test for new day detection and set in infographics
c4bf683Tomás Tormo
tests/qmltests/Greeter/tst_Infographics.qml+17−2
@@ -74,9 +74,9 @@ Item {
74
74
75 function test_set_username_data() {
75 function test_set_username_data() {
76 return [
76 return [
77− { username: "has-password", label: "<b>19</b> minutes talk time", visible: true },
78− { username: "two-factor", label: "", visible: true },
79 { username: "", label: "", visible: false },
77 { username: "", label: "", visible: false },
78+ { username: "two-factor", label: "", visible: true },
79+
80 ]
80 ]
81 }
81 }
82
82
@@ -85,6 +85,21 @@ Item {
85 tryCompare(label, "text", data.label)
85 tryCompare(label, "text", data.label)
86 compare(infographic.visible, data.visible);
86 compare(infographic.visible, data.visible);
87 }
87 }
88+
89+ function test_set_current_day_data(data)
90+ {
91+ return [
92+ { tag: "Same day", currentDaySet: 0, currentDayExpected: 0 },
93+ { tag: "Wrong day", currentDaySet: 1, currentDayExpected: 0 },
94+ ]
95+ }
96+
97+ function test_set_current_day(data)
98+ {
99+ infographic.currentDay = data.currentDaySet
100+ infographic.startShowAnimation()
101+ compare(infographic.currentDay, data.currentDayExpected)
102+ }
88 }
103 }
89
104
90 Infographics {
105 Infographics {