Track: Re-enable filtering
This has been disabled for some time. I added a test for adding track indexes to the filter upon creation, but it doesn't properly test adding to the filter when reading from disk. Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
This commit is contained in:
parent
09bf458d7a
commit
2394e46fb7
|
@ -2,6 +2,7 @@
|
|||
* @file
|
||||
* Copyright 2014 (c) Anna Schumaker.
|
||||
*/
|
||||
#include <core/filter.h>
|
||||
#include <core/tags/track.h>
|
||||
|
||||
#include <sstream>
|
||||
|
@ -24,9 +25,9 @@ Track :: Track(Album *album, Artist *artist, Genre *genre, Library *library,
|
|||
_album(album), _artist(artist), _genre(genre), _library(library),
|
||||
_count(0), _length(length), _track(track), _path(filepath)
|
||||
{
|
||||
//filter :: add(name(), index());
|
||||
//filter :: add(_artist->name(), index());
|
||||
//filter :: add(_album->name(), index());
|
||||
filter :: add(this->name(), index());
|
||||
filter :: add(_artist->name(), index());
|
||||
filter :: add(_album->name(), index());
|
||||
_library->inc_size();
|
||||
}
|
||||
|
||||
|
@ -138,9 +139,9 @@ void Track :: read(File &f)
|
|||
_album = tags :: get_album(album_id);
|
||||
_genre = tags :: get_genre(genre_id);
|
||||
|
||||
//filter :: add(name(), index());
|
||||
//filter :: add(_artist->name(), index());
|
||||
//filter :: add(_album->name(), index());
|
||||
filter :: add(name(), index());
|
||||
filter :: add(_artist->name(), index());
|
||||
filter :: add(_album->name(), index());
|
||||
_library->inc_size();
|
||||
}
|
||||
|
||||
|
|
|
@ -2,8 +2,11 @@
|
|||
* @file
|
||||
* Copyright 2014 (c) Anna Schumaker.
|
||||
*/
|
||||
#include <core/filter.h>
|
||||
#include <core/tags/track.h>
|
||||
#include <tests/test.h>
|
||||
|
||||
#include <set>
|
||||
#include <sstream>
|
||||
|
||||
|
||||
|
@ -61,6 +64,7 @@ static void test_track_tag_constructor()
|
|||
Track a(album, artist, genre, library,
|
||||
"Hyrule Symphony/13 - Legend of Zelda Medley.mp3",
|
||||
"Legend of Zelda Medley", 288, 13);
|
||||
std::set<unsigned int> search;
|
||||
Track b;
|
||||
|
||||
verify_track_tag(&a, 1);
|
||||
|
@ -74,6 +78,19 @@ static void test_track_tag_constructor()
|
|||
f.close();
|
||||
|
||||
verify_track_tag(&b, 2);
|
||||
|
||||
|
||||
filter :: search("Legend of Zelda Medley", search);
|
||||
test_equal(search.size(), (size_t)1);
|
||||
test_equal((*search.begin()), (unsigned)0);
|
||||
|
||||
filter :: search("Koji Kondo", search);
|
||||
test_equal(search.size(), (size_t)1);
|
||||
test_equal((*search.begin()), (unsigned)0);
|
||||
|
||||
filter :: search("Hyrule Symphony", search);
|
||||
test_equal(search.size(), (size_t)1);
|
||||
test_equal((*search.begin()), (unsigned)0);
|
||||
}
|
||||
|
||||
static void test_track_tag_destructor()
|
||||
|
|
Loading…
Reference in New Issue
Block a user