on xenial help sign in
Add another test
commit4eee1a2ac2edb1e3753ca69fd6ce7adb34aa6cf6 authorDaniel d'Andrada <daniel.dandrada@canonical.com> dateFri 13 Mar 2015, 16:18 (12 years ago) parentdf43250
3 files changed+25
qml/Stages/DesktopStage.qml+1 qml/Stages/WindowDecoration.qml+1 tests/qmltests/Stages/tst_DesktopStage.qml+23
qml/Stages/DesktopStage.qml+1
@@ -131,6 +131,7 @@ FocusScope {
131131
132132 DecoratedWindow {
133133 id: decoratedWindow
134+ objectName: "decoratedWindow_" + appId
134135 anchors.fill: parent
135136 application: ApplicationManager.get(index)
136137 active: ApplicationManager.focusedApplicationId === model.appId
qml/Stages/WindowDecoration.qml+1
@@ -55,6 +55,7 @@ Item {
5555
5656 Label {
5757 id: titleLabel
58+ objectName: "windowDecorationTitle"
5859 color: "#DFDBD2"
5960 height: parent.height
6061 verticalAlignment: Text.AlignVCenter
tests/qmltests/Stages/tst_DesktopStage.qml+23
@@ -170,5 +170,28 @@ Rectangle {
170170 tap(webbrowserWindow);
171171 compare(webbrowserWindow.application.session.surface.activeFocus, true);
172172 }
173+
174+ function test_tappingOnWindowTitleChangesFocusedApp() {
175+ webbrowserCheckBox.checked = true;
176+ waitUntilAppSurfaceShowsUp(webbrowserCheckBox.appId);
177+
178+ var webbrowserWindow = findChild(desktopStage, "decoratedWindow_" + webbrowserCheckBox.appId);
179+ verify(webbrowserWindow);
180+ var webbrowserWindowTitle = findChild(webbrowserWindow, "windowDecorationTitle");
181+ verify(webbrowserWindowTitle);
182+ var dashWindow = findChild(desktopStage, "decoratedWindow_unity8-dash");
183+ verify(dashWindow);
184+ var dashWindowTitle = findChild(dashWindow, "windowDecorationTitle");
185+ verify(dashWindowTitle);
186+
187+ // some sanity check
188+ compare(rectsOverlap(dashWindow, webbrowserWindow), false);
189+
190+ tap(dashWindowTitle);
191+ compare(dashWindow.application.session.surface.activeFocus, true);
192+
193+ tap(webbrowserWindowTitle);
194+ compare(webbrowserWindow.application.session.surface.activeFocus, true);
195+ }
173196 }
174197}