core/collection: Move collection_init() out of the collection namespace
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
This commit is contained in:
parent
d97ae38cc2
commit
3204fc0e44
|
@ -16,7 +16,7 @@ void core :: init(struct core_init_data *init)
|
|||
{
|
||||
filter_init();
|
||||
tags_init();
|
||||
collection :: init(init->collection_ops);
|
||||
collection_init(init->collection_ops);
|
||||
playlist :: init(init->playlist_ops);
|
||||
deck :: init(init->history_ops, init->tempq_ops);
|
||||
audio :: init();
|
||||
|
|
|
@ -143,7 +143,7 @@ static void validate_library(void *data)
|
|||
* External API begins here
|
||||
*/
|
||||
|
||||
void collection :: init(struct queue_ops *ops)
|
||||
void collection_init(struct queue_ops *ops)
|
||||
{
|
||||
struct db_entry *track, *next;
|
||||
|
||||
|
|
|
@ -24,12 +24,6 @@ extern "C" {
|
|||
namespace collection
|
||||
{
|
||||
|
||||
/**
|
||||
* Scan over every Track tag and add each enabled Track to the
|
||||
* library queue.
|
||||
*/
|
||||
void init(struct queue_ops *);
|
||||
|
||||
void save(struct queue *, enum queue_flags);
|
||||
|
||||
/**
|
||||
|
@ -84,4 +78,8 @@ namespace collection
|
|||
|
||||
};
|
||||
|
||||
|
||||
/* Called to initialize the collection manager. */
|
||||
void collection_init(struct queue_ops *);
|
||||
|
||||
#endif /* OCARINA_CORE_LIBRARY_H */
|
||||
|
|
|
@ -88,7 +88,7 @@ void test_init()
|
|||
|
||||
filter_init();
|
||||
tags_init();
|
||||
collection :: init(NULL);
|
||||
collection_init(NULL);
|
||||
deck :: init(NULL, NULL);
|
||||
audio :: init();
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@ static void test_init()
|
|||
test_cp_data_dir();
|
||||
filter_init();
|
||||
tags_init();
|
||||
collection :: init(NULL);
|
||||
collection_init(NULL);
|
||||
deck :: init(NULL, NULL);
|
||||
|
||||
test_equal(queue_has_flag(collection :: get_queue(), Q_RANDOM), true);
|
||||
|
|
|
@ -9,26 +9,41 @@ extern "C" {
|
|||
#include <core/library.h>
|
||||
#include "test.h"
|
||||
|
||||
static queue *Q_NULL = NULL;
|
||||
static struct library *LIB_NULL = NULL;
|
||||
|
||||
static void test_init()
|
||||
{
|
||||
queue *q = collection :: get_queue();
|
||||
struct queue *q = collection :: get_queue();
|
||||
GSList *list;
|
||||
|
||||
test_cp_data_dir();
|
||||
filter_init();
|
||||
tags_init();
|
||||
collection :: init(NULL);
|
||||
collection_init(NULL);
|
||||
|
||||
test_not_equal(q, Q_NULL);
|
||||
test_equal(queue_has_flag(q, Q_ENABLED), true);
|
||||
test_equal(queue_has_flag(q, Q_REPEAT), true);
|
||||
test_equal(queue_size(q), (unsigned)24);
|
||||
test_not_equal(q, NULL);
|
||||
test_equal(queue_has_flag(q, Q_ENABLED), true);
|
||||
test_equal(queue_has_flag(q, Q_REPEAT), true);
|
||||
test_equal(queue_has_flag(q, Q_SAVE_SORT), true);
|
||||
test_equal(queue_has_flag(q, Q_SAVE_FLAGS), true);
|
||||
test_equal(queue_has_flag(q, Q_ADD_FRONT), false);
|
||||
test_equal(queue_size(q), 0);
|
||||
|
||||
list = q->q_sort;
|
||||
test_equal(g_slist_length(q->q_sort), 3);
|
||||
test_equal(GPOINTER_TO_INT(list->data), COMPARE_ARTIST);
|
||||
list = g_slist_next(list);
|
||||
test_equal(GPOINTER_TO_INT(list->data), COMPARE_YEAR);
|
||||
list = g_slist_next(list);
|
||||
test_equal(GPOINTER_TO_INT(list->data), COMPARE_TRACK);
|
||||
}
|
||||
|
||||
static void test_enable()
|
||||
{
|
||||
test_cp_data_dir();
|
||||
filter_init();
|
||||
tags_init();
|
||||
collection_init(NULL);
|
||||
|
||||
queue *q = collection :: get_queue();
|
||||
struct library *library = library_get(0);
|
||||
|
||||
|
@ -109,7 +124,7 @@ static void test_update()
|
|||
}
|
||||
|
||||
DECLARE_UNIT_TESTS(
|
||||
UNIT_TEST("Library Init", test_init),
|
||||
UNIT_TEST("Collection Initialization", test_init),
|
||||
UNIT_TEST("Library Enable and Disable", test_enable),
|
||||
UNIT_TEST("Library Delete Path", test_remove),
|
||||
UNIT_TEST("Library Add Path", test_add),
|
||||
|
|
|
@ -20,7 +20,7 @@ static void test_init()
|
|||
test_cp_data_dir();
|
||||
filter_init();
|
||||
tags_init();
|
||||
collection :: init(NULL);
|
||||
collection_init(NULL);
|
||||
playlist :: init(NULL);
|
||||
|
||||
test_not_equal(q, Q_NULL);
|
||||
|
|
Loading…
Reference in New Issue