Skip to content

Commit

Permalink
KtxImageConverter: fix DFD file reading in tests under Emscripten
Browse files Browse the repository at this point in the history
  • Loading branch information
pezcode committed Aug 25, 2021
1 parent e0e29f3 commit 91d87a1
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/MagnumPlugins/KtxImageConverter/Test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ configure_file(${CMAKE_CURRENT_SOURCE_DIR}/configure.h.cmake
file(GENERATE OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/$<CONFIG>/configure.h
INPUT ${CMAKE_CURRENT_BINARY_DIR}/configure.h.in)

file(GLOB DFD_FILES "dfd/*.dfd")
file(GLOB DFD_FILES "${CMAKE_CURRENT_SOURCE_DIR}/dfd/*.dfd")
corrade_add_test(KtxImageConverterTest KtxImageConverterTest.cpp
LIBRARIES Magnum::Trade
FILES
Expand Down Expand Up @@ -89,6 +89,7 @@ corrade_add_test(KtxImageConverterTest KtxImageConverterTest.cpp
${PROJECT_SOURCE_DIR}/src/MagnumPlugins/KtxImporter/Test/2d-compressed-mipmaps-mip2.bin
${PROJECT_SOURCE_DIR}/src/MagnumPlugins/KtxImporter/Test/2d-compressed-mipmaps-mip3.bin
${PROJECT_SOURCE_DIR}/src/MagnumPlugins/KtxImporter/Test/3d.ktx2
${PROJECT_SOURCE_DIR}/src/MagnumPlugins/KtxImporter/Test/3d-mipmaps.ktx2
${PROJECT_SOURCE_DIR}/src/MagnumPlugins/KtxImporter/Test/3d-compressed.ktx2
${PROJECT_SOURCE_DIR}/src/MagnumPlugins/KtxImporter/Test/3d-compressed.bin
${PROJECT_SOURCE_DIR}/src/MagnumPlugins/KtxImporter/Test/3d-compressed-mipmaps.ktx2
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -359,8 +359,14 @@ KtxImageConverterTest::KtxImageConverterTest() {
CORRADE_INTERNAL_ASSERT_OUTPUT(_importerManager.load(KTXIMPORTER_PLUGIN_FILENAME) & PluginManager::LoadState::Loaded);
#endif

/* Map VkFormat to DFD test file. The VkFormat value is in the file name. */
#ifdef CORRADE_TARGET_EMSCRIPTEN
/* Test files are embedded into the root of the virtual filesystem */
const std::string folder = KTXIMAGECONVERTER_TEST_DIR;
#else
const std::string folder = Utility::Directory::join(KTXIMAGECONVERTER_TEST_DIR, "dfd");
#endif

/* Map VkFormat to DFD test file. The VkFormat value is in the file name. */
const auto files = Utility::Directory::list(folder, Utility::Directory::Flag::SkipDirectories | Utility::Directory::Flag::SkipSpecial);
CORRADE_INTERNAL_ASSERT(!files.empty());
for(const auto& f: files) {
Expand Down

0 comments on commit 91d87a1

Please sign in to comment.