From 7100a74def3a82bc52c93b800cec973bf312b1b3 Mon Sep 17 00:00:00 2001 From: juhvu Date: Wed, 21 Sep 2011 13:04:11 +1000 Subject: Wheel event support in qmltestlib + few fixes. added unit test and orientaion support for mouseWheel Change-Id: I9c26dc762281bc32965769c151414ac0e177ad0f Reviewed-on: http://codereview.qt-project.org/5272 Reviewed-by: Qt Sanity Bot Reviewed-by: Juha Vuolle Reviewed-by: Charles Yin --- src/imports/testlib/TestCase.qml | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) (limited to 'src/imports') diff --git a/src/imports/testlib/TestCase.qml b/src/imports/testlib/TestCase.qml index ed8bf55d6b..020f934aac 100644 --- a/src/imports/testlib/TestCase.qml +++ b/src/imports/testlib/TestCase.qml @@ -435,13 +435,31 @@ Item { qtest_fail("window not shown", 2) } - function mouseMove(item, x, y, delay) { + function mouseMove(item, x, y, delay, buttons) { if (delay == undefined) delay = -1 - if (!qtest_events.mouseMove(item, x, y, delay)) + if (buttons == undefined) + buttons = Qt.NoButton + if (!qtest_events.mouseMove(item, x, y, delay, buttons)) qtest_fail("window not shown", 2) } + function mouseWheel(item, x, y, delta, buttons, modifiers, delay, orientation) { + if (delay == undefined) + delay = -1 + if (buttons == undefined) + buttons = Qt.NoButton + if (modifiers === undefined) + modifiers = Qt.NoModifier + if (delta == undefined) + delta = 0 + if (orientation == undefined) + orientation = Qt.Vertical + if (!qtest_events.mouseWheel(item, x, y, buttons, modifiers, delta, delay, orientation)) + qtest_fail("window not shown", 2) + } + + // Functions that can be overridden in subclasses for init/cleanup duties. function initTestCase() {} function cleanupTestCase() {} @@ -692,4 +710,4 @@ Item { if (when && !completed && !running) qtest_run() } -} \ No newline at end of file +} -- cgit v1.2.3