core/playlists/system: Add tests for new tracks and deleting tracks
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
This commit is contained in:
parent
58cd43c330
commit
249de0da21
|
@ -94,6 +94,26 @@ do { \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
|
|
||||||
|
static void test_init()
|
||||||
|
{
|
||||||
|
struct library *library = library_find("tests/Music");
|
||||||
|
|
||||||
|
/* Add tracks to the collection. */
|
||||||
|
track_add(library, "tests/Music/Hyrule Symphony/01 - Title Theme.ogg");
|
||||||
|
track_add(library, "tests/Music/Hyrule Symphony/02 - Kokiri Forest.ogg");
|
||||||
|
pl_system_new_track(track_get(0));
|
||||||
|
pl_system_new_track(track_get(1));
|
||||||
|
|
||||||
|
g_assert_cmpuint(playlist_size(PL_SYSTEM, "Favorites"), ==, 0);
|
||||||
|
g_assert_cmpuint(playlist_size(PL_SYSTEM, "Hidden"), ==, 0);
|
||||||
|
g_assert_cmpuint(playlist_size(PL_SYSTEM, "Queued"), ==, 0);
|
||||||
|
g_assert_cmpuint(playlist_size(PL_SYSTEM, "Collection"), ==, 2);
|
||||||
|
g_assert_cmpuint(playlist_size(PL_SYSTEM, "History"), ==, 0);
|
||||||
|
g_assert_cmpuint(playlist_size(PL_SYSTEM, "Unplayed"), ==, 2);
|
||||||
|
g_assert_cmpuint(playlist_size(PL_SYSTEM, "Most Played"), ==, 0);
|
||||||
|
g_assert_cmpuint(playlist_size(PL_SYSTEM, "Least Played"), ==, 0);
|
||||||
|
}
|
||||||
|
|
||||||
static void test_invalid()
|
static void test_invalid()
|
||||||
{
|
{
|
||||||
g_assert_null(playlist_get_queue(PL_SYSTEM, NULL));
|
g_assert_null(playlist_get_queue(PL_SYSTEM, NULL));
|
||||||
|
@ -383,10 +403,28 @@ static void test_least_played()
|
||||||
__test_playlist_clear("Least Played", 1, true, false);
|
__test_playlist_clear("Least Played", 1, true, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void test_delete_tracks()
|
||||||
|
{
|
||||||
|
g_assert_true(playlist_add(PL_SYSTEM, "Favorites", track_get(0)));
|
||||||
|
g_assert_true(playlist_add(PL_SYSTEM, "Hidden", track_get(1)));
|
||||||
|
g_assert_true(playlist_add(PL_SYSTEM, "Queued Tracks", track_get(0)));
|
||||||
|
|
||||||
|
pl_system_delete_track(track_get(0));
|
||||||
|
pl_system_delete_track(track_get(1));
|
||||||
|
|
||||||
|
g_assert_cmpuint(playlist_size(PL_SYSTEM, "Favorites"), ==, 0);
|
||||||
|
g_assert_cmpuint(playlist_size(PL_SYSTEM, "Hidden"), ==, 0);
|
||||||
|
g_assert_cmpuint(playlist_size(PL_SYSTEM, "Queued Tracks"), ==, 0);
|
||||||
|
g_assert_cmpuint(playlist_size(PL_SYSTEM, "Collection"), ==, 0);
|
||||||
|
g_assert_cmpuint(playlist_size(PL_SYSTEM, "History"), ==, 0);
|
||||||
|
g_assert_cmpuint(playlist_size(PL_SYSTEM, "Unplayed"), ==, 0);
|
||||||
|
g_assert_cmpuint(playlist_size(PL_SYSTEM, "Most Played"), ==, 0);
|
||||||
|
g_assert_cmpuint(playlist_size(PL_SYSTEM, "Least Played"), ==, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
int main(int argc, char **argv)
|
int main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
struct library *library;
|
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
idle_init_sync();
|
idle_init_sync();
|
||||||
|
@ -395,12 +433,8 @@ int main(int argc, char **argv)
|
||||||
playlist_init(NULL);
|
playlist_init(NULL);
|
||||||
while (idle_run_task()) {};
|
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_init(&argc, &argv, NULL);
|
||||||
|
g_test_add_func("/Core/Playlists/System/Init", test_init);
|
||||||
g_test_add_func("/Core/Playlists/System/Invalid", test_invalid);
|
g_test_add_func("/Core/Playlists/System/Invalid", test_invalid);
|
||||||
g_test_add_func("/Core/Playlists/System/Favorites", test_favorites);
|
g_test_add_func("/Core/Playlists/System/Favorites", test_favorites);
|
||||||
g_test_add_func("/Core/Playlists/System/Hidden", test_hidden);
|
g_test_add_func("/Core/Playlists/System/Hidden", test_hidden);
|
||||||
|
@ -410,6 +444,7 @@ int main(int argc, char **argv)
|
||||||
g_test_add_func("/Core/Playlists/System/Unplayed Tracks", test_unplayed);
|
g_test_add_func("/Core/Playlists/System/Unplayed Tracks", test_unplayed);
|
||||||
g_test_add_func("/Core/Playlists/System/Most Played Tracks", test_most_played);
|
g_test_add_func("/Core/Playlists/System/Most Played Tracks", test_most_played);
|
||||||
g_test_add_func("/Core/Playlists/System/Least Played Tracks", test_least_played);
|
g_test_add_func("/Core/Playlists/System/Least Played Tracks", test_least_played);
|
||||||
|
g_test_add_func("/Core/PLaylists/System/Delete Tracks", test_delete_tracks);
|
||||||
ret = g_test_run();
|
ret = g_test_run();
|
||||||
|
|
||||||
playlist_deinit();
|
playlist_deinit();
|
||||||
|
|
Loading…
Reference in New Issue