aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/qml/qqmlinstruction/tst_qqmlinstruction.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/qml/qqmlinstruction/tst_qqmlinstruction.cpp')
-rw-r--r--tests/auto/qml/qqmlinstruction/tst_qqmlinstruction.cpp32
1 files changed, 13 insertions, 19 deletions
diff --git a/tests/auto/qml/qqmlinstruction/tst_qqmlinstruction.cpp b/tests/auto/qml/qqmlinstruction/tst_qqmlinstruction.cpp
index 7d27751e77..e25c38d9cc 100644
--- a/tests/auto/qml/qqmlinstruction/tst_qqmlinstruction.cpp
+++ b/tests/auto/qml/qqmlinstruction/tst_qqmlinstruction.cpp
@@ -40,6 +40,7 @@
****************************************************************************/
#include <qtest.h>
+#include "../../shared/util.h"
#include <private/qqmlcompiler_p.h>
#include <QVector3D>
@@ -65,12 +66,6 @@ private slots:
void time();
};
-static QStringList messages;
-static void msgHandler(QtMsgType, const QMessageLogContext &, const QString &msg)
-{
- messages << msg;
-}
-
void tst_qqmlinstruction::dump()
{
QQmlEngine engine;
@@ -128,14 +123,14 @@ void tst_qqmlinstruction::dump()
{
QQmlCompiledData::Instruction::StoreFloat i;
i.propertyIndex = 3;
- i.value = 11.3;
+ i.value = 11.3f;
data->addInstruction(i);
}
{
QQmlCompiledData::Instruction::StoreDouble i;
i.propertyIndex = 4;
- i.value = 14.8;
+ i.value = 14.8f;
data->addInstruction(i);
}
@@ -564,15 +559,14 @@ void tst_qqmlinstruction::dump()
<< "57\t\tSTORE_VAR_BOOL\t\t83\ttrue"
<< "-------------------------------------------------------------------------------";
- messages = QStringList();
- QtMessageHandler old = qInstallMessageHandler(msgHandler);
+ QQmlTestMessageHandler messageHandler;
data->dumpInstructions();
- qInstallMessageHandler(old);
- QCOMPARE(messages.count(), expect.count());
- for (int ii = 0; ii < messages.count(); ++ii) {
- QCOMPARE(messages.at(ii), expect.at(ii));
+ const int messageCount = messageHandler.messages().count();
+ QCOMPARE(messageCount, expect.count());
+ for (int ii = 0; ii < messageCount; ++ii) {
+ QCOMPARE(messageHandler.messages().at(ii), expect.at(ii));
}
data->release();
@@ -676,8 +670,8 @@ void tst_qqmlinstruction::vector3d()
QCOMPARE(Q_ALIGNOF(QQmlInstruction::instr_storeVector3D::QVector3D), Q_ALIGNOF(QVector3D));
QQmlInstruction i;
- i.storeVector3D.vector.xp = 8.2;
- i.storeVector3D.vector.yp = 99.3;
+ i.storeVector3D.vector.xp = 8.2f;
+ i.storeVector3D.vector.yp = 99.3f;
i.storeVector3D.vector.zp = 12.0;
const QVector3D &vector = (const QVector3D &)(i.storeVector3D.vector);
@@ -692,10 +686,10 @@ void tst_qqmlinstruction::vector4d()
QCOMPARE(Q_ALIGNOF(QQmlInstruction::instr_storeVector4D::QVector4D), Q_ALIGNOF(QVector4D));
QQmlInstruction i;
- i.storeVector4D.vector.xp = 8.2;
- i.storeVector4D.vector.yp = 99.3;
+ i.storeVector4D.vector.xp = 8.2f;
+ i.storeVector4D.vector.yp = 99.3f;
i.storeVector4D.vector.zp = 12.0;
- i.storeVector4D.vector.wp = 121.1;
+ i.storeVector4D.vector.wp = 121.1f;
const QVector4D &vector = (const QVector4D &)(i.storeVector4D.vector);
QCOMPARE(vector.x(), (qreal)(float)8.2);