summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/arthur/common/paintcommands.cpp4
-rw-r--r--tests/auto/qgl/tst_qgl.cpp105
-rw-r--r--tests/auto/qpainter/tst_qpainter.cpp6
-rw-r--r--tests/auto/qstatemachine/tst_qstatemachine.cpp31
4 files changed, 36 insertions, 110 deletions
diff --git a/tests/arthur/common/paintcommands.cpp b/tests/arthur/common/paintcommands.cpp
index 475f07d9cf..44deb0e624 100644
--- a/tests/arthur/common/paintcommands.cpp
+++ b/tests/arthur/common/paintcommands.cpp
@@ -974,7 +974,7 @@ void PaintCommands::command_drawPixmap(QRegExp re)
if (sh == 0) sh = -1;
if (m_verboseMode)
- printf(" -(lance) drawPixmap('%s' dim=(%d, %d), depth=%d, (%d, %d, %d, %d), (%d, %d, %d, %d)\n",
+ printf(" -(lance) drawPixmap('%s' dim=(%d, %d), depth=%d, (%f, %f, %f, %f), (%f, %f, %f, %f)\n",
qPrintable(re.cap(1)), pm.width(), pm.height(), pm.depth(),
tx, ty, tw, th, sx, sy, sw, sh);
@@ -1022,7 +1022,7 @@ void PaintCommands::command_drawImage(QRegExp re)
if (sh == 0) sh = -1;
if (m_verboseMode)
- printf(" -(lance) drawImage('%s' dim=(%d, %d), (%d, %d, %d, %d), (%d, %d, %d, %d)\n",
+ printf(" -(lance) drawImage('%s' dim=(%d, %d), (%f, %f, %f, %f), (%f, %f, %f, %f)\n",
qPrintable(re.cap(1)), im.width(), im.height(), tx, ty, tw, th, sx, sy, sw, sh);
m_painter->drawImage(QRectF(tx, ty, tw, th), im, QRectF(sx, sy, sw, sh), Qt::OrderedDither | Qt::OrderedAlphaDither);
diff --git a/tests/auto/qgl/tst_qgl.cpp b/tests/auto/qgl/tst_qgl.cpp
index e9f0476e0b..c680decc01 100644
--- a/tests/auto/qgl/tst_qgl.cpp
+++ b/tests/auto/qgl/tst_qgl.cpp
@@ -82,7 +82,6 @@ private slots:
void glPBufferRendering();
void glWidgetReparent();
void glWidgetRenderPixmap();
- void stackedFBOs();
void colormap();
void fboFormat();
void testDontCrashOnDanglingResources();
@@ -1226,110 +1225,6 @@ void tst_QGL::glWidgetRenderPixmap()
QCOMPARE(fb, reference);
}
-
-// When using multiple FBOs at the same time, unbinding one FBO should re-bind the
-// previous. I.e. It should be possible to have a stack of FBOs where pop'ing there
-// top re-binds the one underneeth.
-void tst_QGL::stackedFBOs()
-{
- if (!QGLFramebufferObject::hasOpenGLFramebufferObjects())
- QSKIP("QGLFramebufferObject not supported on this platform", SkipSingle);
-
- QGLWidget glw;
- glw.show();
-
-#ifdef Q_WS_X11
- qt_x11_wait_for_window_manager(&glw);
-#endif
- QTest::qWait(200);
-
- glw.makeCurrent();
-
- // No multisample with combined depth/stencil attachment:
- QGLFramebufferObjectFormat fboFormat;
- fboFormat.setAttachment(QGLFramebufferObject::CombinedDepthStencil);
-
- // Don't complicate things by using NPOT:
- QGLFramebufferObject *fbo1 = new QGLFramebufferObject(128, 128, fboFormat);
- QGLFramebufferObject *fbo2 = new QGLFramebufferObject(128, 128, fboFormat);
- QGLFramebufferObject *fbo3 = new QGLFramebufferObject(128, 128, fboFormat);
-
- glClearColor(1.0, 0.0, 1.0, 1.0);
- glClear(GL_COLOR_BUFFER_BIT);
-
- fbo1->bind();
- glClearColor(1.0, 0.0, 0.0, 1.0);
- glClear(GL_COLOR_BUFFER_BIT);
-
- fbo2->bind();
- glClearColor(0.0, 1.0, 0.0, 1.0);
- glClear(GL_COLOR_BUFFER_BIT);
-
- fbo3->bind();
- glClearColor(0.0, 0.0, 1.0, 1.0);
- glClear(GL_COLOR_BUFFER_BIT);
- glScissor(32, 32, 64, 64);
- glEnable(GL_SCISSOR_TEST);
- glClearColor(0.0, 1.0, 1.0, 1.0);
- glClear(GL_COLOR_BUFFER_BIT);
- fbo3->release();
-
- // Scissor rect & test should be left untouched by the fbo release...
- glClearColor(0.0, 0.0, 0.0, 1.0);
- glClear(GL_COLOR_BUFFER_BIT);
- fbo2->release();
-
- glClearColor(1.0, 1.0, 1.0, 1.0);
- glClear(GL_COLOR_BUFFER_BIT);
- fbo1->release();
-
- glClearColor(1.0, 1.0, 0.0, 1.0);
- glClear(GL_COLOR_BUFFER_BIT);
-
- glw.swapBuffers();
-
- QImage widgetFB = glw.grabFrameBuffer(false).convertToFormat(QImage::Format_RGB32);
- QImage fb1 = fbo1->toImage().convertToFormat(QImage::Format_RGB32);
- QImage fb2 = fbo2->toImage().convertToFormat(QImage::Format_RGB32);
- QImage fb3 = fbo3->toImage().convertToFormat(QImage::Format_RGB32);
-
- delete fbo1;
- delete fbo2;
- delete fbo3;
-
- QImage widgetReference(widgetFB.size(), widgetFB.format());
- QImage fb1Reference(fb1.size(), fb1.format());
- QImage fb2Reference(fb2.size(), fb2.format());
- QImage fb3Reference(fb3.size(), fb3.format());
-
- QPainter widgetReferencePainter(&widgetReference);
- QPainter fb1ReferencePainter(&fb1Reference);
- QPainter fb2ReferencePainter(&fb2Reference);
- QPainter fb3ReferencePainter(&fb3Reference);
-
- widgetReferencePainter.fillRect(0, 0, widgetReference.width(), widgetReference.height(), Qt::magenta);
- fb1ReferencePainter.fillRect(0, 0, fb1Reference.width(), fb1Reference.height(), Qt::red);
- fb2ReferencePainter.fillRect(0, 0, fb2Reference.width(), fb2Reference.height(), Qt::green);
- fb3ReferencePainter.fillRect(0, 0, fb3Reference.width(), fb3Reference.height(), Qt::blue);
-
- // Flip y-coords to match GL for the widget (which can be any size)
- widgetReferencePainter.fillRect(32, glw.height() - 96, 64, 64, Qt::yellow);
- fb1ReferencePainter.fillRect(32, 32, 64, 64, Qt::white);
- fb2ReferencePainter.fillRect(32, 32, 64, 64, Qt::black);
- fb3ReferencePainter.fillRect(32, 32, 64, 64, Qt::cyan);
-
- widgetReferencePainter.end();
- fb1ReferencePainter.end();
- fb2ReferencePainter.end();
- fb3ReferencePainter.end();
-
- QCOMPARE(widgetFB, widgetReference);
- QCOMPARE(fb1, fb1Reference);
- QCOMPARE(fb2, fb2Reference);
- QCOMPARE(fb3, fb3Reference);
-}
-
-
class ColormapExtended : public QGLColormap
{
public:
diff --git a/tests/auto/qpainter/tst_qpainter.cpp b/tests/auto/qpainter/tst_qpainter.cpp
index 8ed83cb851..bcdbe56671 100644
--- a/tests/auto/qpainter/tst_qpainter.cpp
+++ b/tests/auto/qpainter/tst_qpainter.cpp
@@ -4193,9 +4193,9 @@ void tst_QPainter::extendedBlendModes()
QVERIFY(testCompositionMode(255, 255, 255, QPainter::CompositionMode_SoftLight));
QVERIFY(testCompositionMode( 0, 0, 0, QPainter::CompositionMode_SoftLight));
- QVERIFY(testCompositionMode(127, 127, 127, QPainter::CompositionMode_SoftLight));
- QVERIFY(testCompositionMode( 63, 63, 86, QPainter::CompositionMode_SoftLight));
- QVERIFY(testCompositionMode(127, 63, 63, QPainter::CompositionMode_SoftLight));
+ QVERIFY(testCompositionMode(127, 127, 126, QPainter::CompositionMode_SoftLight));
+ QVERIFY(testCompositionMode( 63, 63, 39, QPainter::CompositionMode_SoftLight));
+ QVERIFY(testCompositionMode(127, 63, 62, QPainter::CompositionMode_SoftLight));
QVERIFY(testCompositionMode(255, 255, 0, QPainter::CompositionMode_Difference));
QVERIFY(testCompositionMode( 0, 0, 0, QPainter::CompositionMode_Difference));
diff --git a/tests/auto/qstatemachine/tst_qstatemachine.cpp b/tests/auto/qstatemachine/tst_qstatemachine.cpp
index 9a2b2edf1a..fd39515a98 100644
--- a/tests/auto/qstatemachine/tst_qstatemachine.cpp
+++ b/tests/auto/qstatemachine/tst_qstatemachine.cpp
@@ -208,6 +208,7 @@ private slots:
void task260403_clonedSignals();
void postEventFromOtherThread();
+ void eventFilterForApplication();
};
tst_QStateMachine::tst_QStateMachine()
@@ -4276,5 +4277,35 @@ void tst_QStateMachine::postEventFromOtherThread()
QTRY_COMPARE(finishedSpy.count(), 1);
}
+void tst_QStateMachine::eventFilterForApplication()
+{
+ QStateMachine machine;
+
+ QState *s1 = new QState(&machine);
+ {
+ machine.setInitialState(s1);
+ }
+
+ QState *s2 = new QState(&machine);
+
+ QEventTransition *transition = new QEventTransition(QCoreApplication::instance(),
+ QEvent::ApplicationActivate);
+ transition->setTargetState(s2);
+ s1->addTransition(transition);
+
+ machine.start();
+ QCoreApplication::processEvents();
+
+ QCOMPARE(machine.configuration().size(), 1);
+ QVERIFY(machine.configuration().contains(s1));
+
+ QCoreApplication::postEvent(QCoreApplication::instance(),
+ new QEvent(QEvent::ApplicationActivate));
+ QCoreApplication::processEvents();
+
+ QCOMPARE(machine.configuration().size(), 1);
+ QVERIFY(machine.configuration().contains(s2));
+}
+
QTEST_MAIN(tst_QStateMachine)
#include "tst_qstatemachine.moc"