summaryrefslogtreecommitdiff
path: root/tests/auto/qtextedit/tst_qtextedit.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/qtextedit/tst_qtextedit.cpp')
-rw-r--r--tests/auto/qtextedit/tst_qtextedit.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/auto/qtextedit/tst_qtextedit.cpp b/tests/auto/qtextedit/tst_qtextedit.cpp
index 101baa53b5..d1832d8cb5 100644
--- a/tests/auto/qtextedit/tst_qtextedit.cpp
+++ b/tests/auto/qtextedit/tst_qtextedit.cpp
@@ -58,6 +58,7 @@
#include <qimagereader.h>
#include <qimagewriter.h>
#include <qcommonstyle.h>
+#include <qlayout.h>
#include <qabstracttextdocumentlayout.h>
#include <qtextdocumentfragment.h>
@@ -2111,6 +2112,7 @@ void tst_QTextEdit::setDocumentPreservesPalette()
QPalette whitePal = ed->palette();
whitePal.setColor(QPalette::Active, QPalette::Text, "white");
+
QVERIFY(whitePal != ed->palette());
ed->setPalette(whitePal);
QVERIFY(whitePal.color(QPalette::Active, QPalette::Text)
@@ -2155,9 +2157,15 @@ void tst_QTextEdit::pasteFromQt3RichText()
void tst_QTextEdit::noWrapBackgrounds()
{
+ QWidget topLevel;
+ QVBoxLayout *layout = new QVBoxLayout(&topLevel);
+
QTextEdit edit;
edit.setLineWrapMode(QTextEdit::NoWrap);
+ // hide the cursor in order to make the image comparison below reliable
+ edit.setCursorWidth(0);
+
QTextFrame *root = edit.document()->rootFrame();
QTextFrameFormat frameFormat = root->frameFormat();
frameFormat.setLeftMargin(2);
@@ -2170,6 +2178,9 @@ void tst_QTextEdit::noWrapBackgrounds()
edit.insertPlainText(QLatin1String(" \n \n \n \n"));
edit.setFixedSize(100, 200);
+ layout->addWidget(&edit);
+ topLevel.show();
+
QImage img = QPixmap::grabWidget(edit.viewport()).toImage();
QCOMPARE(img, img.mirrored(true, false));
}