on xenial help sign in
add tests for the new select() function
commitdda4fe1ed1595c3491fae151c4fcf63e7396cd54 authorMichael Zanetti <michael.zanetti@canonical.com> dateThu 20 Mar 2014, 13:27 (13 years ago) parent826aca6
1 file changed+29
tests/qmltests/Stages/tst_PhoneStage.qml+29
tests/qmltests/Stages/tst_PhoneStage.qml+29
@@ -212,6 +212,35 @@ Item {
212212 tryCompare(phoneStage, "painting", false);
213213 }
214214
215+ function test_select_data() {
216+ return [
217+ { tag: "0", index: 0 },
218+ { tag: "2", index: 2 },
219+ { tag: "4", index: 4 },
220+ ]
221+ }
222+
223+ function test_select(data) {
224+ addApps(5);
225+
226+ var spreadView = findChild(phoneStage, "spreadView");
227+
228+ var startX = phoneStage.width;
229+ var startY = phoneStage.height / 2;
230+ var endY = startY;
231+ var endX = units.gu(2);
232+
233+ var selectedApp = ApplicationManager.get(data.index);
234+
235+ touchFlick(phoneStage, startX, startY, endX, endY,
236+ true /* beginTouch */, true /* endTouch */, units.gu(10), 50);
237+
238+ phoneStage.select(selectedApp.appId);
239+
240+ tryCompare(phoneStage, "painting", false);
241+ compare(ApplicationManager.focusedApplicationId, selectedApp.appId);
242+ }
243+
215244 function cleanup() {
216245 while (ApplicationManager.count > 0) {
217246 var oldCount = ApplicationManager.count;