diff --git a/src/Magnum/DebugTools/Test/ForceRendererGLTest.cpp b/src/Magnum/DebugTools/Test/ForceRendererGLTest.cpp index b352fcfc7..c36d8c7f2 100644 --- a/src/Magnum/DebugTools/Test/ForceRendererGLTest.cpp +++ b/src/Magnum/DebugTools/Test/ForceRendererGLTest.cpp @@ -24,8 +24,9 @@ */ #include +#include #include -#include +#include #include "Magnum/Image.h" #include "Magnum/ImageView.h" @@ -125,7 +126,7 @@ void ForceRendererGLTest::render2D() { CORRADE_COMPARE_WITH( framebuffer.read({{}, {64, 64}}, {PixelFormat::RGBA8Unorm}), - Utility::Directory::join(DEBUGTOOLS_TEST_DIR, "ForceRenderer2D.tga"), + Utility::Path::join(DEBUGTOOLS_TEST_DIR, "ForceRenderer2D.tga"), *comparator); } @@ -173,12 +174,12 @@ void ForceRendererGLTest::render3D() { CORRADE_EXPECT_FAIL("I'm unable to convince it to orient the arrowhead correctly in 3D."); CORRADE_COMPARE_WITH( framebuffer.read({{}, {64, 64}}, {PixelFormat::RGBA8Unorm}), - Utility::Directory::join(DEBUGTOOLS_TEST_DIR, "ForceRenderer2D.tga"), + Utility::Path::join(DEBUGTOOLS_TEST_DIR, "ForceRenderer2D.tga"), CompareImageToFile{_manager}); } CORRADE_COMPARE_WITH( framebuffer.read({{}, {64, 64}}, {PixelFormat::RGBA8Unorm}), - Utility::Directory::join(DEBUGTOOLS_TEST_DIR, "ForceRenderer3D.tga"), + Utility::Path::join(DEBUGTOOLS_TEST_DIR, "ForceRenderer3D.tga"), CompareImageToFile{_manager}); } diff --git a/src/Magnum/DebugTools/Test/ObjectRendererGLTest.cpp b/src/Magnum/DebugTools/Test/ObjectRendererGLTest.cpp index 12a460204..5d4d86ce8 100644 --- a/src/Magnum/DebugTools/Test/ObjectRendererGLTest.cpp +++ b/src/Magnum/DebugTools/Test/ObjectRendererGLTest.cpp @@ -24,8 +24,9 @@ */ #include +#include #include -#include +#include #include "Magnum/Image.h" #include "Magnum/ImageView.h" @@ -116,7 +117,7 @@ void ObjectRendererGLTest::render2D() { CORRADE_COMPARE_WITH( framebuffer.read({{}, {64, 64}}, {PixelFormat::RGBA8Unorm}), - Utility::Directory::join(DEBUGTOOLS_TEST_DIR, "ObjectRenderer2D.tga"), + Utility::Path::join(DEBUGTOOLS_TEST_DIR, "ObjectRenderer2D.tga"), /* SwiftShader misplaces two pixels here. Nothing serious. */ (CompareImageToFile{_manager, 71.6f, 0.07f})); } @@ -172,7 +173,7 @@ void ObjectRendererGLTest::render3D() { CORRADE_COMPARE_WITH( framebuffer.read({{}, {64, 64}}, {PixelFormat::RGBA8Unorm}), - Utility::Directory::join(DEBUGTOOLS_TEST_DIR, "ObjectRenderer3D.tga"), + Utility::Path::join(DEBUGTOOLS_TEST_DIR, "ObjectRenderer3D.tga"), *comparator); } diff --git a/src/Magnum/DebugTools/Test/ScreenshotGLTest.cpp b/src/Magnum/DebugTools/Test/ScreenshotGLTest.cpp index 84a9ff2b5..26ec110d1 100644 --- a/src/Magnum/DebugTools/Test/ScreenshotGLTest.cpp +++ b/src/Magnum/DebugTools/Test/ScreenshotGLTest.cpp @@ -25,10 +25,12 @@ #include #include +#include +#include /** @todo remove when screenshot() is -free */ #include -#include #include #include +#include #include "Magnum/ImageView.h" #include "Magnum/PixelFormat.h" @@ -122,11 +124,11 @@ void ScreenshotGLTest::rgba8() { CORRADE_COMPARE(framebuffer.checkStatus(GL::FramebufferTarget::Read), GL::Framebuffer::Status::Complete); - std::string file = Utility::Directory::join(SCREENSHOTTEST_SAVE_DIR, "image.tga"); - if(Utility::Directory::exists(file)) - CORRADE_VERIFY(Utility::Directory::rm(file)); + Containers::String file = Utility::Path::join(SCREENSHOTTEST_SAVE_DIR, "image.tga"); + if(Utility::Path::exists(file)) + CORRADE_VERIFY(Utility::Path::remove(file)); else - CORRADE_VERIFY(Utility::Directory::mkpath(SCREENSHOTTEST_SAVE_DIR)); + CORRADE_VERIFY(Utility::Path::make(SCREENSHOTTEST_SAVE_DIR)); std::ostringstream out; bool succeeded; @@ -179,11 +181,11 @@ void ScreenshotGLTest::r8() { CORRADE_COMPARE(framebuffer.checkStatus(GL::FramebufferTarget::Read), GL::Framebuffer::Status::Complete); - std::string file = Utility::Directory::join(SCREENSHOTTEST_SAVE_DIR, "image.tga"); - if(Utility::Directory::exists(file)) - CORRADE_VERIFY(Utility::Directory::rm(file)); + Containers::String file = Utility::Path::join(SCREENSHOTTEST_SAVE_DIR, "image.tga"); + if(Utility::Path::exists(file)) + CORRADE_VERIFY(Utility::Path::remove(file)); else - CORRADE_VERIFY(Utility::Directory::mkpath(SCREENSHOTTEST_SAVE_DIR)); + CORRADE_VERIFY(Utility::Path::make(SCREENSHOTTEST_SAVE_DIR)); std::ostringstream out; bool succeeded; @@ -236,7 +238,7 @@ void ScreenshotGLTest::unknownFormat() { bool succeeded; { Error redirectOutput{&out}; - succeeded = DebugTools::screenshot(_converterManager, framebuffer, Utility::Directory::join(SCREENSHOTTEST_SAVE_DIR, "image.tga")); + succeeded = DebugTools::screenshot(_converterManager, framebuffer, Utility::Path::join(SCREENSHOTTEST_SAVE_DIR, "image.tga")); } MAGNUM_VERIFY_NO_GL_ERROR(); @@ -273,7 +275,7 @@ void ScreenshotGLTest::pluginLoadFailed() { bool succeeded; { Error redirectOutput{&out}; - succeeded = DebugTools::screenshot(manager, framebuffer, Utility::Directory::join(SCREENSHOTTEST_SAVE_DIR, "image.poo")); + succeeded = DebugTools::screenshot(manager, framebuffer, Utility::Path::join(SCREENSHOTTEST_SAVE_DIR, "image.poo")); } MAGNUM_VERIFY_NO_GL_ERROR(); diff --git a/src/Magnum/GL/Test/RendererGLTest.cpp b/src/Magnum/GL/Test/RendererGLTest.cpp index b9f0eb435..fd8084748 100644 --- a/src/Magnum/GL/Test/RendererGLTest.cpp +++ b/src/Magnum/GL/Test/RendererGLTest.cpp @@ -30,6 +30,7 @@ #include #ifdef CORRADE_TARGET_APPLE +#include #include /* isSandboxed() */ #endif diff --git a/src/Magnum/MeshTools/Test/CompileGLTest.cpp b/src/Magnum/MeshTools/Test/CompileGLTest.cpp index 823e568ac..2fad00561 100644 --- a/src/Magnum/MeshTools/Test/CompileGLTest.cpp +++ b/src/Magnum/MeshTools/Test/CompileGLTest.cpp @@ -26,9 +26,10 @@ #include #include #include +#include #include -#include #include +#include #include "Magnum/Image.h" #include "Magnum/ImageView.h" @@ -515,7 +516,7 @@ template void CompileGLTest::twoDimensions() { MAGNUM_VERIFY_NO_GL_ERROR(); CORRADE_COMPARE_WITH( _framebuffer.read({{}, {32, 32}}, {PixelFormat::RGBA8Unorm}), - Utility::Directory::join(MESHTOOLS_TEST_DIR, "CompileTestFiles/flat2D.tga"), + Utility::Path::join(MESHTOOLS_TEST_DIR, "CompileTestFiles/flat2D.tga"), (DebugTools::CompareImageToFile{_manager})); } @@ -527,7 +528,7 @@ template void CompileGLTest::twoDimensions() { MAGNUM_VERIFY_NO_GL_ERROR(); CORRADE_COMPARE_WITH( _framebuffer.read({{}, {32, 32}}, {PixelFormat::RGBA8Unorm}), - Utility::Directory::join(MESHTOOLS_TEST_DIR, "CompileTestFiles/color2D.tga"), + Utility::Path::join(MESHTOOLS_TEST_DIR, "CompileTestFiles/color2D.tga"), (DebugTools::CompareImageToFile{_manager})); } @@ -541,7 +542,7 @@ template void CompileGLTest::twoDimensions() { MAGNUM_VERIFY_NO_GL_ERROR(); CORRADE_COMPARE_WITH( _framebuffer.read({{}, {32, 32}}, {PixelFormat::RGBA8Unorm}), - Utility::Directory::join(MESHTOOLS_TEST_DIR, "CompileTestFiles/textured2D.tga"), + Utility::Path::join(MESHTOOLS_TEST_DIR, "CompileTestFiles/textured2D.tga"), /* SwiftShader has some minor off-by-one precision differences, llvmpipe as well */ (DebugTools::CompareImageToFile{_manager, 1.75f, 0.22f})); @@ -758,7 +759,7 @@ template void CompileGLTest::threeDimensions() { MAGNUM_VERIFY_NO_GL_ERROR(); CORRADE_COMPARE_WITH( _framebuffer.read({{}, {32, 32}}, {PixelFormat::RGBA8Unorm}), - Utility::Directory::join(MESHTOOLS_TEST_DIR, "CompileTestFiles/flat3D.tga"), + Utility::Path::join(MESHTOOLS_TEST_DIR, "CompileTestFiles/flat3D.tga"), (DebugTools::CompareImageToFile{_manager})); } @@ -775,7 +776,7 @@ template void CompileGLTest::threeDimensions() { MAGNUM_VERIFY_NO_GL_ERROR(); CORRADE_COMPARE_WITH( _framebuffer.read({{}, {32, 32}}, {PixelFormat::RGBA8Unorm}), - Utility::Directory::join(MESHTOOLS_TEST_DIR, "CompileTestFiles/phong.tga"), + Utility::Path::join(MESHTOOLS_TEST_DIR, "CompileTestFiles/phong.tga"), /* SwiftShader has some minor off-by-one precision differences */ (DebugTools::CompareImageToFile{_manager, 0.5f, 0.013f})); } @@ -795,7 +796,7 @@ template void CompileGLTest::threeDimensions() { MAGNUM_VERIFY_NO_GL_ERROR(); CORRADE_COMPARE_WITH( _framebuffer.read({{}, {32, 32}}, {PixelFormat::RGBA8Unorm}), - Utility::Directory::join(MESHTOOLS_TEST_DIR, "CompileTestFiles/phong-flat.tga"), + Utility::Path::join(MESHTOOLS_TEST_DIR, "CompileTestFiles/phong-flat.tga"), /* SwiftShader has some minor off-by-one precision differences */ (DebugTools::CompareImageToFile{_manager, 0.5f, 0.012f})); } else if(data.flags & Flag::GeneratedSmoothNormals) { @@ -810,7 +811,7 @@ template void CompileGLTest::threeDimensions() { MAGNUM_VERIFY_NO_GL_ERROR(); CORRADE_COMPARE_WITH( _framebuffer.read({{}, {32, 32}}, {PixelFormat::RGBA8Unorm}), - Utility::Directory::join(MESHTOOLS_TEST_DIR, "CompileTestFiles/phong-smooth.tga"), + Utility::Path::join(MESHTOOLS_TEST_DIR, "CompileTestFiles/phong-smooth.tga"), /* SwiftShader has some minor off-by-one precision differences */ (DebugTools::CompareImageToFile{_manager, 0.5f, 0.0088f})); } @@ -825,7 +826,7 @@ template void CompileGLTest::threeDimensions() { MAGNUM_VERIFY_NO_GL_ERROR(); CORRADE_COMPARE_WITH( _framebuffer.read({{}, {32, 32}}, {PixelFormat::RGBA8Unorm}), - Utility::Directory::join(MESHTOOLS_TEST_DIR, "CompileTestFiles/color3D.tga"), + Utility::Path::join(MESHTOOLS_TEST_DIR, "CompileTestFiles/color3D.tga"), /* SwiftShader has some minor off-by-one precision differences */ (DebugTools::CompareImageToFile{_manager, 0.5f, 0.0162f})); } @@ -841,7 +842,7 @@ template void CompileGLTest::threeDimensions() { MAGNUM_VERIFY_NO_GL_ERROR(); CORRADE_COMPARE_WITH( _framebuffer.read({{}, {32, 32}}, {PixelFormat::RGBA8Unorm}), - Utility::Directory::join(MESHTOOLS_TEST_DIR, "CompileTestFiles/textured3D.tga"), + Utility::Path::join(MESHTOOLS_TEST_DIR, "CompileTestFiles/textured3D.tga"), /* SwiftShader has some minor off-by-one precision differences, llvmpipe as well */ (DebugTools::CompareImageToFile{_manager, 2.0f, 0.256f})); @@ -908,7 +909,7 @@ template void CompileGLTest::threeDimensions() { MAGNUM_VERIFY_NO_GL_ERROR(); CORRADE_COMPARE_WITH( _framebuffer.read({{}, {32, 32}}, {PixelFormat::RGBA8Unorm}), - Utility::Directory::join(MESHTOOLS_TEST_DIR, "CompileTestFiles/tbn.tga"), + Utility::Path::join(MESHTOOLS_TEST_DIR, "CompileTestFiles/tbn.tga"), /* SwiftShader has some minor off-by-one precision differences */ (DebugTools::CompareImageToFile{_manager, 1.0f, 0.0948f})); #else @@ -973,7 +974,7 @@ void CompileGLTest::multipleAttributes() { MAGNUM_VERIFY_NO_GL_ERROR(); CORRADE_COMPARE_WITH( _framebuffer.read({{}, {32, 32}}, {PixelFormat::RGBA8Unorm}), - Utility::Directory::join(MESHTOOLS_TEST_DIR, "CompileTestFiles/textured2D.tga"), + Utility::Path::join(MESHTOOLS_TEST_DIR, "CompileTestFiles/textured2D.tga"), /* SwiftShader has some minor off-by-one precision differences, llvmpipe as well */ (DebugTools::CompareImageToFile{_manager, 1.75f, 0.22f})); @@ -1115,7 +1116,7 @@ void CompileGLTest::packedAttributes() { MAGNUM_VERIFY_NO_GL_ERROR(); CORRADE_COMPARE_WITH( _framebuffer.read({{}, {32, 32}}, {PixelFormat::RGBA8Unorm}), - Utility::Directory::join(MESHTOOLS_TEST_DIR, "CompileTestFiles/phong.tga"), + Utility::Path::join(MESHTOOLS_TEST_DIR, "CompileTestFiles/phong.tga"), /* SwiftShader has some minor off-by-one precision differences */ (DebugTools::CompareImageToFile{_manager, 0.5f, 0.013f})); @@ -1127,7 +1128,7 @@ void CompileGLTest::packedAttributes() { MAGNUM_VERIFY_NO_GL_ERROR(); CORRADE_COMPARE_WITH( _framebuffer.read({{}, {32, 32}}, {PixelFormat::RGBA8Unorm}), - Utility::Directory::join(MESHTOOLS_TEST_DIR, "CompileTestFiles/color3D.tga"), + Utility::Path::join(MESHTOOLS_TEST_DIR, "CompileTestFiles/color3D.tga"), /* SwiftShader has some minor off-by-one precision differences */ (DebugTools::CompareImageToFile{_manager, 0.5f, 0.0162f})); @@ -1140,7 +1141,7 @@ void CompileGLTest::packedAttributes() { MAGNUM_VERIFY_NO_GL_ERROR(); CORRADE_COMPARE_WITH( _framebuffer.read({{}, {32, 32}}, {PixelFormat::RGBA8Unorm}), - Utility::Directory::join(MESHTOOLS_TEST_DIR, "CompileTestFiles/textured3D.tga"), + Utility::Path::join(MESHTOOLS_TEST_DIR, "CompileTestFiles/textured3D.tga"), /* SwiftShader has some minor off-by-one precision differences, llvmpipe more */ (DebugTools::CompareImageToFile{_manager, 2.0f, 0.259f})); @@ -1400,7 +1401,7 @@ void CompileGLTest::externalBuffers() { MAGNUM_VERIFY_NO_GL_ERROR(); CORRADE_COMPARE_WITH( _framebuffer.read({{}, {32, 32}}, {PixelFormat::RGBA8Unorm}), - Utility::Directory::join(MESHTOOLS_TEST_DIR, "CompileTestFiles/flat2D.tga"), + Utility::Path::join(MESHTOOLS_TEST_DIR, "CompileTestFiles/flat2D.tga"), (DebugTools::CompareImageToFile{_manager})); } diff --git a/src/Magnum/Shaders/Test/DistanceFieldVectorGLTest.cpp b/src/Magnum/Shaders/Test/DistanceFieldVectorGLTest.cpp index 854366e0d..a7c117588 100644 --- a/src/Magnum/Shaders/Test/DistanceFieldVectorGLTest.cpp +++ b/src/Magnum/Shaders/Test/DistanceFieldVectorGLTest.cpp @@ -26,9 +26,16 @@ #include #include #include +#include +#include /** @todo remove once AbstractImporter is -free */ #include -#include #include +#include + +#ifdef CORRADE_TARGET_APPLE +#include +#include /* isSandboxed() */ +#endif #include "Magnum/Image.h" #include "Magnum/ImageView.h" @@ -333,13 +340,13 @@ DistanceFieldVectorGLTest::DistanceFieldVectorGLTest() { #endif #ifdef CORRADE_TARGET_APPLE - if(Utility::Directory::isSandboxed() + if(Utility::System::isSandboxed() #if defined(CORRADE_TARGET_IOS) && defined(CORRADE_TESTSUITE_TARGET_XCTEST) /** @todo Fix this once I persuade CMake to run XCTest tests properly */ && std::getenv("SIMULATOR_UDID") #endif ) { - _testDir = Utility::Directory::path(Utility::Directory::executableLocation()); + _testDir = Utility::Path::split(*Utility::Path::executableLocation()).first(); } else #endif { @@ -673,7 +680,7 @@ template void DistanceFieldVectorGLTest::ren GL::Texture2D texture; Containers::Optional image; - CORRADE_VERIFY(importer->openFile(Utility::Directory::join(_testDir, "TestFiles/vector-distancefield.tga")) && (image = importer->image2D(0))); + CORRADE_VERIFY(importer->openFile(Utility::Path::join(_testDir, "TestFiles/vector-distancefield.tga")) && (image = importer->image2D(0))); texture.setMinificationFilter(GL::SamplerFilter::Linear) .setMagnificationFilter(GL::SamplerFilter::Linear) .setWrapping(GL::SamplerWrapping::ClampToEdge); @@ -720,7 +727,7 @@ template void DistanceFieldVectorGLTest::ren CORRADE_COMPARE_WITH( /* Dropping the alpha channel, as it's always 1.0 */ Containers::arrayCast(_framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels()), - Utility::Directory::join(_testDir, "VectorTestFiles/defaults.tga"), + Utility::Path::join(_testDir, "VectorTestFiles/defaults.tga"), (DebugTools::CompareImageToFile{_manager, 201.0f, 6.1f})); #if !(defined(MAGNUM_TARGET_GLES2) && defined(MAGNUM_TARGET_WEBGL)) @@ -734,7 +741,7 @@ template void DistanceFieldVectorGLTest::ren CORRADE_COMPARE_WITH( /* Dropping the alpha channel, as it's always 1.0 */ Containers::arrayCast(_framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels()), - Utility::Directory::join(_testDir, "VectorTestFiles/defaults-distancefield.tga"), + Utility::Path::join(_testDir, "VectorTestFiles/defaults-distancefield.tga"), (DebugTools::CompareImageToFile{_manager, maxThreshold, meanThreshold})); } @@ -761,7 +768,7 @@ template void DistanceFieldVectorGLTest::ren GL::Texture2D texture; Containers::Optional image; - CORRADE_VERIFY(importer->openFile(Utility::Directory::join(_testDir, "TestFiles/vector-distancefield.tga")) && (image = importer->image2D(0))); + CORRADE_VERIFY(importer->openFile(Utility::Path::join(_testDir, "TestFiles/vector-distancefield.tga")) && (image = importer->image2D(0))); texture.setMinificationFilter(GL::SamplerFilter::Linear) .setMagnificationFilter(GL::SamplerFilter::Linear) .setWrapping(GL::SamplerWrapping::ClampToEdge); @@ -808,7 +815,7 @@ template void DistanceFieldVectorGLTest::ren CORRADE_COMPARE_WITH( /* Dropping the alpha channel, as it's always 1.0 */ Containers::arrayCast(_framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels()), - Utility::Directory::join(_testDir, "VectorTestFiles/defaults.tga"), + Utility::Path::join(_testDir, "VectorTestFiles/defaults.tga"), (DebugTools::CompareImageToFile{_manager, 201.0f, 6.1f})); #if !(defined(MAGNUM_TARGET_GLES2) && defined(MAGNUM_TARGET_WEBGL)) @@ -822,7 +829,7 @@ template void DistanceFieldVectorGLTest::ren CORRADE_COMPARE_WITH( /* Dropping the alpha channel, as it's always 1.0 */ Containers::arrayCast(_framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels()), - Utility::Directory::join(_testDir, "VectorTestFiles/defaults-distancefield.tga"), + Utility::Path::join(_testDir, "VectorTestFiles/defaults-distancefield.tga"), (DebugTools::CompareImageToFile{_manager, maxThreshold, meanThreshold})); } @@ -852,7 +859,7 @@ template void DistanceFieldVectorGLTest::ren GL::Texture2D texture; Containers::Optional image; - CORRADE_VERIFY(importer->openFile(Utility::Directory::join(_testDir, "TestFiles/vector-distancefield.tga")) && (image = importer->image2D(0))); + CORRADE_VERIFY(importer->openFile(Utility::Path::join(_testDir, "TestFiles/vector-distancefield.tga")) && (image = importer->image2D(0))); texture.setMinificationFilter(GL::SamplerFilter::Linear) .setMagnificationFilter(GL::SamplerFilter::Linear) .setWrapping(GL::SamplerWrapping::ClampToEdge); @@ -930,7 +937,7 @@ template void DistanceFieldVectorGLTest::ren const Float maxThreshold = 32.0f, meanThreshold = 2.386f; #endif CORRADE_COMPARE_WITH(pixels, - Utility::Directory::join({_testDir, "VectorTestFiles", data.file2D}), + Utility::Path::join({_testDir, "VectorTestFiles", data.file2D}), (DebugTools::CompareImageToFile{_manager, maxThreshold, meanThreshold})); } @@ -960,7 +967,7 @@ template void DistanceFieldVectorGLTest::ren GL::Texture2D texture; Containers::Optional image; - CORRADE_VERIFY(importer->openFile(Utility::Directory::join(_testDir, "TestFiles/vector-distancefield.tga")) && (image = importer->image2D(0))); + CORRADE_VERIFY(importer->openFile(Utility::Path::join(_testDir, "TestFiles/vector-distancefield.tga")) && (image = importer->image2D(0))); texture.setMinificationFilter(GL::SamplerFilter::Linear) .setMagnificationFilter(GL::SamplerFilter::Linear) .setWrapping(GL::SamplerWrapping::ClampToEdge); @@ -1044,7 +1051,7 @@ template void DistanceFieldVectorGLTest::ren const Float maxThreshold = 32.0f, meanThreshold = 1.613f; #endif CORRADE_COMPARE_WITH(pixels, - Utility::Directory::join({_testDir, "VectorTestFiles", data.file3D}), + Utility::Path::join({_testDir, "VectorTestFiles", data.file3D}), (DebugTools::CompareImageToFile{_manager, maxThreshold, meanThreshold})); } @@ -1084,7 +1091,7 @@ void DistanceFieldVectorGLTest::renderMulti2D() { CORRADE_VERIFY(importer); Containers::Optional image; - CORRADE_VERIFY(importer->openFile(Utility::Directory::join(_testDir, "TestFiles/vector-distancefield.tga")) && (image = importer->image2D(0))); + CORRADE_VERIFY(importer->openFile(Utility::Path::join(_testDir, "TestFiles/vector-distancefield.tga")) && (image = importer->image2D(0))); GL::Texture2D vector; vector.setMinificationFilter(GL::SamplerFilter::Linear) .setMagnificationFilter(GL::SamplerFilter::Linear) @@ -1246,7 +1253,7 @@ void DistanceFieldVectorGLTest::renderMulti2D() { CORRADE_COMPARE_WITH( /* Dropping the alpha channel, as it's always 1.0 */ Containers::arrayCast(_framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels()), - Utility::Directory::join({_testDir, "VectorTestFiles", data.expected2D}), + Utility::Path::join({_testDir, "VectorTestFiles", data.expected2D}), (DebugTools::CompareImageToFile{_manager, data.maxThreshold, data.meanThreshold})); } @@ -1285,7 +1292,7 @@ void DistanceFieldVectorGLTest::renderMulti3D() { CORRADE_VERIFY(importer); Containers::Optional image; - CORRADE_VERIFY(importer->openFile(Utility::Directory::join(_testDir, "TestFiles/vector-distancefield.tga")) && (image = importer->image2D(0))); + CORRADE_VERIFY(importer->openFile(Utility::Path::join(_testDir, "TestFiles/vector-distancefield.tga")) && (image = importer->image2D(0))); GL::Texture2D vector; vector.setMinificationFilter(GL::SamplerFilter::Linear) .setMagnificationFilter(GL::SamplerFilter::Linear) @@ -1452,7 +1459,7 @@ void DistanceFieldVectorGLTest::renderMulti3D() { CORRADE_COMPARE_WITH( /* Dropping the alpha channel, as it's always 1.0 */ Containers::arrayCast(_framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels()), - Utility::Directory::join({_testDir, "VectorTestFiles", data.expected3D}), + Utility::Path::join({_testDir, "VectorTestFiles", data.expected3D}), (DebugTools::CompareImageToFile{_manager, data.maxThreshold, data.meanThreshold})); } #endif diff --git a/src/Magnum/Shaders/Test/FlatGLTest.cpp b/src/Magnum/Shaders/Test/FlatGLTest.cpp index cd8377800..f8f074c7d 100644 --- a/src/Magnum/Shaders/Test/FlatGLTest.cpp +++ b/src/Magnum/Shaders/Test/FlatGLTest.cpp @@ -26,10 +26,17 @@ #include #include #include +#include +#include /** @todo remove once AbstractImporter is -free */ #include #include -#include #include +#include + +#ifdef CORRADE_TARGET_APPLE +#include +#include /* isSandboxed() */ +#endif #include "Magnum/Image.h" #include "Magnum/ImageView.h" @@ -150,7 +157,7 @@ struct FlatGLTest: GL::OpenGLTester { private: PluginManager::Manager _manager{"nonexistent"}; - std::string _testDir; + Containers::String _testDir; GL::Renderbuffer _color{NoCreate}; #ifndef MAGNUM_TARGET_GLES2 @@ -806,13 +813,13 @@ FlatGLTest::FlatGLTest() { #endif #ifdef CORRADE_TARGET_APPLE - if(Utility::Directory::isSandboxed() + if(Utility::System::isSandboxed() #if defined(CORRADE_TARGET_IOS) && defined(CORRADE_TESTSUITE_TARGET_XCTEST) /** @todo Fix this once I persuade CMake to run XCTest tests properly */ && std::getenv("SIMULATOR_UDID") #endif ) { - _testDir = Utility::Directory::path(Utility::Directory::executableLocation()); + _testDir = Utility::Path::split(*Utility::Path::executableLocation()).first(); } else #endif { @@ -1296,7 +1303,7 @@ template void FlatGLTest::renderDefaults2D() { CORRADE_COMPARE_WITH( /* Dropping the alpha channel, as it's always 1.0 */ Containers::arrayCast(_framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels()), - Utility::Directory::join(_testDir, "FlatTestFiles/defaults.tga"), + Utility::Path::join(_testDir, "FlatTestFiles/defaults.tga"), /* SwiftShader has 8 different pixels on the edges */ (DebugTools::CompareImageToFile{_manager, 238.0f, 0.2975f})); } @@ -1349,7 +1356,7 @@ template void FlatGLTest::renderDefaults3D() { CORRADE_COMPARE_WITH( /* Dropping the alpha channel, as it's always 1.0 */ Containers::arrayCast(_framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels()), - Utility::Directory::join(_testDir, "FlatTestFiles/defaults.tga"), + Utility::Path::join(_testDir, "FlatTestFiles/defaults.tga"), /* SwiftShader has 8 different pixels on the edges */ (DebugTools::CompareImageToFile{_manager, 238.0f, 0.2975f})); } @@ -1413,7 +1420,7 @@ template void FlatGLTest::renderColored2D() { CORRADE_COMPARE_WITH( /* Dropping the alpha channel, as it's always 1.0 */ Containers::arrayCast(_framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels()), - Utility::Directory::join(_testDir, "FlatTestFiles/colored2D.tga"), + Utility::Path::join(_testDir, "FlatTestFiles/colored2D.tga"), (DebugTools::CompareImageToFile{_manager, maxThreshold, meanThreshold})); } @@ -1486,7 +1493,7 @@ template void FlatGLTest::renderColored3D() { CORRADE_COMPARE_WITH( /* Dropping the alpha channel, as it's always 1.0 */ Containers::arrayCast(_framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels()), - Utility::Directory::join(_testDir, "FlatTestFiles/colored3D.tga"), + Utility::Path::join(_testDir, "FlatTestFiles/colored3D.tga"), (DebugTools::CompareImageToFile{_manager, maxThreshold, meanThreshold})); } @@ -1613,7 +1620,7 @@ template void FlatGLTest::renderSinglePixelTextured2D() { CORRADE_COMPARE_WITH( /* Dropping the alpha channel, as it's always 1.0 */ Containers::arrayCast(_framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels()), - Utility::Directory::join(_testDir, "FlatTestFiles/colored2D.tga"), + Utility::Path::join(_testDir, "FlatTestFiles/colored2D.tga"), (DebugTools::CompareImageToFile{_manager, maxThreshold, meanThreshold})); } @@ -1735,7 +1742,7 @@ template void FlatGLTest::renderSinglePixelTextured3D() { CORRADE_COMPARE_WITH( /* Dropping the alpha channel, as it's always 1.0 */ Containers::arrayCast(_framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels()), - Utility::Directory::join(_testDir, "FlatTestFiles/colored3D.tga"), + Utility::Path::join(_testDir, "FlatTestFiles/colored3D.tga"), (DebugTools::CompareImageToFile{_manager, maxThreshold, meanThreshold})); } @@ -1770,7 +1777,7 @@ template void FlatGLTest::renderTextured2D() { CORRADE_VERIFY(importer); Containers::Optional image; - CORRADE_VERIFY(importer->openFile(Utility::Directory::join(_testDir, "TestFiles/diffuse-texture.tga")) && (image = importer->image2D(0))); + CORRADE_VERIFY(importer->openFile(Utility::Path::join(_testDir, "TestFiles/diffuse-texture.tga")) && (image = importer->image2D(0))); FlatGL2D::Flags flags = data.flags|flag; #ifndef MAGNUM_TARGET_GLES2 @@ -1861,7 +1868,7 @@ template void FlatGLTest::renderTextured2D() { const Float maxThreshold = 15.667f, meanThreshold = 3.254f; #endif CORRADE_COMPARE_WITH(pixels, - Utility::Directory::join(_testDir, "FlatTestFiles/textured2D.tga"), + Utility::Path::join(_testDir, "FlatTestFiles/textured2D.tga"), (DebugTools::CompareImageToFile{_manager, maxThreshold, meanThreshold})); } @@ -1896,7 +1903,7 @@ template void FlatGLTest::renderTextured3D() { CORRADE_VERIFY(importer); Containers::Optional image; - CORRADE_VERIFY(importer->openFile(Utility::Directory::join(_testDir, "TestFiles/diffuse-texture.tga")) && (image = importer->image2D(0))); + CORRADE_VERIFY(importer->openFile(Utility::Path::join(_testDir, "TestFiles/diffuse-texture.tga")) && (image = importer->image2D(0))); FlatGL3D::Flags flags = data.flags|flag; #ifndef MAGNUM_TARGET_GLES2 @@ -1997,7 +2004,7 @@ template void FlatGLTest::renderTextured3D() { const Float maxThreshold = 139.0f, meanThreshold = 2.896f; #endif CORRADE_COMPARE_WITH(pixels, - Utility::Directory::join(_testDir, "FlatTestFiles/textured3D.tga"), + Utility::Path::join(_testDir, "FlatTestFiles/textured3D.tga"), (DebugTools::CompareImageToFile{_manager, maxThreshold, meanThreshold})); } @@ -2038,7 +2045,7 @@ template void FlatGLTest::renderVertexColor2D() { GL::Texture2D texture; Containers::Optional image; - CORRADE_VERIFY(importer->openFile(Utility::Directory::join(_testDir, "TestFiles/diffuse-texture.tga")) && (image = importer->image2D(0))); + CORRADE_VERIFY(importer->openFile(Utility::Path::join(_testDir, "TestFiles/diffuse-texture.tga")) && (image = importer->image2D(0))); texture.setMinificationFilter(GL::SamplerFilter::Linear) .setMagnificationFilter(GL::SamplerFilter::Linear) .setWrapping(GL::SamplerWrapping::ClampToEdge) @@ -2086,7 +2093,7 @@ template void FlatGLTest::renderVertexColor2D() { CORRADE_COMPARE_WITH( /* Dropping the alpha channel, as it's always 1.0 */ Containers::arrayCast(_framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels()), - Utility::Directory::join(_testDir, "FlatTestFiles/vertexColor2D.tga"), + Utility::Path::join(_testDir, "FlatTestFiles/vertexColor2D.tga"), (DebugTools::CompareImageToFile{_manager, maxThreshold, meanThreshold})); } @@ -2127,7 +2134,7 @@ template void FlatGLTest::renderVertexColor3D() { GL::Texture2D texture; Containers::Optional image; - CORRADE_VERIFY(importer->openFile(Utility::Directory::join(_testDir, "TestFiles/diffuse-texture.tga")) && (image = importer->image2D(0))); + CORRADE_VERIFY(importer->openFile(Utility::Path::join(_testDir, "TestFiles/diffuse-texture.tga")) && (image = importer->image2D(0))); texture.setMinificationFilter(GL::SamplerFilter::Linear) .setMagnificationFilter(GL::SamplerFilter::Linear) .setWrapping(GL::SamplerWrapping::ClampToEdge) @@ -2184,7 +2191,7 @@ template void FlatGLTest::renderVertexColor3D() { CORRADE_COMPARE_WITH( /* Dropping the alpha channel, as it's always 1.0 */ Containers::arrayCast(_framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels()), - Utility::Directory::join(_testDir, "FlatTestFiles/vertexColor3D.tga"), + Utility::Path::join(_testDir, "FlatTestFiles/vertexColor3D.tga"), (DebugTools::CompareImageToFile{_manager, maxThreshold, meanThreshold})); } @@ -2226,7 +2233,7 @@ template void FlatGLTest::renderAlpha2D() { CORRADE_VERIFY(importer); GL::Texture2D texture; - CORRADE_VERIFY(importer->openFile(Utility::Directory::join({_testDir, "TestFiles", "diffuse-alpha-texture.tga"})) && (image = importer->image2D(0))); + CORRADE_VERIFY(importer->openFile(Utility::Path::join({_testDir, "TestFiles", "diffuse-alpha-texture.tga"})) && (image = importer->image2D(0))); texture.setMinificationFilter(GL::SamplerFilter::Linear) .setMagnificationFilter(GL::SamplerFilter::Linear) .setWrapping(GL::SamplerWrapping::ClampToEdge) @@ -2284,7 +2291,7 @@ template void FlatGLTest::renderAlpha2D() { CORRADE_COMPARE_WITH( /* Dropping the alpha channel, as it's always 1.0 */ Containers::arrayCast(_framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels()), - Utility::Directory::join(_testDir, data.expected2D), + Utility::Path::join(_testDir, data.expected2D), (DebugTools::CompareImageToFile{_manager, maxThreshold, meanThreshold})); } @@ -2312,7 +2319,7 @@ template void FlatGLTest::renderAlpha3D() { CORRADE_VERIFY(importer); GL::Texture2D texture; - CORRADE_VERIFY(importer->openFile(Utility::Directory::join({_testDir, "TestFiles", "diffuse-alpha-texture.tga"})) && (image = importer->image2D(0))); + CORRADE_VERIFY(importer->openFile(Utility::Path::join({_testDir, "TestFiles", "diffuse-alpha-texture.tga"})) && (image = importer->image2D(0))); texture.setMinificationFilter(GL::SamplerFilter::Linear) .setMagnificationFilter(GL::SamplerFilter::Linear) .setWrapping(GL::SamplerWrapping::ClampToEdge) @@ -2391,7 +2398,7 @@ template void FlatGLTest::renderAlpha3D() { CORRADE_COMPARE_WITH( /* Dropping the alpha channel, as it's always 1.0 */ Containers::arrayCast(_framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels()), - Utility::Directory::join({_testDir, data.expected3D}), + Utility::Path::join({_testDir, data.expected3D}), (DebugTools::CompareImageToFile{_manager, maxThreshold, meanThreshold})); } @@ -2545,7 +2552,7 @@ template void FlatGLTest::renderObjectId2D() { CORRADE_COMPARE_WITH( /* Dropping the alpha channel, as it's always 1.0 */ Containers::arrayCast(_framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels()), - Utility::Directory::join(_testDir, "FlatTestFiles/colored2D.tga"), + Utility::Path::join(_testDir, "FlatTestFiles/colored2D.tga"), (DebugTools::CompareImageToFile{_manager, maxThreshold, meanThreshold})); /* Object ID -- no need to verify the whole image, just check that pixels @@ -2694,7 +2701,7 @@ template void FlatGLTest::renderObjectId3D() { CORRADE_COMPARE_WITH( /* Dropping the alpha channel, as it's always 1.0 */ Containers::arrayCast(_framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels()), - Utility::Directory::join(_testDir, "FlatTestFiles/colored3D.tga"), + Utility::Path::join(_testDir, "FlatTestFiles/colored3D.tga"), (DebugTools::CompareImageToFile{_manager, maxThreshold, meanThreshold})); /* Object ID -- no need to verify the whole image, just check that pixels @@ -2815,7 +2822,7 @@ template void FlatGLTest::renderInstanced2D() { CORRADE_VERIFY(importer); Containers::Optional image; - CORRADE_VERIFY(importer->openFile(Utility::Directory::join(_testDir, "TestFiles/diffuse-texture.tga")) && (image = importer->image2D(0))); + CORRADE_VERIFY(importer->openFile(Utility::Path::join(_testDir, "TestFiles/diffuse-texture.tga")) && (image = importer->image2D(0))); #ifndef MAGNUM_TARGET_GLES2 /* For arrays we upload three slices of the original image to half-high @@ -3003,7 +3010,7 @@ template void FlatGLTest::renderInstanced2D() { CORRADE_COMPARE_WITH( /* Dropping the alpha channel, as it's always 1.0 */ Containers::arrayCast(_framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels()), - Utility::Directory::join({_testDir, "FlatTestFiles", data.expected2D}), + Utility::Path::join({_testDir, "FlatTestFiles", data.expected2D}), (DebugTools::CompareImageToFile{_manager, data.maxThreshold, data.meanThreshold})); #ifndef MAGNUM_TARGET_GLES2 @@ -3128,7 +3135,7 @@ template void FlatGLTest::renderInstanced3D() { CORRADE_VERIFY(importer); Containers::Optional image; - CORRADE_VERIFY(importer->openFile(Utility::Directory::join(_testDir, "TestFiles/diffuse-texture.tga")) && (image = importer->image2D(0))); + CORRADE_VERIFY(importer->openFile(Utility::Path::join(_testDir, "TestFiles/diffuse-texture.tga")) && (image = importer->image2D(0))); #ifndef MAGNUM_TARGET_GLES2 /* For arrays we upload three slices of the original image to half-high @@ -3319,7 +3326,7 @@ template void FlatGLTest::renderInstanced3D() { CORRADE_COMPARE_WITH( /* Dropping the alpha channel, as it's always 1.0 */ Containers::arrayCast(_framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels()), - Utility::Directory::join({_testDir, "FlatTestFiles", data.expected3D}), + Utility::Path::join({_testDir, "FlatTestFiles", data.expected3D}), (DebugTools::CompareImageToFile{_manager, data.maxThreshold, data.meanThreshold})); #ifndef MAGNUM_TARGET_GLES2 @@ -3388,7 +3395,7 @@ void FlatGLTest::renderMulti2D() { CORRADE_VERIFY(importer); Containers::Optional image; - CORRADE_VERIFY(importer->openFile(Utility::Directory::join(_testDir, "TestFiles/diffuse-texture.tga")) && (image = importer->image2D(0))); + CORRADE_VERIFY(importer->openFile(Utility::Path::join(_testDir, "TestFiles/diffuse-texture.tga")) && (image = importer->image2D(0))); /* For arrays we upload three slices of the original image to half-high slices */ @@ -3658,7 +3665,7 @@ void FlatGLTest::renderMulti2D() { CORRADE_COMPARE_WITH( /* Dropping the alpha channel, as it's always 1.0 */ Containers::arrayCast(_framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels()), - Utility::Directory::join({_testDir, "FlatTestFiles", data.expected2D}), + Utility::Path::join({_testDir, "FlatTestFiles", data.expected2D}), (DebugTools::CompareImageToFile{_manager, data.maxThreshold, data.meanThreshold})); /* Object ID -- no need to verify the whole image, just check that pixels @@ -3724,7 +3731,7 @@ void FlatGLTest::renderMulti3D() { CORRADE_VERIFY(importer); Containers::Optional image; - CORRADE_VERIFY(importer->openFile(Utility::Directory::join(_testDir, "TestFiles/diffuse-texture.tga")) && (image = importer->image2D(0))); + CORRADE_VERIFY(importer->openFile(Utility::Path::join(_testDir, "TestFiles/diffuse-texture.tga")) && (image = importer->image2D(0))); /* For arrays we upload three slices of the original image to half-high slices */ @@ -4001,7 +4008,7 @@ void FlatGLTest::renderMulti3D() { CORRADE_COMPARE_WITH( /* Dropping the alpha channel, as it's always 1.0 */ Containers::arrayCast(_framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels()), - Utility::Directory::join({_testDir, "FlatTestFiles", data.expected3D}), + Utility::Path::join({_testDir, "FlatTestFiles", data.expected3D}), (DebugTools::CompareImageToFile{_manager, data.maxThreshold, data.meanThreshold})); /* Object ID -- no need to verify the whole image, just check that pixels diff --git a/src/Magnum/Shaders/Test/MeshVisualizerGLTest.cpp b/src/Magnum/Shaders/Test/MeshVisualizerGLTest.cpp index 793a3f4b1..be7d8781a 100644 --- a/src/Magnum/Shaders/Test/MeshVisualizerGLTest.cpp +++ b/src/Magnum/Shaders/Test/MeshVisualizerGLTest.cpp @@ -26,11 +26,17 @@ #include #include #include +#include #include #include #include -#include #include +#include + +#ifdef CORRADE_TARGET_APPLE +#include +#include /* isSandboxed() */ +#endif #include "Magnum/DebugTools/ColorMap.h" #include "Magnum/DebugTools/CompareImage.h" @@ -186,7 +192,7 @@ struct MeshVisualizerGLTest: GL::OpenGLTester { private: PluginManager::Manager _manager{"nonexistent"}; - std::string _testDir; + Containers::String _testDir; GL::Renderbuffer _color{NoCreate}, _depth{NoCreate}; @@ -1310,13 +1316,13 @@ MeshVisualizerGLTest::MeshVisualizerGLTest() { #endif #ifdef CORRADE_TARGET_APPLE - if(Utility::Directory::isSandboxed() + if(Utility::System::isSandboxed() #if defined(CORRADE_TARGET_IOS) && defined(CORRADE_TESTSUITE_TARGET_XCTEST) /** @todo Fix this once I persuade CMake to run XCTest tests properly */ && std::getenv("SIMULATOR_UDID") #endif ) { - _testDir = Utility::Directory::path(Utility::Directory::executableLocation()); + _testDir = Utility::Path::split(*Utility::Path::executableLocation()).first(); } else #endif { @@ -2425,7 +2431,7 @@ template void MeshVisualizerGLTest::renderDefault CORRADE_COMPARE_WITH( /* Dropping the alpha channel, as it's always 1.0 */ Containers::arrayCast(_framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels()), - Utility::Directory::join(_testDir, "MeshVisualizerTestFiles/defaults-wireframe2D.tga"), + Utility::Path::join(_testDir, "MeshVisualizerTestFiles/defaults-wireframe2D.tga"), (DebugTools::CompareImageToFile{_manager})); } @@ -2456,7 +2462,7 @@ template void MeshVisualizerGLTest::renderDefault CORRADE_COMPARE_WITH( /* Dropping the alpha channel, as it's always 1.0 */ Containers::arrayCast(_framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels()), - Utility::Directory::join(_testDir, "MeshVisualizerTestFiles/defaults-wireframe2D.tga"), + Utility::Path::join(_testDir, "MeshVisualizerTestFiles/defaults-wireframe2D.tga"), /* AMD has off-by-one errors on edges compared to Intel */ (DebugTools::CompareImageToFile{_manager, 1.0f, 0.082f})); } @@ -2522,7 +2528,7 @@ template void MeshVisualizerGLTest::renderDefault CORRADE_COMPARE_WITH( /* Dropping the alpha channel, as it's always 1.0 */ Containers::arrayCast(_framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels()), - Utility::Directory::join(_testDir, "MeshVisualizerTestFiles/defaults-wireframe3D.tga"), + Utility::Path::join(_testDir, "MeshVisualizerTestFiles/defaults-wireframe3D.tga"), (DebugTools::CompareImageToFile{_manager})); } @@ -2557,7 +2563,7 @@ template void MeshVisualizerGLTest::renderDefault CORRADE_COMPARE_WITH( /* Dropping the alpha channel, as it's always 1.0 */ Containers::arrayCast(_framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels()), - Utility::Directory::join(_testDir, "MeshVisualizerTestFiles/defaults-wireframe3D.tga"), + Utility::Path::join(_testDir, "MeshVisualizerTestFiles/defaults-wireframe3D.tga"), /* AMD has off-by-one errors on edges compared to Intel */ (DebugTools::CompareImageToFile{_manager, 1.0f, 0.06f})); } @@ -2612,7 +2618,7 @@ template void MeshVisualizerGLTest::renderDefault CORRADE_COMPARE_WITH( /* Dropping the alpha channel, as it's always 1.0 */ Containers::arrayCast(_framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels()), - Utility::Directory::join(_testDir, "MeshVisualizerTestFiles/defaults-objectid2D.tga"), + Utility::Path::join(_testDir, "MeshVisualizerTestFiles/defaults-objectid2D.tga"), /* SwiftShader has a few rounding errors on edges */ (DebugTools::CompareImageToFile{_manager, 24.67f, 0.11f})); } @@ -2669,7 +2675,7 @@ template void MeshVisualizerGLTest::renderDefault CORRADE_COMPARE_WITH( /* Dropping the alpha channel, as it's always 1.0 */ Containers::arrayCast(_framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels()), - Utility::Directory::join(_testDir, "MeshVisualizerTestFiles/defaults-objectid3D.tga"), + Utility::Path::join(_testDir, "MeshVisualizerTestFiles/defaults-objectid3D.tga"), /* SwiftShader has a few rounding errors on edges and off-by-two pixels */ (DebugTools::CompareImageToFile{_manager, 24.67f, 2.55f})); @@ -2746,7 +2752,7 @@ template void MeshVisualizerGLTest::renderDefault CORRADE_COMPARE_WITH( /* Dropping the alpha channel, as it's always 1.0 */ Containers::arrayCast(_framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels()), - Utility::Directory::join(_testDir, "MeshVisualizerTestFiles/defaults-instancedobjectid2D.tga"), + Utility::Path::join(_testDir, "MeshVisualizerTestFiles/defaults-instancedobjectid2D.tga"), /* SwiftShader has a few rounding errors on edges */ (DebugTools::CompareImageToFile{_manager, 150.67f, 0.45f})); } @@ -2826,7 +2832,7 @@ template void MeshVisualizerGLTest::renderDefault CORRADE_COMPARE_WITH( /* Dropping the alpha channel, as it's always 1.0 */ Containers::arrayCast(_framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels()), - Utility::Directory::join(_testDir, "MeshVisualizerTestFiles/defaults-instancedobjectid3D.tga"), + Utility::Path::join(_testDir, "MeshVisualizerTestFiles/defaults-instancedobjectid3D.tga"), /* SwiftShader has a few rounding errors on edges */ (DebugTools::CompareImageToFile{_manager, 150.67f, 0.165f})); } @@ -2878,7 +2884,7 @@ template void MeshVisualizerGLTest::renderDefault CORRADE_COMPARE_WITH( /* Dropping the alpha channel, as it's always 1.0 */ Containers::arrayCast(_framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels()), - Utility::Directory::join(_testDir, "MeshVisualizerTestFiles/defaults-vertexid2D.tga"), + Utility::Path::join(_testDir, "MeshVisualizerTestFiles/defaults-vertexid2D.tga"), (DebugTools::CompareImageToFile{_manager, 1.0f, 0.017f})); } @@ -2933,7 +2939,7 @@ template void MeshVisualizerGLTest::renderDefault CORRADE_COMPARE_WITH( /* Dropping the alpha channel, as it's always 1.0 */ Containers::arrayCast(_framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels()), - Utility::Directory::join(_testDir, "MeshVisualizerTestFiles/defaults-vertexid3D.tga"), + Utility::Path::join(_testDir, "MeshVisualizerTestFiles/defaults-vertexid3D.tga"), (DebugTools::CompareImageToFile{_manager, 1.0f, 0.012f})); } @@ -3013,7 +3019,7 @@ template void MeshVisualizerGLTest::renderDefault CORRADE_COMPARE_WITH( /* Dropping the alpha channel, as it's always 1.0 */ Containers::arrayCast(_framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels()), - Utility::Directory::join(_testDir, "MeshVisualizerTestFiles/defaults-primitiveid2D.tga"), + Utility::Path::join(_testDir, "MeshVisualizerTestFiles/defaults-primitiveid2D.tga"), /* SwiftShader has a few rounding errors on edges */ (DebugTools::CompareImageToFile{_manager, 76.67f, 0.23f})); } @@ -3098,7 +3104,7 @@ template void MeshVisualizerGLTest::renderDefault CORRADE_COMPARE_WITH( /* Dropping the alpha channel, as it's always 1.0 */ Containers::arrayCast(_framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels()), - Utility::Directory::join(_testDir, "MeshVisualizerTestFiles/defaults-primitiveid3D.tga"), + Utility::Path::join(_testDir, "MeshVisualizerTestFiles/defaults-primitiveid3D.tga"), /* SwiftShader has a few rounding errors on edges */ (DebugTools::CompareImageToFile{_manager, 88.34f, 0.071f})); } @@ -3166,7 +3172,7 @@ template void MeshVisualizerGLTest::renderDefault CORRADE_COMPARE_WITH( /* Dropping the alpha channel, as it's always 1.0 */ Containers::arrayCast(_framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels()), - Utility::Directory::join(_testDir, "MeshVisualizerTestFiles/defaults-tbn.tga"), + Utility::Path::join(_testDir, "MeshVisualizerTestFiles/defaults-tbn.tga"), /* AMD has off-by-one errors on edges compared to Intel */ (DebugTools::CompareImageToFile{_manager, 1.0f, 0.06f})); } @@ -3282,7 +3288,7 @@ template void MeshVisualizerGLTest::renderWirefra CORRADE_COMPARE_WITH( /* Dropping the alpha channel, as it's always 1.0 */ Containers::arrayCast(_framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels()), - Utility::Directory::join({_testDir, "MeshVisualizerTestFiles", data.file}), + Utility::Path::join({_testDir, "MeshVisualizerTestFiles", data.file}), (DebugTools::CompareImageToFile{_manager, maxThreshold, meanThreshold})); } @@ -3299,7 +3305,7 @@ template void MeshVisualizerGLTest::renderWirefra CORRADE_COMPARE_WITH( /* Dropping the alpha channel, as it's always 1.0 */ Containers::arrayCast(_framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels()), - Utility::Directory::join({_testDir, "MeshVisualizerTestFiles", data.fileXfail}), + Utility::Path::join({_testDir, "MeshVisualizerTestFiles", data.fileXfail}), (DebugTools::CompareImageToFile{_manager, maxThreshold, meanThreshold})); } } @@ -3430,7 +3436,7 @@ template void MeshVisualizerGLTest::renderWirefra CORRADE_COMPARE_WITH( /* Dropping the alpha channel, as it's always 1.0 */ Containers::arrayCast(_framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels()), - Utility::Directory::join({_testDir, "MeshVisualizerTestFiles", data.file}), + Utility::Path::join({_testDir, "MeshVisualizerTestFiles", data.file}), (DebugTools::CompareImageToFile{_manager, maxThreshold, meanThreshold})); } @@ -3447,7 +3453,7 @@ template void MeshVisualizerGLTest::renderWirefra CORRADE_COMPARE_WITH( /* Dropping the alpha channel, as it's always 1.0 */ Containers::arrayCast(_framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels()), - Utility::Directory::join({_testDir, "MeshVisualizerTestFiles", data.fileXfail}), + Utility::Path::join({_testDir, "MeshVisualizerTestFiles", data.fileXfail}), (DebugTools::CompareImageToFile{_manager, maxThreshold, meanThreshold})); } } @@ -3639,7 +3645,7 @@ template void MeshVisualizerGLTest::renderObjectV CORRADE_COMPARE_WITH( /* Dropping the alpha channel, as it's always 1.0 */ Containers::arrayCast(_framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels()), - Utility::Directory::join({_testDir, "MeshVisualizerTestFiles", data.file2D}), + Utility::Path::join({_testDir, "MeshVisualizerTestFiles", data.file2D}), /* AMD has slight off-by-one errors compared to Intel, SwiftShader a bit more */ (DebugTools::CompareImageToFile{_manager, 4.67f, 0.141f})); @@ -3850,7 +3856,7 @@ template void MeshVisualizerGLTest::renderObjectV CORRADE_COMPARE_WITH( /* Dropping the alpha channel, as it's always 1.0 */ Containers::arrayCast(_framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels()), - Utility::Directory::join({_testDir, "MeshVisualizerTestFiles", data.file3D}), + Utility::Path::join({_testDir, "MeshVisualizerTestFiles", data.file3D}), (DebugTools::CompareImageToFile{_manager, maxThreshold, meanThreshold})); } #endif @@ -3893,7 +3899,7 @@ void MeshVisualizerGLTest::renderWireframe3DPerspective() { CORRADE_COMPARE_WITH( /* Dropping the alpha channel, as it's always 1.0 */ Containers::arrayCast(_framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels()), - Utility::Directory::join(_testDir, "MeshVisualizerTestFiles/wireframe-perspective.tga"), + Utility::Path::join(_testDir, "MeshVisualizerTestFiles/wireframe-perspective.tga"), (DebugTools::CompareImageToFile{_manager, 0.667f, 0.002f})); } @@ -4086,7 +4092,7 @@ template void MeshVisualizerGLTest::renderTangent CORRADE_COMPARE_WITH( /* Dropping the alpha channel, as it's always 1.0 */ Containers::arrayCast(_framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels()), - Utility::Directory::join({_testDir, "MeshVisualizerTestFiles", data.file}), + Utility::Path::join({_testDir, "MeshVisualizerTestFiles", data.file}), (DebugTools::CompareImageToFile{_manager, maxThreshold, meanThreshold})); } #endif @@ -4345,7 +4351,7 @@ template void MeshVisualizerGLTest::renderInstanc CORRADE_COMPARE_WITH( /* Dropping the alpha channel, as it's always 1.0 */ Containers::arrayCast(_framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels()), - Utility::Directory::join({_testDir, "MeshVisualizerTestFiles", data.expected}), + Utility::Path::join({_testDir, "MeshVisualizerTestFiles", data.expected}), (DebugTools::CompareImageToFile{_manager, data.maxThreshold, data.meanThreshold})); } @@ -4635,7 +4641,7 @@ template void MeshVisualizerGLTest::renderInstanc CORRADE_COMPARE_WITH( /* Dropping the alpha channel, as it's always 1.0 */ Containers::arrayCast(_framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels()), - Utility::Directory::join({_testDir, "MeshVisualizerTestFiles", data.expected}), + Utility::Path::join({_testDir, "MeshVisualizerTestFiles", data.expected}), (DebugTools::CompareImageToFile{_manager, data.maxThreshold, data.meanThreshold})); } @@ -4956,7 +4962,7 @@ void MeshVisualizerGLTest::renderMulti2D() { CORRADE_COMPARE_WITH( /* Dropping the alpha channel, as it's always 1.0 */ Containers::arrayCast(_framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels()), - Utility::Directory::join({_testDir, "MeshVisualizerTestFiles", data.expected}), + Utility::Path::join({_testDir, "MeshVisualizerTestFiles", data.expected}), (DebugTools::CompareImageToFile{_manager, data.maxThreshold, data.meanThreshold})); } @@ -5287,7 +5293,7 @@ void MeshVisualizerGLTest::renderMulti3D() { CORRADE_COMPARE_WITH( /* Dropping the alpha channel, as it's always 1.0 */ Containers::arrayCast(_framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels()), - Utility::Directory::join({_testDir, "MeshVisualizerTestFiles", data.expected}), + Utility::Path::join({_testDir, "MeshVisualizerTestFiles", data.expected}), (DebugTools::CompareImageToFile{_manager, data.maxThreshold, data.meanThreshold})); } #endif diff --git a/src/Magnum/Shaders/Test/PhongGLTest.cpp b/src/Magnum/Shaders/Test/PhongGLTest.cpp index d653d952c..6a87fd813 100644 --- a/src/Magnum/Shaders/Test/PhongGLTest.cpp +++ b/src/Magnum/Shaders/Test/PhongGLTest.cpp @@ -26,12 +26,18 @@ #include #include #include -#include +#include +#include /** @todo remove once AbstractImporter is -free */ #include #include #include -#include #include +#include + +#ifdef CORRADE_TARGET_APPLE +#include +#include /* isSandboxed() */ +#endif #include "Magnum/Image.h" #include "Magnum/ImageView.h" @@ -162,7 +168,7 @@ struct PhongGLTest: GL::OpenGLTester { private: PluginManager::Manager _manager{"nonexistent"}; - std::string _testDir; + Containers::String _testDir; GL::Renderbuffer _color{NoCreate}; #ifndef MAGNUM_TARGET_GLES2 @@ -1147,13 +1153,13 @@ PhongGLTest::PhongGLTest() { #endif #ifdef CORRADE_TARGET_APPLE - if(Utility::Directory::isSandboxed() + if(Utility::System::isSandboxed() #if defined(CORRADE_TARGET_IOS) && defined(CORRADE_TESTSUITE_TARGET_XCTEST) /** @todo Fix this once I persuade CMake to run XCTest tests properly */ && std::getenv("SIMULATOR_UDID") #endif ) { - _testDir = Utility::Directory::path(Utility::Directory::executableLocation()); + _testDir = Utility::Path::split(*Utility::Path::executableLocation()).first(); } else #endif { @@ -1753,7 +1759,7 @@ template void PhongGLTest::renderDefaults() { CORRADE_COMPARE_WITH( /* Dropping the alpha channel, as it's always 1.0 */ Containers::arrayCast(_framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels()), - Utility::Directory::join(_testDir, "PhongTestFiles/defaults.tga"), + Utility::Path::join(_testDir, "PhongTestFiles/defaults.tga"), (DebugTools::CompareImageToFile{_manager, maxThreshold, meanThreshold})); } @@ -1853,7 +1859,7 @@ template void PhongGLTest::renderColored() { CORRADE_COMPARE_WITH( /* Dropping the alpha channel, as it's always 1.0 */ Containers::arrayCast(_framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels()), - Utility::Directory::join(_testDir, "PhongTestFiles/colored.tga"), + Utility::Path::join(_testDir, "PhongTestFiles/colored.tga"), (DebugTools::CompareImageToFile{_manager, maxThreshold, meanThreshold})); } @@ -2050,7 +2056,7 @@ template void PhongGLTest::renderSinglePixelTextured() { CORRADE_COMPARE_WITH( /* Dropping the alpha channel, as it's always 1.0 */ Containers::arrayCast(_framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels()), - Utility::Directory::join(_testDir, "PhongTestFiles/colored.tga"), + Utility::Path::join(_testDir, "PhongTestFiles/colored.tga"), (DebugTools::CompareImageToFile{_manager, maxThreshold, meanThreshold})); } @@ -2108,7 +2114,7 @@ template void PhongGLTest::renderTextured() { #endif if(data.flags & PhongGL::Flag::AmbientTexture) { Containers::Optional image; - CORRADE_VERIFY(importer->openFile(Utility::Directory::join(_testDir, "TestFiles/ambient-texture.tga")) && (image = importer->image2D(0))); + CORRADE_VERIFY(importer->openFile(Utility::Path::join(_testDir, "TestFiles/ambient-texture.tga")) && (image = importer->image2D(0))); #ifndef MAGNUM_TARGET_GLES2 if(data.flags & PhongGL::Flag::TextureArrays) { @@ -2136,7 +2142,7 @@ template void PhongGLTest::renderTextured() { so ambient/specular is visible */ if(data.flags & PhongGL::Flag::DiffuseTexture) { Containers::Optional image; - CORRADE_VERIFY(importer->openFile(Utility::Directory::join(_testDir, "TestFiles/diffuse-texture.tga")) && (image = importer->image2D(0))); + CORRADE_VERIFY(importer->openFile(Utility::Path::join(_testDir, "TestFiles/diffuse-texture.tga")) && (image = importer->image2D(0))); #ifndef MAGNUM_TARGET_GLES2 if(data.flags & PhongGL::Flag::TextureArrays) { @@ -2162,7 +2168,7 @@ template void PhongGLTest::renderTextured() { if(data.flags & PhongGL::Flag::SpecularTexture) { Containers::Optional image; - CORRADE_VERIFY(importer->openFile(Utility::Directory::join(_testDir, "TestFiles/specular-texture.tga")) && (image = importer->image2D(0))); + CORRADE_VERIFY(importer->openFile(Utility::Path::join(_testDir, "TestFiles/specular-texture.tga")) && (image = importer->image2D(0))); #ifndef MAGNUM_TARGET_GLES2 if(data.flags & PhongGL::Flag::TextureArrays) { @@ -2288,7 +2294,7 @@ template void PhongGLTest::renderTextured() { CORRADE_COMPARE_WITH( /* Dropping the alpha channel, as it's always 1.0 */ Containers::arrayCast(_framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels()), - Utility::Directory::join({_testDir, "PhongTestFiles", data.expected}), + Utility::Path::join({_testDir, "PhongTestFiles", data.expected}), (DebugTools::CompareImageToFile{_manager, maxThreshold, meanThreshold})); } @@ -2326,7 +2332,7 @@ template void PhongGLTest::renderTexturedNormal() { /* Normal texture. Flip normal Y, if requested */ Containers::Optional image; - CORRADE_VERIFY(importer->openFile(Utility::Directory::join(_testDir, "TestFiles/normal-texture.tga")) && (image = importer->image2D(0))); + CORRADE_VERIFY(importer->openFile(Utility::Path::join(_testDir, "TestFiles/normal-texture.tga")) && (image = importer->image2D(0))); if(data.flipNormalY) for(auto row: image->mutablePixels()) for(Color3ub& pixel: row) pixel.y() = 255 - pixel.y(); @@ -2484,7 +2490,7 @@ template void PhongGLTest::renderTexturedNormal() { const Float maxThreshold = 191.0f, meanThreshold = 3.017f; #endif CORRADE_COMPARE_WITH(pixels, - Utility::Directory::join({_testDir, "PhongTestFiles", data.expected}), + Utility::Path::join({_testDir, "PhongTestFiles", data.expected}), (DebugTools::CompareImageToFile{_manager, maxThreshold, meanThreshold})); } @@ -2532,7 +2538,7 @@ template void PhongGLTest::renderVertexColor() { GL::Texture2D diffuse; Containers::Optional image; - CORRADE_VERIFY(importer->openFile(Utility::Directory::join(_testDir, "TestFiles/diffuse-texture.tga")) && (image = importer->image2D(0))); + CORRADE_VERIFY(importer->openFile(Utility::Path::join(_testDir, "TestFiles/diffuse-texture.tga")) && (image = importer->image2D(0))); diffuse.setMinificationFilter(GL::SamplerFilter::Linear) .setMagnificationFilter(GL::SamplerFilter::Linear) .setWrapping(GL::SamplerWrapping::ClampToEdge) @@ -2609,7 +2615,7 @@ template void PhongGLTest::renderVertexColor() { CORRADE_COMPARE_WITH( /* Dropping the alpha channel, as it's always 1.0 */ Containers::arrayCast(_framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels()), - Utility::Directory::join(_testDir, "PhongTestFiles/vertexColor.tga"), + Utility::Path::join(_testDir, "PhongTestFiles/vertexColor.tga"), (DebugTools::CompareImageToFile{_manager, maxThreshold, meanThreshold})); } @@ -2723,7 +2729,7 @@ template void PhongGLTest::renderShininess() { CORRADE_COMPARE_WITH( /* Dropping the alpha channel, as it's always 1.0 */ Containers::arrayCast(_framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels()), - Utility::Directory::join({_testDir, "PhongTestFiles", data.expected}), + Utility::Path::join({_testDir, "PhongTestFiles", data.expected}), (DebugTools::CompareImageToFile{_manager, maxThreshold, meanThreshold})); } @@ -2745,7 +2751,7 @@ template void PhongGLTest::renderShininess() { CORRADE_COMPARE_WITH( /* Dropping the alpha channel, as it's always 1.0 */ Containers::arrayCast(_framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels()), - Utility::Directory::join({_testDir, "PhongTestFiles", "shininess0-overflow.tga"}), + Utility::Path::join({_testDir, "PhongTestFiles", "shininess0-overflow.tga"}), /* The threshold = 0.001 case has a slight reddish tone on SwiftShader; ARM Mali has one pixel off */ (DebugTools::CompareImageToFile{_manager, 255.0f, 23.1f})); @@ -2795,7 +2801,7 @@ template void PhongGLTest::renderAlpha() { CORRADE_VERIFY(importer); GL::Texture2D ambient; - CORRADE_VERIFY(importer->openFile(Utility::Directory::join({_testDir, "TestFiles", data.ambientTexture})) && (image = importer->image2D(0))); + CORRADE_VERIFY(importer->openFile(Utility::Path::join({_testDir, "TestFiles", data.ambientTexture})) && (image = importer->image2D(0))); ambient.setMinificationFilter(GL::SamplerFilter::Linear) .setMagnificationFilter(GL::SamplerFilter::Linear) .setWrapping(GL::SamplerWrapping::ClampToEdge) @@ -2803,7 +2809,7 @@ template void PhongGLTest::renderAlpha() { .setSubImage(0, {}, *image); GL::Texture2D diffuse; - CORRADE_VERIFY(importer->openFile(Utility::Directory::join({_testDir, "TestFiles", data.diffuseTexture})) && (image = importer->image2D(0))); + CORRADE_VERIFY(importer->openFile(Utility::Path::join({_testDir, "TestFiles", data.diffuseTexture})) && (image = importer->image2D(0))); diffuse.setMinificationFilter(GL::SamplerFilter::Linear) .setMagnificationFilter(GL::SamplerFilter::Linear) .setWrapping(GL::SamplerWrapping::ClampToEdge); @@ -2912,7 +2918,7 @@ template void PhongGLTest::renderAlpha() { CORRADE_COMPARE_WITH( /* Dropping the alpha channel, as it's always 1.0 */ Containers::arrayCast(_framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels()), - Utility::Directory::join(_testDir, data.expected), + Utility::Path::join(_testDir, data.expected), (DebugTools::CompareImageToFile{_manager, maxThreshold, meanThreshold})); } @@ -3093,7 +3099,7 @@ template void PhongGLTest::renderObjectId() { CORRADE_COMPARE_WITH( /* Dropping the alpha channel, as it's always 1.0 */ Containers::arrayCast(_framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels()), - Utility::Directory::join(_testDir, "PhongTestFiles/colored.tga"), + Utility::Path::join(_testDir, "PhongTestFiles/colored.tga"), (DebugTools::CompareImageToFile{_manager, maxThreshold, meanThreshold})); /* Object ID -- no need to verify the whole image, just check that pixels @@ -3221,7 +3227,7 @@ template void PhongGLTest::renderLights() { CORRADE_COMPARE_WITH( /* Dropping the alpha channel, as it's always 1.0 */ Containers::arrayCast(image.pixels()), - Utility::Directory::join({_testDir, "PhongTestFiles", data.file}), + Utility::Path::join({_testDir, "PhongTestFiles", data.file}), (DebugTools::CompareImageToFile{_manager, maxThreshold, meanThreshold})); } @@ -3279,7 +3285,7 @@ void PhongGLTest::renderLightsSetOneByOne() { CORRADE_COMPARE_WITH( /* Dropping the alpha channel, as it's always 1.0 */ Containers::arrayCast(image.pixels()), - Utility::Directory::join({_testDir, "PhongTestFiles/light-point-range1.5.tga"}), + Utility::Path::join({_testDir, "PhongTestFiles/light-point-range1.5.tga"}), (DebugTools::CompareImageToFile{_manager, maxThreshold, meanThreshold})); } @@ -3320,7 +3326,7 @@ void PhongGLTest::renderLowLightAngle() { CORRADE_COMPARE_WITH( /* Dropping the alpha channel, as it's always 1.0 */ Containers::arrayCast(_framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels()), - Utility::Directory::join(_testDir, "PhongTestFiles/low-light-angle.tga"), + Utility::Path::join(_testDir, "PhongTestFiles/low-light-angle.tga"), (DebugTools::CompareImageToFile{_manager, maxThreshold, meanThreshold})); } @@ -3393,7 +3399,7 @@ void PhongGLTest::renderLightCulling() { CORRADE_COMPARE_WITH( /* Dropping the alpha channel, as it's always 1.0 */ Containers::arrayCast(_framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels()), - Utility::Directory::join(_testDir, "PhongTestFiles/colored.tga"), + Utility::Path::join(_testDir, "PhongTestFiles/colored.tga"), (DebugTools::CompareImageToFile{_manager, maxThreshold, meanThreshold})); } #endif @@ -3434,7 +3440,7 @@ template void PhongGLTest::renderZeroLights() { GL::Texture2D ambient; Containers::Optional ambientImage; - CORRADE_VERIFY(importer->openFile(Utility::Directory::join(_testDir, "TestFiles/diffuse-alpha-texture.tga")) && (ambientImage = importer->image2D(0))); + CORRADE_VERIFY(importer->openFile(Utility::Path::join(_testDir, "TestFiles/diffuse-alpha-texture.tga")) && (ambientImage = importer->image2D(0))); ambient.setMinificationFilter(GL::SamplerFilter::Linear) .setMagnificationFilter(GL::SamplerFilter::Linear) .setWrapping(GL::SamplerWrapping::ClampToEdge) @@ -3541,7 +3547,7 @@ template void PhongGLTest::renderZeroLights() { /* Dropping the alpha channel, as it's always 1.0 */ Containers::arrayCast(_framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels()), /* Should be equivalent to masked Flat3D */ - Utility::Directory::join(_testDir, "FlatTestFiles/textured3D-alpha-mask0.5.tga"), + Utility::Path::join(_testDir, "FlatTestFiles/textured3D-alpha-mask0.5.tga"), (DebugTools::CompareImageToFile{_manager, maxThreshold, meanThreshold})); #ifndef MAGNUM_TARGET_GLES2 @@ -3682,7 +3688,7 @@ template void PhongGLTest::renderInstanced() { if(data.flags & PhongGL::Flag::DiffuseTexture) { Containers::Optional image; - CORRADE_VERIFY(importer->openFile(Utility::Directory::join(_testDir, "TestFiles/diffuse-texture.tga")) && (image = importer->image2D(0))); + CORRADE_VERIFY(importer->openFile(Utility::Path::join(_testDir, "TestFiles/diffuse-texture.tga")) && (image = importer->image2D(0))); #ifndef MAGNUM_TARGET_GLES2 if(data.flags & PhongGL::Flag::TextureArrays) { @@ -3732,7 +3738,7 @@ template void PhongGLTest::renderInstanced() { if(data.flags & PhongGL::Flag::NormalTexture) { Containers::Optional image; - CORRADE_VERIFY(importer->openFile(Utility::Directory::join(_testDir, "TestFiles/normal-texture.tga")) && (image = importer->image2D(0))); + CORRADE_VERIFY(importer->openFile(Utility::Path::join(_testDir, "TestFiles/normal-texture.tga")) && (image = importer->image2D(0))); #ifndef MAGNUM_TARGET_GLES2 if(data.flags & PhongGL::Flag::TextureArrays) { @@ -3953,7 +3959,7 @@ template void PhongGLTest::renderInstanced() { CORRADE_COMPARE_WITH( /* Dropping the alpha channel, as it's always 1.0 */ Containers::arrayCast(_framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels()), - Utility::Directory::join({_testDir, "PhongTestFiles", data.expected}), + Utility::Path::join({_testDir, "PhongTestFiles", data.expected}), (DebugTools::CompareImageToFile{_manager, data.maxThreshold, data.meanThreshold})); #ifndef MAGNUM_TARGET_GLES2 @@ -4022,7 +4028,7 @@ void PhongGLTest::renderMulti() { CORRADE_VERIFY(importer); Containers::Optional image; - CORRADE_VERIFY(importer->openFile(Utility::Directory::join(_testDir, "TestFiles/diffuse-texture.tga")) && (image = importer->image2D(0))); + CORRADE_VERIFY(importer->openFile(Utility::Path::join(_testDir, "TestFiles/diffuse-texture.tga")) && (image = importer->image2D(0))); /* For arrays we upload three slices of the original image to half-high slices */ @@ -4342,7 +4348,7 @@ void PhongGLTest::renderMulti() { CORRADE_COMPARE_WITH( /* Dropping the alpha channel, as it's always 1.0 */ Containers::arrayCast(_framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels()), - Utility::Directory::join({_testDir, "PhongTestFiles", data.expected}), + Utility::Path::join({_testDir, "PhongTestFiles", data.expected}), (DebugTools::CompareImageToFile{_manager, data.maxThreshold, data.meanThreshold})); /* Object ID -- no need to verify the whole image, just check that pixels diff --git a/src/Magnum/Shaders/Test/ShadersGLBenchmark.cpp b/src/Magnum/Shaders/Test/ShadersGLBenchmark.cpp index 5b8f56443..598e0897b 100644 --- a/src/Magnum/Shaders/Test/ShadersGLBenchmark.cpp +++ b/src/Magnum/Shaders/Test/ShadersGLBenchmark.cpp @@ -23,9 +23,10 @@ DEALINGS IN THE SOFTWARE. */ +#include #include -#include #include +#include #include "Magnum/Image.h" #include "Magnum/ImageView.h" @@ -670,7 +671,7 @@ template void ShadersGLBenchmark::flat() { MAGNUM_VERIFY_NO_GL_ERROR(); CORRADE_COMPARE_WITH(_framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}), - Utility::Directory::join(SHADERS_TEST_DIR, "BenchmarkFiles/trivial.tga"), + Utility::Path::join(SHADERS_TEST_DIR, "BenchmarkFiles/trivial.tga"), DebugTools::CompareImageToFile{_manager}); } @@ -837,7 +838,7 @@ void ShadersGLBenchmark::phong() { MAGNUM_VERIFY_NO_GL_ERROR(); CORRADE_COMPARE_WITH(_framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}), - Utility::Directory::join(SHADERS_TEST_DIR, "BenchmarkFiles/trivial.tga"), + Utility::Path::join(SHADERS_TEST_DIR, "BenchmarkFiles/trivial.tga"), DebugTools::CompareImageToFile{_manager}); } @@ -896,7 +897,7 @@ template void ShadersGLBenchmark::vertexColor() { MAGNUM_VERIFY_NO_GL_ERROR(); CORRADE_COMPARE_WITH(_framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}), - Utility::Directory::join(SHADERS_TEST_DIR, "BenchmarkFiles/trivial.tga"), + Utility::Path::join(SHADERS_TEST_DIR, "BenchmarkFiles/trivial.tga"), DebugTools::CompareImageToFile{_manager}); } @@ -968,7 +969,7 @@ template void ShadersGLBenchmark::vector() { MAGNUM_VERIFY_NO_GL_ERROR(); CORRADE_COMPARE_WITH(_framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}), - Utility::Directory::join(SHADERS_TEST_DIR, "BenchmarkFiles/trivial.tga"), + Utility::Path::join(SHADERS_TEST_DIR, "BenchmarkFiles/trivial.tga"), DebugTools::CompareImageToFile{_manager}); } @@ -1038,7 +1039,7 @@ template void ShadersGLBenchmark::distanceFieldVector() MAGNUM_VERIFY_NO_GL_ERROR(); CORRADE_COMPARE_WITH(_framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}), - Utility::Directory::join(SHADERS_TEST_DIR, "BenchmarkFiles/trivial.tga"), + Utility::Path::join(SHADERS_TEST_DIR, "BenchmarkFiles/trivial.tga"), DebugTools::CompareImageToFile{_manager}); } @@ -1172,7 +1173,7 @@ void ShadersGLBenchmark::meshVisualizer2D() { MAGNUM_VERIFY_NO_GL_ERROR(); CORRADE_COMPARE_WITH(_framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}), - Utility::Directory::join(SHADERS_TEST_DIR, "BenchmarkFiles/trivial.tga"), + Utility::Path::join(SHADERS_TEST_DIR, "BenchmarkFiles/trivial.tga"), DebugTools::CompareImageToFile{_manager}); } @@ -1323,7 +1324,7 @@ void ShadersGLBenchmark::meshVisualizer3D() { MAGNUM_VERIFY_NO_GL_ERROR(); CORRADE_COMPARE_WITH(_framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}), - Utility::Directory::join(SHADERS_TEST_DIR, "BenchmarkFiles/trivial.tga"), + Utility::Path::join(SHADERS_TEST_DIR, "BenchmarkFiles/trivial.tga"), DebugTools::CompareImageToFile{_manager}); } diff --git a/src/Magnum/Shaders/Test/VectorGLTest.cpp b/src/Magnum/Shaders/Test/VectorGLTest.cpp index bf54f7cfc..3c185f728 100644 --- a/src/Magnum/Shaders/Test/VectorGLTest.cpp +++ b/src/Magnum/Shaders/Test/VectorGLTest.cpp @@ -26,10 +26,17 @@ #include #include #include +#include +#include /** @todo remove once AbstractImporter is -free */ #include -#include #include #include +#include + +#ifdef CORRADE_TARGET_APPLE +#include +#include /* isSandboxed() */ +#endif #include "Magnum/Image.h" #include "Magnum/ImageView.h" @@ -116,7 +123,7 @@ struct VectorGLTest: GL::OpenGLTester { private: PluginManager::Manager _manager{"nonexistent"}; - std::string _testDir; + Containers::String _testDir; GL::Renderbuffer _color{NoCreate}; #ifndef MAGNUM_TARGET_GLES2 @@ -330,13 +337,13 @@ VectorGLTest::VectorGLTest() { #endif #ifdef CORRADE_TARGET_APPLE - if(Utility::Directory::isSandboxed() + if(Utility::System::isSandboxed() #if defined(CORRADE_TARGET_IOS) && defined(CORRADE_TESTSUITE_TARGET_XCTEST) /** @todo Fix this once I persuade CMake to run XCTest tests properly */ && std::getenv("SIMULATOR_UDID") #endif ) { - _testDir = Utility::Directory::path(Utility::Directory::executableLocation()); + _testDir = Utility::Path::split(*Utility::Path::executableLocation()).first(); } else #endif { @@ -664,7 +671,7 @@ template void VectorGLTest::renderDefaults2D() { GL::Texture2D texture; Containers::Optional image; - CORRADE_VERIFY(importer->openFile(Utility::Directory::join(_testDir, "TestFiles/vector.tga")) && (image = importer->image2D(0))); + CORRADE_VERIFY(importer->openFile(Utility::Path::join(_testDir, "TestFiles/vector.tga")) && (image = importer->image2D(0))); texture.setMinificationFilter(GL::SamplerFilter::Linear) .setMagnificationFilter(GL::SamplerFilter::Linear) .setWrapping(GL::SamplerWrapping::ClampToEdge); @@ -716,7 +723,7 @@ template void VectorGLTest::renderDefaults2D() { CORRADE_COMPARE_WITH( /* Dropping the alpha channel, as it's always 1.0 */ Containers::arrayCast(_framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels()), - Utility::Directory::join(_testDir, "VectorTestFiles/defaults.tga"), + Utility::Path::join(_testDir, "VectorTestFiles/defaults.tga"), (DebugTools::CompareImageToFile{_manager, maxThreshold, meanThreshold})); } @@ -743,7 +750,7 @@ template void VectorGLTest::renderDefaults3D() { GL::Texture2D texture; Containers::Optional image; - CORRADE_VERIFY(importer->openFile(Utility::Directory::join(_testDir, "TestFiles/vector.tga")) && (image = importer->image2D(0))); + CORRADE_VERIFY(importer->openFile(Utility::Path::join(_testDir, "TestFiles/vector.tga")) && (image = importer->image2D(0))); texture.setMinificationFilter(GL::SamplerFilter::Linear) .setMagnificationFilter(GL::SamplerFilter::Linear) .setWrapping(GL::SamplerWrapping::ClampToEdge); @@ -795,7 +802,7 @@ template void VectorGLTest::renderDefaults3D() { CORRADE_COMPARE_WITH( /* Dropping the alpha channel, as it's always 1.0 */ Containers::arrayCast(_framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels()), - Utility::Directory::join(_testDir, "VectorTestFiles/defaults.tga"), + Utility::Path::join(_testDir, "VectorTestFiles/defaults.tga"), (DebugTools::CompareImageToFile{_manager, maxThreshold, meanThreshold})); } @@ -825,7 +832,7 @@ template void VectorGLTest::render2D() { GL::Texture2D texture; Containers::Optional image; - CORRADE_VERIFY(importer->openFile(Utility::Directory::join(_testDir, "TestFiles/vector.tga")) && (image = importer->image2D(0))); + CORRADE_VERIFY(importer->openFile(Utility::Path::join(_testDir, "TestFiles/vector.tga")) && (image = importer->image2D(0))); texture.setMinificationFilter(GL::SamplerFilter::Linear) .setMagnificationFilter(GL::SamplerFilter::Linear) .setWrapping(GL::SamplerWrapping::ClampToEdge); @@ -900,7 +907,7 @@ template void VectorGLTest::render2D() { const Float maxThreshold = 170.0f, meanThreshold = 0.962f; #endif CORRADE_COMPARE_WITH(pixels, - Utility::Directory::join({_testDir, "VectorTestFiles", data.file2D}), + Utility::Path::join({_testDir, "VectorTestFiles", data.file2D}), (DebugTools::CompareImageToFile{_manager, maxThreshold, meanThreshold})); } @@ -930,7 +937,7 @@ template void VectorGLTest::render3D() { GL::Texture2D texture; Containers::Optional image; - CORRADE_VERIFY(importer->openFile(Utility::Directory::join(_testDir, "TestFiles/vector.tga")) && (image = importer->image2D(0))); + CORRADE_VERIFY(importer->openFile(Utility::Path::join(_testDir, "TestFiles/vector.tga")) && (image = importer->image2D(0))); texture.setMinificationFilter(GL::SamplerFilter::Linear) .setMagnificationFilter(GL::SamplerFilter::Linear) .setWrapping(GL::SamplerWrapping::ClampToEdge); @@ -1009,7 +1016,7 @@ template void VectorGLTest::render3D() { const Float maxThreshold = 170.0f, meanThreshold = 0.660f; #endif CORRADE_COMPARE_WITH(pixels, - Utility::Directory::join({_testDir, "VectorTestFiles", data.file3D}), + Utility::Path::join({_testDir, "VectorTestFiles", data.file3D}), (DebugTools::CompareImageToFile{_manager, maxThreshold, meanThreshold})); } @@ -1049,7 +1056,7 @@ void VectorGLTest::renderMulti2D() { CORRADE_VERIFY(importer); Containers::Optional image; - CORRADE_VERIFY(importer->openFile(Utility::Directory::join(_testDir, "TestFiles/vector.tga")) && (image = importer->image2D(0))); + CORRADE_VERIFY(importer->openFile(Utility::Path::join(_testDir, "TestFiles/vector.tga")) && (image = importer->image2D(0))); GL::Texture2D vector; vector.setMinificationFilter(GL::SamplerFilter::Linear) .setMagnificationFilter(GL::SamplerFilter::Linear) @@ -1211,7 +1218,7 @@ void VectorGLTest::renderMulti2D() { CORRADE_COMPARE_WITH( /* Dropping the alpha channel, as it's always 1.0 */ Containers::arrayCast(_framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels()), - Utility::Directory::join({_testDir, "VectorTestFiles", data.expected2D}), + Utility::Path::join({_testDir, "VectorTestFiles", data.expected2D}), (DebugTools::CompareImageToFile{_manager, data.maxThreshold, data.meanThreshold})); } @@ -1250,7 +1257,7 @@ void VectorGLTest::renderMulti3D() { CORRADE_VERIFY(importer); Containers::Optional image; - CORRADE_VERIFY(importer->openFile(Utility::Directory::join(_testDir, "TestFiles/vector.tga")) && (image = importer->image2D(0))); + CORRADE_VERIFY(importer->openFile(Utility::Path::join(_testDir, "TestFiles/vector.tga")) && (image = importer->image2D(0))); GL::Texture2D vector; vector.setMinificationFilter(GL::SamplerFilter::Linear) .setMagnificationFilter(GL::SamplerFilter::Linear) @@ -1417,7 +1424,7 @@ void VectorGLTest::renderMulti3D() { CORRADE_COMPARE_WITH( /* Dropping the alpha channel, as it's always 1.0 */ Containers::arrayCast(_framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels()), - Utility::Directory::join({_testDir, "VectorTestFiles", data.expected3D}), + Utility::Path::join({_testDir, "VectorTestFiles", data.expected3D}), (DebugTools::CompareImageToFile{_manager, data.maxThreshold, data.meanThreshold})); } #endif diff --git a/src/Magnum/Shaders/Test/VertexColorGLTest.cpp b/src/Magnum/Shaders/Test/VertexColorGLTest.cpp index 258eb9158..6b9b2011e 100644 --- a/src/Magnum/Shaders/Test/VertexColorGLTest.cpp +++ b/src/Magnum/Shaders/Test/VertexColorGLTest.cpp @@ -25,9 +25,15 @@ #include #include +#include #include -#include #include +#include + +#ifdef CORRADE_TARGET_APPLE +#include +#include /* isSandboxed() */ +#endif #include "Magnum/DebugTools/CompareImage.h" #include "Magnum/Image.h" @@ -102,7 +108,7 @@ struct VertexColorGLTest: GL::OpenGLTester { private: PluginManager::Manager _manager{"nonexistent"}; - std::string _testDir; + Containers::String _testDir; GL::Renderbuffer _color{NoCreate}; #ifndef MAGNUM_TARGET_GLES2 @@ -273,13 +279,13 @@ VertexColorGLTest::VertexColorGLTest() { #endif #ifdef CORRADE_TARGET_APPLE - if(Utility::Directory::isSandboxed() + if(Utility::System::isSandboxed() #if defined(CORRADE_TARGET_IOS) && defined(CORRADE_TESTSUITE_TARGET_XCTEST) /** @todo Fix this once I persuade CMake to run XCTest tests properly */ && std::getenv("SIMULATOR_UDID") #endif ) { - _testDir = Utility::Directory::path(Utility::Directory::executableLocation()); + _testDir = Utility::Path::split(*Utility::Path::executableLocation()).first(); } else #endif { @@ -561,7 +567,7 @@ template void VertexColorGLTest::renderDefa CORRADE_COMPARE_WITH( /* Dropping the alpha channel, as it's always 1.0 */ Containers::arrayCast(_framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels()), - Utility::Directory::join(_testDir, "FlatTestFiles/defaults.tga"), + Utility::Path::join(_testDir, "FlatTestFiles/defaults.tga"), (DebugTools::CompareImageToFile{_manager, maxThreshold, meanThreshold})); } @@ -623,7 +629,7 @@ template void VertexColorGLTest::renderDefa CORRADE_COMPARE_WITH( /* Dropping the alpha channel, as it's always 1.0 */ Containers::arrayCast(_framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels()), - Utility::Directory::join(_testDir, "FlatTestFiles/defaults.tga"), + Utility::Path::join(_testDir, "FlatTestFiles/defaults.tga"), (DebugTools::CompareImageToFile{_manager, maxThreshold, meanThreshold})); } @@ -690,7 +696,7 @@ template void VertexColorGLTest::render2D() CORRADE_COMPARE_WITH( /* Dropping the alpha channel, as it's always 1.0 */ Containers::arrayCast(_framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels()), - Utility::Directory::join(_testDir, "VertexColorTestFiles/vertexColor2D.tga"), + Utility::Path::join(_testDir, "VertexColorTestFiles/vertexColor2D.tga"), (DebugTools::CompareImageToFile{_manager, maxThreshold, meanThreshold})); } @@ -766,7 +772,7 @@ template void VertexColorGLTest::render3D() CORRADE_COMPARE_WITH( /* Dropping the alpha channel, as it's always 1.0 */ Containers::arrayCast(_framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels()), - Utility::Directory::join(_testDir, "VertexColorTestFiles/vertexColor3D.tga"), + Utility::Path::join(_testDir, "VertexColorTestFiles/vertexColor3D.tga"), (DebugTools::CompareImageToFile{_manager, maxThreshold, meanThreshold})); } @@ -895,7 +901,7 @@ void VertexColorGLTest::renderMulti2D() { CORRADE_COMPARE_WITH( /* Dropping the alpha channel, as it's always 1.0 */ Containers::arrayCast(_framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels()), - Utility::Directory::join({_testDir, "VertexColorTestFiles", data.expected2D}), + Utility::Path::join({_testDir, "VertexColorTestFiles", data.expected2D}), (DebugTools::CompareImageToFile{_manager, data.maxThreshold, data.meanThreshold})); } @@ -1026,7 +1032,7 @@ void VertexColorGLTest::renderMulti3D() { CORRADE_COMPARE_WITH( /* Dropping the alpha channel, as it's always 1.0 */ Containers::arrayCast(_framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels()), - Utility::Directory::join({_testDir, "VertexColorTestFiles", data.expected3D}), + Utility::Path::join({_testDir, "VertexColorTestFiles", data.expected3D}), (DebugTools::CompareImageToFile{_manager, data.maxThreshold, data.meanThreshold})); } #endif diff --git a/src/Magnum/TextureTools/Test/DistanceFieldGLTest.cpp b/src/Magnum/TextureTools/Test/DistanceFieldGLTest.cpp index b94398a0c..b48c7a243 100644 --- a/src/Magnum/TextureTools/Test/DistanceFieldGLTest.cpp +++ b/src/Magnum/TextureTools/Test/DistanceFieldGLTest.cpp @@ -23,8 +23,15 @@ DEALINGS IN THE SOFTWARE. */ +#include +#include /** @todo remove when AbstractImporter is -free */ #include -#include +#include + +#ifdef CORRADE_TARGET_APPLE +#include +#include /* isSandboxed() */ +#endif #include "Magnum/Image.h" #include "Magnum/ImageView.h" @@ -65,7 +72,7 @@ struct DistanceFieldGLTest: GL::OpenGLTester { private: PluginManager::Manager _manager{"nonexistent"}; - std::string _testDir; + Containers::String _testDir; }; #ifdef MAGNUM_TARGET_GLES @@ -89,13 +96,13 @@ DistanceFieldGLTest::DistanceFieldGLTest() { #endif #ifdef CORRADE_TARGET_APPLE - if(Utility::Directory::isSandboxed() + if(Utility::System::isSandboxed() #if defined(CORRADE_TARGET_IOS) && defined(CORRADE_TESTSUITE_TARGET_XCTEST) /** @todo Fix this once I persuade CMake to run XCTest tests properly */ && std::getenv("SIMULATOR_UDID") #endif ) { - _testDir = Utility::Directory::join(Utility::Directory::path(Utility::Directory::executableLocation()), "DistanceFieldGLTestFiles"); + _testDir = Utility::Path::join(Utility::Path::split(*Utility::Path::executableLocation()).first(), "DistanceFieldGLTestFiles"); } else #endif { @@ -108,7 +115,7 @@ void DistanceFieldGLTest::test() { if(!(importer = _manager.loadAndInstantiate("TgaImporter"))) CORRADE_SKIP("TgaImporter plugin not found."); - CORRADE_VERIFY(importer->openFile(Utility::Directory::join(_testDir, "input.tga"))); + CORRADE_VERIFY(importer->openFile(Utility::Path::join(_testDir, "input.tga"))); CORRADE_COMPARE(importer->image2DCount(), 1); Containers::Optional inputImage = importer->image2D(0); CORRADE_VERIFY(inputImage); @@ -225,7 +232,7 @@ void DistanceFieldGLTest::test() { #endif CORRADE_COMPARE_WITH(*actualOutputImage, - Utility::Directory::join(_testDir, "output.tga"), + Utility::Path::join(_testDir, "output.tga"), /* Some mobile GPUs have slight (off-by-one) rounding errors compared to the ground truth, but it's just a very small amount of pixels (20-50 out of the total 4k pixels, iOS/WebGL has slightly more). @@ -245,7 +252,7 @@ void DistanceFieldGLTest::benchmark() { if(!(importer = _manager.loadAndInstantiate("TgaImporter"))) CORRADE_SKIP("TgaImporter plugin not found."); - CORRADE_VERIFY(importer->openFile(Utility::Directory::join(_testDir, "input.tga"))); + CORRADE_VERIFY(importer->openFile(Utility::Path::join(_testDir, "input.tga"))); CORRADE_COMPARE(importer->image2DCount(), 1); Containers::Optional inputImage = importer->image2D(0); CORRADE_VERIFY(inputImage);