deck: Make sure that Q_NOTIFY_REMOVE is set
TempQueues need this to tell the GUI when they have been removed. Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
This commit is contained in:
parent
e8b68b84eb
commit
116d1cd28f
|
@ -29,7 +29,7 @@ static File deck_file("deck", 1);
|
|||
|
||||
TempQueue :: TempQueue() {}
|
||||
TempQueue :: TempQueue(bool random)
|
||||
: Queue(Q_ENABLED | (random ? Q_RANDOM : 0)) {}
|
||||
: Queue(Q_ENABLED | (random ? Q_RANDOM : 0) | Q_NOTIFY_REMOVE) {}
|
||||
|
||||
void TempQueue :: set_flag(queue_flags flag)
|
||||
{
|
||||
|
|
|
@ -61,16 +61,21 @@ static void test_init()
|
|||
}
|
||||
|
||||
static unsigned int n = 0;
|
||||
static void on_queue_removed(Queue *queue)
|
||||
{
|
||||
n++;
|
||||
}
|
||||
static class TestNotifier : public QNotifier {
|
||||
public:
|
||||
TestNotifier() : QNotifier() {}
|
||||
void on_remove() { n++; }
|
||||
void on_track_added(unsigned int i) {}
|
||||
void on_track_removed(unsigned int i) {}
|
||||
void on_track_updated(unsigned int i) {}
|
||||
} test_notifier;
|
||||
|
||||
static void test_create_mv_destroy()
|
||||
{
|
||||
Queue *q1, *q2;
|
||||
|
||||
q1 = deck :: create(true);
|
||||
q1->set_notifier(&test_notifier);
|
||||
test_not_equal(q1, Q_NULL);
|
||||
test_equal(q1->has_flag(Q_ENABLED), true);
|
||||
test_equal(q1->has_flag(Q_RANDOM), true);
|
||||
|
@ -78,6 +83,7 @@ static void test_create_mv_destroy()
|
|||
test_equal(deck :: get(2), q1);
|
||||
|
||||
q2 = deck :: create(false);
|
||||
q2->set_notifier(&test_notifier);
|
||||
test_not_equal(q2, Q_NULL);
|
||||
test_equal(q2->has_flag(Q_ENABLED), true);
|
||||
test_equal(q2->has_flag(Q_RANDOM), false);
|
||||
|
@ -91,8 +97,6 @@ static void test_create_mv_destroy()
|
|||
deck :: move(q1, 2);
|
||||
test_equal(deck :: index(q1), (unsigned)2);
|
||||
|
||||
get_callbacks()->on_pq_removed = on_queue_removed;
|
||||
|
||||
deck :: destroy(q1);
|
||||
test_equal(n, (unsigned)1);
|
||||
test_equal(deck :: index(q1), (unsigned)3);
|
||||
|
|
Loading…
Reference in New Issue