diff options
Diffstat (limited to 'tests/auto/render/qscene2d/tst_qscene2d.cpp')
-rw-r--r-- | tests/auto/render/qscene2d/tst_qscene2d.cpp | 64 |
1 files changed, 32 insertions, 32 deletions
diff --git a/tests/auto/render/qscene2d/tst_qscene2d.cpp b/tests/auto/render/qscene2d/tst_qscene2d.cpp index f0ff2db1e..846207456 100644 --- a/tests/auto/render/qscene2d/tst_qscene2d.cpp +++ b/tests/auto/render/qscene2d/tst_qscene2d.cpp @@ -58,10 +58,9 @@ private Q_SLOTS: // THEN QCOMPARE(scene2d.output(), nullptr); - QCOMPARE(scene2d.source(), QUrl(QStringLiteral(""))); QCOMPARE(scene2d.renderPolicy(), QScene2D::Continuous); - QCOMPARE(scene2d.loaded(), false); QCOMPARE(scene2d.item(), nullptr); + QCOMPARE(scene2d.isMouseEnabled(), true); } void checkPropertyChanges() @@ -92,59 +91,60 @@ private Q_SLOTS: } { // WHEN - QSignalSpy spy(&scene2d, SIGNAL(sourceChanged(QUrl))); - const QUrl newValue = QUrl(QStringLiteral("qrc://source.qml")); - scene2d.setSource(newValue); + QSignalSpy spy(&scene2d, SIGNAL(renderPolicyChanged(QScene2D::RenderPolicy))); + const QScene2D::RenderPolicy newValue = QScene2D::SingleShot; + scene2d.setRenderPolicy(newValue); // THEN QVERIFY(spy.isValid()); - QCOMPARE(scene2d.source(), newValue); + QCOMPARE(scene2d.renderPolicy(), newValue); QCOMPARE(spy.count(), 1); // WHEN spy.clear(); - scene2d.setSource(newValue); + scene2d.setRenderPolicy(newValue); // THEN - QCOMPARE(scene2d.source(), newValue); + QCOMPARE(scene2d.renderPolicy(), newValue); QCOMPARE(spy.count(), 0); } { // WHEN - QSignalSpy spy(&scene2d, SIGNAL(renderPolicyChanged(QScene2D::RenderPolicy))); - const QScene2D::RenderPolicy newValue = QScene2D::SingleShot; - scene2d.setRenderPolicy(newValue); + QSignalSpy spy(&scene2d, SIGNAL(itemChanged(QQuickItem*))); + QQuickItem *newValue = item.data(); + scene2d.setItem(newValue); // THEN QVERIFY(spy.isValid()); - QCOMPARE(scene2d.renderPolicy(), newValue); + QCOMPARE(scene2d.item(), newValue); QCOMPARE(spy.count(), 1); // WHEN spy.clear(); - scene2d.setRenderPolicy(newValue); + scene2d.setItem(newValue); // THEN - QCOMPARE(scene2d.renderPolicy(), newValue); + QCOMPARE(scene2d.item(), newValue); QCOMPARE(spy.count(), 0); } + { // WHEN - QSignalSpy spy(&scene2d, SIGNAL(itemChanged(QQuickItem*))); - QQuickItem *newValue = item.data(); - scene2d.setItem(newValue); + QSignalSpy spy(&scene2d, SIGNAL(mouseEnabledChanged(bool))); + bool newValue = false; + scene2d.setMouseEnabled(newValue); // THEN QVERIFY(spy.isValid()); - QCOMPARE(scene2d.item(), newValue); + QCOMPARE(scene2d.isMouseEnabled(), newValue); QCOMPARE(spy.count(), 1); // WHEN spy.clear(); - scene2d.setItem(newValue); + scene2d.setMouseEnabled(newValue); // THEN - QCOMPARE(scene2d.item(), newValue); + QCOMPARE(scene2d.isMouseEnabled(), newValue); QCOMPARE(spy.count(), 0); } } @@ -156,7 +156,6 @@ private Q_SLOTS: QScopedPointer<Qt3DRender::QRenderTargetOutput> output(new Qt3DRender::QRenderTargetOutput()); scene2d.setOutput(output.data()); - scene2d.setSource(QUrl(QStringLiteral("qrc://source.qml"))); scene2d.setRenderPolicy(QScene2D::SingleShot); // WHEN @@ -181,6 +180,7 @@ private Q_SLOTS: QCOMPARE(scene2d.isEnabled(), true); QCOMPARE(scene2d.isEnabled(), creationChangeData->isNodeEnabled()); QCOMPARE(scene2d.metaObject(), creationChangeData->metaObject()); + QCOMPARE(scene2d.isMouseEnabled(), cloneData.mouseEnabled); } // WHEN @@ -242,7 +242,7 @@ private Q_SLOTS: } - void checkSourceUpdate() + void checkRenderPolicyUpdate() { // GIVEN TestArbiter arbiter; @@ -251,14 +251,15 @@ private Q_SLOTS: { // WHEN - scene2d.setSource(QUrl(QStringLiteral("qrc://source.qml"))); + scene2d.setRenderPolicy(QScene2D::SingleShot); QCoreApplication::processEvents(); // THEN QCOMPARE(arbiter.events.size(), 1); auto change = arbiter.events.first().staticCast<Qt3DCore::QPropertyUpdatedChange>(); - QCOMPARE(change->propertyName(), "source"); - QCOMPARE(change->value().value<QUrl>(), scene2d.source()); + QCOMPARE(change->propertyName(), "renderPolicy"); + QCOMPARE(change->value().value<Qt3DRender::Quick::QScene2D::RenderPolicy>(), + scene2d.renderPolicy()); QCOMPARE(change->type(), Qt3DCore::PropertyUpdated); arbiter.events.clear(); @@ -266,7 +267,7 @@ private Q_SLOTS: { // WHEN - scene2d.setSource(QUrl(QStringLiteral("qrc://source.qml"))); + scene2d.setRenderPolicy(QScene2D::SingleShot); QCoreApplication::processEvents(); // THEN @@ -275,7 +276,7 @@ private Q_SLOTS: } - void checkRenderPolicyUpdate() + void checkMouseEnabledUpdate() { // GIVEN TestArbiter arbiter; @@ -284,15 +285,14 @@ private Q_SLOTS: { // WHEN - scene2d.setRenderPolicy(QScene2D::SingleShot); + scene2d.setMouseEnabled(false); QCoreApplication::processEvents(); // THEN QCOMPARE(arbiter.events.size(), 1); auto change = arbiter.events.first().staticCast<Qt3DCore::QPropertyUpdatedChange>(); - QCOMPARE(change->propertyName(), "renderPolicy"); - QCOMPARE(change->value().value<Qt3DRender::Quick::QScene2D::RenderPolicy>(), - scene2d.renderPolicy()); + QCOMPARE(change->propertyName(), "mouseEnabled"); + QCOMPARE(change->value().toBool(), scene2d.isMouseEnabled()); QCOMPARE(change->type(), Qt3DCore::PropertyUpdated); arbiter.events.clear(); @@ -300,7 +300,7 @@ private Q_SLOTS: { // WHEN - scene2d.setRenderPolicy(QScene2D::SingleShot); + scene2d.setMouseEnabled(false); QCoreApplication::processEvents(); // THEN |