@@ -87,7 +87,6 @@ if(Qt5Test_FOUND AND GTEST_FOUND AND GMOCK_LIBRARY)
|
||||
add_test_file(src/song_test.cpp false)
|
||||
add_test_file(src/collectionbackend_test.cpp false)
|
||||
add_test_file(src/collectionmodel_test.cpp true)
|
||||
add_test_file(src/playlist_test.cpp true)
|
||||
add_test_file(src/songplaylistitem_test.cpp false)
|
||||
add_test_file(src/organiseformat_test.cpp false)
|
||||
|
||||
|
||||
@@ -75,6 +75,8 @@ class CollectionModelTest : public ::testing::Test {
|
||||
Song AddSong(const QString& title, const QString& artist, const QString& album, int length) {
|
||||
Song song;
|
||||
song.Init(title, artist, album, length);
|
||||
song.set_mtime(0);
|
||||
song.set_ctime(0);
|
||||
return AddSong(song);
|
||||
}
|
||||
|
||||
@@ -111,6 +113,8 @@ TEST_F(CollectionModelTest, CompilationAlbums) {
|
||||
Song song;
|
||||
song.Init("Title", "Artist", "Album", 123);
|
||||
song.set_compilation(true);
|
||||
song.set_mtime(0);
|
||||
song.set_ctime(0);
|
||||
|
||||
AddSong(song);
|
||||
model_->Init(false);
|
||||
@@ -200,6 +204,8 @@ TEST_F(CollectionModelTest, VariousArtistSongs) {
|
||||
QString n = QString::number(i+1);
|
||||
Song song;
|
||||
song.Init("Title " + n, "Artist " + n, "Album", 0);
|
||||
song.set_mtime(0);
|
||||
song.set_ctime(0);
|
||||
songs << song;
|
||||
}
|
||||
|
||||
|
||||
@@ -59,6 +59,7 @@ TEST_F(OrganiseFormatTest, BasicReplace) {
|
||||
format_.set_format("%album %albumartist %artist %bitrate %comment %composer %performer %grouping %disc %genre %length %samplerate %bitdepth %title %track %year");
|
||||
|
||||
ASSERT_TRUE(format_.IsValid());
|
||||
|
||||
EXPECT_EQ("album_albumartist_artist_123_comment_composer_performer_grouping_789_genre_987_654_32_title_321_2010", format_.GetFilenameForSong(song_));
|
||||
|
||||
}
|
||||
@@ -135,11 +136,12 @@ TEST_F(OrganiseFormatTest, ReplaceNonAscii) {
|
||||
|
||||
format_.set_remove_non_ascii(false);
|
||||
EXPECT_EQ(QString::fromUtf8("Röyksopp"), format_.GetFilenameForSong(song_));
|
||||
|
||||
format_.set_remove_non_ascii(true);
|
||||
EXPECT_EQ("Royksopp", format_.GetFilenameForSong(song_));
|
||||
|
||||
song_.set_artist(QString::fromUtf8("Владимир Высоцкий"));
|
||||
EXPECT_EQ("_________________", format_.GetFilenameForSong(song_));
|
||||
EXPECT_EQ("????????_????????", format_.GetFilenameForSong(song_));
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -53,15 +53,15 @@ class PlaylistTest : public ::testing::Test {
|
||||
Song metadata;
|
||||
metadata.Init(title, artist, album, length);
|
||||
|
||||
//MockPlaylistItem* ret = new MockPlaylistItem;
|
||||
MockPlaylistItem *ret = new MockPlaylistItem;
|
||||
//EXPECT_CALL(*ret, Metadata()).WillRepeatedly(Return(metadata));
|
||||
|
||||
//return ret;
|
||||
return ret;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
std::shared_ptr<PlaylistItem> MakeMockItemP(const QString& title, const QString& artist = QString(), const QString& album = QString(), int length = 123) const {
|
||||
return std::shared_ptr<PlaylistItem>(MakeMockItem(title, artist, album, length));
|
||||
PlaylistItemPtr MakeMockItemP(const QString& title, const QString& artist = QString(), const QString& album = QString(), int length = 123) const {
|
||||
return PlaylistItemPtr(MakeMockItem(title, artist, album, length));
|
||||
}
|
||||
|
||||
Playlist playlist_;
|
||||
@@ -76,7 +76,7 @@ TEST_F(PlaylistTest, Basic) {
|
||||
TEST_F(PlaylistTest, InsertItems) {
|
||||
|
||||
MockPlaylistItem* item = MakeMockItem("Title", "Artist", "Album", 123);
|
||||
std::shared_ptr<PlaylistItem> item_ptr(item);
|
||||
PlaylistItemPtr item_ptr(item);
|
||||
|
||||
// Insert the item
|
||||
EXPECT_EQ(0, playlist_.rowCount(QModelIndex()));
|
||||
|
||||
Reference in New Issue
Block a user