diff options
| author | OPNA2608 <opna2608@protonmail.com> | 2026-03-26 16:27:31 +0100 |
|---|---|---|
| committer | Mike Gabriel <mike.gabriel@das-netzwerkteam.de> | 2026-06-11 20:55:49 +0200 |
| commit | 5f421ccac8c37c7ef20d0eb2d1a7d06bbe574088 (patch) | |
| tree | de2e2e3c72d2e3a0919b3bfba65a51d39b1b86c4 /tests/client/convertertest.cpp | |
| parent | 07e7bdef28716beada6ab24c156b6c78f405724e (diff) | |
| download | qmenumodel-5f421ccac8c37c7ef20d0eb2d1a7d06bbe574088.tar.gz qmenumodel-5f421ccac8c37c7ef20d0eb2d1a7d06bbe574088.tar.bz2 qmenumodel-5f421ccac8c37c7ef20d0eb2d1a7d06bbe574088.zip | |
{libqmenumodel/src,tests/client}: Fix warnings with Qt6
Diffstat (limited to 'tests/client/convertertest.cpp')
| -rw-r--r-- | tests/client/convertertest.cpp | 39 |
1 files changed, 33 insertions, 6 deletions
diff --git a/tests/client/convertertest.cpp b/tests/client/convertertest.cpp index 095a022..72f3c1d 100644 --- a/tests/client/convertertest.cpp +++ b/tests/client/convertertest.cpp @@ -72,14 +72,26 @@ private: g_variant_unref(gv); return result; } - bool compare(GVariant *gv, const QVariant::Type type) + bool compare(GVariant *gv, const QMetaType::Type type) { g_variant_ref_sink(gv); const QVariant& qv = Converter::toQVariant(gv); - bool result = (qv.type() == type); + bool result = ( +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) + qv.typeId() +#else + (QMetaType::Type)qv.type() +#endif + == type + ); if (!result) { qWarning() << "types are different: GVariant:" << g_variant_type_peek_string(g_variant_get_type(gv)) - << "Result:" << qv.type() + << "Result:" << +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) + qv.typeId() +#else + qv.type() +#endif << "Expected:"<< type; } g_variant_unref(gv); @@ -300,7 +312,7 @@ private Q_SLOTS: QFETCH(QGVariant, value); QFETCH(unsigned, expectedType); - QVERIFY(compare(value, (QVariant::Type) expectedType)); + QVERIFY(compare(value, (QMetaType::Type) expectedType)); } void testConvertToQVariantAndBack_data() @@ -318,7 +330,14 @@ private Q_SLOTS: GVariant *gv = Converter::toGVariant(qv); gboolean equals = g_variant_equal(value, gv); - if (!equals && qv.type() == QVariant::List) { + if (!equals && ( +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) + qv.typeId() +#else + qv.type() +#endif + == QVariant::List + )) { QVERIFY(g_variant_type_is_array(g_variant_get_type(value))); QVERIFY(g_variant_type_is_tuple(g_variant_get_type(gv))); @@ -373,7 +392,15 @@ private Q_SLOTS: QFETCH(QString, value); QFETCH(unsigned, expectedType); - QCOMPARE(Converter::toQVariantFromVariantString(value).type(), (QVariant::Type) expectedType); + QCOMPARE( + Converter::toQVariantFromVariantString(value) +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) + .typeId() +#else + .type() +#endif + , (QMetaType::Type) expectedType + ); } }; |
