Added a way to set artists that must not be split, fixes #522

This commit is contained in:
emeric
2025-04-27 18:03:45 +02:00
parent a26632828e
commit cc9c6a42ff
21 changed files with 233 additions and 38 deletions
+1
View File
@@ -15,6 +15,7 @@ add_executable(test-database
RatedRelease.cpp
RatedTrack.cpp
Release.cpp
ScanSettings.cpp
StarredArtist.cpp
StarredRelease.cpp
StarredTrack.cpp
+2
View File
@@ -31,6 +31,7 @@
#include "database/RatedArtist.hpp"
#include "database/RatedRelease.hpp"
#include "database/RatedTrack.hpp"
#include "database/ScanSettings.hpp"
#include "database/StarredArtist.hpp"
#include "database/StarredRelease.hpp"
#include "database/StarredTrack.hpp"
@@ -362,6 +363,7 @@ VALUES
EXPECT_FALSE(RatedTrack::find(session, RatedTrackId{}));
EXPECT_FALSE(Release::find(session, ReleaseId{}));
EXPECT_FALSE(ReleaseType::find(session, ReleaseTypeId{}));
EXPECT_FALSE(ScanSettings::find(session, ScanSettingsId{}));
EXPECT_FALSE(StarredArtist::find(session, StarredArtistId{}));
EXPECT_FALSE(StarredRelease::find(session, StarredReleaseId{}));
EXPECT_FALSE(StarredTrack::find(session, StarredTrackId{}));
+52
View File
@@ -0,0 +1,52 @@
/*
* Copyright (C) 2021 Emeric Poupon
*
* This file is part of LMS.
*
* LMS is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* LMS is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with LMS. If not, see <http://www.gnu.org/licenses/>.
*/
#include "database/ScanSettings.hpp"
#include <initializer_list>
#include "Common.hpp"
namespace lms::db::tests
{
using ScopedScanSettings = ScopedEntity<db::ScanSettings>;
TEST_F(DatabaseFixture, ScanSettings)
{
ScopedScanSettings settings{ session, "test" };
{
auto transaction{ session.createReadTransaction() };
const auto artists{ settings.get()->getArtistsToNotSplit() };
ASSERT_EQ(artists.size(), 0);
}
{
auto transaction{ session.createWriteTransaction() };
settings.get().modify()->setArtistsToNotSplit(std::initializer_list<std::string_view>{ "AC/DC", "My/Artist" });
}
{
auto transaction{ session.createReadTransaction() };
const auto artists{ settings.get()->getArtistsToNotSplit() };
ASSERT_EQ(artists.size(), 2);
}
}
} // namespace lms::db::tests