qt: playlist: use item title if available
[vlc.git] / test / libvlc / test.h
blobb40d66d351a13ab9f95f13d46f9b652c36e29fb8
1 /*
2 * test.h - libvlc smoke test common definitions
4 */
6 /**********************************************************************
7 * Copyright (C) 2007 RĂ©mi Denis-Courmont. *
8 * Copyright (C) 2008 Pierre d'Herbemont. *
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 **********************************************************************/
24 #ifndef TEST_H
25 #define TEST_H
27 /*********************************************************************
28 * Some useful common headers
31 #ifdef HAVE_CONFIG_H
32 # include "config.h"
33 #endif
34 #include <vlc/vlc.h>
36 #undef NDEBUG
37 #include <assert.h>
39 #include <stdio.h>
40 #include <stdlib.h>
41 #include <stdbool.h>
42 #include <unistd.h>
43 #include <signal.h>
45 /*********************************************************************
46 * Some useful global var
49 static const char * test_defaults_args[] = {
50 "-v", "--vout=vdummy", "--aout=adummy", "--text-renderer=tdummy",
53 static const int test_defaults_nargs =
54 sizeof (test_defaults_args) / sizeof (test_defaults_args[0]);
56 static const char test_default_sample[] = "mock://";
58 /*********************************************************************
59 * Some useful common functions
62 #define test_log( ... ) printf( "testapi: " __VA_ARGS__ );
64 static inline void on_timeout(int signum)
66 assert(signum == SIGALRM);
67 abort(); /* Cause a core dump */
70 static inline void test_init (void)
72 (void)test_default_sample; /* This one may not be used */
74 /* Make sure "make check" does not get stuck */
75 /* Timeout of 10secs by default */
76 unsigned alarm_timeout = 10;
77 /* Valid timeout value are < 0, for infinite, and > 0, for the number of
78 * seconds */
79 char *alarm_timeout_str = getenv("VLC_TEST_TIMEOUT");
80 if (alarm_timeout_str)
82 int val = atoi(alarm_timeout_str);
83 if (val <= 0)
84 alarm_timeout = 0; /* infinite */
85 else
86 alarm_timeout = val;
88 if (alarm_timeout != 0)
90 struct sigaction sig = {
91 .sa_handler = on_timeout,
93 sigaction(SIGALRM, &sig, NULL);
94 alarm (alarm_timeout);
97 setenv( "VLC_PLUGIN_PATH", "../modules", 1 );
100 #endif /* TEST_H */