@@ -1,5 +1,5 @@
11/*
2− * Copyright (C) 2015-2016 Canonical, Ltd.
2+ * Copyright (C) 2015-2017 Canonical, Ltd.
33 *
44 * This program is free software; you can redistribute it and/or modify
55 * it under the terms of the GNU General Public License as published by
@@ -761,6 +761,38 @@ Rectangle {
761761 tryCompare(appDelegate, "stage", ApplicationInfoInterface.SideStage);
762762 }
763763
764+ /*
765+ Regression test for https://bugs.launchpad.net/ubuntu/+source/unity8/+bug/1670361
766+
767+ Clicks near the top window edge (but still inside the window boundaries) should go to
768+ the window (and not get eaten by some translucent decoration like in that bug).
769+ */
770+ function test_clickNearTopEdgeGoesToWindow() {
771+ compare(topLevelSurfaceList.count, 1); // assume unity8-dash is already there
772+
773+ var appDelegate = findChild(stage, "appDelegate_" + topLevelSurfaceList.idAt(0));
774+ verify(appDelegate);
775+
776+ var surfaceItem = findChild(appDelegate, "surfaceItem");
777+ verify(surfaceItem);
778+
779+ compare(surfaceItem.mousePressCount, 0);
780+ compare(surfaceItem.mouseReleaseCount, 0);
764781
782+ mouseClick(appDelegate, 1, 1); // near top left
783+
784+ compare(surfaceItem.mousePressCount, 1);
785+ compare(surfaceItem.mouseReleaseCount, 1);
786+
787+ mouseClick(appDelegate, appDelegate.width / 2, 1); // near top
788+
789+ compare(surfaceItem.mousePressCount, 2);
790+ compare(surfaceItem.mouseReleaseCount, 2);
791+
792+ mouseClick(appDelegate, appDelegate.width - 1, 1); // near top right
793+
794+ compare(surfaceItem.mousePressCount, 3);
795+ compare(surfaceItem.mouseReleaseCount, 3);
796+ }
765797 }
766798}