[gupnp-av] Add regression test for bgo#674319
- From: Jens Georg <jensgeorg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gupnp-av] Add regression test for bgo#674319
- Date: Fri, 20 Apr 2012 11:08:11 +0000 (UTC)
commit 8635c16413c5a81d0a44e936c200ecd9a6de3d54
Author: Jens Georg <mail jensge org>
Date: Fri Apr 20 13:05:26 2012 +0200
Add regression test for bgo#674319
configure.ac | 1 +
tests/Makefile.am | 2 +
tests/gtest/Makefile.am | 18 +++++++++
tests/gtest/test-regression.c | 82 +++++++++++++++++++++++++++++++++++++++++
4 files changed, 103 insertions(+), 0 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 7638179..9789a9b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -45,6 +45,7 @@ AC_CONFIG_FILES([
Makefile
libgupnp-av/Makefile
tests/Makefile
+tests/gtest/Makefile
doc/Makefile
doc/version.xml
gupnp-av-1.0.pc
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 8d8beeb..262ec91 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -1,3 +1,5 @@
+SUBDIRS = gtest
+
AM_CFLAGS = $(LIBGUPNP_CFLAGS) -I$(top_srcdir)
noinst_PROGRAMS = test-search-criteria-parser
diff --git a/tests/gtest/Makefile.am b/tests/gtest/Makefile.am
new file mode 100644
index 0000000..b28b6c6
--- /dev/null
+++ b/tests/gtest/Makefile.am
@@ -0,0 +1,18 @@
+TESTS_ENVIRONMENT = G_SLICE=debug-blocks \
+ LD_LIBRARY_PATH=$(top_builddir)/libgssdp/.libs
+
+TESTS=$(check_PROGRAMS)
+
+check_PROGRAMS = test-regression
+
+test_regression_SOURCES = test-regression.c
+
+LDADD = \
+ $(top_builddir)/libgupnp-av/libgupnp-av-1.0.la \
+ $(LIBGUPNP_LIBS)
+
+AM_CFLAGS = \
+ $(LIBGUPNP_CFLAGS) \
+ -I $(top_srcdir) \
+ -DDATA_PATH="\"$(srcdir)\""
+
diff --git a/tests/gtest/test-regression.c b/tests/gtest/test-regression.c
new file mode 100644
index 0000000..5c54e22
--- /dev/null
+++ b/tests/gtest/test-regression.c
@@ -0,0 +1,82 @@
+/*
+ * Copyright (C) 2012 Openismus GmbH
+ *
+ * Author: Jens Georg <jensg openismus com>
+ *
+ * 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., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#include <libgupnp-av/gupnp-didl-lite-parser.h>
+
+#define TEST_DIDL_BGO674319 \
+"<?xml version=\"1.0\" encoding=\"UTF-8\"?>" \
+"<DIDL-Lite" \
+" xmlns:dc=\"http://purl.org/dc/elements/1.1/\"" \
+" xmlns=\"urn:schemas-upnp-org:metadata-1-0/DIDL-Lite/\"" \
+" xmlns:upnp=\"urn:schemas-upnp-org:metadata-1-0/upnp/\"" \
+" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"" \
+" xsi:schemaLocation=\"urn:schemas-upnp-org:metadata-1-0/DIDL-Lite/" \
+" http://www.upnp.org/schemas/av/didl-lite-v2-20060531.xsd" \
+" urn:schemas-upnp-org:metadata-1-0/upnp/" \
+" http://www.upnp.org/schemas/av/upnp-v2-20060531.xsd\">" \
+" <item id=\"\" parentID=\"0\" restricted=\"0\">" \
+" <dc:title>New Song</dc:title>" \
+" <upnp:class>object.item.audioItem</upnp:class>" \
+" <res protocolInfo=\"*:*:*:*\" />" \
+" <upnp:artist></upnp:artist>" \
+" </item>" \
+"</DIDL-Lite>"
+
+static void
+test_bgo674319_on_object_available (GUPnPDIDLLiteParser *parser,
+ GUPnPDIDLLiteObject *object,
+ gpointer user_data)
+{
+ GUPnPDIDLLiteObject **out = (GUPnPDIDLLiteObject **) user_data;
+ *out = g_object_ref (object);
+}
+
+static void
+test_bgo674319 (void)
+{
+ GUPnPDIDLLiteParser *parser;
+ GUPnPDIDLLiteObject *object = NULL;
+ GList *artists;
+
+ parser = gupnp_didl_lite_parser_new ();
+ g_signal_connect (parser,
+ "object-available",
+ G_CALLBACK (test_bgo674319_on_object_available),
+ &object);
+ g_assert (gupnp_didl_lite_parser_parse_didl (parser, TEST_DIDL_BGO674319, NULL));
+ g_assert (object != NULL);
+
+ artists = gupnp_didl_lite_object_get_artists (object);
+ g_assert (artists == NULL);
+}
+
+int main (int argc, char *argv[])
+{
+ g_type_init ();
+ g_test_init (&argc, &argv, NULL);
+
+ g_test_add_func ("/bugs/gnome/674319", test_bgo674319);
+
+ g_test_run ();
+
+
+ return 0;
+}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]