diff options
Diffstat (limited to 'tests/auto/tst_qmlshadersplugin.cpp')
-rw-r--r-- | tests/auto/tst_qmlshadersplugin.cpp | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/tests/auto/tst_qmlshadersplugin.cpp b/tests/auto/tst_qmlshadersplugin.cpp index d17baea..19c5d9d 100644 --- a/tests/auto/tst_qmlshadersplugin.cpp +++ b/tests/auto/tst_qmlshadersplugin.cpp @@ -72,6 +72,7 @@ private slots: void initTestCase(); void shaderEffectItemAPI(); void shaderEffectSourceAPI(); + void combined(); private: QDeclarativeEngine engine; @@ -108,17 +109,20 @@ void tst_qmlshadersplugin::shaderEffectItemAPI() QCOMPARE(obj->property("vertexShader").toString(), QString("")); QCOMPARE(obj->property("blending").toBool(), true); QCOMPARE(obj->property("meshResolution").toSize(), QSize(1, 1)); + QCOMPARE(obj->property("visible").toBool(), true); // Seting the values QVERIFY(obj->setProperty("fragmentShader", QString(qt_default_fragment_code))); QVERIFY(obj->setProperty("vertexShader", QString(qt_default_vertex_code))); QVERIFY(obj->setProperty("blending", false)); QVERIFY(obj->setProperty("meshResolution", QSize(20, 10))); + QVERIFY(obj->setProperty("visible", false)); QCOMPARE(obj->property("fragmentShader").toString(), QString(qt_default_fragment_code)); QCOMPARE(obj->property("vertexShader").toString(), QString(qt_default_vertex_code)); QCOMPARE(obj->property("blending").toBool(), false); QCOMPARE(obj->property("meshResolution").toSize(), QSize(20, 10)); + QCOMPARE(obj->property("visible").toBool(), false); delete obj; } @@ -169,6 +173,33 @@ void tst_qmlshadersplugin::shaderEffectSourceAPI() delete obj; } +void tst_qmlshadersplugin::combined() +{ + QGLFormat format = QGLFormat::defaultFormat(); + format.setSampleBuffers(false); + format.setSwapInterval(1); + + QGLWidget* glWidget = new QGLWidget(format); + glWidget->setAutoFillBackground(false); + + QDeclarativeView view; + view.setViewportUpdateMode(QGraphicsView::FullViewportUpdate); + view.setAttribute(Qt::WA_OpaquePaintEvent); + view.setAttribute(Qt::WA_NoSystemBackground); + view.setViewport(glWidget); + view.setSource(QUrl::fromLocalFile("main.qml")); + view.show(); + QTest::qWait(1000); + + QObject *item = view.rootObject()->findChild<QDeclarativeItem*>("effectItem"); + QVERIFY(item != 0); + + QObject *src = view.rootObject()->findChild<QDeclarativeItem*>("effectSource"); + QVERIFY(src != 0); + + QCOMPARE(item->property("source"), QVariant::fromValue(src)); +} + QTEST_MAIN(tst_qmlshadersplugin) #include "tst_qmlshadersplugin.moc" |