487274ff00
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
58 lines
1.4 KiB
C
58 lines
1.4 KiB
C
/*
|
|
* Copyright 2016 (c) Anna Schumaker.
|
|
*/
|
|
#include <core/idle.h>
|
|
#include <core/playlist.h>
|
|
#include <core/tags/artist.h>
|
|
#include <core/tags/library.h>
|
|
#include <core/tags/tags.h>
|
|
#include <tests/test.h>
|
|
|
|
|
|
void test_artist()
|
|
{
|
|
struct artist *artist;
|
|
|
|
g_assert_false(playlist_new(PL_ARTIST, "Koji Kondo"));
|
|
g_assert_null(playlist_get_queue(PL_ARTIST, "Koji Kondo"));
|
|
|
|
artist = artist_find("Koji Kondo");
|
|
g_assert_null(artist->ar_playlist);
|
|
g_assert_false(playlist_add(PL_ARTIST, "Koji Kondo", track_get(0)));
|
|
|
|
pl_artist_init(NULL);
|
|
while (idle_run_task()) {};
|
|
|
|
g_assert_cmpuint(playlist_size(PL_ARTIST, "Koji Kondo"), ==, 2);
|
|
g_assert_nonnull(artist->ar_playlist);
|
|
g_assert_false(playlist_remove(PL_ARTIST, "Koji Kondo", track_get(0)));
|
|
g_assert_cmpuint(playlist_size(PL_ARTIST, "Koji Kondo"), ==, 2);
|
|
|
|
g_assert_false(playlist_delete(PL_ARTIST, "Koji Kondo"));
|
|
pl_artist_deinit();
|
|
g_assert_null(artist->ar_playlist);
|
|
}
|
|
|
|
int main(int argc, char **argv)
|
|
{
|
|
struct library *library;
|
|
int ret;
|
|
|
|
idle_init_sync();
|
|
tags_init();
|
|
while (idle_run_task()) {};
|
|
|
|
/* Add tracks to the collection. */
|
|
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");
|
|
|
|
g_test_init(&argc, &argv, NULL);
|
|
g_test_add_func("/Core/Playlists/Artist", test_artist);
|
|
ret = g_test_run();
|
|
|
|
tags_deinit();
|
|
idle_deinit();
|
|
return ret;
|
|
}
|