on xenial help sign in
More Shell test fixing

* Further defragment tests and helper functions * When moving the mouse and making sure you didn't go too far on the x axis, checking your y axis is not very useful.

commit3654844e065c4901458e5f256e8d45de81213a96 authorDalton Durst <dalton@ubports.com> dateTue 14 May 2019, 13:49 (7 years ago) parent7755dd4
1 file changed+99−99
tests/qmltests/tst_Shell.qml+99−99
tests/qmltests/tst_Shell.qml+99−99
@@ -776,6 +776,104 @@ Rectangle {
776776 LightDMController.userMode = mode;
777777 }
778778
779+ function dragToCloseIndicatorsPanel() {
780+ var indicators = findChild(shell, "indicators");
781+
782+ var touchStartX = shell.width / 2;
783+ var touchStartY = shell.height - (indicators.minimizedPanelHeight * 0.5);
784+ touchFlick(shell,
785+ touchStartX, touchStartY,
786+ touchStartX, shell.height * 0.1);
787+
788+ tryCompare(indicators, "fullyClosed", true);
789+ }
790+
791+ function dragLauncherIntoView() {
792+ var launcher = findChild(shell, "launcher");
793+ var launcherPanel = findChild(launcher, "launcherPanel");
794+ waitForRendering(launcher);
795+ verify(launcherPanel.x = - launcherPanel.width);
796+
797+ var touchStartX = 2;
798+ var touchStartY = shell.height / 2;
799+ touchFlick(shell, touchStartX, touchStartY, launcherPanel.width + units.gu(1), touchStartY);
800+
801+ tryCompare(launcherPanel, "x", 0);
802+ tryCompare(launcher, "state", "visible");
803+ }
804+
805+ function tapOnAppIconInLauncher() {
806+ var launcherPanel = findChild(shell, "launcherPanel");
807+
808+ // pick the first icon, the one at the top.
809+ var appIcon = findChild(launcherPanel, "launcherDelegate0")
810+ tap(appIcon, appIcon.width / 2, appIcon.height / 2);
811+ }
812+
813+ function showIndicators() {
814+ var indicators = findChild(shell, "indicators");
815+ indicators.show();
816+ tryCompare(indicators, "fullyOpened", true);
817+ }
818+
819+ function hideIndicators() {
820+ var indicators = findChild(shell, "indicators");
821+ if (indicators.fullyOpened) {
822+ indicators.hide();
823+ }
824+ }
825+
826+ function waitUntilDashIsFocused() {
827+ tryCompare(ApplicationManager, "focusedApplicationId", "unity8-dash");
828+ }
829+
830+ function swipeFromLeftEdge(swipeLength) {
831+ var touchStartX = 2;
832+ var touchStartY = shell.height / 2;
833+ touchFlick(shell,
834+ touchStartX , touchStartY,
835+ touchStartX + swipeLength, touchStartY);
836+ }
837+
838+ function itemIsOnScreen(item) {
839+ var itemRectInShell = item.mapToItem(shell, 0, 0, item.width, item.height);
840+
841+ return itemRectInShell.x >= 0
842+ && itemRectInShell.y >= 0
843+ && itemRectInShell.x + itemRectInShell.width <= shell.width
844+ && itemRectInShell.y + itemRectInShell.height <= shell.height;
845+ }
846+
847+ function showGreeter() {
848+ var greeter = findChild(shell, "greeter");
849+ LightDM.Greeter.showGreeter();
850+ waitForRendering(greeter);
851+ tryCompare(greeter, "fullyShown", true);
852+
853+ // greeter unloads its internal components when hidden
854+ // and reloads them when shown. Thus we have to do this
855+ // again before interacting with it otherwise any
856+ // SwipeAreas in there won't be easily fooled by
857+ // fake swipes.
858+ removeTimeConstraintsFromSwipeAreas(greeter);
859+ }
860+
861+ function revealLauncherByEdgePushWithMouse() {
862+ var launcher = findChild(shell, "launcher");
863+ verify(launcher);
864+
865+ // Place the mouse against the window/screen edge and push beyond the barrier threshold
866+ mouseMove(shell, 0, shell.height / 2);
867+ launcher.pushEdge(EdgeBarrierSettings.pushThreshold * .8);
868+
869+ var panel = findChild(launcher, "launcherPanel");
870+ verify(panel);
871+
872+ // wait until it gets fully extended
873+ tryCompare(panel, "x", 0);
874+ tryCompare(launcher, "state", "visibleTemporary");
875+ }
876+
779877 function test_snapDecisionDismissalReturnsFocus() {
780878 loadShell("phone");
781879 swipeAwayGreeter();
@@ -994,104 +1092,6 @@ Rectangle {
9941092 tryCompare(webAppSurface, "activeFocus", true);
9951093 }
9961094
997− function dragToCloseIndicatorsPanel() {
998− var indicators = findChild(shell, "indicators");
999−
1000− var touchStartX = shell.width / 2;
1001− var touchStartY = shell.height - (indicators.minimizedPanelHeight * 0.5);
1002− touchFlick(shell,
1003− touchStartX, touchStartY,
1004− touchStartX, shell.height * 0.1);
1005−
1006− tryCompare(indicators, "fullyClosed", true);
1007− }
1008−
1009− function dragLauncherIntoView() {
1010− var launcher = findChild(shell, "launcher");
1011− var launcherPanel = findChild(launcher, "launcherPanel");
1012− waitForRendering(launcher);
1013− verify(launcherPanel.x = - launcherPanel.width);
1014−
1015− var touchStartX = 2;
1016− var touchStartY = shell.height / 2;
1017− touchFlick(shell, touchStartX, touchStartY, launcherPanel.width + units.gu(1), touchStartY);
1018−
1019− tryCompare(launcherPanel, "x", 0);
1020− tryCompare(launcher, "state", "visible");
1021− }
1022−
1023− function tapOnAppIconInLauncher() {
1024− var launcherPanel = findChild(shell, "launcherPanel");
1025−
1026− // pick the first icon, the one at the top.
1027− var appIcon = findChild(launcherPanel, "launcherDelegate0")
1028− tap(appIcon, appIcon.width / 2, appIcon.height / 2);
1029− }
1030−
1031− function showIndicators() {
1032− var indicators = findChild(shell, "indicators");
1033− indicators.show();
1034− tryCompare(indicators, "fullyOpened", true);
1035− }
1036−
1037− function hideIndicators() {
1038− var indicators = findChild(shell, "indicators");
1039− if (indicators.fullyOpened) {
1040− indicators.hide();
1041− }
1042− }
1043−
1044− function waitUntilDashIsFocused() {
1045− tryCompare(ApplicationManager, "focusedApplicationId", "unity8-dash");
1046− }
1047−
1048− function swipeFromLeftEdge(swipeLength) {
1049− var touchStartX = 2;
1050− var touchStartY = shell.height / 2;
1051− touchFlick(shell,
1052− touchStartX , touchStartY,
1053− touchStartX + swipeLength, touchStartY);
1054− }
1055−
1056− function itemIsOnScreen(item) {
1057− var itemRectInShell = item.mapToItem(shell, 0, 0, item.width, item.height);
1058−
1059− return itemRectInShell.x >= 0
1060− && itemRectInShell.y >= 0
1061− && itemRectInShell.x + itemRectInShell.width <= shell.width
1062− && itemRectInShell.y + itemRectInShell.height <= shell.height;
1063− }
1064−
1065− function showGreeter() {
1066− var greeter = findChild(shell, "greeter");
1067− LightDM.Greeter.showGreeter();
1068− waitForRendering(greeter);
1069− tryCompare(greeter, "fullyShown", true);
1070−
1071− // greeter unloads its internal components when hidden
1072− // and reloads them when shown. Thus we have to do this
1073− // again before interacting with it otherwise any
1074− // SwipeAreas in there won't be easily fooled by
1075− // fake swipes.
1076− removeTimeConstraintsFromSwipeAreas(greeter);
1077− }
1078−
1079− function revealLauncherByEdgePushWithMouse() {
1080− var launcher = findChild(shell, "launcher");
1081− verify(launcher);
1082−
1083− // Place the mouse against the window/screen edge and push beyond the barrier threshold
1084− mouseMove(shell, 0, shell.height / 2);
1085− launcher.pushEdge(EdgeBarrierSettings.pushThreshold * .8);
1086−
1087− var panel = findChild(launcher, "launcherPanel");
1088− verify(panel);
1089−
1090− // wait until it gets fully extended
1091− tryCompare(panel, "x", 0);
1092− tryCompare(launcher, "state", "visibleTemporary");
1093− }
1094−
10951095 function test_focusRequestedHidesGreeter() {
10961096 loadShell("phone");
10971097 swipeAwayGreeter();
@@ -1713,7 +1713,7 @@ Rectangle {
17131713 }
17141714 }
17151715
1716− verify(y < 4000);
1716+ verify(x < 4000);
17171717
17181718 keyRelease(Qt.Key_Alt);
17191719 }