diff options
author | mae <qt-info@nokia.com> | 2009-08-05 12:27:40 (GMT) |
---|---|---|
committer | mae <qt-info@nokia.com> | 2009-08-05 12:30:14 (GMT) |
commit | dced21168b2d5d2cbcc3ce999a85f1e59e7934b1 (patch) | |
tree | 6cf9dc039569d5a6eb3a46f3490c6a77f08bcbf8 /tests | |
parent | 56b2195b4fe06bab51be3ca7e52e7cb669ba9147 (diff) | |
download | Qt-dced21168b2d5d2cbcc3ce999a85f1e59e7934b1.zip Qt-dced21168b2d5d2cbcc3ce999a85f1e59e7934b1.tar.gz Qt-dced21168b2d5d2cbcc3ce999a85f1e59e7934b1.tar.bz2 |
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')
-rw-r--r-- | tests/auto/qplaintextedit/tst_qplaintextedit.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/tests/auto/qplaintextedit/tst_qplaintextedit.cpp b/tests/auto/qplaintextedit/tst_qplaintextedit.cpp index 40ad539..e8350e3 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; |