summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorPaul Lemire <paul.lemire@kdab.com>2020-11-24 17:22:40 +0100
committerPaul Lemire <paul.lemire@kdab.com>2020-11-24 19:57:47 +0100
commit5457ad2a0a58157c2ba7aa77c73d4b22883e4d0b (patch)
tree214890aa4fba2bcc3054c533975b48033c0883b0 /tests
parent41ddcab8d568f61179dbd5dcd95f09807c02aa57 (diff)
QAbstractTexture: expose mipLevel
This is supposed to be exposed for Qt6 Pick-to: 6.0 Pick-to: 6.0.0 Change-Id: I3fefcd706ca16328946f33d665055dfe2a4c3563 Reviewed-by: Mike Krus <mike.krus@kdab.com>
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);