on xenial help sign in
Better check for the Drawer's readiness
f5b4abdDalton Durst
tests/qmltests/Launcher/tst_Drawer.qml+13−23
@@ -109,17 +109,10 @@ StyledItem {
109 tryCompareFunction( function(){ return drawer.x === 0; }, true );
109 tryCompareFunction( function(){ return drawer.x === 0; }, true );
110 tryCompare(launcher, "state", "drawer");
110 tryCompare(launcher, "state", "drawer");
111 tryCompare(launcher, "drawerShown", true);
111 tryCompare(launcher, "drawerShown", true);
112+ tryCompare(drawer, "fullyOpen", true);
112 return drawer;
113 return drawer;
113 }
114 }
114
115
115− function openDrawerAndWait() {
116− // Open the drawer by directly calling on the Launcher, then wait for it to animate in
117− launcher.toggleDrawer(true);
118− waitForRendering(launcher);
119− waitUntilTransitionsEnd(launcher);
120− return findChild(launcher, "drawer");
121− }
122−
123 function revealByEdgePush() {
116 function revealByEdgePush() {
124 // Place the mouse against the window/screen edge and push beyond the barrier threshold
117 // Place the mouse against the window/screen edge and push beyond the barrier threshold
125 // If the mouse did not move between two revealByEdgePush(), we need it to move out the
118 // If the mouse did not move between two revealByEdgePush(), we need it to move out the
@@ -247,7 +240,7 @@ StyledItem {
247 typeString("cam");
240 typeString("cam");
248 keyClick(Qt.Key_Enter);
241 keyClick(Qt.Key_Enter);
249
242
250− compare(launcher.lastSelectedApplication, "camera-app");
243+ tryCompare(launcher, "lastSelectedApplication", "camera-app");
251 waitForRendering(launcher);
244 waitForRendering(launcher);
252 tryCompare(launcher, "drawerShown", false);
245 tryCompare(launcher, "drawerShown", false);
253 }
246 }
@@ -281,25 +274,22 @@ StyledItem {
281 tryCompareFunction(function() { return !!searchField }, true);
274 tryCompareFunction(function() { return !!searchField }, true);
282 tryCompare(searchField, "selectedText", searchField.displayText);
275 tryCompare(searchField, "selectedText", searchField.displayText);
283 typeString("cam");
276 typeString("cam");
284− tryCompareFunction(function() { return searchField.displayText }, "cam");
277+ tryCompare(searchField, "displayText", "cam");
285
278
286 // Try again to make sure it cleaned and everything
279 // Try again to make sure it cleaned and everything
287 keyClick(Qt.Key_Escape);
280 keyClick(Qt.Key_Escape);
288− waitForRendering(launcher);
281+ tryCompare(drawer, "fullyClosed", true);
289− waitUntilTransitionsEnd(launcher);
282+ dragDrawerIntoView();
290− launcher.toggleDrawer(true);
291− waitForRendering(launcher);
292− waitUntilTransitionsEnd(launcher);
293
283
294− tryCompare(searchField, "selectedText", searchField.displayText);
284+ tryCompare(searchField, "displayText", "");
295 typeString("terminal");
285 typeString("terminal");
296− tryCompareFunction(function() { return searchField.displayText }, "terminal");
286+ tryCompare(searchField, "displayText", "terminal");
297
287
298 }
288 }
299
289
300 function test_kbdSearch() {
290 function test_kbdSearch() {
301 // Try out the keyboard navigation for the search field
291 // Try out the keyboard navigation for the search field
302− var drawer = openDrawerAndWait();
292+ var drawer = dragDrawerIntoView();
303 var searchField = findChild(drawer, "searchField");
293 var searchField = findChild(drawer, "searchField");
304
294
305 tryCompare(searchField, "focus", false);
295 tryCompare(searchField, "focus", false);
@@ -309,13 +299,13 @@ StyledItem {
309 tryCompare(searchField, "focus", false);
299 tryCompare(searchField, "focus", false);
310
300
311 // Make sure the focus doesn't get put back when reopening
301 // Make sure the focus doesn't get put back when reopening
312− openDrawerAndWait();
302+ dragDrawerIntoView();
313 tryCompare(searchField, "focus", false);
303 tryCompare(searchField, "focus", false);
314 }
304 }
315
305
316 function test_kbdGrid() {
306 function test_kbdGrid() {
317 // Try out the keyboard navigation around the grid
307 // Try out the keyboard navigation around the grid
318− var drawer = openDrawerAndWait();
308+ var drawer = dragDrawerIntoView();
319 var searchField = findChild(drawer, "searchField");
309 var searchField = findChild(drawer, "searchField");
320 var appList = findChild(drawer, "drawerAppList");
310 var appList = findChild(drawer, "drawerAppList");
321
311
@@ -337,7 +327,7 @@ StyledItem {
337
327
338 function test_kbdFocusMoves() {
328 function test_kbdFocusMoves() {
339 // Make sure keyboard focus can move between the search field and grid
329 // Make sure keyboard focus can move between the search field and grid
340− var drawer = openDrawerAndWait();
330+ var drawer = dragDrawerIntoView();
341 var searchField = findChild(drawer, "searchField");
331 var searchField = findChild(drawer, "searchField");
342 var appList = findChild(drawer, "drawerAppList");
332 var appList = findChild(drawer, "drawerAppList");
343
333
@@ -354,7 +344,7 @@ StyledItem {
354 }
344 }
355
345
356 function test_focusAppFromLauncherWhileDrawerIsOpen() {
346 function test_focusAppFromLauncherWhileDrawerIsOpen() {
357− openDrawerAndWait();
347+ dragDrawerIntoView();
358 var appIcon = findChild(launcher, "launcherDelegate4")
348 var appIcon = findChild(launcher, "launcherDelegate4")
359
349
360 mouseMove(appIcon, appIcon.width / 2, appIcon.height / 2);
350 mouseMove(appIcon, appIcon.width / 2, appIcon.height / 2);
@@ -385,7 +375,7 @@ StyledItem {
385 }
375 }
386
376
387 function test_closeWhileDragging() {
377 function test_closeWhileDragging() {
388− var drawer = openDrawerAndWait();
378+ var drawer = dragDrawerIntoView();
389 var handle = findChild(drawer, "drawerHandle");
379 var handle = findChild(drawer, "drawerHandle");
390 tryCompare(drawer.anchors, "rightMargin", -drawer.width);
380 tryCompare(drawer.anchors, "rightMargin", -drawer.width);
391
381