diff options
author | Marco Trevisan (Treviño) <mail@3v1n0.net> | 2016-10-24 21:21:48 +0200 |
---|---|---|
committer | Marco Trevisan (Treviño) <mail@3v1n0.net> | 2016-10-24 21:21:48 +0200 |
commit | 3509321d765b02355e3e207050bb137b48eade44 (patch) | |
tree | 4ea8b8461dcfe8e888d5a64f2f579dd028355690 /tests/client/convertertest.cpp | |
parent | 3bcc60fe180a27a63ccc7a4b0635454316e37748 (diff) | |
download | qmenumodel-3509321d765b02355e3e207050bb137b48eade44.tar.gz qmenumodel-3509321d765b02355e3e207050bb137b48eade44.tar.bz2 qmenumodel-3509321d765b02355e3e207050bb137b48eade44.zip |
Add conversion tests for maps and lists to QVariant
Diffstat (limited to 'tests/client/convertertest.cpp')
-rw-r--r-- | tests/client/convertertest.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/client/convertertest.cpp b/tests/client/convertertest.cpp index fe72181..1a3bce8 100644 --- a/tests/client/convertertest.cpp +++ b/tests/client/convertertest.cpp @@ -241,6 +241,16 @@ private Q_SLOTS: QTest::newRow("UInt64") << QGVariant(g_variant_new_uint64(53)) << (unsigned) QVariant::ULongLong; QTest::newRow("Double") << QGVariant(g_variant_new_double(53.3)) << (unsigned) QVariant::Double; QTest::newRow("String") << QGVariant(g_variant_new_string("53")) << (unsigned) QVariant::String; + + GVariantBuilder* builder = g_variant_builder_new(G_VARIANT_TYPE("a{sv}")); + g_variant_builder_add(builder, "{sv}", "fooo", g_variant_new_variant(g_variant_new_int64(53))); + QTest::newRow("Map") << QGVariant(g_variant_new("a{sv}", builder)) << (unsigned) QVariant::Map; + g_variant_builder_unref(builder); + + builder = g_variant_builder_new(G_VARIANT_TYPE("ai")); + g_variant_builder_add(builder, "i", g_variant_new_int32(53)); + QTest::newRow("List") << QGVariant(g_variant_new("ai", builder)) << (unsigned) QVariant::List; + g_variant_builder_unref(builder); } void testConvertToQVariant() @@ -267,6 +277,8 @@ private Q_SLOTS: QTest::newRow("Double") << "double 65" << (unsigned) QVariant::Double; QTest::newRow("String") << "string '65'" << (unsigned) QVariant::String; QTest::newRow("String simple") << "\"65\"" << (unsigned) QVariant::String; + QTest::newRow("Map") << "{'foo': <65>}" << (unsigned) QVariant::Map; + QTest::newRow("List") << "[65, 66]" << (unsigned) QVariant::List; } void testConvertToQVariantFromString() |