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
28 /* Test media properties. The 'e' parameter may be NULL, in which case
29 * the test for exact values (e.g. title and ID) will be skipped. */
30 void qm_test(const gchar
*func
, const gchar
*url
,
31 const qm_test_exact_t e
, const qm_test_opts_t o
)
36 if (chk_skip(func
) == TRUE
)
41 g_assert_cmpint(qerr(q
), ==, QUVI_OK
);
45 qm
= quvi_media_new(q
, url
);
46 g_test_message("errmsg=%s", quvi_errmsg(q
));
47 g_assert_cmpint(qerr(q
), ==, QUVI_OK
);
54 g_test_message("TEST_LEVEL=complete");
61 qm_cmp_s(QUVI_MEDIA_PROPERTY_TITLE
, e
->title
);
64 qm_cmp_s(QUVI_MEDIA_PROPERTY_ID
, e
->id
);
67 /* Thumbnail, expected, but check length only. */
69 qm_chk_l(QUVI_MEDIA_PROPERTY_THUMBNAIL_URL
);
73 if (o
->gt0
.duration_ms
== TRUE
)
74 qm_chk_gt0(QUVI_MEDIA_PROPERTY_DURATION_MS
);
76 if (o
->gt0
.start_time_ms
== TRUE
)
77 qm_chk_gt0(QUVI_MEDIA_PROPERTY_START_TIME_MS
);
81 for (c
=0; quvi_media_stream_next(qm
) == QUVI_TRUE
; ++c
);
82 g_assert_cmpint(c
, >, 0);
84 while (quvi_media_stream_next(qm
) == QUVI_TRUE
)
86 qm_chk_l(QUVI_MEDIA_STREAM_PROPERTY_URL
);
88 if (c
>1) /* Must have a stream ID, when there are >1 streams. */
89 qm_chk_l(QUVI_MEDIA_STREAM_PROPERTY_ID
);
93 if (o
->s_len_gt0
.stream
.container
== TRUE
)
94 qm_chk_l(QUVI_MEDIA_STREAM_PROPERTY_CONTAINER
);
96 /* Optional: Video. */
98 if (o
->gt0
.stream
.video
.bitrate_kbit_s
== TRUE
)
99 qm_chk_gt0(QUVI_MEDIA_STREAM_PROPERTY_VIDEO_BITRATE_KBIT_S
);
101 if (o
->gt0
.stream
.video
.height
== TRUE
)
102 qm_chk_gt0(QUVI_MEDIA_STREAM_PROPERTY_VIDEO_HEIGHT
);
104 if (o
->gt0
.stream
.video
.width
== TRUE
)
105 qm_chk_gt0(QUVI_MEDIA_STREAM_PROPERTY_VIDEO_WIDTH
);
107 if (o
->s_len_gt0
.stream
.video
.encoding
== TRUE
)
108 qm_chk_l(QUVI_MEDIA_STREAM_PROPERTY_VIDEO_ENCODING
);
110 /* Optional: Audio. */
112 if (o
->gt0
.stream
.audio
.bitrate_kbit_s
== TRUE
)
113 qm_chk_gt0(QUVI_MEDIA_STREAM_PROPERTY_AUDIO_BITRATE_KBIT_S
);
115 if (o
->s_len_gt0
.stream
.audio
.encoding
== TRUE
)
116 qm_chk_l(QUVI_MEDIA_STREAM_PROPERTY_AUDIO_ENCODING
);
121 g_test_message("TEST_LEVEL=basic");
123 /* Must return >0 media streams. */
125 qm_chk_l(QUVI_MEDIA_STREAM_PROPERTY_URL
);
132 /* vim: set ts=2 sw=2 tw=72 expandtab: */