Commit 214c7fc1 authored by Hugo Beauzée-Luyssen's avatar Hugo Beauzée-Luyssen

MediaLibrary: Add a way to fetch a bookmark by its id

parent f624aad5
Pipeline #59380 passed with stage
in 22 minutes and 9 seconds
......@@ -885,6 +885,8 @@ public:
virtual bool requestThumbnail( int64_t mediaId, ThumbnailSizeType sizeType,
uint32_t desiredWidth, uint32_t desiredHeight,
float position ) = 0;
virtual BookmarkPtr bookmark( int64_t bookmarkId ) const = 0;
};
}
......
......@@ -2814,5 +2814,9 @@ bool MediaLibrary::requestThumbnail( int64_t mediaId, ThumbnailSizeType sizeType
return true;
}
BookmarkPtr MediaLibrary::bookmark( int64_t bookmarkId ) const
{
return Bookmark::fetch( this, bookmarkId );
}
}
......@@ -267,6 +267,8 @@ public:
uint32_t desiredWidth, uint32_t desiredHeight,
float position ) override;
virtual BookmarkPtr bookmark( int64_t bookmarkId ) const override;
protected:
// Allow access to unit test MediaLibrary implementations
static const std::vector<const char*> SupportedMediaExtensions;
......
......@@ -293,3 +293,15 @@ TEST_F( Bookmarks, OrderByCreationDate )
ASSERT_EQ( b3->id(), bookmarks[1]->id() );
ASSERT_EQ( b1->id(), bookmarks[2]->id() );
}
TEST_F( Bookmarks, Fetch )
{
auto b = Bookmark::create( ml.get(), 1, m->id() );
ASSERT_NE( nullptr, b );
auto b2 = ml->bookmark( b->id() );
ASSERT_NE( b2, nullptr );
b2 = ml->bookmark( b->id() + 1 );
ASSERT_EQ( nullptr, b2 );
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment