2 * Copyright (C) 2012 Toni Gundogdu <legatvs@gmail.com>
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library 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 GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
28 /* Test playlist properties. The 'e' parameter may be NULL, in which
29 * case the test for the exact values (e.g. ID) will be skipped. */
30 void qp_test(const gchar
*func
, const gchar
*url
,
31 const qp_test_exact_t e
, const qp_test_opts_t o
)
37 if (chk_skip(func
) == TRUE
)
42 g_assert_cmpint(qerr(q
), ==, QUVI_OK
);
46 qp
= quvi_playlist_new(q
, url
);
47 g_test_message("errmsg=%s", quvi_errmsg(q
));
48 g_assert_cmpint(qerr(q
), ==, QUVI_OK
);
53 g_test_message("TEST_LEVEL=complete");
60 qp_cmp_s(QUVI_PLAYLIST_PROPERTY_ID
, e
->id
);
65 if (o
->s_len_gt0
.thumbnail_url
== TRUE
)
66 qp_chk_l(QUVI_PLAYLIST_PROPERTY_THUMBNAIL_URL
);
68 if (o
->s_len_gt0
.title
== TRUE
)
69 qp_chk_l(QUVI_PLAYLIST_PROPERTY_TITLE
);
74 while (quvi_playlist_media_next(qp
) == QUVI_TRUE
)
76 qp_chk_l(QUVI_PLAYLIST_MEDIA_PROPERTY_URL
);
80 if (o
->gt0
.media
.duration_ms
== TRUE
)
81 qp_chk_gt0(QUVI_PLAYLIST_MEDIA_PROPERTY_DURATION_MS
);
83 if (o
->s_len_gt0
.media
.title
== TRUE
)
84 qp_chk_l(QUVI_PLAYLIST_MEDIA_PROPERTY_TITLE
);
88 g_assert_cmpint(c
, >, 0);
92 g_test_message("TEST_LEVEL=basic");
94 /* Must return >0 media URLs. */
96 for (c
=0; quvi_playlist_media_next(qp
) == QUVI_TRUE
; ++c
);
97 g_assert_cmpint(c
, >, 0);
99 qp_chk_l(QUVI_PLAYLIST_MEDIA_PROPERTY_URL
);
102 quvi_playlist_free(qp
);
106 /* vim: set ts=2 sw=2 tw=72 expandtab: */