diff options
author | Kaj Grönholm <kaj.gronholm@qt.io> | 2019-06-05 10:23:58 +0300 |
---|---|---|
committer | Kaj Grönholm <kaj.gronholm@qt.io> | 2019-06-05 15:11:56 +0300 |
commit | 33d8c8e8eae5dcf14dcaacca1d9fafcf9ba46759 (patch) | |
tree | ff2100876d7f713b1ff58da11195dcbc90142b0a | |
parent | 44d89b1a1f84b528d3dce93d057c67db868d38c1 (diff) |
Fix autotests
Fix building and running autotests after latest API & module changes.
Task-number: QT3DS-3213
Change-Id: I15e3da941c499453021e87a574cfb888b87e6773
Reviewed-by: Miikka Heikkinen <miikka.heikkinen@qt.io>
Reviewed-by: Tomi Korpipää <tomi.korpipaa@qt.io>
-rw-r--r-- | src/Runtime/ogl-runtime/testres.qrc | 20 | ||||
-rw-r--r-- | tests/auto/runtime/runtime.pro | 5 | ||||
-rw-r--r-- | tests/auto/studio3d/q3dssurfaceviewer/tst_q3dssurfaceviewer.cpp | 41 |
3 files changed, 21 insertions, 45 deletions
diff --git a/src/Runtime/ogl-runtime/testres.qrc b/src/Runtime/ogl-runtime/testres.qrc index 7b3c20bc..095e538f 100644 --- a/src/Runtime/ogl-runtime/testres.qrc +++ b/src/Runtime/ogl-runtime/testres.qrc @@ -1,14 +1,14 @@ <RCC> <qresource prefix="/"> - <file alias="aluminium.shader">../../Studio/Content/Material Library/aluminum.shader</file> - <file alias="asphalt.shader">../../Studio/Content/Material Library/asphalt.shader</file> - <file alias="concrete.shader">../../Studio/Content/Material Library/concrete.shader</file> - <file alias="copper.shader">../../Studio/Content/Material Library/copper.shader</file> - <file alias="porcelain.shader">../../Studio/Content/Material Library/porcelain.shader</file> - <file alias="simple_glass.shader">../../Studio/Content/Material Library/simple_glass.shader</file> - <file alias="Desaturate.effect">../../Studio/Content/Effect Library/Desaturate.effect</file> - <file alias="Gaussian Blur.effect">../../Studio/Content/Effect Library/Gaussian Blur.effect</file> - <file alias="Sepia.effect">../../Studio/Content/Effect Library/Sepia.effect</file> - <file alias="Bloom.effect">../../Studio/Content/Effect Library/Bloom.effect</file> + <file alias="aluminium.shader">../../../Studio/Content/Material Library/aluminum.shader</file> + <file alias="asphalt.shader">../../../Studio/Content/Material Library/asphalt.shader</file> + <file alias="concrete.shader">../../../Studio/Content/Material Library/concrete.shader</file> + <file alias="copper.shader">../../../Studio/Content/Material Library/copper.shader</file> + <file alias="porcelain.shader">../../../Studio/Content/Material Library/porcelain.shader</file> + <file alias="simple_glass.shader">../../../Studio/Content/Material Library/simple_glass.shader</file> + <file alias="Desaturate.effect">../../../Studio/Content/Effect Library/Desaturate.effect</file> + <file alias="Gaussian Blur.effect">../../../Studio/Content/Effect Library/Gaussian Blur.effect</file> + <file alias="Sepia.effect">../../../Studio/Content/Effect Library/Sepia.effect</file> + <file alias="Bloom.effect">../../../Studio/Content/Effect Library/Bloom.effect</file> </qresource> </RCC> diff --git a/tests/auto/runtime/runtime.pro b/tests/auto/runtime/runtime.pro index 534af9f8..146a243f 100644 --- a/tests/auto/runtime/runtime.pro +++ b/tests/auto/runtime/runtime.pro @@ -4,10 +4,11 @@ include($$PWD/../../../src/Runtime/ogl-runtime/commoninclude.pri) TARGET = tst_qt3dsruntime QT += testlib gui +QT += quick-private + RESOURCES += \ runtime.qrc \ - $$PWD/../../../src/Runtime/testres.qrc \ - $$PWD/../../../src/Runtime/platformres.qrc + $$PWD/../../../src/Runtime/ogl-runtime/testres.qrc INCLUDEPATH += \ $$PWD/../../../src/Runtime/ogl-runtime/src/Qt3DSRuntimeRender/RendererImpl diff --git a/tests/auto/studio3d/q3dssurfaceviewer/tst_q3dssurfaceviewer.cpp b/tests/auto/studio3d/q3dssurfaceviewer/tst_q3dssurfaceviewer.cpp index 4f299075..786ef3a3 100644 --- a/tests/auto/studio3d/q3dssurfaceviewer/tst_q3dssurfaceviewer.cpp +++ b/tests/auto/studio3d/q3dssurfaceviewer/tst_q3dssurfaceviewer.cpp @@ -236,7 +236,7 @@ void tst_Q3DSSurfaceViewer::createViewer(Q3DSSurfaceViewer *&viewer, QSurface *s viewer->setSize(size); viewer->setUpdateInterval(updateInterval); - QVERIFY(viewer->initialize(surface, m_context, fboId)); + QVERIFY(viewer->create(surface, m_context, fboId)); QCOMPARE(spy.count(), 1); QVERIFY(viewer->isRunning()); @@ -318,7 +318,7 @@ void tst_Q3DSSurfaceViewer::testBasics() checkPixel(m_viewer, Qt::red); - m_viewer->shutdown(); + m_viewer->destroy(); QCOMPARE(spy.count(), 1); QVERIFY(!m_viewer->isRunning()); @@ -622,7 +622,10 @@ void tst_Q3DSSurfaceViewer::testReset() QStringLiteral("diffuse.b"), QVariant(1.0)); checkPixel(m_viewer, Qt::blue); - m_viewer->reset(); + // Note: reset() is private method now, instead can reload presentation by switching sources + // m_viewer->reset(); + m_viewer->presentation()->setSource(ANIMATION); + m_viewer->presentation()->setSource(RED); checkPixel(m_viewer, Qt::red); } @@ -648,17 +651,14 @@ void tst_Q3DSSurfaceViewer::testSettings() QSignalSpy spy1(s, &Q3DSViewerSettings::matteColorChanged); QSignalSpy spy2(s, &Q3DSViewerSettings::showRenderStatsChanged); - QSignalSpy spy3(s, &Q3DSViewerSettings::shadeModeChanged); QSignalSpy spy4(s, &Q3DSViewerSettings::scaleModeChanged); QVERIFY(spy1.isValid()); QVERIFY(spy2.isValid()); - QVERIFY(spy3.isValid()); QVERIFY(spy4.isValid()); // Check defaults QCOMPARE(s->matteColor(), QColor(Qt::black)); QCOMPARE(s->isShowRenderStats(), false); - QCOMPARE(s->shadeMode(), Q3DSViewerSettings::ShadeModeShaded); QCOMPARE(s->scaleMode(), Q3DSViewerSettings::ScaleModeCenter); // Matte @@ -669,7 +669,6 @@ void tst_Q3DSSurfaceViewer::testSettings() QCOMPARE(spy1.count(), 1); QCOMPARE(spy2.count(), 0); - QCOMPARE(spy3.count(), 0); QCOMPARE(spy4.count(), 0); checkPixel(m_viewer, Qt::cyan); @@ -682,7 +681,6 @@ void tst_Q3DSSurfaceViewer::testSettings() QCOMPARE(spy1.count(), 1); QCOMPARE(spy2.count(), 1); - QCOMPARE(spy3.count(), 0); QCOMPARE(spy4.count(), 0); QImage image2 = m_viewer->grab(); @@ -691,26 +689,8 @@ void tst_Q3DSSurfaceViewer::testSettings() s->setShowRenderStats(false); QCOMPARE(spy1.count(), 1); QCOMPARE(spy2.count(), 2); - QCOMPARE(spy3.count(), 0); - QCOMPARE(spy4.count(), 0); - - // ShadeMode - image1 = m_viewer->grab(); - - s->setShadeMode(Q3DSViewerSettings::ShadeModeShadedWireframe); - QCOMPARE(s->shadeMode(), Q3DSViewerSettings::ShadeModeShadedWireframe); - - QCOMPARE(spy1.count(), 1); - QCOMPARE(spy2.count(), 2); - QCOMPARE(spy3.count(), 1); QCOMPARE(spy4.count(), 0); - image2 = m_viewer->grab(); - QVERIFY(image1 != image2); - - // Restore shade mode so following tests are not affected by wireframes - s->setShadeMode(Q3DSViewerSettings::ShadeModeShaded); - // ScaleMode checkPixel(m_viewer, Qt::cyan); checkPixel(m_viewer, Qt::cyan, QPoint(50, height / 2)); @@ -719,7 +699,6 @@ void tst_Q3DSSurfaceViewer::testSettings() QCOMPARE(spy1.count(), 1); QCOMPARE(spy2.count(), 2); - QCOMPARE(spy3.count(), 2); QCOMPARE(spy4.count(), 1); checkPixel(m_viewer, Qt::cyan); @@ -730,7 +709,6 @@ void tst_Q3DSSurfaceViewer::testSettings() QCOMPARE(spy1.count(), 1); QCOMPARE(spy2.count(), 2); - QCOMPARE(spy3.count(), 2); QCOMPARE(spy4.count(), 2); checkPixel(m_viewer, Qt::blue); @@ -744,17 +722,14 @@ void tst_Q3DSSurfaceViewer::testSettings() s->setMatteColor(Qt::yellow); s->setShowRenderStats(true); - s->setShadeMode(Q3DSViewerSettings::ShadeModeShadedWireframe); s->setScaleMode(Q3DSViewerSettings::ScaleModeFit); QCOMPARE(s->matteColor(), QColor(Qt::yellow)); QCOMPARE(s->isShowRenderStats(), true); - QCOMPARE(s->shadeMode(), Q3DSViewerSettings::ShadeModeShadedWireframe); QCOMPARE(s->scaleMode(), Q3DSViewerSettings::ScaleModeFit); QCOMPARE(spy1.count(), 2); QCOMPARE(spy2.count(), 3); - QCOMPARE(spy3.count(), 3); QCOMPARE(spy4.count(), 3); image2 = m_viewer->grab(); @@ -764,12 +739,10 @@ void tst_Q3DSSurfaceViewer::testSettings() QCOMPARE(s->matteColor(), QColor(Qt::cyan)); QCOMPARE(s->isShowRenderStats(), false); - QCOMPARE(s->shadeMode(), Q3DSViewerSettings::ShadeModeShaded); QCOMPARE(s->scaleMode(), Q3DSViewerSettings::ScaleModeFill); QCOMPARE(spy1.count(), 3); QCOMPARE(spy2.count(), 4); - QCOMPARE(spy3.count(), 4); QCOMPARE(spy4.count(), 4); QImage image3 = m_viewer->grab(); @@ -1001,6 +974,8 @@ void tst_Q3DSSurfaceViewer::testPresentationActivation() else createOffscreenAndViewer(m_viewer, ANIMATION); + // Note: Presentation filename isn't default ID anymore, need to set manually. + m_viewer->setPresentationId(QStringLiteral("animation")); m_viewer->settings()->setScaleMode(Q3DSViewerSettings::ScaleModeFill); { |