summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJesus Fernandez <jesus.fernandez@qt.io>2018-09-21 13:01:11 +0200
committerJesus Fernandez <Jesus.Fernandez@qt.io>2018-09-25 07:19:49 +0000
commit870a8f2cbec11696d5e378825e82fbb707cc4eaf (patch)
tree3f70e6056e71bc5c8483ac3b4474285b303b0078
parentfab5775dace35b66650b40d08a67b9182b2ae7f0 (diff)
Remove QVERIFY and QCOMPARE
Avoids calling QCOMPARE and QVERIFY inside an asynchronous function called from a QTRY_* that is subject to a QEXPECT_FAIL. Change-Id: Ibca2fd3d2cc83b6330f9436f0a0e1b602144880c Reviewed-by: MÃ¥rten Nordheim <marten.nordheim@qt.io>
-rw-r--r--tests/plugins/platforms/webgl/tst_webgl.cpp21
1 files changed, 14 insertions, 7 deletions
diff --git a/tests/plugins/platforms/webgl/tst_webgl.cpp b/tests/plugins/platforms/webgl/tst_webgl.cpp
index 157bf45..773f5da 100644
--- a/tests/plugins/platforms/webgl/tst_webgl.cpp
+++ b/tests/plugins/platforms/webgl/tst_webgl.cpp
@@ -224,6 +224,9 @@ void tst_WebGL::parseTextMessage(const QString &text)
}
}
+// This function gets called inside a QTRY_* that is subject to
+// a QEXPECT_FAIL, which treats QCOMPARE and QVERIFY
+// specially, so we have to avoid using those.
void tst_WebGL::parseBinaryMessage(const QByteArray &data)
{
const QSet<QString> commandsNeedingResponse {
@@ -279,19 +282,23 @@ void tst_WebGL::parseBinaryMessage(const QByteArray &data)
quint32 magic = 0;
stream >> magic;
offset += sizeof(magic);
- QCOMPARE(magic, 0xbaadf00d);
+ if (magic != 0xbaadf00d) {
+ QFAIL(qPrintable(QStringLiteral("Magic token is 0x%1 not 0x%2")
+ .arg(magic, 0, 16).arg(0xbaadf00d, 0, 16)));
+ }
}
- QCOMPARE(int(offset), data.size());
+ if (int(offset) != data.size())
+ QFAIL(qPrintable(QStringLiteral("Offset is %1 not %2").arg(offset).arg(data.size())));
if (id == -1) {
emit command(function, parameters);
if (function == "attachShader") {
const auto shader = pointer(parameters[1], shaders);
- QVERIFY(shader);
+ if (!shader) QFAIL("Null pointer");
auto program = pointer(parameters[0], programs);
- QVERIFY(program);
+ if (!program) QFAIL("Null pointer");
program->attached[shader->type] = shader;
} else if (function == "bindBuffer") {
auto buffer = pointer(parameters[1], buffers);
@@ -303,15 +310,15 @@ void tst_WebGL::parseBinaryMessage(const QByteArray &data)
QTest::qFail("Unsupported buffer type", __FILE__, __LINE__);
} else if (function == "compileShader") {
auto shader = pointer(parameters[0], shaders);
- QVERIFY(shader);
+ if (!shader) QFAIL("Null pointer");
shader->compiled = true;
} else if (function == "linkProgram") {
auto program = pointer(parameters[0], programs);
- QVERIFY(program);
+ if (!program) QFAIL("Null pointer");
program->linked = true;
} else if (function == "shaderSource") {
auto shader = pointer(parameters[0], shaders);
- QVERIFY(shader);
+ if (!shader) QFAIL("Null pointer");
shader->source = parameters[1].toString();
} else if (function == "makeCurrent") {
currentContext = pointer(parameters[3].toInt(), contexts);