diff options
Diffstat (limited to 'tests/auto/render/qabstracttexture/tst_qabstracttexture.cpp')
-rw-r--r-- | tests/auto/render/qabstracttexture/tst_qabstracttexture.cpp | 47 |
1 files changed, 47 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 |