Browse Source

AnyAudioImporter: test case for uppercase extensions

pull/312/head
Max Schwarz 7 years ago
parent
commit
8c12e06d41
  1. 16
      src/MagnumPlugins/AnyAudioImporter/Test/AnyAudioImporterTest.cpp
  2. 5
      src/MagnumPlugins/AnyAudioImporter/Test/CMakeLists.txt
  3. 1
      src/MagnumPlugins/AnyAudioImporter/Test/configure.h.cmake
  4. BIN
      src/MagnumPlugins/WavAudioImporter/Test/uppercase.WAV

16
src/MagnumPlugins/AnyAudioImporter/Test/AnyAudioImporterTest.cpp

@ -38,6 +38,8 @@ struct AnyImporterTest: TestSuite::Tester {
void wav();
void uppercase();
void unknown();
/* Explicitly forbid system-wide plugin dependencies */
@ -46,7 +48,7 @@ struct AnyImporterTest: TestSuite::Tester {
AnyImporterTest::AnyImporterTest() {
addTests({&AnyImporterTest::wav,
&AnyImporterTest::uppercase,
&AnyImporterTest::unknown});
/* Load the plugin directly from the build tree. Otherwise it's static and
@ -72,6 +74,18 @@ void AnyImporterTest::wav() {
CORRADE_COMPARE(importer->frequency(), 96000);
}
void AnyImporterTest::uppercase() {
if(!(_manager.loadState("WavAudioImporter") & PluginManager::LoadState::Loaded))
CORRADE_SKIP("WavAudioImporter plugin not enabled, cannot test");
Containers::Pointer<AbstractImporter> importer = _manager.instantiate("AnyAudioImporter");
CORRADE_VERIFY(importer->openFile(UPPERCASE_WAV_FILE));
/* Check only parameters, as it is good enough proof that it is working */
CORRADE_COMPARE(importer->format(), BufferFormat::Stereo8);
CORRADE_COMPARE(importer->frequency(), 96000);
}
void AnyImporterTest::unknown() {
std::ostringstream output;
Error redirectError{&output};

5
src/MagnumPlugins/AnyAudioImporter/Test/CMakeLists.txt

@ -25,8 +25,10 @@
if(CORRADE_TARGET_EMSCRIPTEN OR CORRADE_TARGET_ANDROID)
set(WAV_FILE stereo8.wav)
set(UPPERCASE_WAV_FILE uppercase.wav)
else()
set(WAV_FILE ${PROJECT_SOURCE_DIR}/src/MagnumPlugins/WavAudioImporter/Test/stereo8.wav)
set(UPPERCASE_WAV_FILE ${PROJECT_SOURCE_DIR}/src/MagnumPlugins/WavAudioImporter/Test/uppercase.WAV)
endif()
# CMake before 3.8 has broken $<TARGET_FILE*> expressions for iOS (see
@ -52,7 +54,8 @@ endif()
corrade_add_test(AnyAudioImporterTest AnyAudioImporterTest.cpp
LIBRARIES MagnumAudio
FILES
../../WavAudioImporter/Test/stereo8.wav)
../../WavAudioImporter/Test/stereo8.wav
../../WavAudioImporter/Test/uppercase.WAV)
if(NOT BUILD_PLUGINS_STATIC)
target_include_directories(AnyAudioImporterTest PRIVATE $<TARGET_FILE_DIR:AnyAudioImporterTest>)
else()

1
src/MagnumPlugins/AnyAudioImporter/Test/configure.h.cmake

@ -26,3 +26,4 @@
#cmakedefine ANYAUDIOIMPORTER_PLUGIN_FILENAME "${ANYAUDIOIMPORTER_PLUGIN_FILENAME}"
#cmakedefine WAVAUDIOIMPORTER_PLUGIN_FILENAME "${WAVAUDIOIMPORTER_PLUGIN_FILENAME}"
#define WAV_FILE "${WAV_FILE}"
#define UPPERCASE_WAV_FILE "${UPPERCASE_WAV_FILE}"

BIN
src/MagnumPlugins/WavAudioImporter/Test/uppercase.WAV

Binary file not shown.
Loading…
Cancel
Save