summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/guiapplauncher/tst_guiapplauncher.cpp8
-rw-r--r--tests/auto/qgl/tst_qgl.cpp27
-rw-r--r--tests/auto/qpainter/tst_qpainter.cpp24
-rw-r--r--tests/auto/qscriptengineagent/tst_qscriptengineagent.cpp51
-rw-r--r--tests/auto/qwidget/tst_qwidget.cpp4
5 files changed, 102 insertions, 12 deletions
diff --git a/tests/auto/guiapplauncher/tst_guiapplauncher.cpp b/tests/auto/guiapplauncher/tst_guiapplauncher.cpp
index 048ea35..4b3ce18 100644
--- a/tests/auto/guiapplauncher/tst_guiapplauncher.cpp
+++ b/tests/auto/guiapplauncher/tst_guiapplauncher.cpp
@@ -128,10 +128,10 @@ const struct Example examples[] = {
{"mainwindows/menus Example", "mainwindows/menus", "menus", 10, -1},
{"mainwindows/recentfiles Example", "mainwindows/recentfiles", "recentfiles", 10, -1},
{"mainwindows/sdi Example", "mainwindows/sdi", "sdi", 10, -1},
- {"multitouch/dials Example", "multitouch/dials", "dials", 10, -1},
- {"multitouch/fingerpaint Example", "multitouch/fingerpaint", "fingerpaint", 10, -1},
- {"multitouch/knobs Example", "multitouch/knobs", "knobs", 10, -1},
- {"multitouch/pinchzoom Example", "multitouch/pinchzoom", "pinchzoom", 10, -1},
+ {"touch/dials Example", "touch/dials", "dials", 10, -1},
+ {"touch/fingerpaint Example", "touch/fingerpaint", "fingerpaint", 10, -1},
+ {"touch/knobs Example", "touch/knobs", "knobs", 10, -1},
+ {"touch/pinchzoom Example", "touch/pinchzoom", "pinchzoom", 10, -1},
{"opengl/2dpainting Example", "opengl/2dpainting", "2dpainting", 10, -1},
{"opengl/grabber Example", "opengl/grabber", "grabber", 10, -1},
{"opengl/hellogl Example", "opengl/hellogl", "hellogl", 10, -1},
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;
diff --git a/tests/auto/qwidget/tst_qwidget.cpp b/tests/auto/qwidget/tst_qwidget.cpp
index f20d27a..f722f89 100644
--- a/tests/auto/qwidget/tst_qwidget.cpp
+++ b/tests/auto/qwidget/tst_qwidget.cpp
@@ -9694,7 +9694,6 @@ void tst_QWidget::destroyBackingStoreWhenHidden()
// Native child widget should once again share parent's backing store
QVERIFY(0 != backingStore(parent));
- QEXPECT_FAIL("", "QTBUG-10643", Continue);
QVERIFY(0 == backingStore(child));
}
@@ -9743,7 +9742,7 @@ void tst_QWidget::destroyBackingStoreWhenHidden()
QVERIFY(0 != backingStore(child));
// Parent is obscured, therefore its backing store should be destroyed
- QEXPECT_FAIL("", "QTBUG-10643", Continue);
+ QEXPECT_FAIL("", "QTBUG-12406", Continue);
QVERIFY(0 == backingStore(parent));
// Disable full screen
@@ -9757,7 +9756,6 @@ void tst_QWidget::destroyBackingStoreWhenHidden()
// Native child widget should once again share parent's backing store
QVERIFY(0 != backingStore(parent));
- QEXPECT_FAIL("", "QTBUG-10643", Continue);
QVERIFY(0 == backingStore(child));
}
}