diff options
author | Qt Continuous Integration System <qt-info@nokia.com> | 2011-08-04 11:33:05 +1000 |
---|---|---|
committer | Qt Continuous Integration System <qt-info@nokia.com> | 2011-08-04 11:33:05 +1000 |
commit | c4495832d6c680af3116374471831a02b72a852e (patch) | |
tree | 575d4fd3d84c08290caa56364787ef80321465d8 /tests | |
parent | 1bff371ba56f456207b8e4e837d2b57fe72507e2 (diff) | |
parent | f9eac4edbd06adef7569ca99043da57129c96812 (diff) | |
download | qt4-tools-c4495832d6c680af3116374471831a02b72a852e.tar.gz |
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/qt-qml into 4.7-integration
* '4.7' of scm.dev.nokia.troll.no:qt/qt-qml:
Move cursorDelegate with the mouse selection of read only text input.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp b/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp index 8530c7f6ee..5d6f2a2891 100644 --- a/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp +++ b/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp @@ -1679,15 +1679,26 @@ void tst_qdeclarativetextedit::cursorDelegate() QInputMethodEvent event; QApplication::sendEvent(view, &event); + // Test delegate gets moved on mouse press. textEditObject->setSelectByMouse(true); textEditObject->setCursorPosition(0); - qDebug() << textEditObject->boundingRect() << textEditObject->positionToRectangle(5).center() << view->mapFromScene(textEditObject->positionToRectangle(5).center()); - QTest::mouseClick(view->viewport(), Qt::LeftButton, 0, view->mapFromScene(textEditObject->positionToRectangle(5).center())); + const QPoint point1 = view->mapFromScene(textEditObject->positionToRectangle(5).center()); + QTest::mouseClick(view->viewport(), Qt::LeftButton, 0, point1); QVERIFY(textEditObject->cursorPosition() != 0); QCOMPARE(textEditObject->cursorRectangle().x(), qRound(delegateObject->x())); QCOMPARE(textEditObject->cursorRectangle().y(), qRound(delegateObject->y())); + // Test delegate gets moved on mouse drag + textEditObject->setCursorPosition(0); + const QPoint point2 = view->mapFromScene(textEditObject->positionToRectangle(10).center()); + QTest::mousePress(view->viewport(), Qt::LeftButton, 0, point1); + QMouseEvent mv(QEvent::MouseMove, point2, Qt::LeftButton, Qt::LeftButton,Qt::NoModifier); + QApplication::sendEvent(view->viewport(), &mv); + QTest::mouseRelease(view->viewport(), Qt::LeftButton, 0, point2); + QCOMPARE(textEditObject->cursorRectangle().x(), qRound(delegateObject->x())); + QCOMPARE(textEditObject->cursorRectangle().y(), qRound(delegateObject->y())); + textEditObject->setReadOnly(true); textEditObject->setCursorPosition(0); QTest::mouseClick(view->viewport(), Qt::LeftButton, 0, view->mapFromScene(textEditObject->positionToRectangle(5).center())); @@ -1696,6 +1707,12 @@ void tst_qdeclarativetextedit::cursorDelegate() QCOMPARE(textEditObject->cursorRectangle().y(), qRound(delegateObject->y())); textEditObject->setCursorPosition(0); + QTest::mouseClick(view->viewport(), Qt::LeftButton, 0, view->mapFromScene(textEditObject->positionToRectangle(5).center())); + QVERIFY(textEditObject->cursorPosition() != 0); + QCOMPARE(textEditObject->cursorRectangle().x(), qRound(delegateObject->x())); + QCOMPARE(textEditObject->cursorRectangle().y(), qRound(delegateObject->y())); + + textEditObject->setCursorPosition(0); QCOMPARE(textEditObject->cursorRectangle().x(), qRound(delegateObject->x())); QCOMPARE(textEditObject->cursorRectangle().y(), qRound(delegateObject->y())); QVERIFY(textEditObject->cursorRectangle().y() >= 0); |