diff options
-rw-r--r-- | libqmenumodel/src/converter.cpp | 6 | ||||
-rw-r--r-- | tests/client/convertertest.cpp | 8 |
2 files changed, 11 insertions, 3 deletions
diff --git a/libqmenumodel/src/converter.cpp b/libqmenumodel/src/converter.cpp index 527ae85..91cafab 100644 --- a/libqmenumodel/src/converter.cpp +++ b/libqmenumodel/src/converter.cpp @@ -58,6 +58,11 @@ QVariant Converter::toQVariant(GVariant *value) gsize size = 0; const gchar *v = g_variant_get_string(value, &size); result.setValue(QString::fromUtf8(v, size)); + } else if (g_variant_type_equal(type, G_VARIANT_TYPE_BYTESTRING)) { + gsize size = 0; + gchar *bs = g_variant_dup_bytestring(value, &size); + result.setValue(QByteArray::fromRawData(bs, size)); + g_free(bs); } else if (g_variant_type_equal(type, G_VARIANT_TYPE_VARIANT)) { GVariant *var = g_variant_get_variant(value); result = toQVariant(var); @@ -111,7 +116,6 @@ QVariant Converter::toQVariant(GVariant *value) * G_VARIANT_TYPE_DICT_ENTRY * G_VARIANT_TYPE_DICTIONARY * G_VARIANT_TYPE_STRING_ARRAY - * G_VARIANT_TYPE_BYTESTRING * G_VARIANT_TYPE_OBJECT_PATH_ARRAY * G_VARIANT_TYPE_BYTESTRING_ARRAY */ diff --git a/tests/client/convertertest.cpp b/tests/client/convertertest.cpp index a6a82de..e61caa0 100644 --- a/tests/client/convertertest.cpp +++ b/tests/client/convertertest.cpp @@ -169,8 +169,6 @@ private Q_SLOTS: QVERIFY(compare(QVariantMap({{"fooBar", 0xdeadbeef}}), G_VARIANT_TYPE_VARDICT)); } - // LIST CHECK! - void testBooleanToQVariant() { // Boolean @@ -231,6 +229,12 @@ private Q_SLOTS: QVERIFY(compare(g_variant_new_string("53"), QVariant::String)); } + void testByteArrayToQVariant() + { + // ByteArray + QVERIFY(compare(g_variant_new_bytestring("53"), QVariant::ByteArray)); + } + void testTupleConversion() { QVariantList qTuple; |