@@ -89,6 +89,13 @@ Item {
89 topLevelSurfaceList: topSurfaceList
89 topLevelSurfaceList: topSurfaceList
94+ id: clickThroughTester
95+ anchors.fill: desktopStageLoader.item
96+ acceptedButtons: Qt.AllButtons
94 Rectangle {
101 Rectangle {
@@ -140,6 +147,11 @@ Item {
152+ target: clickThroughTester
143 UnityTestCase {
155 UnityTestCase {
144 id: testCase
156 id: testCase
145 name: "DesktopStage"
157 name: "DesktopStage"
@@ -179,6 +191,7 @@ Item {
179 desktopStageLoader.active = true;
191 desktopStageLoader.active = true;
180 tryCompare(desktopStageLoader, "status", Loader.Ready);
192 tryCompare(desktopStageLoader, "status", Loader.Ready);
194+ mouseEaterSpy.clear();
184 function waitUntilAppSurfaceShowsUp(surfaceId) {
197 function waitUntilAppSurfaceShowsUp(surfaceId) {
@@ -703,5 +716,74 @@ Item {
703 dialerDelegate.surface.setMaximumHeight(0);
716 dialerDelegate.surface.setMaximumHeight(0);
704 tryCompare(dialerMaximizeButton, "visible", true);
717 tryCompare(dialerMaximizeButton, "visible", true);
720+ function test_canMoveWindowWithLeftMouseButtonOnly_data() {
722+ {tag: "left mouse button", button: Qt.LeftButton },
723+ {tag: "right mouse button", button: Qt.RightButton },
724+ {tag: "middle mouse button", button: Qt.MiddleButton }
728+ function test_canMoveWindowWithLeftMouseButtonOnly(data) {
729+ var appDelegate = startApplication("dialer-app");
730+ verify(appDelegate);
732+ var posBefore = Qt.point(appDelegate.x, appDelegate.y);
734+ mousePress(appDelegate, appDelegate.width / 2, units.gu(1), data.button);
735+ mouseMove(appDelegate, appDelegate.width / 2, -units.gu(100), undefined /* delay */, data.button);
737+ var posAfter = Qt.point(appDelegate.x, appDelegate.y);
739+ tryCompareFunction(function(){return posBefore == posAfter;}, data.button !== Qt.LeftButton ? true : false);
742+ function test_preventMouseEventsThruDesktopSpread() {
743+ var spread = findChild(desktopStage, "spread");
746+ tryCompareFunction( function(){ return spread.ready }, true );
748+ mouseEaterSpy.signalName = "wheel";
749+ mouseWheel(spread, spread.width/2, spread.height/2, 10, 10);
750+ tryCompare(mouseEaterSpy, "count", 0);
752+ mouseEaterSpy.clear();
753+ mouseEaterSpy.signalName = "clicked";
754+ mouseClick(spread, spread.width/2, spread.height/2, Qt.RightButton);
755+ tryCompare(mouseEaterSpy, "count", 0);
760+ function test_eatWindowDecorationMouseEvents_data() {
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 },
770+ function test_eatWindowDecorationMouseEvents(data) {
771+ var dialerAppDelegate = startApplication("dialer-app");
772+ verify(dialerAppDelegate);
773+ var decoration = findChild(dialerAppDelegate, "appWindowDecoration");
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);
782+ mouseDoubleClick(decoration, decoration.width/2, decoration.height/2, data.button);
783+ tryCompare(dialerAppDelegate, "maximized", false);
786+ tryCompare(mouseEaterSpy, "count", 0);