diff options
author | Charles Yin <charles.yin@nokia.com> | 2012-03-13 11:47:59 +1000 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-07-04 10:12:10 +0200 |
commit | b9c039b3ac76d20ffe2d05259d5406b7c1bac25d (patch) | |
tree | 56cd88fe36d29a19b22f31212924bd5eb023b161 /src/imports/testlib | |
parent | 8a80f76fd6591b0553c5e9574a5f04cd3bebb659 (diff) |
Improve mouseWheel() function
Use new angleDela() API and update the documentation.
Change-Id: Ie01c979d8c411e81165caedc7e020e39f9d64371
Reviewed-by: Michael Brasser <michael.brasser@nokia.com>
Diffstat (limited to 'src/imports/testlib')
-rw-r--r-- | src/imports/testlib/TestCase.qml | 12 | ||||
-rw-r--r-- | src/imports/testlib/testcase.qdoc | 46 |
2 files changed, 47 insertions, 11 deletions
diff --git a/src/imports/testlib/TestCase.qml b/src/imports/testlib/TestCase.qml index 883a864e59..9060ecc3b3 100644 --- a/src/imports/testlib/TestCase.qml +++ b/src/imports/testlib/TestCase.qml @@ -455,18 +455,18 @@ Item { qtest_fail("window not shown", 2) } - function mouseWheel(item, x, y, delta, buttons, modifiers, delay, orientation) { + function mouseWheel(item, x, y, xDelta, yDelta, buttons, modifiers, delay) { 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)) + if (xDelta == undefined) + xDelta = 0 + if (yDelta == undefined) + yDelta = 0 + if (!qtest_events.mouseWheel(item, x, y, buttons, modifiers, xDelta, yDelta, delay)) qtest_fail("window not shown", 2) } diff --git a/src/imports/testlib/testcase.qdoc b/src/imports/testlib/testcase.qdoc index 469614da6d..90fc538539 100644 --- a/src/imports/testlib/testcase.qdoc +++ b/src/imports/testlib/testcase.qdoc @@ -515,7 +515,7 @@ If \a item is obscured by another item, or a child of \a item occupies that position, then the event will be delivered to the other item instead. - \sa mouseRelease(), mouseClick(), mouseDoubleClick(), mouseMove() + \sa mouseRelease(), mouseClick(), mouseDoubleClick(), mouseMove(), mouseDrag(), mouseWheel() */ /*! @@ -531,7 +531,7 @@ If \a item is obscured by another item, or a child of \a item occupies that position, then the event will be delivered to the other item instead. - \sa mousePress(), mouseClick(), mouseDoubleClick(), mouseMove() + \sa mousePress(), mouseClick(), mouseDoubleClick(), mouseMove(), mouseDrag(), mouseWheel() */ /*! @@ -547,7 +547,7 @@ If \a item is obscured by another item, or a child of \a item occupies that position, then the event will be delivered to the other item instead. - \sa mousePress(), mouseRelease(), mouseDoubleClick(), mouseMove() + \sa mousePress(), mouseRelease(), mouseDoubleClick(), mouseMove(), mouseDrag(), mouseWheel() */ /*! @@ -563,7 +563,7 @@ If \a item is obscured by another item, or a child of \a item occupies that position, then the event will be delivered to the other item instead. - \sa mousePress(), mouseRelease(), mouseClick(), mouseMove() + \sa mousePress(), mouseRelease(), mouseClick(), mouseMove(), mouseDrag(), mouseWheel() */ /*! @@ -578,7 +578,43 @@ If \a item is obscured by another item, or a child of \a item occupies that position, then the event will be delivered to the other item instead. - \sa mousePress(), mouseRelease(), mouseClick(), mouseDoubleClick() + \sa mousePress(), mouseRelease(), mouseClick(), mouseDoubleClick(), mouseDrag(), mouseWheel() +*/ + +/*! + \qmlmethod TestCase::mouseDrag(item, x, y, dx, dy, button = Qt.LeftButton, modifiers = Qt.NoModifier, delay = -1) + + Simulates dragging the mouse on an \a item with \a button pressed and an optional \a modifier. + The initial drag position is defined by \a x and \a y, + and drag distance is defined by \a dx and \a dy. If \a delay is specified, + the test will wait for the specified amount of milliseconds before releasing the button. + + The position given by \a x and \a y is transformed from the co-ordinate + system of \a item into window co-ordinates and then delivered. + If \a item is obscured by another item, or a child of \a item occupies + that position, then the event will be delivered to the other item instead. + + Note: this method does not imply a drop action, to make a drop, an additional + mouseRelease(item, x + dx, y + dy) is needed. + + \sa mousePress(), mouseClick(), mouseDoubleClick(), mouseMove(), mouseRelease(), mouseWheel() +*/ + +/*! + \qmlmethod TestCase::mouseWheel(item, x, y, xDelta, yDelta, button = Qt.LeftButton, modifiers = Qt.NoModifier, delay = -1) + + Simulates rotating the mouse wheel on an \a item with \a button pressed and an optional \a modifier. + The position of the wheel event is defined by \a x and \a y. + If \a delay is specified, the test will wait for the specified amount of milliseconds before releasing the button. + + The position given by \a x and \a y is transformed from the co-ordinate + system of \a item into window co-ordinates and then delivered. + If \a item is obscured by another item, or a child of \a item occupies + that position, then the event will be delivered to the other item instead. + + The \a xDelta and \a yDelta contain the wheel rotation distance in eighths of a degree. see \l QWheelEvent::angleDelta() for more details. + + \sa mousePress(), mouseClick(), mouseDoubleClick(), mouseMove(), mouseRelease(), mouseDrag(), QWheelEvent::angleDelta() */ /*! |