From 302254a78bf9b6f0c962eb20eb2ebe99b11e2e12 Mon Sep 17 00:00:00 2001 From: Toni Gundogdu Date: Tue, 7 Aug 2012 12:56:23 +0300 Subject: [PATCH] tests: Add playlist/playlist_youtube.c --- tests/playlist/playlist_youtube.c | 90 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 90 insertions(+) create mode 100644 tests/playlist/playlist_youtube.c diff --git a/tests/playlist/playlist_youtube.c b/tests/playlist/playlist_youtube.c new file mode 100644 index 0000000..34adb37 --- /dev/null +++ b/tests/playlist/playlist_youtube.c @@ -0,0 +1,90 @@ +/* libquvi-scripts + * Copyright (C) 2012 Toni Gundogdu + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + * 02110-1301, USA. + */ + +#include "config.h" + +#include +#include +#include + +#include "tests.h" + +static const gchar *URLs[] = +{ + "http://www.youtube.com/watch?v=p5o7gBKHwtk&list=PL954CCC04F8437E14&feature=plcp", + "http://www.youtube.com/watch?v=AAfpq6EPKck&feature=list_related&playnext=1&list=SP1C90BDF46E6EACFD", + "http://www.youtube.com/playlist?list=PLEE6E4AF38BC19EC2", + "http://www.youtube.com/playlist?list=PLAAF3A1D0CA1E304F", + "http://is.gd/B4BBAA", + "http://www.youtube.com/watch?v=XIKFORGW3Ig&list=PL2484FAEB06A4FB74&", + "http://www.youtube.com/playlist?list=PL5BF9E09ECEC8F88F", + NULL +}; + +static const gchar *IDs[] = +{ + "954CCC04F8437E14", + "1C90BDF46E6EACFD", + "EE6E4AF38BC19EC2", + "AAF3A1D0CA1E304F", + "5BF9E09ECEC8F88F", + "2484FAEB06A4FB74", + "5BF9E09ECEC8F88F", + NULL +}; + +static void test_playlist_youtube() +{ + struct qp_test_exact_s e; + struct qp_test_opts_s o; + gint i; + + for (i=0; URLs[i] != NULL && IDs[i] != NULL; ++i) + { + memset(&e, 0, sizeof(e)); + memset(&o, 0, sizeof(o)); + + /* Exact values. */ + + e.id = IDs[i]; + +#ifdef _NOT_IMPLEMENTED_IN_PLAYLIST_YOUTUBE_LUA + /* Optional: string values */ + + o.s_len_gt0.thumbnail_url = TRUE; + o.s_len_gt0.title = TRUE; + + o.s_len_gt0.media.title = TRUE; + + /* Optional: numerical values */ + + o.gt0.media.duration_ms = TRUE; +#endif + qp_test(__func__, URLs[i], &e, &o); + } +} + +gint main(gint argc, gchar **argv) +{ + g_test_init(&argc, &argv, NULL); + g_test_add_func("/playlist/youtube", test_playlist_youtube); + return (g_test_run()); +} + +/* vim: set ts=2 sw=2 tw=72 expandtab: */ -- 2.11.4.GIT