on xenial help sign in
close the app only when the close button is tapped, not the entire thumbnail
commit19d90274930f18a8cc6f880143dbaf236f92081c authorom26er@ubuntu.com <> dateMon 14 Oct 2013, 13:01 (13 years ago) parentdaa342a38746e0
2 files changed+31−7
Dash/Apps/RunningApplicationTile.qml+7−3 tests/qmltests/Dash/Apps/tst_RunningApplicationsGrid.qml+24−4
Dash/Apps/RunningApplicationTile.qml+7−3
@@ -39,9 +39,7 @@ AbstractButton {
3939 property bool terminationModeEnabled: false
4040
4141 onClicked: {
42− if (terminationModeEnabled)
43− requestedApplicationTermination(application)
44− else
42+ if (!terminationModeEnabled)
4543 requestedApplicationActivation(application)
4644 }
4745
@@ -123,6 +121,7 @@ AbstractButton {
123121 }
124122
125123 CloseIcon {
124+ objectName: "closeIcon " + model.name
126125 anchors {
127126 left: shapedApplicationImage.left
128127 leftMargin: -units.gu(1)
@@ -133,5 +132,10 @@ AbstractButton {
133132 width: units.gu(6)
134133 id: closeIcon
135134 enabled: root.terminationModeEnabled
135+
136+ MouseArea {
137+ anchors { fill: parent; margins: -units.gu(1) }
138+ onClicked: requestedApplicationTermination(application)
139+ }
136140 }
137141}
tests/qmltests/Dash/Apps/tst_RunningApplicationsGrid.qml+24−4
@@ -195,9 +195,9 @@ Item {
195195 !runningApplicationsGrid.terminationModeEnabled
196196 }
197197
198− // While on termination mode, clicking a running application tile causes the
199− // corresponding application to be terminated.
200− function test_clickTileToTerminateApp() {
198+ // While on termination mode, clicking a running application tile, outside of
199+ // the close icon should do nothing
200+ function test_clickTileNotClose() {
201201 runningApplicationsGrid.terminationModeEnabled = true
202202
203203 var calendarTile = findChild(runningApplicationsGrid, "runningAppTile Calendar")
@@ -207,10 +207,30 @@ Item {
207207
208208 mouseClick(calendarTile, calendarTile.width/2, calendarTile.height/2)
209209
210+ verify(fakeRunningAppsModel.contains("calendar"))
211+
212+ // The tile for the Calendar app should stay there
213+ tryCompareFunction(checkCalendarTileExists, true)
214+ }
215+
216+ // While in termination mode, clicking on a running application tile's close icon
217+ // causes the corresponding application to be terminated
218+ function test_clickCloseIconToTerminateApp() {
219+ runningApplicationsGrid.terminationModeEnabled = true
220+
221+ var calendarTile = findChild(runningApplicationsGrid, "runningAppTile Calendar")
222+ var calendarTileCloseButton = findChild(runningApplicationsGrid, "closeIcon Calendar")
223+
224+ verify(calendarTile != undefined)
225+ verify(calendarTileCloseButton != undefined)
226+ verify(fakeRunningAppsModel.contains("calendar"))
227+
228+ mouseClick(calendarTileCloseButton, calendarTileCloseButton.width/2, calendarTileCloseButton.height/2)
229+
210230 verify(!fakeRunningAppsModel.contains("calendar"))
211231
212232 // The tile for the Calendar app should eventually vanish since the
213− // application has been terminated
233+ // application has been terminated.
214234 tryCompareFunction(checkCalendarTileExists, false)
215235 }
216236