summaryrefslogtreecommitdiffstats
path: root/tests/auto/qplaintextedit/tst_qplaintextedit.cpp
diff options
context:
space:
mode:
authormae <qt-info@nokia.com>2009-08-05 14:27:40 +0200
committermae <qt-info@nokia.com>2009-08-05 14:30:14 +0200
commitdced21168b2d5d2cbcc3ce999a85f1e59e7934b1 (patch)
tree6cf9dc039569d5a6eb3a46f3490c6a77f08bcbf8 /tests/auto/qplaintextedit/tst_qplaintextedit.cpp
parent56b2195b4fe06bab51be3ca7e52e7cb669ba9147 (diff)
Fix failing autotest tst_QPlainTextEdit::lineWrapModes()
QPlainText edit does lazy line wrapping only for the visible blocks. Resizing the editor in the auto test thus has to make it wide enough that at least some characters are visible for the block to be laid out.
Diffstat (limited to 'tests/auto/qplaintextedit/tst_qplaintextedit.cpp')
-rw-r--r--tests/auto/qplaintextedit/tst_qplaintextedit.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/tests/auto/qplaintextedit/tst_qplaintextedit.cpp b/tests/auto/qplaintextedit/tst_qplaintextedit.cpp
index 40ad539ee2..e8350e39b3 100644
--- a/tests/auto/qplaintextedit/tst_qplaintextedit.cpp
+++ b/tests/auto/qplaintextedit/tst_qplaintextedit.cpp
@@ -856,7 +856,12 @@ void tst_QPlainTextEdit::lineWrapModes()
ed->setLineWrapMode(QPlainTextEdit::NoWrap);
QCOMPARE(lineCount(), 1);
ed->setLineWrapMode(QPlainTextEdit::WidgetWidth);
- ed->resize(1, 1000);
+
+ // QPlainTextEdit does lazy line layout on resize, only for the visible blocks.
+ // We thus need to make it wide enough to show something visible.
+ int minimumWidth = 2 * ed->document()->documentMargin();
+ minimumWidth += ed->fontMetrics().width(QLatin1Char('a'));
+ ed->resize(minimumWidth, 1000);
QCOMPARE(lineCount(), 26);
ed->setParent(0);
delete window;