diff --git a/include/core/driver.h b/include/core/driver.h index e71a7de2..03588ff8 100644 --- a/include/core/driver.h +++ b/include/core/driver.h @@ -86,32 +86,4 @@ public: virtual long duration() = 0; }; - -#ifdef CONFIG_TEST -class TestDriver : public Driver -{ -public: - bool playing; - long cur_pos; - long cur_duration; - std::string cur_file; - - TestDriver(); - ~TestDriver(); - void init(int *, char ***, void (*)(), void (*)()); - - void load(const std::string &); - bool play(); - bool pause(); - bool is_playing(); - - void seek_to(long); - long position(); - long duration(); - - void eos(); - void error(); -}; -#endif /* CONFIG_TEST */ - #endif /* OCARINA_CORE_DRIVER_H */ diff --git a/tests/core/audio.cpp b/tests/core/audio.cpp index 4f4013f7..883908b7 100644 --- a/tests/core/audio.cpp +++ b/tests/core/audio.cpp @@ -11,24 +11,52 @@ Track *TRACK_NULL = NULL; static unsigned int eos_count = 0; static unsigned int error_count = 0; -TestDriver :: TestDriver() : playing(false), cur_pos(0), cur_duration(0) {} -TestDriver :: ~TestDriver() {} -void TestDriver :: init(int *argc, char ***argv, void (*eos_cb)(), void (*error_cb)()) - { on_eos = eos_cb; on_error = error_cb; } -void TestDriver :: load(const std::string &file) - { cur_file = file; playing = false; cur_pos = 0; } -bool TestDriver :: play() { playing = true; return true; } -bool TestDriver :: pause() { playing = false; return true; } -bool TestDriver :: is_playing() { return playing; } +class TestDriver : public Driver +{ +public: + bool playing; + long cur_pos; + long cur_duration; + std::string cur_file; -void TestDriver :: seek_to(long pos) { cur_pos = pos; } -long TestDriver :: position() { return cur_pos; } -long TestDriver :: duration() { return cur_duration; } + TestDriver() : playing(false), cur_pos(0), cur_duration(0) {} + ~TestDriver() {}; -void TestDriver :: eos() { on_eos(); } -void TestDriver :: error() { on_error(); } + void init(int *argc, char ***argv, void (*eos_cb)(), void (*error_cb)()) + { + on_eos = eos_cb; + on_error = error_cb; + } + void load(const std::string &file) + { + cur_file = file; + playing = false; + cur_pos = 0; + } + + bool play() + { + playing = true; + return true; + } + + bool pause() + { + playing = false; + return true; + } + + bool is_playing() { return playing; } + + void seek_to(long offset) { cur_pos = offset; } + long position() { return cur_pos; } + long duration() { return cur_duration; } + + void eos() { on_eos(); } + void error() { on_error(); } +}; void on_eos() {