on xenial help sign in
Use a different way to test clicks on buttons and interactive-areas
commitb7b5af84cd6f98a426de8c43497931034c96834d authorMirco Müller <mirco.mueller@ubuntu.com> dateTue 18 Jun 2013, 17:50 (13 years ago) parent31777a2
1 file changed+9−4
tests/qmltests/Notifications/tst_Notifications.qml+9−4
tests/qmltests/Notifications/tst_Notifications.qml+9−4
@@ -29,13 +29,18 @@ Row {
2929 id: mockNotification
3030
3131 QtObject {
32− function invokeAction(actionId) { }
32+ function invokeAction(actionId) {
33+ mockModel.actionId = actionId
34+ print ("action-id: ", actionId)
35+ }
3336 }
3437 }
3538
3639 ListModel {
3740 id: mockModel
3841
42+ property string actionId
43+
3944 function getRaw(id) {
4045 return mockNotification.createObject(mockModel)
4146 }
@@ -319,7 +324,7 @@ Row {
319324 actionSpy.target = findChild(notification, "interactiveArea")
320325 mouseClick(notification, notification.width / 2, notification.height / 2)
321326 actionSpy.wait()
322− compare(actionSpy.signalArguments[0][0], data.actions[0]["id"], "got wrong id for interactive action")
327+ compare(mockModel.actionId, data.actions[0]["id"], "got wrong id for interactive action")
323328 compare(clickThroughSpy.count, 0, "click on interactive notification fell through")
324329 } else {
325330 mouseClick(notification, notification.width / 2, notification.height / 2)
@@ -339,13 +344,13 @@ Row {
339344 actionSpy.target = buttonCancel
340345 mouseClick(buttonCancel, buttonCancel.width / 2, buttonCancel.height / 2)
341346 actionSpy.wait()
342− compare(actionSpy.signalArguments[0][0], data.actions[1]["id"], "got wrong id for negative action")
347+ compare(mockModel.actionId, data.actions[1]["id"], "got wrong id for negative action")
343348 actionSpy.clear()
344349
345350 actionSpy.target = buttonAccept
346351 mouseClick(buttonAccept, buttonAccept.width / 2, buttonAccept.height / 2)
347352 actionSpy.wait()
348− compare(actionSpy.signalArguments[0][0], data.actions[0]["id"], "got wrong id positive action")
353+ compare(mockModel.actionId, data.actions[0]["id"], "got wrong id positive action")
349354 }
350355 }
351356 }