~azzar1/unity8/launcher-tooltips

« back to all changes in this revision

Viewing changes to tests/qmltests/Launcher/tst_Launcher.qml

  • Committer: Andrea Azzarone
  • Date: 2016-09-26 12:52:55 UTC
  • Revision ID: azzaronea@gmail.com-20160926125255-blf3570vuyepfjzw
Update tests.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1355
1355
        }
1356
1356
 
1357
1357
        function test_tooltip() {
1358
 
            dragLauncherIntoView()
 
1358
            launcher.lockedVisible = true;
 
1359
            dragLauncherIntoView();
1359
1360
 
1360
 
            var item = findChild(launcher, "launcherDelegate0")
1361
 
            var tooltipShape = findChild(launcher, "tooltipShape")
 
1361
            var item = findChild(launcher, "launcherDelegate0");
 
1362
            var tooltipShape = findChild(launcher, "tooltipShape");
1362
1363
 
1363
1364
            // Make sure we don't start the test with the mouse hovering the launcher
1364
 
            mouseMove(root, root.width, root.height / 2)
 
1365
            mouseMove(root, root.width, root.height / 2);
1365
1366
 
1366
1367
            // Initial state
1367
 
            compare(tooltipShape.visible, false)
 
1368
            tryCompare(tooltipShape, "visible", false);
1368
1369
 
1369
1370
            // Move the mouse on the launcher icon
1370
 
            mouseMove(item, item.width / 2, item.height / 2)
1371
 
            mouseMove(item, item.width / 2 + 1, item.height / 2)
1372
 
            tryCompare(tooltipShape, "visible", true)
 
1371
            mouseMove(item, item.width / 2, item.height / 2);
 
1372
            mouseMove(item, item.width / 2 + 1, item.height / 2);
 
1373
            tryCompare(tooltipShape, "visible", true);
1373
1374
 
1374
1375
            // Move the mouse away
1375
 
            mouseMove(root, root.width, root.height / 2)
1376
 
            tryCompare(tooltipShape, "visible", false)
 
1376
            mouseMove(root, root.width, root.height / 2);
 
1377
            tryCompare(tooltipShape, "visible", false);
1377
1378
        }
1378
1379
 
1379
 
        function test_quicklist_dismiss_tooltip() {
1380
 
            dragLauncherIntoView()
 
1380
        function test_quicklist_dismisses_tooltip() {
 
1381
            launcher.lockedVisible = true;
 
1382
            dragLauncherIntoView();
1381
1383
 
1382
 
            var item = findChild(launcher, "launcherDelegate0")
1383
 
            var tooltipShape = findChild(launcher, "tooltipShape")
1384
 
            var quickListShape = findChild(launcher, "quickListShape")
 
1384
            var item = findChild(launcher, "launcherDelegate0");
 
1385
            var tooltipShape = findChild(launcher, "tooltipShape");
 
1386
            var quickListShape = findChild(launcher, "quickListShape");
1385
1387
 
1386
1388
            // Make sure we don't start the test with the mouse hovering the launcher
1387
 
            mouseMove(root, root.width, root.height / 2)
 
1389
            mouseMove(root, root.width, root.height / 2);
1388
1390
 
1389
1391
            // Initial state
1390
 
            compare(tooltipShape.visible, false)
1391
 
 
1392
 
                                    var tooltip = findChild(launcher, "tooltip")
1393
 
 
 
1392
            tryCompare(tooltipShape, "visible", false);
1394
1393
 
1395
1394
            // Move the mouse on the launcher icon
1396
 
            mouseMove(item, item.width / 2, item.height / 2)
1397
 
            mouseMove(item, item.width / 2 + 1, item.height / 2)
1398
 
            tryCompare(tooltipShape, "visible", true)
1399
 
                        console.log(tooltip.state)
1400
 
 
 
1395
            mouseMove(item, item.width / 2, item.height / 2);
 
1396
            mouseMove(item, item.width / 2 + 1, item.height / 2);
 
1397
            tryCompare(tooltipShape, "visible", true);
1401
1398
 
1402
1399
            // Right click to show the quicklist
1403
 
            mouseClick(item, item.width / 2, item.height / 2, Qt.RightButton)
1404
 
            tryCompare(quickListShape, "visible", true)
1405
 
 
1406
 
            console.log(tooltip.state)
1407
 
            tryCompare(tooltipShape, "visible", false)
 
1400
            mouseClick(item, item.width / 2, item.height / 2, Qt.RightButton);
 
1401
            tryCompare(quickListShape, "visible", true);
 
1402
            tryCompare(tooltipShape, "visible", false);
 
1403
 
 
1404
            // Left click hides the quicklist, tooltip is still dismissed
 
1405
            mouseClick(item, item.width / 2, item.height / 2, Qt.LefftButton);
 
1406
            tryCompare(quickListShape, "visible", false);
 
1407
            tryCompare(tooltipShape, "visible", false);
 
1408
 
 
1409
            // Mouse motion should should show tooltip again
 
1410
            mouseMove(item, item.width / 2, item.height / 2);
 
1411
            mouseMove(item, item.width / 2 + 1, item.height / 2);
 
1412
            tryCompare(tooltipShape, "visible", true);
1408
1413
        }
1409
1414
 
1410
 
        function test_click_dismiss_tooltip() {
1411
 
            dragLauncherIntoView()
 
1415
        function test_click_dismisses_tooltip() {
 
1416
            launcher.lockedVisible = true;
 
1417
            dragLauncherIntoView();
1412
1418
 
1413
 
            var item = findChild(launcher, "launcherDelegate0")
1414
 
            var tooltipShape = findChild(launcher, "tooltipShape")
 
1419
            var item = findChild(launcher, "launcherDelegate0");
 
1420
            var tooltipShape = findChild(launcher, "tooltipShape");
1415
1421
 
1416
1422
            // Make sure we don't start the test with the mouse hovering the launcher
1417
 
            mouseMove(root, root.width, root.height / 2)
 
1423
            mouseMove(root, root.width, root.height / 2);
1418
1424
 
1419
1425
            // Initial state
1420
 
            compare(tooltipShape.visible, false)
 
1426
            compare(tooltipShape.visible, false);
1421
1427
 
1422
1428
            // Move the mouse on the launcher icon
1423
 
            mouseMove(item, item.width / 2, item.height / 2)
1424
 
            mouseMove(item, item.width / 2 + 1, item.height / 2)
1425
 
            tryCompare(tooltipShape, "visible", true)
 
1429
            mouseMove(item, item.width / 2, item.height / 2);
 
1430
            mouseMove(item, item.width / 2 + 1, item.height / 2);
 
1431
            tryCompare(tooltipShape, "visible", true);
1426
1432
 
1427
1433
            // Left click should dismiss the tooltip
1428
 
            mouseClick(item, item.width / 2, item.height / 2, Qt.LeftButton)
1429
 
            tryCompare(tooltipShape, "visible", false)
 
1434
            mouseClick(item, item.width / 2 + 1, item.height / 2, Qt.LeftButton);
 
1435
            tryCompare(tooltipShape, "visible", false);
 
1436
 
 
1437
            // Mouse motion should should show tooltip again
 
1438
            mouseMove(item, item.width / 2, item.height / 2);
 
1439
            mouseMove(item, item.width / 2 + 1, item.height / 2);
 
1440
            tryCompare(tooltipShape, "visible", true);
1430
1441
        }
1431
1442
    }
1432
1443
}