From ec13cf30f10dabce37af3ce9d6763066e8cf4cc4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Trond=20Kjern=C3=A5sen?= Date: Thu, 5 Nov 2009 11:21:31 +0100 Subject: Removed the FBO stacking behaviour and the test attached to it. Having this behaviour in QGLFrameBufferObject complicates alot of things and isn't really necessary. Reviewed-by: Tom Cooksey --- tests/auto/qgl/tst_qgl.cpp | 105 --------------------------------------------- 1 file changed, 105 deletions(-) (limited to 'tests/auto') 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: -- cgit v1.2.3 From d456ac11027f7573aa32745a8bc972d2b83926f4 Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Thu, 5 Nov 2009 14:17:56 +0100 Subject: Add test for QEventTransition when filtering on a QApplication instance Test for 8ec037effce7f515fffed6b05c011e385fb52593. Reviewed-by: Gunnar --- tests/auto/qstatemachine/tst_qstatemachine.cpp | 31 ++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) (limited to 'tests/auto') 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" -- cgit v1.2.3 From 3c0b6de86ce044ce6f3f4a445d1de90b4e7bb1d9 Mon Sep 17 00:00:00 2001 From: Gunnar Sletta Date: Fri, 6 Nov 2009 10:10:46 +0100 Subject: Updated testcase since soft-light algorithm rewrite. The SVG standard changed the algorithm which implies some changes to the results as well. Reviewed-by: Kim --- tests/auto/qpainter/tst_qpainter.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'tests/auto') 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)); -- cgit v1.2.3 From 9b500e9a09907f05002bd0e57869c5312ae101db Mon Sep 17 00:00:00 2001 From: David Faure Date: Fri, 6 Nov 2009 12:59:35 +0100 Subject: Fix QPainter::setPen(pen with color but no style) on non-extended. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It was working with a QImage but not with a QPixmap, which is obviously a bug. In addition, it broke WebCore::GraphicsContext::setPlatformStrokeColor which does exactly what I put in the unittest: get pen, set color, set pen. This commit fixes the wrong color in the underline of the links in http://www.davidfaure.fr/kde/link_underline_color.html in QtWebkit. Merge-request: 1995 Reviewed-by: Samuel Rødal --- tests/auto/qpainter/tst_qpainter.cpp | 39 ++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) (limited to 'tests/auto') diff --git a/tests/auto/qpainter/tst_qpainter.cpp b/tests/auto/qpainter/tst_qpainter.cpp index bcdbe56671..4d2c6266ba 100644 --- a/tests/auto/qpainter/tst_qpainter.cpp +++ b/tests/auto/qpainter/tst_qpainter.cpp @@ -239,9 +239,12 @@ private slots: void taskQT4444_dontOverflowDashOffset(); void painterBegin(); + void setPenColorOnImage(); + void setPenColorOnPixmap(); private: void fillData(); + void setPenColor(QPainter& p); QColor baseColor( int k, int intensity=255 ); QImage getResImage( const QString &dir, const QString &addition, const QString &extension ); QBitmap getBitmap( const QString &dir, const QString &filename, bool mask ); @@ -4352,5 +4355,41 @@ void tst_QPainter::painterBegin() QVERIFY(!p.end()); } +void tst_QPainter::setPenColor(QPainter& p) +{ + p.setPen(Qt::NoPen); + + // Setting color, then style + // Should work even though the pen is "NoPen with color", temporarily. + QPen newPen(p.pen()); + newPen.setColor(Qt::red); + QCOMPARE(p.pen().style(), newPen.style()); + QCOMPARE(p.pen().style(), Qt::NoPen); + p.setPen(newPen); + + QCOMPARE(p.pen().color().name(), QString("#ff0000")); + + QPen newPen2(p.pen()); + newPen2.setStyle(Qt::SolidLine); + p.setPen(newPen2); + + QCOMPARE(p.pen().color().name(), QString("#ff0000")); +} + +void tst_QPainter::setPenColorOnImage() +{ + QImage img(QSize(10, 10), QImage::Format_ARGB32_Premultiplied); + QPainter p(&img); + setPenColor(p); +} + +void tst_QPainter::setPenColorOnPixmap() +{ + QPixmap pix(10, 10); + QPainter p(&pix); + setPenColor(p); +} + QTEST_MAIN(tst_QPainter) + #include "tst_qpainter.moc" -- cgit v1.2.3