core/playlist: Convert file to C
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
This commit is contained in:
parent
5844402ee3
commit
02c82c182e
|
@ -7,9 +7,9 @@
|
|||
extern "C" {
|
||||
#include <core/collection.h>
|
||||
#include <core/filter.h>
|
||||
#include <core/playlist.h>
|
||||
#include <core/tags/tags.h>
|
||||
}
|
||||
#include <core/playlist.h>
|
||||
|
||||
|
||||
void core :: init(struct core_init_data *init)
|
||||
|
|
|
@ -1,10 +1,8 @@
|
|||
/**
|
||||
/*
|
||||
* Copyright 2013 (c) Anna Schumaker.
|
||||
*/
|
||||
extern "C" {
|
||||
#include <core/collection.h>
|
||||
#include <core/string.h>
|
||||
}
|
||||
#include <core/playlist.h>
|
||||
|
||||
static struct database playlist_db;
|
||||
|
@ -13,7 +11,7 @@ static enum playlist_t playlist_cur;
|
|||
static const gchar *playlist_names[2] = { "Favorites", "Banned" };
|
||||
|
||||
|
||||
static inline index_entry *__playlist_lookup(enum playlist_t plist)
|
||||
static inline struct index_entry *__playlist_lookup(enum playlist_t plist)
|
||||
{
|
||||
return INDEX_ENTRY(db_get(&playlist_db, playlist_names[plist]));
|
||||
}
|
|
@ -3,8 +3,8 @@
|
|||
*/
|
||||
extern "C" {
|
||||
#include <core/collection.h>
|
||||
}
|
||||
#include <core/playlist.h>
|
||||
}
|
||||
#include <gui/tabs.h>
|
||||
#include <gui/queue/label.h>
|
||||
|
||||
|
|
|
@ -5,8 +5,8 @@ extern "C" {
|
|||
#include <core/collection.h>
|
||||
#include <core/containers/index.h>
|
||||
#include <core/idle.h>
|
||||
}
|
||||
#include <core/playlist.h>
|
||||
}
|
||||
#include <gui/ocarina.h>
|
||||
|
||||
|
||||
|
|
|
@ -2,7 +2,9 @@
|
|||
* Copyright 2014 (c) Anna Schumaker.
|
||||
*/
|
||||
#include <core/audio.h>
|
||||
extern "C" {
|
||||
#include <core/playlist.h>
|
||||
}
|
||||
#include <gui/tabs.h>
|
||||
#include <gui/queue/label.h>
|
||||
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
* Copyright 2014 (c) Anna Schumaker.
|
||||
*/
|
||||
#include <core/deck.h>
|
||||
#include <core/playlist.h>
|
||||
extern "C" {
|
||||
#include <core/playlist.h>
|
||||
#include <core/string.h>
|
||||
}
|
||||
#include <gui/tabs.h>
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/**
|
||||
/*
|
||||
* Copyright 2013 (c) Anna Schumaker.
|
||||
*
|
||||
* The playlist manager is in charge of the various playlists Ocarina
|
||||
|
@ -8,12 +8,8 @@
|
|||
#ifndef OCARINA_CORE_PLAYLIST_H
|
||||
#define OCARINA_CORE_PLAYLIST_H
|
||||
|
||||
extern "C" {
|
||||
#include <core/containers/index.h>
|
||||
#include <core/queue.h>
|
||||
}
|
||||
|
||||
#include <string>
|
||||
|
||||
enum playlist_t {
|
||||
PL_FAVORITED, /* Songs that the user likes. */
|
||||
|
|
|
@ -26,7 +26,7 @@ res += [ CoreTest("idle", "idle.c") ]
|
|||
res += SConscript("tags/Sconscript")
|
||||
res += [ CoreTest("queue", "queue.c") ]
|
||||
res += [ CoreTest("collection", "collection.c") ]
|
||||
res += [ CoreTest("playlist", "playlist.cpp") ]
|
||||
res += [ CoreTest("playlist", "playlist.c") ]
|
||||
res += [ CoreTest("deck", "deck.cpp") ]
|
||||
res += [ CoreTest("audio", "audio.cpp") ]
|
||||
|
||||
|
|
|
@ -1,18 +1,16 @@
|
|||
/*
|
||||
* Copyright 2013 (c) Anna Schumaker.
|
||||
*/
|
||||
extern "C" {
|
||||
#include <core/collection.h>
|
||||
#include <core/filter.h>
|
||||
#include <core/idle.h>
|
||||
#include <core/tags/tags.h>
|
||||
}
|
||||
#include <core/playlist.h>
|
||||
#include "test.h"
|
||||
#include <core/tags/tags.h>
|
||||
#include <tests/test.h>
|
||||
|
||||
static void test_init()
|
||||
{
|
||||
queue *q = playlist_get_queue();
|
||||
struct queue *q = playlist_get_queue();
|
||||
GSList *list;
|
||||
|
||||
filter_init();
|
||||
|
@ -20,10 +18,10 @@ static void test_init()
|
|||
collection_init(NULL);
|
||||
playlist_init(NULL);
|
||||
|
||||
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_NO_SORT), true);
|
||||
test_not_equal((void *)q, NULL);
|
||||
test_equal(queue_has_flag(q, Q_ENABLED), (bool)true);
|
||||
test_equal(queue_has_flag(q, Q_REPEAT), (bool)true);
|
||||
test_equal(queue_has_flag(q, Q_NO_SORT), (bool)true);
|
||||
test_equal(queue_size(q), 0);
|
||||
|
||||
list = q->q_sort;
|
||||
|
@ -46,11 +44,11 @@ static void test_add()
|
|||
struct track *track = track_get(0);
|
||||
|
||||
playlist_add(PL_FAVORITED, NULL);
|
||||
test_equal(playlist_has(PL_FAVORITED, NULL), false);
|
||||
test_equal(playlist_has(PL_FAVORITED, NULL), (bool)false);
|
||||
|
||||
test_equal(playlist_has(PL_FAVORITED, track), false);
|
||||
test_equal(playlist_has(PL_FAVORITED, track), (bool)false);
|
||||
playlist_add(PL_FAVORITED, track);
|
||||
test_equal(playlist_has(PL_FAVORITED, track), true);
|
||||
test_equal(playlist_has(PL_FAVORITED, track), (bool)true);
|
||||
test_equal(queue_size(q), 1);
|
||||
playlist_add(PL_FAVORITED, track);
|
||||
test_equal(queue_size(q), 1);
|
||||
|
@ -61,9 +59,9 @@ static void test_add()
|
|||
playlist_select(PL_BANNED);
|
||||
test_equal(queue_size(q), 0);
|
||||
test_equal(queue_size(c), 13);
|
||||
test_equal(playlist_has(PL_BANNED, track), false);
|
||||
test_equal(playlist_has(PL_BANNED, track), (bool)false);
|
||||
playlist_add(PL_BANNED, track);
|
||||
test_equal(playlist_has(PL_BANNED, track), true);
|
||||
test_equal(playlist_has(PL_BANNED, track), (bool)true);
|
||||
test_equal(queue_size(q), 1);
|
||||
test_equal(queue_size(c), 12);
|
||||
|
||||
|
@ -85,9 +83,9 @@ static void test_remove()
|
|||
|
||||
playlist_select(PL_FAVORITED);
|
||||
test_equal(queue_size(q), 2);
|
||||
test_equal(playlist_has(PL_FAVORITED, track), true);
|
||||
test_equal(playlist_has(PL_FAVORITED, track), (bool)true);
|
||||
playlist_remove(PL_FAVORITED, track);
|
||||
test_equal(playlist_has(PL_FAVORITED, track), false);
|
||||
test_equal(playlist_has(PL_FAVORITED, track), (bool)false);
|
||||
test_equal(queue_size(q), 1);
|
||||
|
||||
playlist_remove(PL_FAVORITED, track);
|
||||
|
@ -99,9 +97,9 @@ static void test_remove()
|
|||
playlist_select(PL_BANNED);
|
||||
test_equal(queue_size(q), 1);
|
||||
test_equal(queue_size(c), 12);
|
||||
test_equal(playlist_has(PL_BANNED, track), true);
|
||||
test_equal(playlist_has(PL_BANNED, track), (bool)true);
|
||||
playlist_remove(PL_BANNED, track);
|
||||
test_equal(playlist_has(PL_BANNED, track), false);
|
||||
test_equal(playlist_has(PL_BANNED, track), (bool)false);
|
||||
test_equal(queue_size(q), 0);
|
||||
test_equal(queue_size(c), 13);
|
||||
}
|
||||
|
@ -152,7 +150,7 @@ static void test_deinit()
|
|||
filter_deinit();
|
||||
|
||||
test_equal(queue_size(q), 0);
|
||||
test_equal(q->q_sort, NULL);
|
||||
test_equal((void *)q->q_sort, NULL);
|
||||
}
|
||||
|
||||
DECLARE_UNIT_TESTS(
|
Loading…
Reference in New Issue