2016-09-09 08:35:52 -04:00
|
|
|
/*
|
|
|
|
* Copyright 2016 (c) Anna Schumaker.
|
|
|
|
*/
|
|
|
|
#include <core/idle.h>
|
|
|
|
#include <core/playlist.h>
|
|
|
|
#include <core/settings.h>
|
|
|
|
#include <core/tags/tags.h>
|
|
|
|
|
|
|
|
static void test_null()
|
|
|
|
{
|
|
|
|
g_assert_null(playlist_new(PL_MAX_TYPE, "NULL"));
|
|
|
|
g_assert_null(playlist_new(PL_MAX_TYPE, NULL));
|
2016-09-09 10:17:37 -04:00
|
|
|
g_assert_false(playlist_delete(NULL));
|
2016-09-10 12:08:11 -04:00
|
|
|
|
2016-09-12 10:59:46 -04:00
|
|
|
g_assert_null(playlist_lookup(PL_MAX_TYPE, "NULL"));
|
2016-09-12 13:49:27 -04:00
|
|
|
g_assert_null(playlist_lookup(PL_MAX_TYPE, NULL));
|
2016-09-12 10:59:46 -04:00
|
|
|
g_assert_null(playlist_get(PL_MAX_TYPE, 0));
|
2016-09-12 13:49:27 -04:00
|
|
|
|
2016-09-12 16:02:46 -04:00
|
|
|
g_assert(playlist_current() == playlist_lookup(PL_SYSTEM, "Collection"));
|
2016-09-12 13:08:24 -04:00
|
|
|
g_assert_false(playlist_select(NULL));
|
2016-09-12 16:02:46 -04:00
|
|
|
g_assert(playlist_current() == playlist_lookup(PL_SYSTEM, "Collection"));
|
2016-09-12 13:08:24 -04:00
|
|
|
|
2016-09-10 12:08:11 -04:00
|
|
|
g_assert_false(playlist_add(NULL, NULL));
|
|
|
|
g_assert_false(playlist_add(NULL, track_get(0)));
|
2016-09-10 13:46:30 -04:00
|
|
|
g_assert_false(playlist_has(NULL, NULL));
|
|
|
|
g_assert_false(playlist_has(NULL, track_get(0)));
|
2016-09-10 14:31:43 -04:00
|
|
|
g_assert_cmpuint(playlist_size(NULL), ==, 0);
|
2016-09-10 13:11:18 -04:00
|
|
|
g_assert_false(playlist_remove(NULL, NULL));
|
|
|
|
g_assert_false(playlist_remove(NULL, track_get(0)));
|
2016-09-12 08:17:41 -04:00
|
|
|
|
|
|
|
g_assert_false(playlist_get_random(NULL));
|
|
|
|
playlist_set_random(NULL, true);
|
|
|
|
g_assert_false(playlist_get_random(NULL));
|
2016-09-12 09:49:35 -04:00
|
|
|
|
|
|
|
g_assert_false(playlist_sort(NULL, COMPARE_TRACK, true));
|
|
|
|
g_assert_false(playlist_sort(NULL, COMPARE_TRACK, false));
|
2016-09-09 08:35:52 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
int main(int argc, char **argv)
|
|
|
|
{
|
2016-09-10 12:08:11 -04:00
|
|
|
struct library *library;
|
2016-09-09 08:35:52 -04:00
|
|
|
int ret;
|
|
|
|
|
|
|
|
idle_init_sync();
|
|
|
|
settings_init();
|
|
|
|
tags_init();
|
|
|
|
playlist_init(NULL);
|
|
|
|
while (idle_run_task()) {};
|
|
|
|
|
2016-09-10 12:08:11 -04:00
|
|
|
library = library_find("tests/Music");
|
|
|
|
track_add(library, "tests/Music/Hyrule Symphony/01 - Title Theme.ogg");
|
|
|
|
|
2016-09-09 08:35:52 -04:00
|
|
|
g_test_init(&argc, &argv, NULL);
|
|
|
|
g_test_add_func("/Core/Playlist/NULL", test_null);
|
|
|
|
ret = g_test_run();
|
|
|
|
|
|
|
|
playlist_deinit();
|
|
|
|
tags_deinit();
|
|
|
|
settings_deinit();
|
|
|
|
idle_deinit();
|
|
|
|
return ret;
|
|
|
|
}
|