summaryrefslogtreecommitdiffstats
path: root/tests/auto/declarative/qdeclarativetextedit
diff options
context:
space:
mode:
authorMitch Curtis <mitch.curtis@digia.com>2014-03-11 13:31:53 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-03-24 14:20:33 +0100
commit292a6707e565f226314fba541b3cdeaef5046d4e (patch)
tree7ed47067e715fdc203d3c3ce105c086243d11e06 /tests/auto/declarative/qdeclarativetextedit
parent6ac69be3148822a0dafce227eab19b97722b6cc2 (diff)
Ensure TextEdit's text is vertically aligned after resizing its height.
The current code only updates the alignment if the width of the TextEdit changed, but we must also check if the height has changed. Task-number: QTBUG-36069 [ChangeLog][QtDeclarative][TextEdit] Fixed TextEdit not vertically aligning its text after having its height changed. Change-Id: I428a01111874c70d2151213d2b3c5553e7f21186 Reviewed-by: J-P Nurmi <jpnurmi@digia.com>
Diffstat (limited to 'tests/auto/declarative/qdeclarativetextedit')
-rw-r--r--tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp b/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp
index a348545a..d5162544 100644
--- a/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp
+++ b/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp
@@ -663,6 +663,19 @@ void tst_qdeclarativetextedit::vAlign()
QVERIFY(textEditObject->cursorRectangle().bottom() > 100);
QVERIFY(textEditObject->positionToRectangle(0).top() < 100);
QVERIFY(textEditObject->positionToRectangle(0).bottom() > 100);
+
+ // Test vertical alignment after resizing the height.
+ textEditObject->setHeight(textEditObject->height() - 20);
+ QVERIFY(textEditObject->cursorRectangle().top() < 90);
+ QVERIFY(textEditObject->cursorRectangle().bottom() > 90);
+ QVERIFY(textEditObject->positionToRectangle(0).top() < 90);
+ QVERIFY(textEditObject->positionToRectangle(0).bottom() > 90);
+
+ textEditObject->setHeight(textEditObject->height() + 40);
+ QVERIFY(textEditObject->cursorRectangle().top() < 110);
+ QVERIFY(textEditObject->cursorRectangle().bottom() > 110);
+ QVERIFY(textEditObject->positionToRectangle(0).top() < 110);
+ QVERIFY(textEditObject->positionToRectangle(0).bottom() > 110);
}
void tst_qdeclarativetextedit::font()