summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/render/qabstracttexture/tst_qabstracttexture.cpp47
-rw-r--r--tests/auto/render/texture/tst_texture.cpp1
2 files changed, 48 insertions, 0 deletions
diff --git a/tests/auto/render/qabstracttexture/tst_qabstracttexture.cpp b/tests/auto/render/qabstracttexture/tst_qabstracttexture.cpp
index 99048fbc2..126e77ac2 100644
--- a/tests/auto/render/qabstracttexture/tst_qabstracttexture.cpp
+++ b/tests/auto/render/qabstracttexture/tst_qabstracttexture.cpp
@@ -85,6 +85,7 @@ private Q_SLOTS:
QCOMPARE(abstractTexture.depth(), 1);
QCOMPARE(abstractTexture.magnificationFilter(), Qt3DRender::QAbstractTexture::Nearest);
QCOMPARE(abstractTexture.minificationFilter(), Qt3DRender::QAbstractTexture::Nearest);
+ QCOMPARE(abstractTexture.mipLevels(), 1);
QCOMPARE(abstractTexture.maximumAnisotropy(), 1.0f);
QCOMPARE(abstractTexture.comparisonFunction(), Qt3DRender::QAbstractTexture::CompareLessEqual);
QCOMPARE(abstractTexture.comparisonMode(), Qt3DRender::QAbstractTexture::CompareNone);
@@ -330,6 +331,25 @@ private Q_SLOTS:
QCOMPARE(abstractTexture.samples(), newValue);
QCOMPARE(spy.count(), 0);
}
+ {
+ // WHEN
+ QSignalSpy spy(&abstractTexture, SIGNAL(mipLevelsChanged(int)));
+ const int newValue = 1024;
+ abstractTexture.setMipLevels(newValue);
+
+ // THEN
+ QVERIFY(spy.isValid());
+ QCOMPARE(abstractTexture.mipLevels(), newValue);
+ QCOMPARE(spy.count(), 1);
+
+ // WHEN
+ spy.clear();
+ abstractTexture.setMipLevels(newValue);
+
+ // THEN
+ QCOMPARE(abstractTexture.mipLevels(), newValue);
+ QCOMPARE(spy.count(), 0);
+ }
}
void checkFormatUpdate()
@@ -668,6 +688,33 @@ private Q_SLOTS:
}
+ void checkMipLevelsUpdate()
+ {
+ // GIVEN
+ TestArbiter arbiter;
+ FakeTexture abstractTexture;
+ arbiter.setArbiterOnNode(&abstractTexture);
+
+ {
+ // WHEN
+ abstractTexture.setMipLevels(16);
+
+ // THEN
+ QCOMPARE(arbiter.dirtyNodes().size(), 1);
+ QCOMPARE(arbiter.dirtyNodes().front(), &abstractTexture);
+
+ arbiter.clear();
+ }
+
+ {
+ // WHEN
+ abstractTexture.setMipLevels(16);
+
+ // THEN
+ QCOMPARE(arbiter.dirtyNodes().size(), 0);
+ }
+ }
+
void checkTextureImageAdded()
{
// GIVEN
diff --git a/tests/auto/render/texture/tst_texture.cpp b/tests/auto/render/texture/tst_texture.cpp
index caaa4d6f2..ed38f4822 100644
--- a/tests/auto/render/texture/tst_texture.cpp
+++ b/tests/auto/render/texture/tst_texture.cpp
@@ -223,6 +223,7 @@ void tst_RenderTexture::checkPropertyMirroring()
frontend.setDepth(16);
frontend.setLayers(8);
frontend.setSamples(32);
+ frontend.setMipLevels(8);
// WHEN
simulateInitializationSync(&frontend, &backend);