@@ -89,6 +89,13 @@ Item {
8989 topLevelSurfaceList: topSurfaceList
9090 }
9191 }
92+
93+ MouseArea {
94+ id: clickThroughTester
95+ anchors.fill: desktopStageLoader.item
96+ acceptedButtons: Qt.AllButtons
97+ hoverEnabled: true
98+ }
9299 }
93100
94101 Rectangle {
@@ -140,6 +147,11 @@ Item {
140147 }
141148 }
142149
150+ SignalSpy {
151+ id: mouseEaterSpy
152+ target: clickThroughTester
153+ }
154+
143155 UnityTestCase {
144156 id: testCase
145157 name: "DesktopStage"
@@ -179,6 +191,7 @@ Item {
179191 desktopStageLoader.active = true;
180192 tryCompare(desktopStageLoader, "status", Loader.Ready);
181193
194+ mouseEaterSpy.clear();
182195 }
183196
184197 function waitUntilAppSurfaceShowsUp(surfaceId) {
@@ -703,5 +716,74 @@ Item {
703716 dialerDelegate.surface.setMaximumHeight(0);
704717 tryCompare(dialerMaximizeButton, "visible", true);
705718 }
719+
720+ function test_canMoveWindowWithLeftMouseButtonOnly_data() {
721+ return [
722+ {tag: "left mouse button", button: Qt.LeftButton },
723+ {tag: "right mouse button", button: Qt.RightButton },
724+ {tag: "middle mouse button", button: Qt.MiddleButton }
725+ ]
726+ }
727+
728+ function test_canMoveWindowWithLeftMouseButtonOnly(data) {
729+ var appDelegate = startApplication("dialer-app");
730+ verify(appDelegate);
731+
732+ var posBefore = Qt.point(appDelegate.x, appDelegate.y);
733+
734+ mousePress(appDelegate, appDelegate.width / 2, units.gu(1), data.button);
735+ mouseMove(appDelegate, appDelegate.width / 2, -units.gu(100), undefined /* delay */, data.button);
736+
737+ var posAfter = Qt.point(appDelegate.x, appDelegate.y);
738+
739+ tryCompareFunction(function(){return posBefore == posAfter;}, data.button !== Qt.LeftButton ? true : false);
740+ }
741+
742+ function test_preventMouseEventsThruDesktopSpread() {
743+ var spread = findChild(desktopStage, "spread");
744+ verify(spread);
745+ spread.show();
746+ tryCompareFunction( function(){ return spread.ready }, true );
747+
748+ mouseEaterSpy.signalName = "wheel";
749+ mouseWheel(spread, spread.width/2, spread.height/2, 10, 10);
750+ tryCompare(mouseEaterSpy, "count", 0);
751+
752+ mouseEaterSpy.clear();
753+ mouseEaterSpy.signalName = "clicked";
754+ mouseClick(spread, spread.width/2, spread.height/2, Qt.RightButton);
755+ tryCompare(mouseEaterSpy, "count", 0);
756+
757+ spread.cancel();
758+ }
759+
760+ function test_eatWindowDecorationMouseEvents_data() {
761+ return [
762+ {tag: "left mouse click", signalName: "clicked", button: Qt.LeftButton },
763+ {tag: "right mouse click", signalName: "clicked", button: Qt.RightButton },
764+ {tag: "middle mouse click", signalName: "clicked", button: Qt.MiddleButton },
765+ {tag: "mouse wheel", signalName: "wheel", button: Qt.MiddleButton },
766+ {tag: "double click (RMB)", signalName: "doubleClicked", button: Qt.RightButton },
767+ ]
768+ }
769+
770+ function test_eatWindowDecorationMouseEvents(data) {
771+ var dialerAppDelegate = startApplication("dialer-app");
772+ verify(dialerAppDelegate);
773+ var decoration = findChild(dialerAppDelegate, "appWindowDecoration");
774+ verify(decoration);
775+
776+ mouseEaterSpy.signalName = data.signalName;
777+ if (data.signalName === "wheel") {
778+ mouseWheel(decoration, decoration.width/2, decoration.height/2, 20, 20);
779+ } else if (data.signalName === "clicked") {
780+ mouseClick(decoration, decoration.width/2, decoration.height/2, data.button);
781+ } else {
782+ mouseDoubleClick(decoration, decoration.width/2, decoration.height/2, data.button);
783+ tryCompare(dialerAppDelegate, "maximized", false);
784+ }
785+
786+ tryCompare(mouseEaterSpy, "count", 0);
787+ }
706788 }
707789}