LIBQUVI_SHOW_SCRIPT: Output script path if URL was accepted
[libquvi.git] / tests / goto.c
blob333b662681d4873ee426a23d13445a3293e53dff
1 /* libquvi
2 * Copyright (C) 2012 Toni Gundogdu <legatvs@gmail.com>
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version 2
7 * of the License, or (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
17 * 02110-1301, USA.
20 #include "config.h"
22 #include <string.h>
23 #include <glib.h>
24 #include <quvi.h>
26 #include "tests.h"
28 /* academicearth.lua uses the "goto_url" instruction. */
30 static const gchar URL[] =
31 "http://www.academicearth.org/lectures/intro-roman-architecture";
33 static const gchar TITLE[] = "1. Introduction to Roman Architecture";
35 static void test_goto_url()
37 quvi_media_t qm;
38 quvi_t q;
39 gchar *s;
41 if (chk_internet() == FALSE)
42 return;
44 if (chk_skip(__func__) == TRUE)
45 return;
47 q = quvi_new();
48 g_assert(q != NULL);
49 g_assert_cmpint(qerr(q), ==, QUVI_OK);
51 chk_verbose(q);
53 qm = quvi_media_new(q, URL);
54 g_assert_cmpint(qerr_m(q, URL), ==, QUVI_OK);
55 g_assert(qm != NULL);
57 quvi_media_get(qm, QUVI_MEDIA_PROPERTY_TITLE, &s);
58 g_assert_cmpint(qerr(q), ==, QUVI_OK);
59 g_assert_cmpstr(s, ==, TITLE);
61 quvi_media_free(qm);
62 quvi_free(q);
65 gint main(gint argc, gchar **argv)
67 g_test_init(&argc, &argv, NULL);
68 g_test_add_func("/quvi/goto URL", test_goto_url);
69 return (g_test_run());
72 /* vim: set ts=2 sw=2 tw=72 expandtab: */