summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorMarc Mutz <marc.mutz@kdab.com>2016-10-05 01:07:57 +0200
committerPaul Lemire <paul.lemire@kdab.com>2016-10-05 07:08:33 +0000
commit5100f7d66b7574ebe7b13348311b7472ae73a010 (patch)
tree52ae7fa79338f85ac9b3c714054ac2c452d417a0 /tests
parent46e90067c249aed1dfb1efb4b323be24643c73c8 (diff)
UniformValue: fix size in call to memcpy for QMatrix4x4 inputs
There was another layer of sizeof applied to what should have been the size, resulting in a size of 4/8 on (32/64)-bit platforms instead of the intended 64 bytes. Added a test. Coverity-Id: 171502 Change-Id: I937a1c7ede728d54a57ea5a1278cb9a198d514a2 Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/render/uniform/tst_uniform.cpp24
1 files changed, 24 insertions, 0 deletions
diff --git a/tests/auto/render/uniform/tst_uniform.cpp b/tests/auto/render/uniform/tst_uniform.cpp
index 4a7f086e9..255b79646 100644
--- a/tests/auto/render/uniform/tst_uniform.cpp
+++ b/tests/auto/render/uniform/tst_uniform.cpp
@@ -254,6 +254,30 @@ private Q_SLOTS:
QCOMPARE(v.constData<float>()[2], 454.0f);
QCOMPARE(v.constData<float>()[3], 1584.0f);
}
+ {
+ // GIVEN
+ UniformValue v = UniformValue::fromVariant(QVariant::fromValue(QMatrix4x4()));
+ // THEN
+ QCOMPARE(v.constData<float>()[ 0], 1.0f);
+ QCOMPARE(v.constData<float>()[ 1], 0.0f);
+ QCOMPARE(v.constData<float>()[ 2], 0.0f);
+ QCOMPARE(v.constData<float>()[ 3], 0.0f);
+
+ QCOMPARE(v.constData<float>()[ 4], 0.0f);
+ QCOMPARE(v.constData<float>()[ 5], 1.0f);
+ QCOMPARE(v.constData<float>()[ 6], 0.0f);
+ QCOMPARE(v.constData<float>()[ 7], 0.0f);
+
+ QCOMPARE(v.constData<float>()[ 8], 0.0f);
+ QCOMPARE(v.constData<float>()[ 9], 0.0f);
+ QCOMPARE(v.constData<float>()[10], 1.0f);
+ QCOMPARE(v.constData<float>()[11], 0.0f);
+
+ QCOMPARE(v.constData<float>()[12], 0.0f);
+ QCOMPARE(v.constData<float>()[13], 0.0f);
+ QCOMPARE(v.constData<float>()[14], 0.0f);
+ QCOMPARE(v.constData<float>()[15], 1.0f);
+ }
}
void checkComparison()