on xenial help sign in
add a test for showing/hiding the window controls overlay
3b6f569Lukáš Tinkl
qml/Stages/WindowControlsOverlay.qml+5−2
@@ -31,8 +31,10 @@ Item {
31 TabletSideStageTouchGesture {
31 TabletSideStageTouchGesture {
32 id: gestureArea
32 id: gestureArea
33 anchors.fill: parent
33 anchors.fill: parent
34+
35+ // NB: for testing, not to clash with unity7 touch overlay controls
34− minimumTouchPoints: 2
36+ // minimumTouchPoints: 2
35− maximumTouchPoints: 2
37+ // maximumTouchPoints: 2
36
38
37 onRecognisedPressChanged: {
39 onRecognisedPressChanged: {
38 if (recognisedPress && target && !target.fullscreen) {
40 if (recognisedPress && target && !target.fullscreen) {
@@ -103,6 +105,7 @@ Item {
103 // the visual overlay
105 // the visual overlay
104 Item {
106 Item {
105 id: overlay
107 id: overlay
108+ objectName: "windowControlsOverlay"
106 anchors.fill: parent
109 anchors.fill: parent
107 opacity: overlayTimer.running ? 1 : 0
110 opacity: overlayTimer.running ? 1 : 0
108 visible: opacity == 1
111 visible: opacity == 1
tests/qmltests/Stages/tst_DesktopStage.qml+25
@@ -535,5 +535,30 @@ Item {
535 // verify the drop shadow is gone
535 // verify the drop shadow is gone
536 verify(PanelState.dropShadow == false);
536 verify(PanelState.dropShadow == false);
537 }
537 }
538+
539+ function test_threeFingerTapShowsWindowControls_data() {
540+ return [
541+ { tag: "1 finger", touchIds: [0], result: false },
542+ { tag: "2 finger", touchIds: [0, 1], result: false },
543+ { tag: "3 finger", touchIds: [0, 1, 2], result: true },
544+ { tag: "4 finger", touchIds: [0, 1, 2, 3], result: false },
545+ ];
546+ }
547+
548+ function test_threeFingerTapShowsWindowControls(data) {
549+ var facebookApp = startApplication("facebook-webapp");
550+ var facebookAppDelegate = findChild(desktopStage, "appDelegate_facebook-webapp");
551+ verify(facebookAppDelegate);
552+ var overlay = findChild(facebookAppDelegate, "windowControlsOverlay");
553+ verify(overlay);
554+
555+ multiTouchTap(data.touchIds, facebookAppDelegate);
556+ tryCompare(overlay, "visible", data.result);
557+
558+ if (data.result) { // if shown, try to hide it by clicking outside
559+ mouseClick(desktopStage);
560+ tryCompare(overlay, "visible", false);
561+ }
562+ }
538 }
563 }
539}
564}