]> git.sesse.net Git - vlc/blob - src/control/testapi.c
libvlc-control smoke test. Feel free to extend
[vlc] / src / control / testapi.c
1 /*
2  * testapi.c - libvlc-control smoke test
3  *
4  * $Id$
5  */
6
7 /**********************************************************************
8  *  Copyright (C) 2007 RĂ©mi Denis-Courmont.                           *
9  *  This program is free software; you can redistribute and/or modify *
10  *  it under the terms of the GNU General Public License as published *
11  *  by the Free Software Foundation; version 2 of the license, or (at *
12  *  your option) any later version.                                   *
13  *                                                                    *
14  *  This program is distributed in the hope that it will be useful,   *
15  *  but WITHOUT ANY WARRANTY; without even the implied warranty of    *
16  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.              *
17  *  See the GNU General Public License for more details.              *
18  *                                                                    *
19  *  You should have received a copy of the GNU General Public License *
20  *  along with this program; if not, you can get it from:             *
21  *  http://www.gnu.org/copyleft/gpl.html                              *
22  **********************************************************************/
23
24 #include <vlc/mediacontrol.h>
25 #include <assert.h>
26
27 int main (int argc, char *argv[])
28 {
29     mediacontrol_Exception ex;
30     mediacontrol_Instance *mc, *mc2;
31     libvlc_instance_t *vlc;
32
33     mediacontrol_exception_init (&ex);
34     mc = mediacontrol_new (argc, argv, &ex);
35     assert (mc);
36     assert (!ex.code);
37     mediacontrol_exception_cleanup (&ex);
38
39     /* Duplication test */
40     vlc = mediacontrol_get_libvlc_instance (mc);
41     assert (vlc);
42     assert (!ex.code);
43
44     mediacontrol_exception_init (&ex);
45     mc2 = mediacontrol_new_from_instance (vlc, &ex);
46     assert (mc2);
47     assert (!ex.code);
48     mediacontrol_exception_cleanup (&ex);
49
50     //mediacontrol_exit (mc2);
51
52     /* Input tests */
53     mediacontrol_exception_init (&ex);
54     mediacontrol_resume (mc, NULL, &ex);
55     assert (ex.code); /* should fail: we have no input */
56     mediacontrol_exception_cleanup (&ex);
57
58     mediacontrol_exception_init (&ex);
59     mediacontrol_pause (mc, NULL, &ex);
60     assert (ex.code); /* should fail: we have no input */
61     mediacontrol_exception_cleanup (&ex);
62
63     mediacontrol_exception_init (&ex);
64     mediacontrol_stop (mc, NULL, &ex);
65     mediacontrol_exception_cleanup (&ex);
66
67     /* Playlist tests */
68     mediacontrol_exception_init (&ex);
69     mediacontrol_playlist_clear (mc, &ex);
70     assert (!ex.code);
71     mediacontrol_exception_cleanup (&ex);
72
73     mediacontrol_exception_init (&ex);
74     mediacontrol_playlist_add_item (mc, "/dev/null", &ex);
75     mediacontrol_exception_cleanup (&ex);
76
77     mediacontrol_exception_init (&ex);
78     mediacontrol_playlist_clear (mc, &ex);
79     assert (!ex.code);
80     mediacontrol_exception_cleanup (&ex);
81
82     mediacontrol_exit (mc);
83     return 0;
84 }