diff options
author | J-P Nurmi <jpnurmi@gmail.com> | 2014-05-17 12:42:43 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2014-05-19 14:49:58 +0200 |
commit | 76679048013fc70d2cb7042e32f1dd0cb4d5dfa5 (patch) | |
tree | b8160f01dda00cc0490bb8011ff1eb6e63a360f9 /tests/auto | |
parent | 851ae1a77dc207ec11b8ed3f0786bfe1c1905e4c (diff) |
Fix tst_qquicktextedit::cursorRectangle_QTBUG_38947()
Fix the uninitialize variable and make sure the test creates
a window that has a sensible (200x200) size.
Change-Id: I02616ab3c832276921e84ae98b7ed926d8fc5f5e
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
Reviewed-by: Liang Qi <liang.qi@digia.com>
Diffstat (limited to 'tests/auto')
-rw-r--r-- | tests/auto/quick/qquicktextedit/data/qtbug-38947.qml | 19 | ||||
-rw-r--r-- | tests/auto/quick/qquicktextedit/tst_qquicktextedit.cpp | 4 |
2 files changed, 14 insertions, 9 deletions
diff --git a/tests/auto/quick/qquicktextedit/data/qtbug-38947.qml b/tests/auto/quick/qquicktextedit/data/qtbug-38947.qml index 3c8254f4ce..ebf8080e69 100644 --- a/tests/auto/quick/qquicktextedit/data/qtbug-38947.qml +++ b/tests/auto/quick/qquicktextedit/data/qtbug-38947.qml @@ -1,11 +1,16 @@ import QtQuick 2.0 -TextEdit { - text: "Hello\nWorld!" - selectByMouse: true - cursorDelegate: Rectangle { - width: 10 - color: "transparent" - border.color: "red" +Item { + height: 200 + width: 200 + TextEdit { + objectName: "textedit" + text: "Hello\nWorld!" + selectByMouse: true + cursorDelegate: Rectangle { + width: 10 + color: "transparent" + border.color: "red" + } } } diff --git a/tests/auto/quick/qquicktextedit/tst_qquicktextedit.cpp b/tests/auto/quick/qquicktextedit/tst_qquicktextedit.cpp index 32e4a99ef0..1ffd67cbf1 100644 --- a/tests/auto/quick/qquicktextedit/tst_qquicktextedit.cpp +++ b/tests/auto/quick/qquicktextedit/tst_qquicktextedit.cpp @@ -5267,7 +5267,7 @@ void tst_qquicktextedit::cursorRectangle_QTBUG_38947() window.show(); window.requestActivate(); QTest::qWaitForWindowExposed(&window); - QQuickTextEdit *edit = qobject_cast<QQuickTextEdit *>(window.rootObject()); + QQuickTextEdit *edit = window.rootObject()->findChild<QQuickTextEdit *>("textedit"); QVERIFY(edit); QPoint from = edit->positionToRectangle(0).center().toPoint(); @@ -5276,7 +5276,7 @@ void tst_qquicktextedit::cursorRectangle_QTBUG_38947() QSignalSpy spy(edit, SIGNAL(cursorRectangleChanged())); QVERIFY(spy.isValid()); - for (int i = i; i < edit->length() - 1; ++i) { + for (int i = 1; i < edit->length() - 1; ++i) { QRectF rect = edit->positionToRectangle(i); QTest::mouseMove(&window, rect.center().toPoint()); QCOMPARE(edit->cursorRectangle(), rect); |