summaryrefslogtreecommitdiffstats
path: root/tests/auto/render
diff options
context:
space:
mode:
authorMauro Persano <mauro.persano@kdab.com>2016-07-26 21:53:55 -0300
committerSean Harmer <sean.harmer@kdab.com>2016-08-12 20:07:51 +0000
commit817f4b2842e885912fe68b88e419dac4999c0325 (patch)
treec7b0efeeaafec57e01b990dfe3df941e9091b2df /tests/auto/render
parent8ed28493952ece3660a42b9c2759e5d8b402f89f (diff)
Allow setting sample count for multisample targets
Adds new property which allows you to change the number of samples per texel in a texture. Only used for multisample render targets (Texture2DMultisample and Texture2DMultisampleArray). Change-Id: I76934c3af125fb97f61e35cb4db84799bd17a6ab Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
Diffstat (limited to 'tests/auto/render')
-rw-r--r--tests/auto/render/texture/tst_texture.cpp31
1 files changed, 31 insertions, 0 deletions
diff --git a/tests/auto/render/texture/tst_texture.cpp b/tests/auto/render/texture/tst_texture.cpp
index 0594909c1..5c6bc2b37 100644
--- a/tests/auto/render/texture/tst_texture.cpp
+++ b/tests/auto/render/texture/tst_texture.cpp
@@ -145,6 +145,26 @@ void tst_RenderTexture::checkFrontendPropertyNotifications()
// THEN
QCOMPARE(arbiter.events.size(), 0);
+
+ // WHEN
+ texture.setSamples(32);
+ QCoreApplication::processEvents();
+
+ // THEN
+ QCOMPARE(arbiter.events.size(), 1);
+ change = arbiter.events.first().staticCast<Qt3DCore::QPropertyUpdatedChange>();
+ QCOMPARE(change->propertyName(), "samples");
+ QCOMPARE(change->value().value<int>(), 32);
+ QCOMPARE(change->type(), Qt3DCore::PropertyUpdated);
+
+ arbiter.events.clear();
+
+ // WHEN
+ texture.setSamples(32);
+ QCoreApplication::processEvents();
+
+ // THEN
+ QCOMPARE(arbiter.events.size(), 0);
}
template <typename FrontendTextureType, Qt3DRender::QAbstractTexture::Target Target>
@@ -158,6 +178,7 @@ void tst_RenderTexture::checkPropertyMirroring()
frontend.setHeight(128);
frontend.setDepth(16);
frontend.setLayers(8);
+ frontend.setSamples(32);
// WHEN
simulateInitialization(&frontend, &backend);
@@ -169,6 +190,7 @@ void tst_RenderTexture::checkPropertyMirroring()
QCOMPARE(backend.height(), frontend.height());
QCOMPARE(backend.depth(), frontend.depth());
QCOMPARE(backend.layers(), frontend.layers());
+ QCOMPARE(backend.samples(), frontend.samples());
}
void tst_RenderTexture::checkPropertyMirroring()
@@ -228,6 +250,15 @@ void tst_RenderTexture::checkPropertyChanges()
// THEN
QCOMPARE(backend.layers(), 32);
+
+ // WHEN
+ updateChange.reset(new Qt3DCore::QPropertyUpdatedChange(Qt3DCore::QNodeId()));
+ updateChange->setValue(64);
+ updateChange->setPropertyName("samples");
+ backend.sceneChangeEvent(updateChange);
+
+ // THEN
+ QCOMPARE(backend.samples(), 64);
}
QTEST_APPLESS_MAIN(tst_RenderTexture)