From dced21168b2d5d2cbcc3ce999a85f1e59e7934b1 Mon Sep 17 00:00:00 2001 From: mae Date: Wed, 5 Aug 2009 14:27:40 +0200 Subject: 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. --- tests/auto/qplaintextedit/tst_qplaintextedit.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 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; -- cgit v0.12