[totem-pl-parser] Add test case for missing PLS entries
- From: Bastien Nocera <hadess src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [totem-pl-parser] Add test case for missing PLS entries
- Date: Tue, 1 Jun 2010 18:12:27 +0000 (UTC)
commit 9907ccdf7c998d99785c19db2a76409aa2d5e9b9
Author: Bastien Nocera <hadess hadess net>
Date: Tue Jun 1 19:11:22 2010 +0100
Add test case for missing PLS entries
Add test case for the problem with missing PLS entries.
plparse/tests/Makefile.am | 3 +-
plparse/tests/missing-items.pls | 80 +++++++++++++++++++++++++++++++++++++++
plparse/tests/parser.c | 44 +++++++++++++++++++++
3 files changed, 126 insertions(+), 1 deletions(-)
---
diff --git a/plparse/tests/Makefile.am b/plparse/tests/Makefile.am
index 982c2d8..e6fd73f 100644
--- a/plparse/tests/Makefile.am
+++ b/plparse/tests/Makefile.am
@@ -54,4 +54,5 @@ EXTRA_DIST = \
pukas.wax \
asf-with-asx-suffix.asx \
remote_xspf.php \
- HackerMedley
+ HackerMedley \
+ missing-items.pls
diff --git a/plparse/tests/missing-items.pls b/plparse/tests/missing-items.pls
new file mode 100644
index 0000000..7e47b6b
--- /dev/null
+++ b/plparse/tests/missing-items.pls
@@ -0,0 +1,80 @@
+[playlist]
+
+# http://www.absoluteradio.co.uk/listen/on_your_computer.html
+file1=http://network.absoluteradio.co.uk/core/audio/ogg/live.pls?service=vr
+title1=Absolute Radio (Modem)
+genre1=Pop
+
+file2=http://network.absoluteradio.co.uk/core/audio/ogg/live.pls?service=vrbb
+title2=Absolute Radio (Broadband)
+genre2=Pop
+
+file3=http://network.absoluteradio.co.uk/core/audio/ogg/live.pls?service=al
+title3=Absolute Radio dabbl (Modem)
+genre3=General
+
+file4=http://network.absoluteradio.co.uk/core/audio/ogg/live.pls?service=albb
+title4=Absolute Radio dabbl (Broadband)
+genre4=General
+
+file5=http://network.absoluteradio.co.uk/core/audio/ogg/live.pls?service=vc
+title5=Absolute Classic Rock (Modem)
+genre5=Rock'n'Roll
+
+file6=http://network.absoluteradio.co.uk/core/audio/ogg/live.pls?service=vcbb
+title6=Absolute Classic Rock (Broadband)
+genre6=Rock'n'Roll
+
+file7=http://ubuntu.hbr1.com:19800/trance.ogg
+title7=HBR1.com - I.D.M. Tranceponder
+genre7=Trance
+
+file8=http://ubuntu.hbr1.com:19800/tronic.ogg
+title8=HBR1.com - Tronic Lounge
+genre8=House
+
+file9=http://ubuntu.hbr1.com:19800/ambient.ogg
+title9=HBR1.com - Dream Factory
+genre9=Ambient
+
+# http://www.wknc.org/listen/
+file10=http://wknc.sma.ncsu.edu:8000/wkncmq.ogg.m3u
+title10=WKNC 88.1 FM (NC State) (Low Quality)
+genre10=Music
+
+file11=http://wknc.sma.ncsu.edu:8000/wknchq.ogg.m3u
+title11=WKNC 88.1 FM (NC State) (High Quality)
+genre11=Music
+
+# http://www.nrk.no/lyd/
+file14=http://media.hiof.no/streams/m3u/nrk-p1-172.ogg.m3u
+title14=NRK P1 (Norway)
+genre14=General
+
+file15=http://media.hiof.no/streams/m3u/nrk-p2-172.ogg.m3u
+title15=NRK P2 (Norway)
+genre15=General
+
+file16=http://media.hiof.no/streams/m3u/nrk-petre-172.ogg.m3u
+title16=NRK P3 (Norway)
+genre16=General
+
+file17=http://media.hiof.no/streams/m3u/nrk-alltid-nyheter-172.ogg.m3u
+title17=NRK Alltid Nyheter (Norway)
+genre17=
+
+file18=http://media.hiof.no/streams/m3u/nrk-mpetre-172.ogg.m3u
+title18=NRK mP3 (Norway)
+genre18=
+
+file19=http://media.hiof.no/streams/m3u/nrk-alltid-klassisk-172.ogg.m3u
+title19=NRK Alltid Klassisk (Norway)
+genre19=
+
+file20=http://media.hiof.no/streams/m3u/nrk-stortinget-172.ogg.m3u
+title20=NRK Stortinget (Norway)
+genre20=
+
+file21=http://www.kwur.com/icecast/kwurogg.m3u
+title21=KWUR 90.3 FM St. Louis Underground Radio
+genre21=
diff --git a/plparse/tests/parser.c b/plparse/tests/parser.c
index d84cd61..96f7ac4 100644
--- a/plparse/tests/parser.c
+++ b/plparse/tests/parser.c
@@ -275,6 +275,37 @@ parser_test_get_parse_result (const char *uri)
}
static void
+entry_parsed_num_cb (TotemPlParser *parser,
+ const char *uri,
+ GHashTable *metadata,
+ guint *ret)
+{
+ *ret = *ret + 1;
+}
+
+static guint
+parser_test_get_num_entries (const char *uri)
+{
+ TotemPlParserResult retval;
+ guint ret = 0;
+ TotemPlParser *pl = totem_pl_parser_new ();
+
+ g_object_set (pl, "recurse", FALSE,
+ "debug", option_debug,
+ "force", option_force,
+ "disable-unsafe", option_disable_unsafe,
+ NULL);
+ g_signal_connect (G_OBJECT (pl), "entry-parsed",
+ G_CALLBACK (entry_parsed_num_cb), &ret);
+
+ retval = totem_pl_parser_parse_with_base (pl, uri, option_base_uri, FALSE);
+ g_test_message ("Got retval %d for uri '%s'", retval, uri);
+ g_object_unref (pl);
+
+ return ret;
+}
+
+static void
playlist_started_order (TotemPlParser *parser,
const char *uri,
GHashTable *metadata,
@@ -398,6 +429,18 @@ test_parsing_out_of_order_asx (void)
}
static void
+test_parsing_num_entries (void)
+{
+ char *uri;
+ guint num;
+
+ uri = get_relative_uri (TEST_SRCDIR "missing-items.pls");
+ num = parser_test_get_num_entries (uri);
+ g_free (uri);
+ g_assert (num == 19);
+}
+
+static void
test_parsing_404_error (void)
{
g_test_bug ("158052");
@@ -635,6 +678,7 @@ main (int argc, char *argv[])
g_test_add_func ("/parser/parsing/xml_mixed_cdata", test_parsing_xml_mixed_cdata);
g_test_add_func ("/parser/parsing/not_asx_playlist", test_parsing_not_asx_playlist);
g_test_add_func ("/parser/parsing/not_really_php", test_parsing_not_really_php);
+ g_test_add_func ("/parser/parsing/num_items_in_pls", test_parsing_num_entries);
return g_test_run ();
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]