@@ -38,15 +38,43 @@ Item {
38 width: units.gu(120)
38 width: units.gu(120)
39 height: units.gu(120)
39 height: units.gu(120)
47+ sourceComponent: Component {
49+ model: infographicModel
41 UT.UnityTestCase {
54 UT.UnityTestCase {
42 name: "Infographics"
55 name: "Infographics"
43 when: windowShown
56 when: windowShown
58+ property var dataCircle
61+ property var presentCircles
62+ property var pastCircles
63+ property var infographic
66+ loader.active = false;
67+ tryCompare(loader, "status", Loader.Null);
68+ tryCompare(loader, "item", null);
69+ loader.active = true;
70+ tryCompare(loader, "status", Loader.Ready);
71+ infographic = loader.item
45− property var dataCircle: findChild(infographic, "dataCircle")
72+ dataCircle = findChild(infographic, "dataCircle")
46− property var dots: findChild(infographic, "dots")
73+ dots = findChild(infographic, "dots")
47− property var label: findChild(infographic, "label")
74+ label = findChild(infographic, "label")
48− property var presentCircles: findChild(infographic, "presentCircles")
75+ presentCircles = findChild(infographic, "presentCircles")
49− property var pastCircles: findChild(infographic, "pastCircles")
76+ pastCircles = findChild(infographic, "pastCircles")
51 function test_dot_states_data() {
79 function test_dot_states_data() {
@@ -74,8 +102,9 @@ Item {
75 function test_set_username_data() {
103 function test_set_username_data() {
77− { username: "", label: "", visible: false },
105+ { username: "has-password", label: "<b>19</b> minutes talk time", visible: true },
78− { username: "two-factor", label: "", visible: true },
106+ { username: "two-factor", label: "", visible: true },
107+ { username: "", label: "", visible: false },
@@ -89,26 +118,18 @@ Item {
89 function test_set_current_day_data(data)
118 function test_set_current_day_data(data)
92− { tag: "Same day", currentDaySet: 0, currentDayExpected: 0 },
121+ { tag: "Same day", username: "", expectedDay: "".length}, // Expecting day 0, since the UserMetrics mock sets this value at creation time
93− { tag: "Wrong day", currentDaySet: 1, currentDayExpected: 0 },
122+ { tag: "Different day", username: "has-password", expectedDay: "has-password".length},
97 function test_set_current_day(data)
126 function test_set_current_day(data)
99− infographic.currentDay = data.currentDaySet
128+ infographicModel.username = data.username
100− infographic.startShowAnimation()
101− compare(infographic.currentDay, data.currentDayExpected)
129+ tryCompare(infographic, "currentDay", data.expectedDay)
108− anchors.fill: parent
109− model: infographicModel
112 Dot { id: dot }
133 Dot { id: dot }
113 ObjectPositioner { id: objectPositioner }
134 ObjectPositioner { id: objectPositioner }