aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/calendar
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/calendar')
-rw-r--r--tests/auto/calendar/data/tst_monthgrid.qml53
1 files changed, 53 insertions, 0 deletions
diff --git a/tests/auto/calendar/data/tst_monthgrid.qml b/tests/auto/calendar/data/tst_monthgrid.qml
index 413e6d55..f07121dc 100644
--- a/tests/auto/calendar/data/tst_monthgrid.qml
+++ b/tests/auto/calendar/data/tst_monthgrid.qml
@@ -79,6 +79,11 @@ TestCase {
}
}
+ Component {
+ id: signalSpy
+ SignalSpy { }
+ }
+
function test_locale() {
var control = delegateGrid.createObject(testCase, {month: 0, year: 2013})
@@ -227,4 +232,52 @@ TestCase {
control.destroy()
}
+
+ function test_clicked_data() {
+ return [
+ { tag: "mouse", touch: false },
+ { tag: "touch", touch: true }
+ ]
+ }
+
+ function test_clicked(data) {
+ var control = createTemporaryObject(defaultGrid, testCase)
+ verify(control)
+
+ compare(control.contentItem.children.length, 6 * 7 + 1)
+
+ var pressedSpy = signalSpy.createObject(control, {target: control, signalName: "pressed"})
+ verify(pressedSpy.valid)
+
+ var releasedSpy = signalSpy.createObject(control, {target: control, signalName: "released"})
+ verify(releasedSpy.valid)
+
+ var clickedSpy = signalSpy.createObject(control, {target: control, signalName: "clicked"})
+ verify(clickedSpy.valid)
+
+ var touch = touchEvent(control)
+
+ for (var i = 0; i < 42; ++i) {
+ var cell = control.contentItem.children[i]
+ verify(cell)
+
+ if (data.touch)
+ touch.press(0, cell).commit()
+ else
+ mousePress(cell)
+
+ compare(pressedSpy.count, i + 1)
+ compare(releasedSpy.count, i)
+ compare(clickedSpy.count, i)
+
+ if (data.touch)
+ touch.release(0, cell).commit()
+ else
+ mouseRelease(cell)
+
+ compare(pressedSpy.count, i + 1)
+ compare(releasedSpy.count, i + 1)
+ compare(clickedSpy.count, i + 1)
+ }
+ }
}