2 * Copyright (C) 2012,2013 Toni Gundogdu <legatvs@gmail.com>
4 * This file is part of libquvi-scripts <http://quvi.sourceforge.net>.
6 * This program is free software: you can redistribute it and/or
7 * modify it under the terms of the GNU Affero General Public
8 * License as published by the Free Software Foundation, either
9 * version 3 of the License, or (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU Affero General Public License for more details.
16 * You should have received a copy of the GNU Affero General
17 * Public License along with this program. If not, see
18 * <http://www.gnu.org/licenses/>.
29 /* Test playlist properties. The 'e' parameter may be NULL, in which
30 * case the test for the exact values (e.g. ID) will be skipped. */
31 void qp_test(const gchar
*func
, const gchar
*url
,
32 const qp_test_exact_t e
, const qp_test_opts_t o
)
38 if (chk_skip(func
) == TRUE
)
43 g_assert_cmpint(quvi_errcode(q
), ==, QUVI_OK
);
47 qp
= quvi_playlist_new(q
, url
);
48 g_test_message("errmsg=%s", quvi_errmsg(q
));
49 g_assert_cmpint(quvi_errcode(q
), ==, QUVI_OK
);
54 g_test_message("TEST_LEVEL=complete");
61 qp_cmp_s(QUVI_PLAYLIST_PROPERTY_ID
, e
->id
);
66 if (o
->s_len_gt0
.thumbnail_url
== TRUE
)
67 qp_chk_l(QUVI_PLAYLIST_PROPERTY_THUMBNAIL_URL
);
69 if (o
->s_len_gt0
.title
== TRUE
)
70 qp_chk_l(QUVI_PLAYLIST_PROPERTY_TITLE
);
75 while (quvi_playlist_media_next(qp
) == QUVI_TRUE
)
77 qp_chk_l(QUVI_PLAYLIST_MEDIA_PROPERTY_URL
);
81 if (o
->gt0
.media
.duration_ms
== TRUE
)
82 qp_chk_gt0(QUVI_PLAYLIST_MEDIA_PROPERTY_DURATION_MS
);
84 if (o
->s_len_gt0
.media
.title
== TRUE
)
85 qp_chk_l(QUVI_PLAYLIST_MEDIA_PROPERTY_TITLE
);
89 g_assert_cmpint(c
, >, 0);
93 g_test_message("TEST_LEVEL=basic");
95 /* Must return >0 media URLs. */
97 for (c
=0; quvi_playlist_media_next(qp
) == QUVI_TRUE
; ++c
)
99 qp_chk_l(QUVI_PLAYLIST_MEDIA_PROPERTY_URL
);
101 g_assert_cmpint(c
, >, 0);
104 quvi_playlist_free(qp
);
108 /* vim: set ts=2 sw=2 tw=72 expandtab: */