Track: Move the default constructor to a new cpp file
I also use this opportunity to create a new default constructor test for the Track tag. This patch also disables the tags test since the tagdb will be going away soon. Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
This commit is contained in:
parent
3e0fb88b1d
commit
7e52c9b364
|
@ -21,8 +21,6 @@ Database<Track> track_db("track.db", false);
|
|||
*
|
||||
*/
|
||||
|
||||
Track :: Track() : library(NULL), artist(NULL), album(NULL), genre(NULL){}
|
||||
|
||||
Track :: Track(const std::string &f, Library *l)
|
||||
: library(l), artist(NULL), album(NULL), genre(NULL),
|
||||
play_count(0), last_year(0), last_month(0), last_day(0),
|
||||
|
@ -134,6 +132,8 @@ bool Track :: tag()
|
|||
|
||||
const std::string Track :: path() const
|
||||
{
|
||||
if (!library)
|
||||
return "";
|
||||
return library->primary_key() + "/" + filepath;
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
/**
|
||||
* @file
|
||||
* Copyright 2014 (c) Anna Schumaker.
|
||||
*/
|
||||
#include <core/tags/track.h>
|
||||
|
||||
|
||||
Track :: Track()
|
||||
: GenericTag(),
|
||||
library(NULL), artist(NULL), album(NULL), genre(NULL),
|
||||
track(0), length(0), play_count(0), last_year(0), last_month(0), last_day(0)
|
||||
{}
|
|
@ -6,6 +6,10 @@
|
|||
#define OCARINA_CORE_TAGS_TRACK_H
|
||||
|
||||
#include <core/tags/generic.h>
|
||||
#include <core/tags/artist.h>
|
||||
#include <core/tags/album.h>
|
||||
#include <core/tags/genre.h>
|
||||
#include <core/tags/library.h>
|
||||
|
||||
|
||||
/**
|
||||
|
@ -33,7 +37,7 @@ enum sort_t {
|
|||
};
|
||||
|
||||
|
||||
class Track : public DatabaseEntry {
|
||||
class Track : public GenericTag {
|
||||
private:
|
||||
void set_length_str();
|
||||
|
||||
|
|
|
@ -23,6 +23,8 @@ test( "tags/library" )
|
|||
test_env.UsePackage("taglib")
|
||||
objs += [ get_test_obj("tags", "core") ]
|
||||
objs += [ get_test_obj("tags/tags", "core") ]
|
||||
test( "tags/track" )
|
||||
|
||||
#test( "tags" )
|
||||
test( "random" )
|
||||
|
||||
|
|
|
@ -3,3 +3,4 @@ artist
|
|||
generic
|
||||
genre
|
||||
library
|
||||
track
|
||||
|
|
|
@ -0,0 +1,37 @@
|
|||
/**
|
||||
* @file
|
||||
* Copyright 2014 (c) Anna Schumaker.
|
||||
*/
|
||||
#include <core/tags/track.h>
|
||||
#include <tests/test.h>
|
||||
|
||||
static void test_track_tag()
|
||||
{
|
||||
Track track;
|
||||
|
||||
test_equal(track.library, (Library *)NULL);
|
||||
test_equal(track.artist, (Artist *)NULL);
|
||||
test_equal(track.album, (Album *)NULL);
|
||||
test_equal(track.genre, (Genre *)NULL);
|
||||
|
||||
test_equal(track.name(), (std::string)"");
|
||||
test_equal(track.lowercase(), (std::string)"");
|
||||
test_equal(track.primary_key(), (std::string)"");
|
||||
test_equal(track.title, (std::string)"");
|
||||
test_equal(track.title_lower, (std::string)"");
|
||||
test_equal(track.filepath, (std::string)"");
|
||||
test_equal(track.length_str, (std::string)"");
|
||||
|
||||
test_equal(track.track, (unsigned)0);
|
||||
test_equal(track.length, (unsigned)0);
|
||||
test_equal(track.play_count, (unsigned)0);
|
||||
test_equal(track.last_year, (unsigned)0);
|
||||
test_equal(track.last_month, (unsigned)0);
|
||||
test_equal(track.last_day, (unsigned)0);
|
||||
}
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
run_test("Track Tag Test", test_track_tag);
|
||||
return 0;
|
||||
}
|
Loading…
Reference in New Issue