Macro qtTrIdx() replaced by tr() and QT_TRANSLATE_NOOP()
[mafwsubrenderer] / gst-plugins-base-subtitles0.10 / tests / check / libs / discoverer.c
1 /* GStreamer unit tests for discoverer
2  *
3  * Copyright (C) 2011 Stefan Kost <ensonic@users.sf.net>
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Library General Public
7  * License as published by the Free Software Foundation; either
8  * version 2 of the License, or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13  * Library General Public License for more details.
14  *
15  * You should have received a copy of the GNU Library General Public
16  * License along with this library; if not, write to the
17  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18  * Boston, MA 02111-1307, USA.
19  */
20
21 #ifdef HAVE_CONFIG_H
22 # include <config.h>
23 #endif
24
25 #include <gst/check/gstcheck.h>
26 #include <gst/pbutils/pbutils.h>
27
28 #include <stdio.h>
29 #include <glib/gstdio.h>
30 #include <glib/gprintf.h>
31
32
33 GST_START_TEST (test_disco_init)
34 {
35   GError *err = NULL;
36   GstDiscoverer *dc;
37
38   dc = gst_discoverer_new (GST_SECOND, &err);
39   fail_unless (dc != NULL);
40   fail_unless (err == NULL);
41
42   g_object_unref (dc);
43 }
44
45 GST_END_TEST;
46
47 GST_START_TEST (test_disco_sync)
48 {
49   GError *err = NULL;
50   GstDiscoverer *dc;
51   GstDiscovererInfo *info;
52   GstDiscovererResult result;
53   gchar *uri;
54
55   dc = gst_discoverer_new (GST_SECOND, &err);
56   fail_unless (dc != NULL);
57   fail_unless (err == NULL);
58
59   /* GST_TEST_FILE comes from makefile CFLAGS */
60   GST_INFO ("discovering file '%s'", GST_TEST_FILE);
61   uri = g_filename_to_uri (GST_TEST_FILE, NULL, &err);
62   fail_unless (err == NULL);
63   GST_INFO ("discovering uri '%s'", uri);
64
65   info = gst_discoverer_discover_uri (dc, uri, &err);
66   result = gst_discoverer_info_get_result (info);
67   GST_INFO ("result: %d", result);
68   gst_discoverer_info_unref (info);
69   g_free (uri);
70
71   if (err) {
72     /* we won't have the codec for the jpeg */
73     g_error_free (err);
74   }
75
76   g_object_unref (dc);
77 }
78
79 GST_END_TEST;
80
81
82 static Suite *
83 discoverer_suite (void)
84 {
85   Suite *s = suite_create ("discoverer");
86   TCase *tc_chain = tcase_create ("general");
87
88   suite_add_tcase (s, tc_chain);
89   tcase_add_test (tc_chain, test_disco_init);
90   tcase_add_test (tc_chain, test_disco_sync);
91   return s;
92 }
93
94 GST_CHECK_MAIN (discoverer);