diff options
author | Andrew den Exter <andrew.den.exter@jollamobile.com> | 2012-12-19 17:12:58 +1000 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-02-01 00:52:44 +0100 |
commit | 561ab99ad65711b61c47df9bd78ea928de525a53 (patch) | |
tree | 5b3faf30dbcee3066e37886cb9702a462f004137 /tests | |
parent | 49651307807fc097d14ae13fb71013e46944eb2a (diff) |
Ensure the cursorRectangle is updated as the width of the text changes.
Outside of when of a monospace font is used, if the text changes the
visual position of the cursor will have most likely changed as well
even when the cursor index hasn't.
Task-number: QTBUG-28677
Change-Id: If8077772d8541a677d5875976e6cd9fc453731df
Reviewed-by: Alan Alpert <aalpert@rim.com>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/quick/qquicktextinput/tst_qquicktextinput.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/tests/auto/quick/qquicktextinput/tst_qquicktextinput.cpp b/tests/auto/quick/qquicktextinput/tst_qquicktextinput.cpp index 3b1c5eb31c..86a05c3d3b 100644 --- a/tests/auto/quick/qquicktextinput/tst_qquicktextinput.cpp +++ b/tests/auto/quick/qquicktextinput/tst_qquicktextinput.cpp @@ -3087,6 +3087,14 @@ void tst_qquicktextinput::cursorRectangle() input.setHAlign(leftToRight ? QQuickTextInput::AlignRight : QQuickTextInput::AlignLeft); r = input.cursorRectangle(); QCOMPARE(r.left(), leftToRight ? input.width() : 0); + + QSignalSpy cursorRectangleSpy(&input, SIGNAL(cursorRectangleChanged())); + + QString widerText = shortText; + widerText[1] = 'W'; // Assumes shortText is at least two characters long. + input.setText(widerText); + + QCOMPARE(cursorRectangleSpy.count(), 1); } void tst_qquicktextinput::readOnly() |