Fix tagreader test

This commit is contained in:
Jonas Kvinge 2021-07-07 23:45:57 +02:00
parent f5091339ad
commit 2a7312f2b4
1 changed files with 16 additions and 3 deletions

View File

@ -29,7 +29,12 @@
#include "core/song.h" #include "core/song.h"
#include "tagreader.h" #if defined(USE_TAGLIB)
# include "tagreadertaglib.h"
#elif defined(USE_TAGPARSER)
# include "tagreadertagparser.h"
#endif
#include "test_utils.h" #include "test_utils.h"
// clazy:excludeall=non-pod-global-static // clazy:excludeall=non-pod-global-static
@ -44,7 +49,11 @@ class TagReaderTest : public ::testing::Test {
} }
static Song ReadSongFromFile(const QString& filename) { static Song ReadSongFromFile(const QString& filename) {
TagReader tag_reader; #if defined(USE_TAGLIB)
TagReaderTagLib tag_reader;
#elif defined(USE_TAGPARSER)
TagReaderTagParser tag_reader;
#endif
Song song; Song song;
::spb::tagreader::SongMetadata pb_song; ::spb::tagreader::SongMetadata pb_song;
@ -56,7 +65,11 @@ class TagReaderTest : public ::testing::Test {
} }
static void WriteSongToFile(const Song& song, const QString& filename) { static void WriteSongToFile(const Song& song, const QString& filename) {
TagReader tag_reader; #if defined(USE_TAGLIB)
TagReaderTagLib tag_reader;
#elif defined(USE_TAGPARSER)
TagReaderTagParser tag_reader;
#endif
::spb::tagreader::SongMetadata pb_song; ::spb::tagreader::SongMetadata pb_song;
song.ToProtobuf(&pb_song); song.ToProtobuf(&pb_song);
tag_reader.SaveFile(filename, pb_song); tag_reader.SaveFile(filename, pb_song);