ocarina/tests/core/playlists/library.c

44 lines
989 B
C

/*
* Copyright 2016 (c) Anna Schumaker.
*/
#include <core/filter.h>
#include <core/idle.h>
#include <core/playlists/library.h>
#include <core/tags/library.h>
#include <core/tags/tags.h>
#include <tests/test.h>
void test_library()
{
struct playlist *playlist;
struct library *library;
idle_init_sync();
filter_init();
tags_init();
while (idle_run_task()) {};
library = library_find("tests/Music");
track_add(library, "tests/Music/Hyrule Symphony/01 - Title Theme.ogg");
track_add(library, "tests/Music/Hyrule Symphony/02 - Kokiri Forest.ogg");
test_equal(library->li_playlist, NULL);
pl_library_init(NULL);
while (idle_run_task()) {};
playlist = (struct playlist *)library->li_playlist;
test_not_equal(library->li_playlist, NULL);
test_equal(queue_size(&playlist->pl_queue), 2);
pl_library_deinit();
test_equal(library->li_playlist, NULL);
tags_deinit();
filter_deinit();
idle_deinit();
}
DECLARE_UNIT_TESTS(
UNIT_TEST("Library Playlists", test_library),
);