summaryrefslogtreecommitdiffstats
path: root/tests/auto
diff options
context:
space:
mode:
authorPaul Lemire <paul.lemire@kdab.com>2018-12-18 07:58:34 +0100
committerPaul Lemire <paul.lemire@kdab.com>2018-12-19 16:40:58 +0000
commitaaedd1f71b7a7e4410966041baba0f392644e482 (patch)
tree8248235681408de5d60a0cb57053237eec37296d /tests/auto
parentd85eede12eeab74ae446a2db4b12e23a846d0502 (diff)
Texture: initialize internal format to NoFormat
Format was initialized to RGBA8_UNorm on TextureProperties. This had the side effect that if you created a TextureLoader entry with no source yet set, the backend would try to load and return early since no texture data had yet been generated. Yet it would still send a notification change with the format (which was RGBA8_UNorm instead of NoFormat) back to the frontend QTextureLoader. This would prevent the QTextureLoader from later being loaded correctly with the format actually read from the image file. Also updated QTextureData/QTextureImageData/QTextureFromSourceLoader for consistency. Change-Id: I23e2287fac297b9b8901476715b1bc1e78c6342b Task-number: QTBUG-72651 Reviewed-by: Sean Harmer <sean.harmer@kdab.com> Reviewed-by: Kevin Ottens <kevin.ottens@kdab.com>
Diffstat (limited to 'tests/auto')
-rw-r--r--tests/auto/render/qtextureimagedata/tst_qtextureimagedata.cpp2
-rw-r--r--tests/auto/render/texture/tst_texture.cpp23
2 files changed, 24 insertions, 1 deletions
diff --git a/tests/auto/render/qtextureimagedata/tst_qtextureimagedata.cpp b/tests/auto/render/qtextureimagedata/tst_qtextureimagedata.cpp
index dec816a5e..ba0c9a9bf 100644
--- a/tests/auto/render/qtextureimagedata/tst_qtextureimagedata.cpp
+++ b/tests/auto/render/qtextureimagedata/tst_qtextureimagedata.cpp
@@ -55,7 +55,7 @@ private Q_SLOTS:
QCOMPARE(tid->layers(), -1);
QCOMPARE(tid->mipLevels(), -1);
QCOMPARE(tid->target(), QOpenGLTexture::Target2D);
- QCOMPARE(tid->format(), QOpenGLTexture::RGBA8_UNorm);
+ QCOMPARE(tid->format(), QOpenGLTexture::NoFormat);
QCOMPARE(tid->pixelFormat(), QOpenGLTexture::RGBA);
QCOMPARE(tid->pixelType(), QOpenGLTexture::UInt8);
QCOMPARE(tid->isCompressed(), false);
diff --git a/tests/auto/render/texture/tst_texture.cpp b/tests/auto/render/texture/tst_texture.cpp
index 9876518e2..d64533732 100644
--- a/tests/auto/render/texture/tst_texture.cpp
+++ b/tests/auto/render/texture/tst_texture.cpp
@@ -72,12 +72,35 @@ private:
void checkPropertyMirroring();
private slots:
+ void checkDefaults();
void checkFrontendPropertyNotifications();
void checkPropertyMirroring();
void checkPropertyChanges();
void checkTextureImageBookeeping();
};
+void tst_RenderTexture::checkDefaults()
+{
+ Qt3DRender::Render::Texture backend;
+
+ QCOMPARE(backend.properties().format, Qt3DRender::QAbstractTexture::NoFormat);
+ QCOMPARE(backend.properties().width, 1);
+ QCOMPARE(backend.properties().height, 1);
+ QCOMPARE(backend.properties().depth, 1);
+ QCOMPARE(backend.properties().layers, 1);
+ QCOMPARE(backend.properties().mipLevels, 1);
+ QCOMPARE(backend.properties().samples, 1);
+ QCOMPARE(backend.properties().generateMipMaps, false);
+ QCOMPARE(backend.parameters().magnificationFilter, Qt3DRender::QAbstractTexture::Nearest);
+ QCOMPARE(backend.parameters().minificationFilter, Qt3DRender::QAbstractTexture::Nearest);
+ QCOMPARE(backend.parameters().wrapModeX, Qt3DRender::QTextureWrapMode::ClampToEdge);
+ QCOMPARE(backend.parameters().wrapModeY, Qt3DRender::QTextureWrapMode::ClampToEdge);
+ QCOMPARE(backend.parameters().wrapModeZ, Qt3DRender::QTextureWrapMode::ClampToEdge);
+ QCOMPARE(backend.parameters().maximumAnisotropy, 1.0f);
+ QCOMPARE(backend.parameters().comparisonFunction, Qt3DRender::QAbstractTexture::CompareLessEqual);
+ QCOMPARE(backend.parameters().comparisonMode, Qt3DRender::QAbstractTexture::CompareNone);
+}
+
void tst_RenderTexture::checkFrontendPropertyNotifications()
{
// GIVEN