From 0de8b456122e20109a9fd763dd1592025aa97169 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hugo=20Beauz=C3=A9e-Luyssen?= Date: Mon, 21 Feb 2022 08:58:29 +0100 Subject: [PATCH] tests: Fix stream based resolver test --- tests/test_fileref.cpp | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/tests/test_fileref.cpp b/tests/test_fileref.cpp index 1fc5def9..f8e79afa 100644 --- a/tests/test_fileref.cpp +++ b/tests/test_fileref.cpp @@ -60,6 +60,18 @@ namespace return new Ogg::Vorbis::File(fileName); } }; + class DummyStreamResolver : public FileRef::StreamTypeResolver + { + public: + virtual File *createFile(FileName, bool, AudioProperties::ReadStyle) const + { + return 0; + } + virtual File *createFileFromStream(IOStream *s, bool, AudioProperties::ReadStyle) const + { + return new MP4::File(s); + } + }; } class TestFileRef : public CppUnit::TestFixture @@ -387,6 +399,15 @@ public: FileRef f(TEST_FILE_PATH_C("xing.mp3")); CPPUNIT_ASSERT(dynamic_cast(f.file()) != NULL); } + + DummyStreamResolver streamResolver; + FileRef::addFileTypeResolver(&streamResolver); + + { + FileStream s(TEST_FILE_PATH_C("xing.mp3")); + FileRef f(&s); + CPPUNIT_ASSERT(dynamic_cast(f.file()) != NULL); + } } };