gui/playlists/library: Return a new playlist pointer
This pointer can be used immediately by testing code instead of simply looking at the return status. Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
This commit is contained in:
parent
249de0da21
commit
4d68ce8ce6
|
@ -77,7 +77,7 @@ void gui_pl_library_init()
|
|||
idle_schedule(IDLE_SYNC, __gui_pl_library_init_idle, NULL);
|
||||
}
|
||||
|
||||
bool gui_pl_library_add(const gchar *filename)
|
||||
struct playlist *gui_pl_library_add(const gchar *filename)
|
||||
{
|
||||
struct playlist *playlist;
|
||||
GtkTreeIter iter;
|
||||
|
@ -90,7 +90,7 @@ bool gui_pl_library_add(const gchar *filename)
|
|||
playlist = playlist_get(PL_LIBRARY, filename);
|
||||
gui_sidebar_iter_sort_child(&iter, playlist, "folder");
|
||||
gui_idle_enable();
|
||||
return true;
|
||||
return playlist;
|
||||
}
|
||||
|
||||
void gui_pl_library_update(struct playlist *playlist)
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
void gui_pl_library_init();
|
||||
|
||||
/* Called to add a library path. */
|
||||
bool gui_pl_library_add(const gchar *);
|
||||
struct playlist *gui_pl_library_add(const gchar *);
|
||||
|
||||
/* Called to update a library path. */
|
||||
void gui_pl_library_update(struct playlist *);
|
||||
|
|
|
@ -24,7 +24,7 @@ static void test_artist()
|
|||
gui_sidebar_iter_find(&iter, "Collection", PL_SYSTEM);
|
||||
g_assert_false(gtk_tree_model_iter_has_child(model, &iter));
|
||||
|
||||
g_assert_true(gui_pl_library_add("tests/Music/Hyrule Symphony"));
|
||||
g_assert_nonnull(gui_pl_library_add("tests/Music/Hyrule Symphony"));
|
||||
g_assert_cmpuint(artist_db_get()->db_size, ==, 0);
|
||||
g_assert_null(playlist_get(PL_ARTIST, "Koji Kondo"));
|
||||
g_assert_false(gtk_tree_model_iter_has_child(model, &iter));
|
||||
|
|
|
@ -29,15 +29,16 @@ static void test_library()
|
|||
g_assert_null(playlist_get(PL_LIBRARY, "tests/Music/Ocarina of Time"));
|
||||
g_assert_null(playlist_get(PL_LIBRARY, "tests/Music/Hyrule Symphony"));
|
||||
|
||||
g_assert_true(gui_pl_library_add("tests/Music/Ocarina of Time"));
|
||||
g_assert_true(gui_pl_library_add("tests/Music/Hyrule Symphony"));
|
||||
ocarina = gui_pl_library_add("tests/Music/Ocarina of Time");
|
||||
g_assert_nonnull(ocarina);
|
||||
|
||||
hyrule = gui_pl_library_add("tests/Music/Hyrule Symphony");
|
||||
g_assert_nonnull(hyrule);
|
||||
|
||||
g_assert_cmpuint(library_db_get()->db_size, ==, 2);
|
||||
g_assert_true(gtk_tree_model_iter_has_child(model, &iter));
|
||||
g_assert_cmpuint(gtk_tree_model_iter_n_children(model, &iter), ==, 2);
|
||||
|
||||
ocarina = playlist_get(PL_LIBRARY, "tests/Music/Ocarina of Time");
|
||||
hyrule = playlist_get(PL_LIBRARY, "tests/Music/Hyrule Symphony");
|
||||
|
||||
g_assert_cmpuint(playlist_size(ocarina->pl_type, ocarina->pl_name), ==, 0);
|
||||
g_assert_cmpuint(playlist_size(hyrule->pl_type, hyrule->pl_name), ==, 0);
|
||||
while (idle_run_task()) {}
|
||||
|
|
|
@ -65,7 +65,7 @@ static void test_system()
|
|||
|
||||
static void test_buttons()
|
||||
{
|
||||
g_assert_true(gui_pl_library_add("tests/Music/Hyrule Symphony"));
|
||||
g_assert_nonnull(gui_pl_library_add("tests/Music/Hyrule Symphony"));
|
||||
while (idle_run_task()) {}
|
||||
|
||||
g_assert_false(gtk_toggle_button_get_active(gui_favorite_button()));
|
||||
|
|
Loading…
Reference in New Issue