diff options
author | Warwick Allison <warwick.allison@nokia.com> | 2010-07-07 04:09:49 (GMT) |
---|---|---|
committer | Jason McDonald <jason.mcdonald@nokia.com> | 2010-07-13 05:19:34 (GMT) |
commit | 32d49340b973b7b4504514a8392d1f631ba248dc (patch) | |
tree | 8371a18e28ec9fb63276032003e69eed76c4bbdd /tests | |
parent | 30afdcfb0eb5c926de434dc65076a97c87ac8d5d (diff) | |
download | Qt-32d49340b973b7b4504514a8392d1f631ba248dc.zip Qt-32d49340b973b7b4504514a8392d1f631ba248dc.tar.gz Qt-32d49340b973b7b4504514a8392d1f631ba248dc.tar.bz2 |
Make Text, TextInput, and TextEdit all have the same size for the same text.
This may mean that the cursor is to the right of the width, so components should
cater for that with a margin if they are boxed / clipped.
TextInput used to try to account for right bearing (and left bearing incorrectly since
it added it on the right). This is removed. Potentially this means that for some fonts
the text repaints incorrectly on the left or right, but if that is the case Text and TextEdit
already had such a problem (undetected), and all will need fixing.
Task-number: QTBUG-11983
(cherry picked from commit 628159323c60c434a202b036ecbaf5e433c703e8)
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp | 6 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp | 2 |
2 files changed, 4 insertions, 4 deletions
diff --git a/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp b/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp index 1ec700b..f7285c2 100644 --- a/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp +++ b/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp @@ -209,7 +209,7 @@ void tst_qdeclarativetextedit::width() QDeclarativeTextEdit *textEditObject = qobject_cast<QDeclarativeTextEdit*>(texteditComponent.create()); QVERIFY(textEditObject != 0); - QCOMPARE(textEditObject->width(), 1.);//+1 for cursor + QCOMPARE(textEditObject->width(), 0.0); } for (int i = 0; i < standard.size(); i++) @@ -225,7 +225,7 @@ void tst_qdeclarativetextedit::width() QDeclarativeTextEdit *textEditObject = qobject_cast<QDeclarativeTextEdit*>(texteditComponent.create()); QVERIFY(textEditObject != 0); - QCOMPARE(textEditObject->width(), qreal(metricWidth + 1 + 3));//+3 is the current way of accounting for space between cursor and last character. + QCOMPARE(textEditObject->width(), qreal(metricWidth)); } for (int i = 0; i < richText.size(); i++) @@ -242,7 +242,7 @@ void tst_qdeclarativetextedit::width() QDeclarativeTextEdit *textEditObject = qobject_cast<QDeclarativeTextEdit*>(texteditComponent.create()); QVERIFY(textEditObject != 0); - QCOMPARE(textEditObject->width(), qreal(documentWidth + 1 + 3)); + QCOMPARE(textEditObject->width(), qreal(documentWidth)); } } diff --git a/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp b/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp index a032071..05dc50b 100644 --- a/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp +++ b/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp @@ -159,7 +159,7 @@ void tst_qdeclarativetextinput::width() QDeclarativeTextInput *textinputObject = qobject_cast<QDeclarativeTextInput*>(textinputComponent.create()); QVERIFY(textinputObject != 0); - QCOMPARE(textinputObject->width(), 1.); // 1 for the cursor + QCOMPARE(textinputObject->width(), 0.0); delete textinputObject; } |