diff options
author | Liang Qi <liang.qi@qt.io> | 2017-06-07 12:05:33 +0200 |
---|---|---|
committer | Liang Qi <liang.qi@qt.io> | 2017-06-07 14:02:43 +0200 |
commit | 7cbee5629604aa49c618829c8e3e55fc64e94df7 (patch) | |
tree | d12041105160c1cb21226b365edb9653d87b5853 /tests/auto/other/lancelot | |
parent | e400b7e326c554ccd819448866265953d2a0f24d (diff) | |
parent | 5f0ce2333f7e11a3ffb5d16a27cd9303efa712d5 (diff) |
Merge remote-tracking branch 'origin/5.9' into dev
Conflicts:
src/widgets/widgets/qmenu.cpp
Change-Id: I6d3baf56eb24501cddb129a3cb6b958ccc25a308
Diffstat (limited to 'tests/auto/other/lancelot')
-rw-r--r-- | tests/auto/other/lancelot/lancelot.pro | 2 | ||||
-rw-r--r-- | tests/auto/other/lancelot/paintcommands.cpp | 9 | ||||
-rw-r--r-- | tests/auto/other/lancelot/paintcommands.h | 5 | ||||
-rw-r--r-- | tests/auto/other/lancelot/scripts/porter_duff.qps | 12 | ||||
-rw-r--r-- | tests/auto/other/lancelot/scripts/porter_duff2.qps | 12 | ||||
-rw-r--r-- | tests/auto/other/lancelot/tst_lancelot.cpp | 10 |
6 files changed, 29 insertions, 21 deletions
diff --git a/tests/auto/other/lancelot/lancelot.pro b/tests/auto/other/lancelot/lancelot.pro index 73c12e67a2..6ece7315ed 100644 --- a/tests/auto/other/lancelot/lancelot.pro +++ b/tests/auto/other/lancelot/lancelot.pro @@ -1,6 +1,6 @@ CONFIG += testcase TARGET = tst_lancelot -QT += testlib +QT += testlib gui-private SOURCES += tst_lancelot.cpp \ paintcommands.cpp diff --git a/tests/auto/other/lancelot/paintcommands.cpp b/tests/auto/other/lancelot/paintcommands.cpp index c28812e120..8419f93e3b 100644 --- a/tests/auto/other/lancelot/paintcommands.cpp +++ b/tests/auto/other/lancelot/paintcommands.cpp @@ -36,6 +36,7 @@ #include <qtextlayout.h> #include <qdebug.h> #include <QStaticText> +#include <private/qimage_p.h> #ifndef QT_NO_OPENGL #include <QOpenGLFramebufferObjectFormat> @@ -2402,7 +2403,13 @@ void PaintCommands::command_surface_begin(QRegExp re) m_painter = new QPainter(&m_surface_pixmap); #endif } else { - m_surface_image = QImage(qRound(w), qRound(h), QImage::Format_ARGB32_Premultiplied); + QImage::Format surface_format; + if (QImage::toPixelFormat(m_format).alphaUsage() != QPixelFormat::UsesAlpha) + surface_format = qt_alphaVersion(m_format); + else + surface_format = m_format; + + m_surface_image = QImage(qRound(w), qRound(h), surface_format); m_surface_image.fill(0); m_painter = new QPainter(&m_surface_image); } diff --git a/tests/auto/other/lancelot/paintcommands.h b/tests/auto/other/lancelot/paintcommands.h index 4113fd6881..fc7496ce11 100644 --- a/tests/auto/other/lancelot/paintcommands.h +++ b/tests/auto/other/lancelot/paintcommands.h @@ -68,9 +68,10 @@ class PaintCommands { public: // construction / initialization - PaintCommands(const QStringList &cmds, int w, int h) + PaintCommands(const QStringList &cmds, int w, int h, QImage::Format format) : m_painter(0) , m_surface_painter(0) + , m_format(format) , m_commands(cmds) , m_gradientSpread(QGradient::PadSpread) , m_gradientCoordinate(QGradient::LogicalMode) @@ -246,8 +247,8 @@ private: // attributes QPainter *m_painter; QPainter *m_surface_painter; + QImage::Format m_format; QImage m_surface_image; - QPixmap m_surface_pixmap; QRectF m_surface_rect; QStringList m_commands; QString m_currentCommand; diff --git a/tests/auto/other/lancelot/scripts/porter_duff.qps b/tests/auto/other/lancelot/scripts/porter_duff.qps index 166e48a57f..94e9c68522 100644 --- a/tests/auto/other/lancelot/scripts/porter_duff.qps +++ b/tests/auto/other/lancelot/scripts/porter_duff.qps @@ -184,7 +184,7 @@ repeat_block postdraw surface_end -# Multiply +# ColorBurn surface_begin 100 300 100 100 repeat_block predraw setCompositionMode ColorBurn @@ -192,7 +192,7 @@ repeat_block postdraw surface_end -# Screen +# HardLight surface_begin 200 300 100 100 repeat_block predraw setCompositionMode HardLight @@ -200,7 +200,7 @@ repeat_block postdraw surface_end -# Overlay +# SoftLight surface_begin 300 300 100 100 repeat_block predraw setCompositionMode SoftLight @@ -208,7 +208,7 @@ repeat_block postdraw surface_end -# Darken +# Difference surface_begin 400 300 100 100 repeat_block predraw setCompositionMode Difference @@ -216,7 +216,7 @@ repeat_block postdraw surface_end -# Lighten +# Exclusion surface_begin 500 300 100 100 repeat_block predraw setCompositionMode Exclusion @@ -248,4 +248,4 @@ drawText 100 500 "ColorBurn" drawText 200 500 "HardLight" drawText 300 500 "SoftLight" drawText 400 500 "Difference" -drawText 500 500 "Exclusion"
\ No newline at end of file +drawText 500 500 "Exclusion" diff --git a/tests/auto/other/lancelot/scripts/porter_duff2.qps b/tests/auto/other/lancelot/scripts/porter_duff2.qps index a792d9b278..f538371ca1 100644 --- a/tests/auto/other/lancelot/scripts/porter_duff2.qps +++ b/tests/auto/other/lancelot/scripts/porter_duff2.qps @@ -194,7 +194,7 @@ repeat_block postdraw surface_end -# Multiply +# ColorBurn surface_begin 100 300 100 100 repeat_block predraw setCompositionMode ColorBurn @@ -202,7 +202,7 @@ repeat_block postdraw surface_end -# Screen +# HardLight surface_begin 200 300 100 100 repeat_block predraw setCompositionMode HardLight @@ -210,7 +210,7 @@ repeat_block postdraw surface_end -# Overlay +# SoftLight surface_begin 300 300 100 100 repeat_block predraw setCompositionMode SoftLight @@ -218,7 +218,7 @@ repeat_block postdraw surface_end -# Darken +# Difference surface_begin 400 300 100 100 repeat_block predraw setCompositionMode Difference @@ -226,7 +226,7 @@ repeat_block postdraw surface_end -# Lighten +# Exclusion surface_begin 500 300 100 100 repeat_block predraw setCompositionMode Exclusion @@ -258,4 +258,4 @@ drawText 100 500 "ColorBurn" drawText 200 500 "HardLight" drawText 300 500 "SoftLight" drawText 400 500 "Difference" -drawText 500 500 "Exclusion"
\ No newline at end of file +drawText 500 500 "Exclusion" diff --git a/tests/auto/other/lancelot/tst_lancelot.cpp b/tests/auto/other/lancelot/tst_lancelot.cpp index 63c62bab86..79d0f7c6cf 100644 --- a/tests/auto/other/lancelot/tst_lancelot.cpp +++ b/tests/auto/other/lancelot/tst_lancelot.cpp @@ -54,7 +54,7 @@ private: void setupTestSuite(const QStringList& blacklist = QStringList()); void runTestSuite(GraphicsEngine engine, QImage::Format format, const QSurfaceFormat &contextFormat = QSurfaceFormat()); - void paint(QPaintDevice *device, GraphicsEngine engine, const QStringList &script, const QString &filePath); + void paint(QPaintDevice *device, GraphicsEngine engine, QImage::Format format, const QStringList &script, const QString &filePath); QStringList qpsFiles; QHash<QString, QStringList> scripts; @@ -318,7 +318,7 @@ void tst_Lancelot::runTestSuite(GraphicsEngine engine, QImage::Format format, co if (engine == Raster) { QImage img(800, 800, format); - paint(&img, engine, script, QFileInfo(filePath).absoluteFilePath()); + paint(&img, engine, format, script, QFileInfo(filePath).absoluteFilePath()); rendered = img; #ifndef QT_NO_OPENGL } else if (engine == OpenGL) { @@ -336,7 +336,7 @@ void tst_Lancelot::runTestSuite(GraphicsEngine engine, QImage::Format format, co QOpenGLFramebufferObject fbo(800, 800, fmt); fbo.bind(); QOpenGLPaintDevice pdv(800, 800); - paint(&pdv, engine, script, QFileInfo(filePath).absoluteFilePath()); + paint(&pdv, engine, format, script, QFileInfo(filePath).absoluteFilePath()); rendered = fbo.toImage().convertToFormat(format); #endif } @@ -344,10 +344,10 @@ void tst_Lancelot::runTestSuite(GraphicsEngine engine, QImage::Format format, co QBASELINE_TEST(rendered); } -void tst_Lancelot::paint(QPaintDevice *device, GraphicsEngine engine, const QStringList &script, const QString &filePath) +void tst_Lancelot::paint(QPaintDevice *device, GraphicsEngine engine, QImage::Format format, const QStringList &script, const QString &filePath) { QPainter p(device); - PaintCommands pcmd(script, 800, 800); + PaintCommands pcmd(script, 800, 800, format); //pcmd.setShouldDrawText(false); switch (engine) { case OpenGL: |