summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorWater-Team <water@pad.test.qt.nokia.com>2011-08-15 23:00:13 (GMT)
committerWater-Team <water@pad.test.qt.nokia.com>2011-08-15 23:00:13 (GMT)
commit69bd07dd091d43049fa8dafa8ec063ab6c90a1fa (patch)
treeba0f5dd91ecb1b5347f5a0fd0d8e2c7de480fb67 /tests
parent6f84e64f3500db9901bb518c8c5bd2ca03fbbf42 (diff)
parentab90235dfa1874e5c70875ed9b68817e698a55b3 (diff)
downloadQt-69bd07dd091d43049fa8dafa8ec063ab6c90a1fa.zip
Qt-69bd07dd091d43049fa8dafa8ec063ab6c90a1fa.tar.gz
Qt-69bd07dd091d43049fa8dafa8ec063ab6c90a1fa.tar.bz2
Merge branch '4.8-upstream' into master-water
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp21
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 8530c7f..5d6f2a2 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);