diff options
author | Qt Continuous Integration System <qt-info@nokia.com> | 2010-07-27 20:12:24 (GMT) |
---|---|---|
committer | Qt Continuous Integration System <qt-info@nokia.com> | 2010-07-27 20:12:24 (GMT) |
commit | 7795c14a574fcee67c840ce996602d61e66683f5 (patch) | |
tree | 299a12bc79a827f8502f2f118b4254ceeaf1e7a0 /tests | |
parent | ef0404ed32c2eee65cfca6137c2d9ebe67e1c5bd (diff) | |
parent | a62045401cc8f55c3175a2b33e8f43b356604f37 (diff) | |
download | Qt-7795c14a574fcee67c840ce996602d61e66683f5.zip Qt-7795c14a574fcee67c840ce996602d61e66683f5.tar.gz Qt-7795c14a574fcee67c840ce996602d61e66683f5.tar.bz2 |
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/oslo-staging-2 into 4.7-integration
* '4.7' of scm.dev.nokia.troll.no:qt/oslo-staging-2:
Don't run the QGL test on systems that does not have GL support.
Remove an useless assert from comp_func_SourceOver_sse2()
QScriptEngineAgent: recompile all the function when installing a debugger.
QScriptDeclarativeObject: we need to save the current stack pointer.
QScriptValue::objectId(): do not assert if the value is not a cell
Implement the composition mode "Plus" with SSE2
Clean the CompositionFunction tables of drawhelper
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/qgl/tst_qgl.cpp | 27 | ||||
-rw-r--r-- | tests/auto/qpainter/tst_qpainter.cpp | 24 | ||||
-rw-r--r-- | tests/auto/qscriptengineagent/tst_qscriptengineagent.cpp | 51 |
3 files changed, 97 insertions, 5 deletions
diff --git a/tests/auto/qgl/tst_qgl.cpp b/tests/auto/qgl/tst_qgl.cpp index 8ee494f..7fe461c 100644 --- a/tests/auto/qgl/tst_qgl.cpp +++ b/tests/auto/qgl/tst_qgl.cpp @@ -2252,5 +2252,30 @@ void tst_QGL::textureCleanup() #endif } -QTEST_MAIN(tst_QGL) +class tst_QGLDummy : public QObject +{ +Q_OBJECT + +public: + tst_QGLDummy() {} + +private slots: + void qglSkipTests() { + QSKIP("QGL not supported on this system.", SkipAll); + } +}; + +int main(int argc, char **argv) +{ + QApplication app(argc, argv); + QTEST_DISABLE_KEYPAD_NAVIGATION \ + QGLWidget glWidget; + if (!glWidget.isValid()) { + tst_QGLDummy tc; + return QTest::qExec(&tc, argc, argv); + } + tst_QGL tc; + return QTest::qExec(&tc, argc, argv); +} + #include "tst_qgl.moc" diff --git a/tests/auto/qpainter/tst_qpainter.cpp b/tests/auto/qpainter/tst_qpainter.cpp index 27ee6e7..f358681 100644 --- a/tests/auto/qpainter/tst_qpainter.cpp +++ b/tests/auto/qpainter/tst_qpainter.cpp @@ -4176,14 +4176,18 @@ void tst_QPainter::inactivePainter() p.setWorldTransform(QTransform().scale(0.5, 0.5), true); } -bool testCompositionMode(int src, int dst, int expected, QPainter::CompositionMode op) +bool testCompositionMode(int src, int dst, int expected, QPainter::CompositionMode op, qreal opacity = 1.0) { - QImage actual(1, 1, QImage::Format_ARGB32_Premultiplied); + // The test image needs to be large enough to test SIMD code + const QSize imageSize(100, 100); + + QImage actual(imageSize, QImage::Format_ARGB32_Premultiplied); actual.fill(QColor(dst, dst, dst).rgb()); QPainter p(&actual); p.setCompositionMode(op); - p.fillRect(0, 0, 1, 1, QColor(src, src, src)); + p.setOpacity(opacity); + p.fillRect(QRect(QPoint(), imageSize), QColor(src, src, src)); p.end(); if (qRed(actual.pixel(0, 0)) != expected) { @@ -4191,7 +4195,9 @@ bool testCompositionMode(int src, int dst, int expected, QPainter::CompositionMo src, dst, qRed(actual.pixel(0, 0)), expected); return false; } else { - return true; + QImage refImage(imageSize, QImage::Format_ARGB32_Premultiplied); + refImage.fill(QColor(expected, expected, expected).rgb()); + return actual == refImage; } } @@ -4206,6 +4212,16 @@ void tst_QPainter::extendedBlendModes() QVERIFY(testCompositionMode( 0, 255, 255, QPainter::CompositionMode_Plus)); QVERIFY(testCompositionMode(128, 128, 255, QPainter::CompositionMode_Plus)); + QVERIFY(testCompositionMode(255, 255, 255, QPainter::CompositionMode_Plus, 0.3)); + QVERIFY(testCompositionMode( 0, 0, 0, QPainter::CompositionMode_Plus, 0.3)); + QVERIFY(testCompositionMode(127, 128, 165, QPainter::CompositionMode_Plus, 0.3)); + QVERIFY(testCompositionMode(127, 0, 37, QPainter::CompositionMode_Plus, 0.3)); + QVERIFY(testCompositionMode( 0, 127, 127, QPainter::CompositionMode_Plus, 0.3)); + QVERIFY(testCompositionMode(255, 0, 75, QPainter::CompositionMode_Plus, 0.3)); + QVERIFY(testCompositionMode( 0, 255, 255, QPainter::CompositionMode_Plus, 0.3)); + QVERIFY(testCompositionMode(128, 128, 166, QPainter::CompositionMode_Plus, 0.3)); + QVERIFY(testCompositionMode(186, 200, 255, QPainter::CompositionMode_Plus, 0.3)); + QVERIFY(testCompositionMode(255, 255, 255, QPainter::CompositionMode_Multiply)); QVERIFY(testCompositionMode( 0, 0, 0, QPainter::CompositionMode_Multiply)); QVERIFY(testCompositionMode(127, 255, 127, QPainter::CompositionMode_Multiply)); diff --git a/tests/auto/qscriptengineagent/tst_qscriptengineagent.cpp b/tests/auto/qscriptengineagent/tst_qscriptengineagent.cpp index ed00b96..c30a636 100644 --- a/tests/auto/qscriptengineagent/tst_qscriptengineagent.cpp +++ b/tests/auto/qscriptengineagent/tst_qscriptengineagent.cpp @@ -97,6 +97,7 @@ private slots: void functionEntryAndExit_objectCall(); void positionChange_1(); void positionChange_2(); + void positionChange_3(); void exceptionThrowAndCatch(); void eventOrder_assigment(); void eventOrder_functionDefinition(); @@ -1625,6 +1626,56 @@ void tst_QScriptEngineAgent::positionChange_2() delete spy; } +void tst_QScriptEngineAgent::positionChange_3() +{ + QScriptEngine eng; + eng.evaluate("function some_function1(a) {\n a++; \n return a + 12; } \n some_function1(42);", "function1.qs", 12); + QScriptValue some_function2 = eng.evaluate("(function (b) {\n b--; \n return b + 11; })", "function2.qs", 21); + some_function2.call(QScriptValue(), QScriptValueList() << 2 ); + + // Test that the agent work, even if installed after the function has been evaluated. + ScriptEngineSpy *spy = new ScriptEngineSpy(&eng, ~(ScriptEngineSpy::IgnorePositionChange)); + { + spy->clear(); + QScriptValue v = eng.evaluate("some_function1(15)"); + QCOMPARE(v.toInt32(), (15+1+12)); + QCOMPARE(spy->count(), 3); + + // some_function1() + QCOMPARE(spy->at(0).type, ScriptEngineEvent::PositionChange); + QVERIFY(spy->at(0).scriptId != -1); + QCOMPARE(spy->at(0).lineNumber, 1); + + // a++ + QCOMPARE(spy->at(1).type, ScriptEngineEvent::PositionChange); + QVERIFY(spy->at(1).scriptId != spy->at(0).scriptId); + QCOMPARE(spy->at(1).lineNumber, 13); + // return a + 12 + QCOMPARE(spy->at(2).type, ScriptEngineEvent::PositionChange); + QVERIFY(spy->at(2).scriptId == spy->at(1).scriptId); + QCOMPARE(spy->at(2).lineNumber, 14); + } + + { + spy->clear(); + QScriptValue v = some_function2.call(QScriptValue(), QScriptValueList() << 89 ); + QCOMPARE(v.toInt32(), (89-1+11)); + QCOMPARE(spy->count(), 2); + + // b-- + QCOMPARE(spy->at(0).type, ScriptEngineEvent::PositionChange); + QVERIFY(spy->at(0).scriptId != -1); + QCOMPARE(spy->at(0).lineNumber, 22); + // return b + 11 + QCOMPARE(spy->at(1).type, ScriptEngineEvent::PositionChange); + QVERIFY(spy->at(1).scriptId == spy->at(0).scriptId); + QCOMPARE(spy->at(1).lineNumber, 23); + } + + QVERIFY(!eng.hasUncaughtException()); +} + + void tst_QScriptEngineAgent::exceptionThrowAndCatch() { QScriptEngine eng; |