Introduced the artwork table. Now resolve the preferred release artwork during scan steps

This commit is contained in:
emeric
2025-06-17 09:46:42 +02:00
parent e5205e7115
commit 7494d055e7
15 changed files with 384 additions and 91 deletions
+10 -7
View File
@@ -20,10 +20,12 @@
#include "Common.hpp"
#include "core/PartialDateTime.hpp"
#include "database/Artwork.hpp"
#include "database/Image.hpp"
namespace lms::db::tests
{
using ScopedArtwork = ScopedEntity<db::Artwork>;
using ScopedImage = ScopedEntity<db::Image>;
using ScopedLabel = ScopedEntity<db::Label>;
using ScopedCountry = ScopedEntity<db::Country>;
@@ -1195,27 +1197,28 @@ namespace lms::db::tests
}
}
TEST_F(DatabaseFixture, Release_image)
TEST_F(DatabaseFixture, Release_artwork)
{
ScopedRelease release{ session, "MyRelease" };
{
auto transaction{ session.createReadTransaction() };
EXPECT_FALSE(release.get()->getImage());
EXPECT_FALSE(release.get()->getPreferredArtwork());
}
ScopedImage image{ session, "/myImage" };
ScopedImage image{ session, "/image.jpg" };
ScopedArtwork artwork{ session, image.lockAndGet() };
{
auto transaction{ session.createWriteTransaction() };
release.get().modify()->setImage(image.get());
release.get().modify()->setPreferredArtwork(artwork.get());
}
{
auto transaction{ session.createReadTransaction() };
auto releaseImage(release.get()->getImage());
ASSERT_TRUE(releaseImage);
EXPECT_EQ(releaseImage->getId(), image.getId());
auto releaseArtwork(release.get()->getPreferredArtwork());
ASSERT_TRUE(releaseArtwork);
EXPECT_EQ(releaseArtwork->getId(), artwork.getId());
}
}