Track: Begin a new Track constructor
I want to provide the Library, Artist, Album, and Genre tags to the Track on construction to (hopefully) eliminate the Track::tag() function. Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
This commit is contained in:
parent
37613573e4
commit
6149c928d2
|
@ -11,4 +11,10 @@ Track :: Track()
|
||||||
track(0), length(0), play_count(0), last_year(0), last_month(0), last_day(0)
|
track(0), length(0), play_count(0), last_year(0), last_month(0), last_day(0)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
Track :: Track(Library *library)
|
||||||
|
: _library(library)
|
||||||
|
{
|
||||||
|
_library->inc_size();
|
||||||
|
}
|
||||||
|
|
||||||
Library *Track :: library() { return _library; }
|
Library *Track :: library() { return _library; }
|
||||||
|
|
|
@ -76,6 +76,13 @@ public:
|
||||||
/** Track constructor */
|
/** Track constructor */
|
||||||
Track();
|
Track();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Track constructor
|
||||||
|
*
|
||||||
|
* @param library The library containing this track.
|
||||||
|
*/
|
||||||
|
Track(Library *);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Track constructor
|
* Track constructor
|
||||||
* @param filepath Filepath of the track
|
* @param filepath Filepath of the track
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
#include <core/tags/track.h>
|
#include <core/tags/track.h>
|
||||||
#include <tests/test.h>
|
#include <tests/test.h>
|
||||||
|
|
||||||
static void test_track_tag()
|
static void test_track_tag_default()
|
||||||
{
|
{
|
||||||
Track track;
|
Track track;
|
||||||
|
|
||||||
|
@ -30,8 +30,18 @@ static void test_track_tag()
|
||||||
test_equal(track.last_day, (unsigned)0);
|
test_equal(track.last_day, (unsigned)0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void test_track_tag_constructor()
|
||||||
|
{
|
||||||
|
Library *library = tags :: get_library("/home/Zelda/Music");
|
||||||
|
Track track(library);
|
||||||
|
|
||||||
|
test_equal(track.library(), library);
|
||||||
|
test_equal(track.library()->size(), (unsigned)1);
|
||||||
|
}
|
||||||
|
|
||||||
int main(int argc, char **argv)
|
int main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
run_test("Track Tag Test", test_track_tag);
|
run_test("Track Tag Default Constructor Test", test_track_tag_default);
|
||||||
|
run_test("Track Tag Constructor Test", test_track_tag_constructor);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue