From 560f14fe8484c0b0cf935147a050ab9df241b2a9 Mon Sep 17 00:00:00 2001 From: Renato Araujo Oliveira Filho Date: Thu, 22 Nov 2012 17:04:03 -0300 Subject: Added 'TEST_XML_OUTPUT' option on cmake to enable/disalbe test output in xml. OBS: The default value is On. --- tests/client/CMakeLists.txt | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'tests') diff --git a/tests/client/CMakeLists.txt b/tests/client/CMakeLists.txt index d946fad..392437c 100644 --- a/tests/client/CMakeLists.txt +++ b/tests/client/CMakeLists.txt @@ -8,9 +8,15 @@ macro(declare_test testname) ${GIO_LDFLAGS} ) + if(TEST_XML_OUTPUT) + set(TEST_ARGS -p -xunitxml -p -o -p test_${testname}.xml) + else() + set(TEST_ARGS "") + endif() + add_test(${testname} ${DBUS_RUNNER} - --task ${CMAKE_CURRENT_BINARY_DIR}/${testname} -p -xunitxml -p -o -p test_${testname}.xml --task-name Client + --task ${CMAKE_CURRENT_BINARY_DIR}/${testname} ${TEST_ARGS} --task-name Client --task ${CMAKE_CURRENT_SOURCE_DIR}/script_${testname}.py --task-name Server --ignore-return) set_tests_properties(${testname} PROPERTIES -- cgit v1.2.3 From c37748989142ae4f9ee1e1cab4cbcff605302970 Mon Sep 17 00:00:00 2001 From: Renato Araujo Oliveira Filho Date: Thu, 22 Nov 2012 17:39:25 -0300 Subject: Implemented support to tuple conversions. --- tests/client/convertertest.cpp | 28 ++++++++++++++++++++++++++++ tests/client/modeltest.cpp | 6 ++++++ tests/client/script_modeltest.py | 1 + 3 files changed, 35 insertions(+) (limited to 'tests') diff --git a/tests/client/convertertest.cpp b/tests/client/convertertest.cpp index 5301653..f382332 100644 --- a/tests/client/convertertest.cpp +++ b/tests/client/convertertest.cpp @@ -88,6 +88,34 @@ private Q_SLOTS: // Map QVERIFY(compare(QVariantMap(), G_VARIANT_TYPE_VARDICT)); + + } + + void testTupleConversion() + { + QVariantList qTuple; + qTuple << 1 << "2" << 3.3; + + GVariant *gTuple = Converter::toGVariant(qTuple); + QVERIFY(g_variant_type_is_tuple(g_variant_get_type(gTuple))); + QCOMPARE(g_variant_n_children(gTuple), (gsize)3); + + GVariant *v = g_variant_get_child_value(gTuple, 0); + int v0 = g_variant_get_int32(v); + QCOMPARE(v0, 1); + g_variant_unref(v); + + v = g_variant_get_child_value(gTuple, 1); + const gchar *v1 = g_variant_get_string(v, NULL); + QCOMPARE(QString(v1), QString("2")); + g_variant_unref(v); + + v = g_variant_get_child_value(gTuple, 2); + gdouble v2 = g_variant_get_double(v); + QCOMPARE(v2, 3.3); + g_variant_unref(v); + + g_variant_unref(gTuple); } }; diff --git a/tests/client/modeltest.cpp b/tests/client/modeltest.cpp index c6b2f0e..1b0ea95 100644 --- a/tests/client/modeltest.cpp +++ b/tests/client/modeltest.cpp @@ -218,6 +218,12 @@ private Q_SLOTS: QCOMPARE(v.type(), QVariant::String); QCOMPARE(v.toString(), QString("dança")); + // Tuple + v = extra["tuple"]; + QVariantList lst; + lst << "1" << 2 << 3.3; + QCOMPARE(v.type(), QVariant::List); + QCOMPARE(v.toList(), lst); } /* diff --git a/tests/client/script_modeltest.py b/tests/client/script_modeltest.py index 72c294c..9f5df9c 100755 --- a/tests/client/script_modeltest.py +++ b/tests/client/script_modeltest.py @@ -24,6 +24,7 @@ al.appendItem("Menu0", "Menu0Act", None, None, {'x-boolean' : GLib.Variant('b', 'x-string' : GLib.Variant('s', '42'), 'x-utf8' : GLib.Variant('s', 'dança'), 'x-map' : GLib.Variant('a{sv}', pmap), + 'x-tuple' : GLib.Variant('(sid)', ("1", 2, 3.3)), }) al.appendItem("Menu1", "Menu1Act") -- cgit v1.2.3