[gupnp-av] tests: add units test for GUPnPDIDLLiteObject namespace getters
- From: Jens Georg <jensgeorg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gupnp-av] tests: add units test for GUPnPDIDLLiteObject namespace getters
- Date: Tue, 23 Dec 2014 21:13:59 +0000 (UTC)
commit f9128ffaa44cef2a6ec4adb2f63913c4f135d771
Author: Sven Neumann <neumann teufel de>
Date: Wed Nov 19 14:12:23 2014 +0100
tests: add units test for GUPnPDIDLLiteObject namespace getters
Tests https://bugzilla.gnome.org/show_bug.cgi?id=740365
Signed-off-by: Sven Neumann <neumann teufel de>
tests/gtest/Makefile.am | 3 ++
tests/gtest/test-didl-lite-object.c | 59 +++++++++++++++++++++++++++++++++++
2 files changed, 62 insertions(+), 0 deletions(-)
---
diff --git a/tests/gtest/Makefile.am b/tests/gtest/Makefile.am
index 9beeafa..ff38b80 100644
--- a/tests/gtest/Makefile.am
+++ b/tests/gtest/Makefile.am
@@ -6,12 +6,15 @@ TESTS=$(check_PROGRAMS)
check_PROGRAMS = \
test-regression \
+ test-didl-lite-object \
test-media-collection \
test-last-change-parser \
test-cds-last-change-parser
test_regression_SOURCES = test-regression.c
+test_didl_lite_object_SOURCES = test-didl-lite-object.c
+
test_media_collection_SOURCES = \
test-media-collection.c
diff --git a/tests/gtest/test-didl-lite-object.c b/tests/gtest/test-didl-lite-object.c
new file mode 100644
index 0000000..8b3913c
--- /dev/null
+++ b/tests/gtest/test-didl-lite-object.c
@@ -0,0 +1,59 @@
+/*
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include <libgupnp-av/gupnp-didl-lite-object.h>
+#include <libgupnp-av/gupnp-didl-lite-writer.h>
+
+static void
+namespace_getters (void)
+{
+ GUPnPDIDLLiteWriter *writer = gupnp_didl_lite_writer_new (NULL);
+ GUPnPDIDLLiteObject *object = GUPNP_DIDL_LITE_OBJECT (gupnp_didl_lite_writer_add_item (writer));
+ xmlNs *namespace;
+
+ namespace = gupnp_didl_lite_object_get_upnp_namespace (object);
+ g_assert (namespace != NULL);
+ g_assert_cmpstr (namespace->prefix, ==, "upnp");
+
+ namespace = gupnp_didl_lite_object_get_dlna_namespace (object);
+ g_assert (namespace != NULL);
+ g_assert_cmpstr (namespace->prefix, ==, "dlna");
+
+
+ namespace = gupnp_didl_lite_object_get_dc_namespace (object);
+ g_assert (namespace != NULL);
+ g_assert_cmpstr (namespace->prefix, ==, "dc");
+
+ namespace = gupnp_didl_lite_object_get_pv_namespace (object);
+ g_assert (namespace != NULL);
+ g_assert_cmpstr (namespace->prefix, ==, "pv");
+}
+
+int
+main (int argc, char **argv)
+{
+#if !GLIB_CHECK_VERSION (2, 35, 0)
+ g_type_init ();
+#endif
+ g_test_init (&argc, &argv, NULL);
+
+ g_test_add_func ("/didl-lite-object/namespace-getters", namespace_getters);
+
+ g_test_run ();
+
+ return 0;
+}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]