diff options
author | Thiago Macieira <thiago.macieira@intel.com> | 2022-11-04 14:39:06 -0700 |
---|---|---|
committer | Thiago Macieira <thiago.macieira@intel.com> | 2022-11-28 10:59:35 -0800 |
commit | f6f1ee63dc1fbdd1f49a18949bd44f6bb0251d1d (patch) | |
tree | 626156d38f5ca5519b75f76e4aecba045d84a24e /tests/auto/corelib/global | |
parent | 5838074912905686475a2cb4ae9780c2532d424b (diff) |
qfloat16: make it a built-in metatype
I've reserved the IDs for int128, uint128, bfloat16, and float128,
because the mask in qvariant.cpp's qIsNumericType() requires primitives
to be less than 64 to operate properly.
Added a QMetaType/QDataStream test to confirm it is indeed built-in.
Change-Id: I3d74c753055744deb8acfffd17247f7f57bada02
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Diffstat (limited to 'tests/auto/corelib/global')
-rw-r--r-- | tests/auto/corelib/global/qfloat16/tst_qfloat16.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/auto/corelib/global/qfloat16/tst_qfloat16.cpp b/tests/auto/corelib/global/qfloat16/tst_qfloat16.cpp index 9acbc2099a..7260c2900d 100644 --- a/tests/auto/corelib/global/qfloat16/tst_qfloat16.cpp +++ b/tests/auto/corelib/global/qfloat16/tst_qfloat16.cpp @@ -4,6 +4,7 @@ #include <QTest> #include <QFloat16> +#include <QMetaType> #include <QTextStream> #include <math.h> @@ -656,6 +657,17 @@ void tst_qfloat16::dataStream() ds >> zero; QCOMPARE(ds.status(), QDataStream::Ok); QCOMPARE(zero, qfloat16(0)); + + ds.device()->seek(0); + ds.resetStatus(); + QMetaType mt = QMetaType(QMetaType::Float16); + QVERIFY(mt.save(ds, &zero)); + + ds.device()->seek(0); + ds.resetStatus(); + zero = -1; + QVERIFY(mt.load(ds, &zero)); + QCOMPARE(zero, qfloat16(0)); } void tst_qfloat16::textStream() |