summaryrefslogtreecommitdiffstats
path: root/tests/auto/widgets/widgets/qtextedit/tst_qtextedit.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/widgets/widgets/qtextedit/tst_qtextedit.cpp')
-rw-r--r--tests/auto/widgets/widgets/qtextedit/tst_qtextedit.cpp37
1 files changed, 35 insertions, 2 deletions
diff --git a/tests/auto/widgets/widgets/qtextedit/tst_qtextedit.cpp b/tests/auto/widgets/widgets/qtextedit/tst_qtextedit.cpp
index 3669935823..c2cf31bfa4 100644
--- a/tests/auto/widgets/widgets/qtextedit/tst_qtextedit.cpp
+++ b/tests/auto/widgets/widgets/qtextedit/tst_qtextedit.cpp
@@ -160,6 +160,7 @@ private slots:
void selectionChanged();
#ifndef QT_NO_CLIPBOARD
void copyPasteBackgroundImage();
+ void copyPasteForegroundImage();
#endif
void setText();
void cursorRect();
@@ -1904,6 +1905,36 @@ void tst_QTextEdit::copyPasteBackgroundImage()
ba.texture().cacheKey() == bb.texture().cacheKey());
QFile::remove(QLatin1String("foo.png"));
}
+
+void tst_QTextEdit::copyPasteForegroundImage()
+{
+ ed->clear();
+
+ QPixmap pix(20, 20);
+ pix.fill(Qt::blue);
+
+ QTextCharFormat fmt;
+ {
+ QBrush textureBrush;
+ {
+ textureBrush.setTexture(pix);
+ }
+ textureBrush.setStyle(Qt::TexturePattern);
+ fmt.setForeground(textureBrush);
+ }
+ ed->textCursor().insertText("Foobar", fmt);
+
+ ed->moveCursor(QTextCursor::Start);
+ ed->moveCursor(QTextCursor::End, QTextCursor::KeepAnchor);
+
+ ed->copy();
+ ed->clear();
+ ed->paste();
+
+ QBrush brush = ed->textCursor().charFormat().foreground();
+ QCOMPARE(brush.style(), Qt::TexturePattern);
+ QCOMPARE(brush.texture().cacheKey(), pix.cacheKey());
+}
#endif
void tst_QTextEdit::setText()
@@ -2638,12 +2669,14 @@ void tst_QTextEdit::wheelEvent()
ed.setReadOnly(true);
float defaultFontSize = ed.font().pointSizeF();
- QWheelEvent wheelUp(QPointF(), QPointF(), QPoint(), QPoint(0, 120), 120, Qt::Vertical, Qt::NoButton, Qt::ControlModifier);
+ QWheelEvent wheelUp(QPointF(), QPointF(), QPoint(), QPoint(0, 120),
+ Qt::NoButton, Qt::ControlModifier, Qt::NoScrollPhase, Qt::MouseEventNotSynthesized);
ed.wheelEvent(&wheelUp);
QCOMPARE(defaultFontSize + 1, ed.font().pointSizeF());
- QWheelEvent wheelHalfDown(QPointF(), QPointF(), QPoint(), QPoint(0, -60), -60, Qt::Vertical, Qt::NoButton, Qt::ControlModifier);
+ QWheelEvent wheelHalfDown(QPointF(), QPointF(), QPoint(), QPoint(0, -60),
+ Qt::NoButton, Qt::ControlModifier, Qt::NoScrollPhase, Qt::MouseEventNotSynthesized);
ed.wheelEvent(&wheelHalfDown);
QCOMPARE(defaultFontSize + 0.5, ed.font().pointSizeF());