test_media_select: Replace URL, update patterns
[libquvi.git] / tests / goto.c
bloba6399726f88862a479f67e26d26d73c41cee7e13
1 /* libquvi
2 * Copyright (C) 2012,2013 Toni Gundogdu <legatvs@gmail.com>
4 * This file is part of libquvi <http://quvi.sourceforge.net/>.
6 * This program is free software: you can redistribute it and/or
7 * modify it under the terms of the GNU Affero General Public
8 * License as published by the Free Software Foundation, either
9 * version 3 of the License, or (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU Affero General Public License for more details.
16 * You should have received a copy of the GNU Affero General
17 * Public License along with this program. If not, see
18 * <http://www.gnu.org/licenses/>.
21 #include "config.h"
23 #include <string.h>
24 #include <glib.h>
25 #include <quvi.h>
27 #include "tests.h"
29 /* media/ted.lua uses the "goto_url" instruction. */
31 static const gchar URL[] =
32 "http://www.ted.com/talks/paul_lewis_crowdsourcing_the_news.html";
34 static const gchar TITLE[] =
35 "TEDxThessaloniki - Paul Lewis - Citizen Journalism";
37 static void test_goto_url()
39 quvi_media_t qm;
40 quvi_t q;
41 gchar *s;
43 if (chk_internet() == FALSE || chk_skip(__func__) == TRUE)
44 return;
46 q = quvi_new();
47 g_assert(q != NULL);
48 g_assert_cmpint(quvi_errcode(q), ==, QUVI_OK);
50 chk_verbose(q);
52 qm = quvi_media_new(q, URL);
53 g_assert_cmpint(qerr_m(q, URL), ==, QUVI_OK);
54 g_assert(qm != NULL);
56 quvi_media_get(qm, QUVI_MEDIA_PROPERTY_TITLE, &s);
57 g_assert_cmpint(quvi_errcode(q), ==, QUVI_OK);
58 g_assert_cmpstr(s, ==, TITLE);
60 quvi_media_free(qm);
61 quvi_free(q);
64 gint main(gint argc, gchar **argv)
66 g_test_init(&argc, &argv, NULL);
67 g_test_add_func("/quvi/goto URL", test_goto_url);
68 return (g_test_run());
71 /* vim: set ts=2 sw=2 tw=72 expandtab: */