Commit 461d87a6 authored by Hugo Beauzée-Luyssen's avatar Hugo Beauzée-Luyssen

unittest: Add a test to check the supported extensions order

parent 7f0566b5
...@@ -283,6 +283,7 @@ unittest_SOURCES = \ ...@@ -283,6 +283,7 @@ unittest_SOURCES = \
test/unittest/ShowTests.cpp \ test/unittest/ShowTests.cpp \
test/unittest/Tests.cpp \ test/unittest/Tests.cpp \
test/unittest/VideoTrackTests.cpp \ test/unittest/VideoTrackTests.cpp \
test/unittest/MiscTests.cpp \
$(NULL) $(NULL)
unittest_CPPFLAGS = \ unittest_CPPFLAGS = \
......
...@@ -82,6 +82,8 @@ const char* const MediaLibrary::supportedExtensions[] = { ...@@ -82,6 +82,8 @@ const char* const MediaLibrary::supportedExtensions[] = {
"wav", "webm", "wma", "wmv", "wv", "xa", "xm" "wav", "webm", "wma", "wmv", "wv", "xa", "xm"
}; };
const size_t MediaLibrary::NbSupportedExtensions = sizeof(supportedExtensions) / sizeof(supportedExtensions[0]);
const uint32_t MediaLibrary::DbModelVersion = 2; const uint32_t MediaLibrary::DbModelVersion = 2;
MediaLibrary::MediaLibrary() MediaLibrary::MediaLibrary()
......
...@@ -145,8 +145,10 @@ class MediaLibrary : public IMediaLibrary, public IDeviceListerCb ...@@ -145,8 +145,10 @@ class MediaLibrary : public IMediaLibrary, public IDeviceListerCb
public: public:
static const uint32_t DbModelVersion; static const uint32_t DbModelVersion;
private: protected:
// Allow access to unit test MediaLibrary implementations
static const char* const supportedExtensions[]; static const char* const supportedExtensions[];
static const size_t NbSupportedExtensions;
private: private:
virtual void startParser(); virtual void startParser();
......
...@@ -145,3 +145,12 @@ std::shared_ptr<Device> MediaLibraryTester::device( const std::string& uuid ) ...@@ -145,3 +145,12 @@ std::shared_ptr<Device> MediaLibraryTester::device( const std::string& uuid )
{ {
return Device::fromUuid( this, uuid ); return Device::fromUuid( this, uuid );
} }
std::vector<const char*> MediaLibraryTester::getSupportedExtensions() const
{
std::vector<const char*> res;
res.reserve( NbSupportedExtensions );
for ( auto i = 0u; i < NbSupportedExtensions; ++i )
res.push_back( supportedExtensions[i] );
return res;
}
...@@ -60,6 +60,7 @@ public: ...@@ -60,6 +60,7 @@ public:
std::shared_ptr<Media> addFile( const std::string& path ); std::shared_ptr<Media> addFile( const std::string& path );
virtual void addLocalFsFactory() override; virtual void addLocalFsFactory() override;
std::shared_ptr<Device> device( const std::string& uuid ); std::shared_ptr<Device> device( const std::string& uuid );
std::vector<const char*> getSupportedExtensions() const;
private: private:
std::unique_ptr<fs::IDirectory> dummyDirectory; std::unique_ptr<fs::IDirectory> dummyDirectory;
......
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