Commit 3853d557 authored by Hugo Beauzée-Luyssen's avatar Hugo Beauzée-Luyssen

unittests: Always provide a IMediaLibraryCb* instance

parent 2f951dfb
......@@ -53,13 +53,20 @@ void Tests::TearDown()
ml.reset();
}
void Tests::Reload(std::shared_ptr<factory::IFileSystem> fs /*= nullptr*/, IMediaLibraryCb* metadataCb /*= nullptr*/ )
void Tests::Reload( std::shared_ptr<factory::IFileSystem> fs /*= nullptr*/, IMediaLibraryCb* metadataCb /*= nullptr*/ )
{
InstantiateMediaLibrary();
if ( fs == nullptr )
{
fs = std::shared_ptr<factory::IFileSystem>( new mock::NoopFsFactory );
}
if ( metadataCb == nullptr )
{
if ( cbMock == nullptr )
cbMock.reset( new mock::NoopCallback );
metadataCb = cbMock.get();
}
ml->setFsFactory( fs );
ml->setVerbosity( LogLevel::Error );
bool res = ml->initialize( "test.db", "/tmp", metadataCb );
......
......@@ -27,6 +27,7 @@ class Playlist;
#include "factory/IFileSystem.h"
#include "MediaLibrary.h"
#include "Folder.h"
#include "mocks/NoopCallback.h"
class MediaLibraryTester : public MediaLibrary
{
......@@ -71,6 +72,7 @@ class Tests : public testing::Test
{
protected:
std::unique_ptr<MediaLibraryTester> ml;
std::unique_ptr<mock::NoopCallback> cbMock;
virtual void SetUp() override;
virtual void InstantiateMediaLibrary();
......
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