From 74d586cb6d5391b186bfa8211fbb1e33f7c20e2f Mon Sep 17 00:00:00 2001 From: Harald Fernengel Date: Thu, 4 Nov 2010 10:39:16 +0100 Subject: Give the toplevel widget a layout This ensures that the top-level will be large enough to view the text edit. --- tests/auto/qtextedit/tst_qtextedit.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/tests/auto/qtextedit/tst_qtextedit.cpp b/tests/auto/qtextedit/tst_qtextedit.cpp index 878579b..321aa22 100644 --- a/tests/auto/qtextedit/tst_qtextedit.cpp +++ b/tests/auto/qtextedit/tst_qtextedit.cpp @@ -58,6 +58,7 @@ #include #include #include +#include #include #include @@ -2157,7 +2158,9 @@ void tst_QTextEdit::pasteFromQt3RichText() void tst_QTextEdit::noWrapBackgrounds() { QWidget topLevel; - QTextEdit edit(&topLevel); + QVBoxLayout *layout = new QVBoxLayout(&topLevel); + + QTextEdit edit; edit.setLineWrapMode(QTextEdit::NoWrap); QTextFrame *root = edit.document()->rootFrame(); @@ -2171,8 +2174,12 @@ void tst_QTextEdit::noWrapBackgrounds() edit.textCursor().setBlockFormat(format); edit.insertPlainText(QLatin1String(" \n \n \n \n")); edit.setFixedSize(100, 200); + + layout->addWidget(&edit); topLevel.show(); + QTest::qWait(1000); + QImage img = QPixmap::grabWidget(edit.viewport()).toImage(); QCOMPARE(img, img.mirrored(true, false)); } -- cgit v0.12