qt: medialib: do not fetch data on rowCount()
[vlc.git] / test / libvlc / core.c
blob703a2f2962ad2e0a3aadce5306179773e749f9e9
1 /*
2 * core.c - libvlc smoke test
4 */
6 /**********************************************************************
7 * Copyright (C) 2007 RĂ©mi Denis-Courmont. *
8 * This program is free software; you can redistribute and/or modify *
9 * it under the terms of the GNU General Public License as published *
10 * by the Free Software Foundation; version 2 of the license, or (at *
11 * your option) any later version. *
12 * *
13 * This program is distributed in the hope that it will be useful, *
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
16 * See the GNU General Public License for more details. *
17 * *
18 * You should have received a copy of the GNU General Public License *
19 * along with this program; if not, you can get it from: *
20 * http://www.gnu.org/copyleft/gpl.html *
21 **********************************************************************/
23 #include "test.h"
25 #include <string.h>
27 static void test_core (const char ** argv, int argc)
29 libvlc_instance_t *vlc;
31 test_log ("Testing core\n");
33 vlc = libvlc_new (argc, argv);
34 assert (vlc != NULL);
36 libvlc_retain (vlc);
37 libvlc_release (vlc);
38 libvlc_release (vlc);
41 static void test_moduledescriptionlist (libvlc_module_description_t *list)
43 libvlc_module_description_t *module = list;
44 while ( module ) {
45 assert (strlen (module->psz_name) );
46 assert (strlen (module->psz_shortname) );
47 assert (module->psz_longname == NULL || strlen (module->psz_longname));
48 assert (module->psz_help == NULL || strlen (module->psz_help));
49 module = module->p_next;
52 libvlc_module_description_list_release (list);
55 static void test_audiovideofilterlists (const char ** argv, int argc)
57 libvlc_instance_t *vlc;
59 test_log ("Testing libvlc_(audio|video)_filter_list_get()\n");
61 vlc = libvlc_new (argc, argv);
62 assert (vlc != NULL);
64 test_moduledescriptionlist (libvlc_audio_filter_list_get (vlc));
65 test_moduledescriptionlist (libvlc_video_filter_list_get (vlc));
67 libvlc_release (vlc);
70 static void test_audio_output (void)
72 libvlc_instance_t *vlc = libvlc_new (0, NULL);
73 assert (vlc != NULL);
75 libvlc_audio_output_t *mods = libvlc_audio_output_list_get (vlc);
76 assert (mods != NULL);
78 puts ("Audio outputs:");
79 for (const libvlc_audio_output_t *o = mods; o != NULL; o = o->p_next)
81 libvlc_audio_output_device_t *devs;
83 printf(" %s: %s\n", o->psz_name, o->psz_description);
85 devs = libvlc_audio_output_device_list_get (vlc, o->psz_name);
86 if (devs == NULL)
87 continue;
88 for (const libvlc_audio_output_device_t *d = devs;
89 d != NULL;
90 d = d->p_next)
91 printf(" %s: %s\n", d->psz_device, d->psz_description);
93 libvlc_audio_output_device_list_release (devs);
95 libvlc_audio_output_list_release (mods);
96 libvlc_release (vlc);
99 int main (void)
101 test_init();
103 test_core (test_defaults_args, test_defaults_nargs);
104 test_audiovideofilterlists (test_defaults_args, test_defaults_nargs);
105 test_audio_output ();
107 return 0;