Browse Source

Wrap all tests in unnamed namespaces.

This makes the compiler warn about test cases that aren't ever used,
which is a good thing.
simd
Vladimír Vondruš 7 years ago
parent
commit
2149f7b869
  1. 2
      package/ci/leaksanitizer.conf
  2. 4
      src/Magnum/Animation/Test/Benchmark.cpp
  3. 16
      src/Magnum/Animation/Test/EasingTest.cpp
  4. 28
      src/Magnum/Animation/Test/InterpolationTest.cpp
  5. 18
      src/Magnum/Animation/Test/PlayerCustomTest.cpp
  6. 80
      src/Magnum/Animation/Test/PlayerTest.cpp
  7. 18
      src/Magnum/Animation/Test/TrackTest.cpp
  8. 35
      src/Magnum/Animation/Test/TrackViewTest.cpp
  9. 4
      src/Magnum/Audio/Test/AbstractImporterTest.cpp
  10. 4
      src/Magnum/Audio/Test/BufferALTest.cpp
  11. 4
      src/Magnum/Audio/Test/BufferFormatTest.cpp
  12. 4
      src/Magnum/Audio/Test/ContextALTest.cpp
  13. 4
      src/Magnum/Audio/Test/ContextTest.cpp
  14. 4
      src/Magnum/Audio/Test/ListenerALTest.cpp
  15. 4
      src/Magnum/Audio/Test/PlayableALTest.cpp
  16. 4
      src/Magnum/Audio/Test/RendererALTest.cpp
  17. 4
      src/Magnum/Audio/Test/RendererTest.cpp
  18. 4
      src/Magnum/Audio/Test/SourceALTest.cpp
  19. 4
      src/Magnum/Audio/Test/SourceTest.cpp
  20. 8
      src/Magnum/DebugTools/Test/BufferDataGLTest.cpp
  21. 4
      src/Magnum/DebugTools/Test/CapsuleRendererTest.cpp
  22. 87
      src/Magnum/DebugTools/Test/CompareImageTest.cpp
  23. 4
      src/Magnum/DebugTools/Test/CylinderRendererTest.cpp
  24. 4
      src/Magnum/DebugTools/Test/ForceRendererTest.cpp
  25. 4
      src/Magnum/DebugTools/Test/LineSegmentRendererTest.cpp
  26. 34
      src/Magnum/DebugTools/Test/TextureImageGLTest.cpp
  27. 4
      src/Magnum/GL/Test/AbstractObjectGLTest.cpp
  28. 4
      src/Magnum/GL/Test/AbstractQueryGLTest.cpp
  29. 93
      src/Magnum/GL/Test/AbstractShaderProgramGLTest.cpp
  30. 4
      src/Magnum/GL/Test/AbstractShaderProgramTest.cpp
  31. 4
      src/Magnum/GL/Test/AbstractTextureGLTest.cpp
  32. 4
      src/Magnum/GL/Test/AttributeTest.cpp
  33. 4
      src/Magnum/GL/Test/BufferGLTest.cpp
  34. 4
      src/Magnum/GL/Test/BufferImageGLTest.cpp
  35. 4
      src/Magnum/GL/Test/BufferImageTest.cpp
  36. 4
      src/Magnum/GL/Test/BufferTest.cpp
  37. 4
      src/Magnum/GL/Test/BufferTextureGLTest.cpp
  38. 4
      src/Magnum/GL/Test/BufferTextureTest.cpp
  39. 4
      src/Magnum/GL/Test/ContextGLTest.cpp
  40. 4
      src/Magnum/GL/Test/ContextTest.cpp
  41. 570
      src/Magnum/GL/Test/CubeMapTextureArrayGLTest.cpp
  42. 4
      src/Magnum/GL/Test/CubeMapTextureArrayTest.cpp
  43. 409
      src/Magnum/GL/Test/CubeMapTextureGLTest.cpp
  44. 4
      src/Magnum/GL/Test/CubeMapTextureTest.cpp
  45. 4
      src/Magnum/GL/Test/DebugOutputGLTest.cpp
  46. 4
      src/Magnum/GL/Test/DebugOutputTest.cpp
  47. 4
      src/Magnum/GL/Test/DefaultFramebufferTest.cpp
  48. 26
      src/Magnum/GL/Test/FramebufferGLTest.cpp
  49. 4
      src/Magnum/GL/Test/FramebufferTest.cpp
  50. 156
      src/Magnum/GL/Test/MeshGLTest.cpp
  51. 12
      src/Magnum/GL/Test/MeshTest.cpp
  52. 4
      src/Magnum/GL/Test/MultisampleTextureGLTest.cpp
  53. 4
      src/Magnum/GL/Test/MultisampleTextureTest.cpp
  54. 4
      src/Magnum/GL/Test/PixelFormatTest.cpp
  55. 222
      src/Magnum/GL/Test/PixelStorageGLTest.cpp
  56. 4
      src/Magnum/GL/Test/PrimitiveQueryGLTest.cpp
  57. 4
      src/Magnum/GL/Test/PrimitiveQueryTest.cpp
  58. 86
      src/Magnum/GL/Test/RectangleTextureGLTest.cpp
  59. 4
      src/Magnum/GL/Test/RectangleTextureTest.cpp
  60. 4
      src/Magnum/GL/Test/RenderbufferGLTest.cpp
  61. 4
      src/Magnum/GL/Test/RenderbufferTest.cpp
  62. 4
      src/Magnum/GL/Test/RendererGLTest.cpp
  63. 4
      src/Magnum/GL/Test/RendererTest.cpp
  64. 14
      src/Magnum/GL/Test/SampleQueryGLTest.cpp
  65. 4
      src/Magnum/GL/Test/SampleQueryTest.cpp
  66. 4
      src/Magnum/GL/Test/SamplerTest.cpp
  67. 4
      src/Magnum/GL/Test/ShaderGLTest.cpp
  68. 4
      src/Magnum/GL/Test/ShaderTest.cpp
  69. 339
      src/Magnum/GL/Test/TextureArrayGLTest.cpp
  70. 4
      src/Magnum/GL/Test/TextureArrayTest.cpp
  71. 568
      src/Magnum/GL/Test/TextureGLTest.cpp
  72. 4
      src/Magnum/GL/Test/TextureTest.cpp
  73. 4
      src/Magnum/GL/Test/TimeQueryGLTest.cpp
  74. 4
      src/Magnum/GL/Test/TimeQueryTest.cpp
  75. 16
      src/Magnum/GL/Test/TransformFeedbackGLTest.cpp
  76. 4
      src/Magnum/GL/Test/TransformFeedbackTest.cpp
  77. 4
      src/Magnum/GL/Test/VersionTest.cpp
  78. 4
      src/Magnum/Math/Algorithms/Test/GaussJordanTest.cpp
  79. 4
      src/Magnum/Math/Algorithms/Test/GramSchmidtTest.cpp
  80. 8
      src/Magnum/Math/Algorithms/Test/KahanSumTest.cpp
  81. 4
      src/Magnum/Math/Algorithms/Test/QrTest.cpp
  82. 4
      src/Magnum/Math/Algorithms/Test/SvdTest.cpp
  83. 8
      src/Magnum/Math/Test/AngleTest.cpp
  84. 4
      src/Magnum/Math/Test/BezierTest.cpp
  85. 4
      src/Magnum/Math/Test/BoolVectorTest.cpp
  86. 8
      src/Magnum/Math/Test/ColorTest.cpp
  87. 4
      src/Magnum/Math/Test/ComplexTest.cpp
  88. 4
      src/Magnum/Math/Test/ConstantsTest.cpp
  89. 4
      src/Magnum/Math/Test/CubicHermiteTest.cpp
  90. 4
      src/Magnum/Math/Test/DistanceTest.cpp
  91. 20
      src/Magnum/Math/Test/DualComplexTest.cpp
  92. 20
      src/Magnum/Math/Test/DualQuaternionTest.cpp
  93. 8
      src/Magnum/Math/Test/DualTest.cpp
  94. 4
      src/Magnum/Math/Test/FrustumTest.cpp
  95. 4
      src/Magnum/Math/Test/FunctionsTest.cpp
  96. 12
      src/Magnum/Math/Test/HalfTest.cpp
  97. 4
      src/Magnum/Math/Test/InterpolationBenchmark.cpp
  98. 4
      src/Magnum/Math/Test/IntersectionBenchmark.cpp
  99. 4
      src/Magnum/Math/Test/IntersectionTest.cpp
  100. 4
      src/Magnum/Math/Test/Matrix3Test.cpp
  101. Some files were not shown because too many files have changed in this diff Show More

2
package/ci/leaksanitizer.conf

@ -2,4 +2,4 @@
# The test case intentionally leaks because there is currently no other way to # The test case intentionally leaks because there is currently no other way to
# trigger given behavior without asserting elsewhere # trigger given behavior without asserting elsewhere
leak:Magnum::Test::ResourceManagerTest::clearWhileReferenced leak:ResourceManagerTest::clearWhileReferenced

4
src/Magnum/Animation/Test/Benchmark.cpp

@ -27,7 +27,7 @@
#include "Magnum/Animation/Player.h" #include "Magnum/Animation/Player.h"
namespace Magnum { namespace Animation { namespace Test { namespace Magnum { namespace Animation { namespace Test { namespace {
struct Benchmark: TestSuite::Tester { struct Benchmark: TestSuite::Tester {
explicit Benchmark(); explicit Benchmark();
@ -260,6 +260,6 @@ void Benchmark::playerAdvanceRawCallbackDirectInterpolator() {
CORRADE_COMPARE(result, 125000); CORRADE_COMPARE(result, 125000);
} }
}}} }}}}
CORRADE_TEST_MAIN(Magnum::Animation::Test::Benchmark) CORRADE_TEST_MAIN(Magnum::Animation::Test::Benchmark)

16
src/Magnum/Animation/Test/EasingTest.cpp

@ -31,7 +31,7 @@
#include "Magnum/Animation/Easing.h" #include "Magnum/Animation/Easing.h"
namespace Magnum { namespace Animation { namespace Test { namespace Magnum { namespace Animation { namespace Test { namespace {
struct EasingTest: TestSuite::Tester { struct EasingTest: TestSuite::Tester {
explicit EasingTest(); explicit EasingTest();
@ -44,8 +44,6 @@ struct EasingTest: TestSuite::Tester {
void benchmark(); void benchmark();
}; };
namespace {
#define _c(name) #name, Easing::name #define _c(name) #name, Easing::name
constexpr struct { constexpr struct {
const char* name; const char* name;
@ -188,8 +186,6 @@ constexpr struct {
}; };
#undef _c #undef _c
}
EasingTest::EasingTest() { EasingTest::EasingTest() {
addInstancedTests({&EasingTest::bounds}, addInstancedTests({&EasingTest::bounds},
Containers::arraySize(BoundsData)); Containers::arraySize(BoundsData));
@ -207,9 +203,7 @@ EasingTest::EasingTest() {
Containers::arraySize(ValueData)); Containers::arraySize(ValueData));
} }
namespace { enum: std::size_t { PropertyVerificationStepCount = 50 };
constexpr std::size_t PropertyVerificationStepCount = 50;
}
void EasingTest::bounds() { void EasingTest::bounds() {
auto&& data = BoundsData[testCaseInstanceId()]; auto&& data = BoundsData[testCaseInstanceId()];
@ -264,9 +258,7 @@ void EasingTest::values() {
CORRADE_COMPARE(data.function(0.75f), data.values[2]); CORRADE_COMPARE(data.function(0.75f), data.values[2]);
} }
namespace { enum: Int { BenchmarkStepCount = 5000 };
constexpr Int BenchmarkStepCount = 5000;
}
void EasingTest::benchmark() { void EasingTest::benchmark() {
auto&& data = ValueData[testCaseInstanceId()]; auto&& data = ValueData[testCaseInstanceId()];
@ -284,6 +276,6 @@ void EasingTest::benchmark() {
CORRADE_COMPARE_AS(result, -350.0f, TestSuite::Compare::Greater); CORRADE_COMPARE_AS(result, -350.0f, TestSuite::Compare::Greater);
} }
}}} }}}}
CORRADE_TEST_MAIN(Magnum::Animation::Test::EasingTest) CORRADE_TEST_MAIN(Magnum::Animation::Test::EasingTest)

28
src/Magnum/Animation/Test/InterpolationTest.cpp

@ -33,7 +33,7 @@
#include "Magnum/Math/DualQuaternion.h" #include "Magnum/Math/DualQuaternion.h"
#include "Magnum/Math/Half.h" #include "Magnum/Math/Half.h"
namespace Magnum { namespace Animation { namespace Test { namespace Magnum { namespace Animation { namespace Test { namespace {
struct InterpolationTest: TestSuite::Tester { struct InterpolationTest: TestSuite::Tester {
explicit InterpolationTest(); explicit InterpolationTest();
@ -76,8 +76,6 @@ struct InterpolationTest: TestSuite::Tester {
void debugExtrapolation(); void debugExtrapolation();
}; };
namespace {
using namespace Math::Literals; using namespace Math::Literals;
const struct { const struct {
@ -146,8 +144,6 @@ const struct {
{"out of bounds", 405780454} {"out of bounds", 405780454}
}; };
}
InterpolationTest::InterpolationTest() { InterpolationTest::InterpolationTest() {
addTests({&InterpolationTest::interpolatorFor, addTests({&InterpolationTest::interpolatorFor,
&InterpolationTest::interpolatorForBool, &InterpolationTest::interpolatorForBool,
@ -374,10 +370,8 @@ void InterpolationTest::interpolatorForCubicHermiteQuaternion() {
"Animation::interpolatorFor(): can't deduce interpolator function for Animation::Interpolation(0xde)\n"); "Animation::interpolatorFor(): can't deduce interpolator function for Animation::Interpolation(0xde)\n");
} }
namespace { constexpr Float Keys[]{0.0f, 2.0f, 4.0f, 5.0f};
constexpr Float Keys[]{0.0f, 2.0f, 4.0f, 5.0f}; constexpr Float Values[]{3.0f, 1.0f, 2.5f, 0.5f};
constexpr Float Values[]{3.0f, 1.0f, 2.5f, 0.5f};
}
void InterpolationTest::interpolate() { void InterpolationTest::interpolate() {
const auto& data = Data[testCaseInstanceId()]; const auto& data = Data[testCaseInstanceId()];
@ -442,14 +436,12 @@ void InterpolationTest::interpolateStrictHint() {
CORRADE_COMPARE(hint, 2); CORRADE_COMPARE(hint, 2);
} }
namespace { using namespace Math::Literals;
using namespace Math::Literals;
const Half HalfValues[]{3.0_h, 1.0_h, 2.5_h, 0.5_h}; const Half HalfValues[]{3.0_h, 1.0_h, 2.5_h, 0.5_h};
Float lerpHalf(const Half& a, const Half& b, Float t) { Float lerpHalf(const Half& a, const Half& b, Float t) {
return Math::lerp(Float(a), Float(b), t); return Math::lerp(Float(a), Float(b), t);
}
} }
void InterpolationTest::interpolateDifferentResultType() { void InterpolationTest::interpolateDifferentResultType() {
@ -466,9 +458,7 @@ void InterpolationTest::interpolateStrictDifferentResultType() {
CORRADE_COMPARE(hint, 2); CORRADE_COMPARE(hint, 2);
} }
namespace { constexpr Int IntegerKeys[]{0, 48, 96, 120};
constexpr Int IntegerKeys[]{0, 48, 96, 120};
}
void InterpolationTest::interpolateIntegerKey() { void InterpolationTest::interpolateIntegerKey() {
std::size_t hint{}; std::size_t hint{};
@ -581,6 +571,6 @@ void InterpolationTest::debugExtrapolation() {
CORRADE_COMPARE(out.str(), "Animation::Extrapolation::DefaultConstructed Animation::Extrapolation(0xde)\n"); CORRADE_COMPARE(out.str(), "Animation::Extrapolation::DefaultConstructed Animation::Extrapolation(0xde)\n");
} }
}}} }}}}
CORRADE_TEST_MAIN(Magnum::Animation::Test::InterpolationTest) CORRADE_TEST_MAIN(Magnum::Animation::Test::InterpolationTest)

18
src/Magnum/Animation/Test/PlayerCustomTest.cpp

@ -27,7 +27,7 @@
#include "Magnum/Animation/Player.hpp" #include "Magnum/Animation/Player.hpp"
namespace Magnum { namespace Animation { namespace Test { namespace Magnum { namespace Animation { namespace Test { namespace {
struct PlayerCustomTest: TestSuite::Tester { struct PlayerCustomTest: TestSuite::Tester {
explicit PlayerCustomTest(); explicit PlayerCustomTest();
@ -43,14 +43,12 @@ PlayerCustomTest::PlayerCustomTest() {
typedef std::uint64_t UnsignedLong; /** @todo what about this? */ typedef std::uint64_t UnsignedLong; /** @todo what about this? */
#endif #endif
namespace { const Animation::Track<UnsignedShort, Float> Track{{
const Animation::Track<UnsignedShort, Float> Track{{ {24, 1.5f}, /* 1.0 sec */
{24, 1.5f}, /* 1.0 sec */ {60, 3.0f}, /* 2.5 sec */
{60, 3.0f}, /* 2.5 sec */ {72, 5.0f}, /* 3.0 sec */
{72, 5.0f}, /* 3.0 sec */ {96, 2.0f} /* 4.0 sec */
{96, 2.0f} /* 4.0 sec */ }, Math::lerp};
}, Math::lerp};
}
void PlayerCustomTest::test() { void PlayerCustomTest::test() {
Player<UnsignedLong, UnsignedShort> player{ Player<UnsignedLong, UnsignedShort> player{
@ -75,6 +73,6 @@ void PlayerCustomTest::test() {
CORRADE_COMPARE(value, 4.0f); CORRADE_COMPARE(value, 4.0f);
} }
}}} }}}}
CORRADE_TEST_MAIN(Magnum::Animation::Test::PlayerCustomTest) CORRADE_TEST_MAIN(Magnum::Animation::Test::PlayerCustomTest)

80
src/Magnum/Animation/Test/PlayerTest.cpp

@ -30,7 +30,7 @@
#include "Magnum/Animation/Player.h" #include "Magnum/Animation/Player.h"
namespace Magnum { namespace Animation { namespace Test { namespace Magnum { namespace Animation { namespace Test { namespace {
struct PlayerTest: TestSuite::Tester { struct PlayerTest: TestSuite::Tester {
explicit PlayerTest(); explicit PlayerTest();
@ -89,34 +89,32 @@ struct PlayerTest: TestSuite::Tester {
void debugState(); void debugState();
}; };
namespace { const struct {
const struct { const char* name;
const char* name; Float offsetFloat;
Float offsetFloat; std::chrono::minutes offsetChrono;
std::chrono::minutes offsetChrono; bool failsFloat, failsFuzzyFloat;
bool failsFloat, failsFuzzyFloat; } RunFor100YearsData[]{
} RunFor100YearsData[]{ {"0", 0.0f, {}, false, false},
{"0", 0.0f, {}, false, false}, {"1 minute", 60.0f, std::chrono::minutes(1), false, false},
{"1 minute", 60.0f, std::chrono::minutes(1), false, false}, {"5 minutes", 5.0f*60.0f, std::chrono::minutes{5}, true, false},
{"5 minutes", 5.0f*60.0f, std::chrono::minutes{5}, true, false}, {"30 minutes", 30.0f*60.0f, std::chrono::minutes{30}, true, false},
{"30 minutes", 30.0f*60.0f, std::chrono::minutes{30}, true, false}, {"1 hour", 60.0f*60.0f, std::chrono::minutes{60}, true, false},
{"1 hour", 60.0f*60.0f, std::chrono::minutes{60}, true, false}, {"1 day", 24.0f*60.0f*60.0f, std::chrono::minutes{24*60}, true, true},
{"1 day", 24.0f*60.0f*60.0f, std::chrono::minutes{24*60}, true, true}, {"100 days", 100.0f*24.0f*60.0f*60.0f, std::chrono::minutes{100*24*60}, true, true},
{"100 days", 100.0f*24.0f*60.0f*60.0f, std::chrono::minutes{100*24*60}, true, true}, {"100 years", 100.0f*365.0f*24.0f*60.0f*60.0f,
{"100 years", 100.0f*365.0f*24.0f*60.0f*60.0f, /* MSVC 2017 (but not 2015) ICEs when assigning hours to minutes
/* MSVC 2017 (but not 2015) ICEs when assigning hours to minutes (or just any other two different chrono types) in a struct array
(or just any other two different chrono types) in a struct array initializer (not when there's just a struct and also not when
initializer (not when there's just a struct and also not when the struct is only a chrono member itself). Keeping at least one
the struct is only a chrono member itself). Keeping at least one instance here so I can monitor when this gets fixed. */
instance here so I can monitor when this gets fixed. */ #if !defined(CORRADE_MSVC2017_COMPATIBILITY) || defined(CORRADE_MSVC2015_COMPATIBLITY)
#if !defined(CORRADE_MSVC2017_COMPATIBILITY) || defined(CORRADE_MSVC2015_COMPATIBLITY) std::chrono::hours{100*365*24},
std::chrono::hours{100*365*24}, #else
#else std::chrono::minutes{100*365*24*60},
std::chrono::minutes{100*365*24*60}, #endif
#endif true, true},
true, true}, };
};
}
PlayerTest::PlayerTest() { PlayerTest::PlayerTest() {
addTests({&PlayerTest::constructEmpty, addTests({&PlayerTest::constructEmpty,
@ -184,14 +182,12 @@ void PlayerTest::constructEmpty() {
CORRADE_COMPARE(player.size(), 0); CORRADE_COMPARE(player.size(), 0);
} }
namespace { const Animation::Track<Float, Float> Track{{
const Animation::Track<Float, Float> Track{{ {1.0f, 1.5f},
{1.0f, 1.5f}, {2.5f, 3.0f},
{2.5f, 3.0f}, {3.0f, 5.0f},
{3.0f, 5.0f}, {4.0f, 2.0f}
{4.0f, 2.0f} }, Math::lerp};
}, Math::lerp};
}
void PlayerTest::construct() { void PlayerTest::construct() {
Animation::Track<Float, Int> track2{{ Animation::Track<Float, Int> track2{{
@ -1248,11 +1244,9 @@ void PlayerTest::addWithCallbackOnChangeTemplate() {
CORRADE_COMPARE(data.called, 2); CORRADE_COMPARE(data.called, 2);
} }
namespace { /* Can't use raw lambdas because MSVC 2015 */
/* Can't use raw lambdas because MSVC 2015 */ void callback(std::vector<Int>& data, Int value) {
void callback(std::vector<Int>& data, Int value) { data.push_back(value);
data.push_back(value);
}
} }
void PlayerTest::addRawCallback() { void PlayerTest::addRawCallback() {
@ -1357,6 +1351,6 @@ void PlayerTest::debugState() {
CORRADE_COMPARE(out.str(), "Animation::State::Playing Animation::State(0xde)\n"); CORRADE_COMPARE(out.str(), "Animation::State::Playing Animation::State(0xde)\n");
} }
}}} }}}}
CORRADE_TEST_MAIN(Magnum::Animation::Test::PlayerTest) CORRADE_TEST_MAIN(Magnum::Animation::Test::PlayerTest)

18
src/Magnum/Animation/Test/TrackTest.cpp

@ -29,7 +29,7 @@
#include "Magnum/Math/Half.h" #include "Magnum/Math/Half.h"
#include "Magnum/Math/Vector3.h" #include "Magnum/Math/Vector3.h"
namespace Magnum { namespace Animation { namespace Test { namespace Magnum { namespace Animation { namespace Test { namespace {
struct TrackTest: TestSuite::Tester { struct TrackTest: TestSuite::Tester {
explicit TrackTest(); explicit TrackTest();
@ -56,8 +56,6 @@ struct TrackTest: TestSuite::Tester {
void atDifferentResultTypeStrict(); void atDifferentResultTypeStrict();
}; };
namespace {
/* Reduced version from InterpolateTest, keep in sync with TrackViewTest */ /* Reduced version from InterpolateTest, keep in sync with TrackViewTest */
const struct { const struct {
const char* name; const char* name;
@ -93,8 +91,6 @@ const struct {
6.0f, -1.5f, -1.5f, 2} 6.0f, -1.5f, -1.5f, 2}
}; };
}
TrackTest::TrackTest() { TrackTest::TrackTest() {
addTests({&TrackTest::constructEmpty, addTests({&TrackTest::constructEmpty,
&TrackTest::constructArrayInterpolator, &TrackTest::constructArrayInterpolator,
@ -217,9 +213,7 @@ void TrackTest::constructArrayInterpolationDefaults() {
CORRADE_COMPARE(a.values()[0], (Vector3{3.0f, 1.0f, 0.1f})); CORRADE_COMPARE(a.values()[0], (Vector3{3.0f, 1.0f, 0.1f}));
} }
namespace { Vector3 customLerp(const Vector3&, const Vector3&, Float) { return {}; }
Vector3 customLerp(const Vector3&, const Vector3&, Float) { return {}; }
}
void TrackTest::constructArrayInterpolationInterpolator() { void TrackTest::constructArrayInterpolationInterpolator() {
const Track<Float, Vector3> a{ const Track<Float, Vector3> a{
@ -437,10 +431,8 @@ void TrackTest::atStrict() {
CORRADE_COMPARE(hint, data.expectedHint); CORRADE_COMPARE(hint, data.expectedHint);
} }
namespace { Float lerpHalf(const Half& a, const Half& b, Float t) {
Float lerpHalf(const Half& a, const Half& b, Float t) { return Math::lerp(Float(a), Float(b), t);
return Math::lerp(Float(a), Float(b), t);
}
} }
void TrackTest::atDifferentResultType() { void TrackTest::atDifferentResultType() {
@ -472,6 +464,6 @@ void TrackTest::atDifferentResultTypeStrict() {
CORRADE_COMPARE(hint, 2); CORRADE_COMPARE(hint, 2);
} }
}}} }}}}
CORRADE_TEST_MAIN(Magnum::Animation::Test::TrackTest) CORRADE_TEST_MAIN(Magnum::Animation::Test::TrackTest)

35
src/Magnum/Animation/Test/TrackViewTest.cpp

@ -29,7 +29,7 @@
#include "Magnum/Math/Half.h" #include "Magnum/Math/Half.h"
#include "Magnum/Math/Vector3.h" #include "Magnum/Math/Vector3.h"
namespace Magnum { namespace Animation { namespace Test { namespace Magnum { namespace Animation { namespace Test { namespace {
struct TrackViewTest: TestSuite::Tester { struct TrackViewTest: TestSuite::Tester {
explicit TrackViewTest(); explicit TrackViewTest();
@ -56,8 +56,6 @@ struct TrackViewTest: TestSuite::Tester {
void atDifferentResultTypeStrict(); void atDifferentResultTypeStrict();
}; };
namespace {
/* Reduced version from InterpolateTest, keep in sync with TrackTest */ /* Reduced version from InterpolateTest, keep in sync with TrackTest */
const struct { const struct {
const char* name; const char* name;
@ -93,8 +91,6 @@ const struct {
6.0f, -1.5f, -1.5f, 2} 6.0f, -1.5f, -1.5f, 2}
}; };
}
TrackViewTest::TrackViewTest() { TrackViewTest::TrackViewTest() {
addTests({&TrackViewTest::constructEmpty, addTests({&TrackViewTest::constructEmpty,
&TrackViewTest::constructInterpolator, &TrackViewTest::constructInterpolator,
@ -204,9 +200,7 @@ void TrackViewTest::constructInterpolationDefaults() {
CORRADE_COMPARE(a[1], (std::pair<Float, Vector3>{5.0f, {0.3f, 0.6f, 1.0f}})); CORRADE_COMPARE(a[1], (std::pair<Float, Vector3>{5.0f, {0.3f, 0.6f, 1.0f}}));
} }
namespace { Vector3 customLerp(const Vector3&, const Vector3&, Float) { return {}; }
Vector3 customLerp(const Vector3&, const Vector3&, Float) { return {}; }
}
void TrackViewTest::constructInterpolationInterpolator() { void TrackViewTest::constructInterpolationInterpolator() {
constexpr Float keys[]{1.0f, 5.0f}; constexpr Float keys[]{1.0f, 5.0f};
@ -381,13 +375,12 @@ void TrackViewTest::constructCopyStorage() {
CORRADE_COMPARE(bv[1], (std::pair<Float, Vector3>{5.0f, {0.3f, 0.6f, 1.0f}})); CORRADE_COMPARE(bv[1], (std::pair<Float, Vector3>{5.0f, {0.3f, 0.6f, 1.0f}}));
} }
namespace { const std::pair<Float, Float> Keyframes[]{
const std::pair<Float, Float> Keyframes[]{ {0.0f, 3.0f},
{0.0f, 3.0f}, {2.0f, 1.0f},
{2.0f, 1.0f}, {4.0f, 2.5f},
{4.0f, 2.5f}, {5.0f, 0.5f}
{5.0f, 0.5f}}; };
}
void TrackViewTest::at() { void TrackViewTest::at() {
const auto& data = AtData[testCaseInstanceId()]; const auto& data = AtData[testCaseInstanceId()];
@ -414,14 +407,12 @@ void TrackViewTest::atStrict() {
CORRADE_COMPARE(hint, data.expectedHint); CORRADE_COMPARE(hint, data.expectedHint);
} }
namespace { using namespace Math::Literals;
using namespace Math::Literals;
const Half HalfValues[]{3.0_h, 1.0_h, 2.5_h, 0.5_h}; const Half HalfValues[]{3.0_h, 1.0_h, 2.5_h, 0.5_h};
Float lerpHalf(const Half& a, const Half& b, Float t) { Float lerpHalf(const Half& a, const Half& b, Float t) {
return Math::lerp(Float(a), Float(b), t); return Math::lerp(Float(a), Float(b), t);
}
} }
void TrackViewTest::atDifferentResultType() { void TrackViewTest::atDifferentResultType() {
@ -445,6 +436,6 @@ void TrackViewTest::atDifferentResultTypeStrict() {
CORRADE_COMPARE(hint, 2); CORRADE_COMPARE(hint, 2);
} }
}}} }}}}
CORRADE_TEST_MAIN(Magnum::Animation::Test::TrackViewTest) CORRADE_TEST_MAIN(Magnum::Animation::Test::TrackViewTest)

4
src/Magnum/Audio/Test/AbstractImporterTest.cpp

@ -31,7 +31,7 @@
#include "configure.h" #include "configure.h"
namespace Magnum { namespace Audio { namespace Test { namespace Magnum { namespace Audio { namespace Test { namespace {
struct AbstractImporterTest: TestSuite::Tester { struct AbstractImporterTest: TestSuite::Tester {
explicit AbstractImporterTest(); explicit AbstractImporterTest();
@ -71,6 +71,6 @@ void AbstractImporterTest::openFile() {
CORRADE_VERIFY(importer.isOpened()); CORRADE_VERIFY(importer.isOpened());
} }
}}} }}}}
CORRADE_TEST_MAIN(Magnum::Audio::Test::AbstractImporterTest) CORRADE_TEST_MAIN(Magnum::Audio::Test::AbstractImporterTest)

4
src/Magnum/Audio/Test/BufferALTest.cpp

@ -28,7 +28,7 @@
#include "Magnum/Audio/Buffer.h" #include "Magnum/Audio/Buffer.h"
#include "Magnum/Audio/Context.h" #include "Magnum/Audio/Context.h"
namespace Magnum { namespace Audio { namespace Test { namespace Magnum { namespace Audio { namespace Test { namespace {
struct BufferALTest: TestSuite::Tester { struct BufferALTest: TestSuite::Tester {
explicit BufferALTest(); explicit BufferALTest();
@ -47,6 +47,6 @@ void BufferALTest::construct() {
CORRADE_VERIFY(buf.id() != 0); CORRADE_VERIFY(buf.id() != 0);
} }
}}} }}}}
CORRADE_TEST_MAIN(Magnum::Audio::Test::BufferALTest) CORRADE_TEST_MAIN(Magnum::Audio::Test::BufferALTest)

4
src/Magnum/Audio/Test/BufferFormatTest.cpp

@ -28,7 +28,7 @@
#include "Magnum/Audio/BufferFormat.h" #include "Magnum/Audio/BufferFormat.h"
namespace Magnum { namespace Audio { namespace Test { namespace Magnum { namespace Audio { namespace Test { namespace {
struct BufferFormatTest: TestSuite::Tester { struct BufferFormatTest: TestSuite::Tester {
explicit BufferFormatTest(); explicit BufferFormatTest();
@ -46,6 +46,6 @@ void BufferFormatTest::debugFormat() {
CORRADE_COMPARE(out.str(), "Audio::BufferFormat::Stereo16 Audio::BufferFormat(0xdead)\n"); CORRADE_COMPARE(out.str(), "Audio::BufferFormat::Stereo16 Audio::BufferFormat(0xdead)\n");
} }
}}} }}}}
CORRADE_TEST_MAIN(Magnum::Audio::Test::BufferFormatTest) CORRADE_TEST_MAIN(Magnum::Audio::Test::BufferFormatTest)

4
src/Magnum/Audio/Test/ContextALTest.cpp

@ -29,7 +29,7 @@
#include "Magnum/Audio/Extensions.h" #include "Magnum/Audio/Extensions.h"
#include "Magnum/Audio/Context.h" #include "Magnum/Audio/Context.h"
namespace Magnum { namespace Audio { namespace Test { namespace Magnum { namespace Audio { namespace Test { namespace {
struct ContextALTest: TestSuite::Tester { struct ContextALTest: TestSuite::Tester {
explicit ContextALTest(); explicit ContextALTest();
@ -87,6 +87,6 @@ void ContextALTest::isExtensionEnabled() {
CORRADE_VERIFY(Context::current().isExtensionSupported<Extensions::ALC::EXT::ENUMERATION>()); CORRADE_VERIFY(Context::current().isExtensionSupported<Extensions::ALC::EXT::ENUMERATION>());
} }
}}} }}}}
CORRADE_TEST_MAIN(Magnum::Audio::Test::ContextALTest) CORRADE_TEST_MAIN(Magnum::Audio::Test::ContextALTest)

4
src/Magnum/Audio/Test/ContextTest.cpp

@ -29,7 +29,7 @@
#include "Magnum/Audio/Context.h" #include "Magnum/Audio/Context.h"
namespace Magnum { namespace Audio { namespace Test { namespace Magnum { namespace Audio { namespace Test { namespace {
struct ContextTest: TestSuite::Tester { struct ContextTest: TestSuite::Tester {
explicit ContextTest(); explicit ContextTest();
@ -94,6 +94,6 @@ void ContextTest::debugHrtfStatus() {
CORRADE_COMPARE(out.str(), "Audio::Context::HrtfStatus::Denied Audio::Context::HrtfStatus(0xdead)\n"); CORRADE_COMPARE(out.str(), "Audio::Context::HrtfStatus::Denied Audio::Context::HrtfStatus(0xdead)\n");
} }
}}} }}}}
CORRADE_TEST_MAIN(Magnum::Audio::Test::ContextTest) CORRADE_TEST_MAIN(Magnum::Audio::Test::ContextTest)

4
src/Magnum/Audio/Test/ListenerALTest.cpp

@ -36,7 +36,7 @@
#include "Magnum/SceneGraph/MatrixTransformation2D.h" #include "Magnum/SceneGraph/MatrixTransformation2D.h"
#include "Magnum/SceneGraph/MatrixTransformation3D.h" #include "Magnum/SceneGraph/MatrixTransformation3D.h"
namespace Magnum { namespace Audio { namespace Test { namespace Magnum { namespace Audio { namespace Test { namespace {
typedef SceneGraph::Scene<SceneGraph::MatrixTransformation2D> Scene2D; typedef SceneGraph::Scene<SceneGraph::MatrixTransformation2D> Scene2D;
typedef SceneGraph::Object<SceneGraph::MatrixTransformation2D> Object2D; typedef SceneGraph::Object<SceneGraph::MatrixTransformation2D> Object2D;
@ -106,6 +106,6 @@ void ListenerALTest::updateGroups() {
CORRADE_COMPARE(playable.source().position(), offset*13.0f); CORRADE_COMPARE(playable.source().position(), offset*13.0f);
} }
}}} }}}}
CORRADE_TEST_MAIN(Magnum::Audio::Test::ListenerALTest) CORRADE_TEST_MAIN(Magnum::Audio::Test::ListenerALTest)

4
src/Magnum/Audio/Test/PlayableALTest.cpp

@ -33,7 +33,7 @@
#include "Magnum/SceneGraph/Object.h" #include "Magnum/SceneGraph/Object.h"
#include "Magnum/SceneGraph/MatrixTransformation3D.h" #include "Magnum/SceneGraph/MatrixTransformation3D.h"
namespace Magnum { namespace Audio { namespace Test { namespace Magnum { namespace Audio { namespace Test { namespace {
typedef SceneGraph::Scene<SceneGraph::MatrixTransformation3D> Scene3D; typedef SceneGraph::Scene<SceneGraph::MatrixTransformation3D> Scene3D;
typedef SceneGraph::Object<SceneGraph::MatrixTransformation3D> Object3D; typedef SceneGraph::Object<SceneGraph::MatrixTransformation3D> Object3D;
@ -100,6 +100,6 @@ void PlayableALTest::group() {
group.stop(); group.stop();
} }
}}} }}}}
CORRADE_TEST_MAIN(Magnum::Audio::Test::PlayableALTest) CORRADE_TEST_MAIN(Magnum::Audio::Test::PlayableALTest)

4
src/Magnum/Audio/Test/RendererALTest.cpp

@ -28,7 +28,7 @@
#include "Magnum/Audio/Context.h" #include "Magnum/Audio/Context.h"
#include "Magnum/Audio/Renderer.h" #include "Magnum/Audio/Renderer.h"
namespace Magnum { namespace Audio { namespace Test { namespace Magnum { namespace Audio { namespace Test { namespace {
struct RendererALTest: TestSuite::Tester { struct RendererALTest: TestSuite::Tester {
explicit RendererALTest(); explicit RendererALTest();
@ -105,6 +105,6 @@ void RendererALTest::distanceModel() {
CORRADE_COMPARE(Renderer::distanceModel(), model); CORRADE_COMPARE(Renderer::distanceModel(), model);
} }
}}} }}}}
CORRADE_TEST_MAIN(Magnum::Audio::Test::RendererALTest) CORRADE_TEST_MAIN(Magnum::Audio::Test::RendererALTest)

4
src/Magnum/Audio/Test/RendererTest.cpp

@ -29,7 +29,7 @@
#include "Magnum/Magnum.h" #include "Magnum/Magnum.h"
#include "Magnum/Audio/Renderer.h" #include "Magnum/Audio/Renderer.h"
namespace Magnum { namespace Audio { namespace Test { namespace Magnum { namespace Audio { namespace Test { namespace {
struct RendererTest: TestSuite::Tester { struct RendererTest: TestSuite::Tester {
explicit RendererTest(); explicit RendererTest();
@ -55,6 +55,6 @@ void RendererTest::debugDistanceModel() {
CORRADE_COMPARE(out.str(), "Audio::Renderer::DistanceModel::Inverse Audio::Renderer::DistanceModel(0xdead)\n"); CORRADE_COMPARE(out.str(), "Audio::Renderer::DistanceModel::Inverse Audio::Renderer::DistanceModel(0xdead)\n");
} }
}}} }}}}
CORRADE_TEST_MAIN(Magnum::Audio::Test::RendererTest) CORRADE_TEST_MAIN(Magnum::Audio::Test::RendererTest)

4
src/Magnum/Audio/Test/SourceALTest.cpp

@ -28,7 +28,7 @@
#include "Magnum/Audio/Context.h" #include "Magnum/Audio/Context.h"
#include "Magnum/Audio/Source.h" #include "Magnum/Audio/Source.h"
namespace Magnum { namespace Audio { namespace Test { namespace Magnum { namespace Audio { namespace Test { namespace {
struct SourceALTest: TestSuite::Tester { struct SourceALTest: TestSuite::Tester {
explicit SourceALTest(); explicit SourceALTest();
@ -168,6 +168,6 @@ void SourceALTest::rolloffFactor() {
CORRADE_COMPARE(source.rolloffFactor(), fact); CORRADE_COMPARE(source.rolloffFactor(), fact);
} }
}}} }}}}
CORRADE_TEST_MAIN(Magnum::Audio::Test::SourceALTest) CORRADE_TEST_MAIN(Magnum::Audio::Test::SourceALTest)

4
src/Magnum/Audio/Test/SourceTest.cpp

@ -28,7 +28,7 @@
#include "Magnum/Audio/Source.h" #include "Magnum/Audio/Source.h"
namespace Magnum { namespace Audio { namespace Test { namespace Magnum { namespace Audio { namespace Test { namespace {
struct SourceTest: TestSuite::Tester { struct SourceTest: TestSuite::Tester {
explicit SourceTest(); explicit SourceTest();
@ -46,6 +46,6 @@ void SourceTest::debugState() {
CORRADE_COMPARE(out.str(), "Audio::Source::State::Playing Audio::Source::State(0xdead)\n"); CORRADE_COMPARE(out.str(), "Audio::Source::State::Playing Audio::Source::State(0xdead)\n");
} }
}}} }}}}
CORRADE_TEST_MAIN(Magnum::Audio::Test::SourceTest) CORRADE_TEST_MAIN(Magnum::Audio::Test::SourceTest)

8
src/Magnum/DebugTools/Test/BufferDataGLTest.cpp

@ -28,7 +28,7 @@
#include "Magnum/DebugTools/BufferData.h" #include "Magnum/DebugTools/BufferData.h"
#include "Magnum/GL/OpenGLTester.h" #include "Magnum/GL/OpenGLTester.h"
namespace Magnum { namespace DebugTools { namespace Test { namespace Magnum { namespace DebugTools { namespace Test { namespace {
struct BufferDataGLTest: Magnum::GL::OpenGLTester { struct BufferDataGLTest: Magnum::GL::OpenGLTester {
explicit BufferDataGLTest(); explicit BufferDataGLTest();
@ -42,9 +42,7 @@ BufferDataGLTest::BufferDataGLTest() {
&BufferDataGLTest::subData}); &BufferDataGLTest::subData});
} }
namespace { constexpr Int Data[] = {2, 7, 5, 13, 25};
constexpr Int Data[] = {2, 7, 5, 13, 25};
}
void BufferDataGLTest::data() { void BufferDataGLTest::data() {
GL::Buffer buffer; GL::Buffer buffer;
@ -64,6 +62,6 @@ void BufferDataGLTest::subData() {
TestSuite::Compare::Container); TestSuite::Compare::Container);
} }
}}} }}}}
CORRADE_TEST_MAIN(Magnum::DebugTools::Test::BufferDataGLTest) CORRADE_TEST_MAIN(Magnum::DebugTools::Test::BufferDataGLTest)

4
src/Magnum/DebugTools/Test/CapsuleRendererTest.cpp

@ -27,7 +27,7 @@
#include "Magnum/DebugTools/Implementation/CapsuleRendererTransformation.h" #include "Magnum/DebugTools/Implementation/CapsuleRendererTransformation.h"
namespace Magnum { namespace DebugTools { namespace Test { namespace Magnum { namespace DebugTools { namespace Test { namespace {
struct CapsuleRendererTest: TestSuite::Tester { struct CapsuleRendererTest: TestSuite::Tester {
explicit CapsuleRendererTest(); explicit CapsuleRendererTest();
@ -174,6 +174,6 @@ void CapsuleRendererTest::common3D() {
} }
CORRADE_IGNORE_DEPRECATED_POP CORRADE_IGNORE_DEPRECATED_POP
}}} }}}}
CORRADE_TEST_MAIN(Magnum::DebugTools::Test::CapsuleRendererTest) CORRADE_TEST_MAIN(Magnum::DebugTools::Test::CapsuleRendererTest)

87
src/Magnum/DebugTools/Test/CompareImageTest.cpp

@ -40,7 +40,7 @@
#include "configure.h" #include "configure.h"
namespace Magnum { namespace DebugTools { namespace Test { namespace Magnum { namespace DebugTools { namespace Test { namespace {
struct CompareImageTest: TestSuite::Tester { struct CompareImageTest: TestSuite::Tester {
explicit CompareImageTest(); explicit CompareImageTest();
@ -166,27 +166,26 @@ CompareImageTest::CompareImageTest() {
&CompareImageTest::fileToImageActualIsCompressed}); &CompareImageTest::fileToImageActualIsCompressed});
} }
namespace { const Float ActualRedData[] = {
const Float ActualRedData[] = { 0.3f, 1.0f, 0.9f,
0.3f, 1.0f, 0.9f, 0.9f, 0.6f, 0.2f,
0.9f, 0.6f, 0.2f, -0.1f, 1.0f, 0.0f
-0.1f, 1.0f, 0.0f };
};
const Float ExpectedRedData[] = { const Float ExpectedRedData[] = {
0.65f, 1.0f, 0.6f, 0.65f, 1.0f, 0.6f,
0.91f, 0.6f, 0.1f, 0.91f, 0.6f, 0.1f,
0.02f, 0.0f, 0.0f 0.02f, 0.0f, 0.0f
}; };
const std::vector<Float> DeltaRed{ const std::vector<Float> DeltaRed{
0.35f, 0.0f, 0.3f, 0.35f, 0.0f, 0.3f,
0.01f, 0.0f, 0.1f, 0.01f, 0.0f, 0.1f,
0.12f, 1.0f, 0.0f}; 0.12f, 1.0f, 0.0f
};
const ImageView2D ActualRed{PixelFormat::R32F, {3, 3}, ActualRedData}; const ImageView2D ActualRed{PixelFormat::R32F, {3, 3}, ActualRedData};
const ImageView2D ExpectedRed{PixelFormat::R32F, {3, 3}, ExpectedRedData}; const ImageView2D ExpectedRed{PixelFormat::R32F, {3, 3}, ExpectedRedData};
}
void CompareImageTest::formatUnknown() { void CompareImageTest::formatUnknown() {
std::ostringstream out; std::ostringstream out;
@ -242,25 +241,23 @@ void CompareImageTest::calculateDelta() {
CORRADE_COMPARE(mean, 0.208889f); CORRADE_COMPARE(mean, 0.208889f);
} }
namespace { /* Different storage for each */
/* Different storage for each */ const UnsignedByte ActualRgbData[] = {
const UnsignedByte ActualRgbData[] = { 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0x56, 0xf8, 0x3a, 0x56, 0x47, 0xec, 0, 0,
0x56, 0xf8, 0x3a, 0x56, 0x47, 0xec, 0, 0, 0x23, 0x57, 0x10, 0xab, 0xcd, 0x85, 0, 0
0x23, 0x57, 0x10, 0xab, 0xcd, 0x85, 0, 0 };
};
const UnsignedByte ExpectedRgbData[] = { const UnsignedByte ExpectedRgbData[] = {
0, 0, 0, 0x55, 0xf8, 0x3a, 0x56, 0x10, 0xed, 0, 0, 0, 0, 0, 0, 0x55, 0xf8, 0x3a, 0x56, 0x10, 0xed, 0, 0, 0,
0, 0, 0, 0x23, 0x27, 0x10, 0xab, 0xcd, 0xfa, 0, 0, 0 0, 0, 0, 0x23, 0x27, 0x10, 0xab, 0xcd, 0xfa, 0, 0, 0
}; };
const ImageView2D ActualRgb{PixelStorage{}.setSkip({0, 1, 0}), const ImageView2D ActualRgb{PixelStorage{}.setSkip({0, 1, 0}),
PixelFormat::RGB8Unorm, {2, 2}, ActualRgbData}; PixelFormat::RGB8Unorm, {2, 2}, ActualRgbData};
const ImageView2D ExpectedRgb{ const ImageView2D ExpectedRgb{
PixelStorage{}.setSkip({1, 0, 0}).setRowLength(3), PixelStorage{}.setSkip({1, 0, 0}).setRowLength(3),
PixelFormat::RGB8Unorm, {2, 2}, ExpectedRgbData}; PixelFormat::RGB8Unorm, {2, 2}, ExpectedRgbData};
}
void CompareImageTest::calculateDeltaStorage() { void CompareImageTest::calculateDeltaStorage() {
std::vector<Float> delta; std::vector<Float> delta;
@ -489,15 +486,13 @@ void CompareImageTest::teardownExternalPluginManager() {
_manager = Containers::NullOpt; _manager = Containers::NullOpt;
} }
namespace { constexpr const char* ImageCompareError =
constexpr const char* ImageCompareError = "Images a and b have both max and mean delta above threshold, actual 39/18.5 but at most 20/10 expected. Delta image:\n"
"Images a and b have both max and mean delta above threshold, actual 39/18.5 but at most 20/10 expected. Delta image:\n" " |?M|\n"
" |?M|\n" " Pixels above max/mean threshold:\n"
" Pixels above max/mean threshold:\n" " [1,1] #abcd85, expected #abcdfa (Δ = 39)\n"
" [1,1] #abcd85, expected #abcdfa (Δ = 39)\n" " [1,0] #5647ec, expected #5610ed (Δ = 18.6667)\n"
" [1,0] #5647ec, expected #5610ed (Δ = 18.6667)\n" " [0,1] #235710, expected #232710 (Δ = 16)\n";
" [0,1] #235710, expected #232710 (Δ = 16)\n";
}
void CompareImageTest::image() { void CompareImageTest::image() {
CORRADE_COMPARE_WITH(ActualRgb, ExpectedRgb, (CompareImage{40.0f, 20.0f})); CORRADE_COMPARE_WITH(ActualRgb, ExpectedRgb, (CompareImage{40.0f, 20.0f}));
@ -936,6 +931,6 @@ void CompareImageTest::fileToImageActualIsCompressed() {
"Actual image a (.../CompareImageCompressed.dds) is compressed, comparison not possible.\n"); "Actual image a (.../CompareImageCompressed.dds) is compressed, comparison not possible.\n");
} }
}}} }}}}
CORRADE_TEST_MAIN(Magnum::DebugTools::Test::CompareImageTest) CORRADE_TEST_MAIN(Magnum::DebugTools::Test::CompareImageTest)

4
src/Magnum/DebugTools/Test/CylinderRendererTest.cpp

@ -27,7 +27,7 @@
#include "Magnum/DebugTools/Implementation/CylinderRendererTransformation.h" #include "Magnum/DebugTools/Implementation/CylinderRendererTransformation.h"
namespace Magnum { namespace DebugTools { namespace Test { namespace Magnum { namespace DebugTools { namespace Test { namespace {
struct CylinderRendererTest: TestSuite::Tester { struct CylinderRendererTest: TestSuite::Tester {
explicit CylinderRendererTest(); explicit CylinderRendererTest();
@ -122,6 +122,6 @@ void CylinderRendererTest::common3D() {
} }
CORRADE_IGNORE_DEPRECATED_POP CORRADE_IGNORE_DEPRECATED_POP
}}} }}}}
CORRADE_TEST_MAIN(Magnum::DebugTools::Test::CylinderRendererTest) CORRADE_TEST_MAIN(Magnum::DebugTools::Test::CylinderRendererTest)

4
src/Magnum/DebugTools/Test/ForceRendererTest.cpp

@ -28,7 +28,7 @@
#include "Magnum/DebugTools/Implementation/ForceRendererTransformation.h" #include "Magnum/DebugTools/Implementation/ForceRendererTransformation.h"
namespace Magnum { namespace DebugTools { namespace Implementation { namespace Test { namespace Magnum { namespace DebugTools { namespace Implementation { namespace Test { namespace {
struct ForceRendererTest: TestSuite::Tester { struct ForceRendererTest: TestSuite::Tester {
explicit ForceRendererTest(); explicit ForceRendererTest();
@ -115,6 +115,6 @@ void ForceRendererTest::arbitrary3D() {
TestSuite::Compare::Less); TestSuite::Compare::Less);
} }
}}}} }}}}}
CORRADE_TEST_MAIN(Magnum::DebugTools::Implementation::Test::ForceRendererTest) CORRADE_TEST_MAIN(Magnum::DebugTools::Implementation::Test::ForceRendererTest)

4
src/Magnum/DebugTools/Test/LineSegmentRendererTest.cpp

@ -31,7 +31,7 @@
#include "Magnum/DebugTools/Implementation/LineSegmentRendererTransformation.h" #include "Magnum/DebugTools/Implementation/LineSegmentRendererTransformation.h"
namespace Magnum { namespace DebugTools { namespace Test { namespace Magnum { namespace DebugTools { namespace Test { namespace {
struct LineSegmentRendererTest: TestSuite::Tester { struct LineSegmentRendererTest: TestSuite::Tester {
explicit LineSegmentRendererTest(); explicit LineSegmentRendererTest();
@ -65,6 +65,6 @@ void LineSegmentRendererTest::line3D() {
} }
CORRADE_IGNORE_DEPRECATED_POP CORRADE_IGNORE_DEPRECATED_POP
}}} }}}}
CORRADE_TEST_MAIN(Magnum::DebugTools::Test::LineSegmentRendererTest) CORRADE_TEST_MAIN(Magnum::DebugTools::Test::LineSegmentRendererTest)

34
src/Magnum/DebugTools/Test/TextureImageGLTest.cpp

@ -40,7 +40,7 @@
#include "Magnum/GL/BufferImage.h" #include "Magnum/GL/BufferImage.h"
#endif #endif
namespace Magnum { namespace DebugTools { namespace Test { namespace Magnum { namespace DebugTools { namespace Test { namespace {
struct TextureImageGLTest: GL::OpenGLTester { struct TextureImageGLTest: GL::OpenGLTester {
explicit TextureImageGLTest(); explicit TextureImageGLTest();
@ -83,12 +83,10 @@ TextureImageGLTest::TextureImageGLTest() {
}); });
} }
namespace { constexpr UnsignedByte Data2D[] = { 0x00, 0x01, 0x02, 0x03,
constexpr UnsignedByte Data2D[] = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b,
0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f };
0x0c, 0x0d, 0x0e, 0x0f };
}
void TextureImageGLTest::subImage2D() { void TextureImageGLTest::subImage2D() {
GL::Texture2D texture; GL::Texture2D texture;
@ -199,12 +197,10 @@ void TextureImageGLTest::subImageCubeBuffer() {
#endif #endif
#ifndef MAGNUM_TARGET_GLES2 #ifndef MAGNUM_TARGET_GLES2
namespace { constexpr UnsignedInt Data2DUInt[] = { 0xcafebabe,
constexpr UnsignedInt Data2DUInt[] = { 0xcafebabe, 0xdeadbeef,
0xdeadbeef, 0xbadf00d,
0xbadf00d, 0xdeadbabe };
0xdeadbabe };
}
void TextureImageGLTest::subImage2DUInt() { void TextureImageGLTest::subImage2DUInt() {
GL::Texture2D texture; GL::Texture2D texture;
@ -221,12 +217,10 @@ void TextureImageGLTest::subImage2DUInt() {
TestSuite::Compare::Container); TestSuite::Compare::Container);
} }
namespace { constexpr Float Data2DFloat[] = { 1.0f,
constexpr Float Data2DFloat[] = { 1.0f, 3.14159f,
3.14159f, 2.71828f,
2.71828f, 1.41421f };
1.41421f };
}
void TextureImageGLTest::subImage2DFloat() { void TextureImageGLTest::subImage2DFloat() {
GL::Texture2D texture; GL::Texture2D texture;
@ -261,6 +255,6 @@ void TextureImageGLTest::subImage2DFloatGeneric() {
} }
#endif #endif
}}} }}}}
CORRADE_TEST_MAIN(Magnum::DebugTools::Test::TextureImageGLTest) CORRADE_TEST_MAIN(Magnum::DebugTools::Test::TextureImageGLTest)

4
src/Magnum/GL/Test/AbstractObjectGLTest.cpp

@ -28,7 +28,7 @@
#include "Magnum/GL/Extensions.h" #include "Magnum/GL/Extensions.h"
#include "Magnum/GL/OpenGLTester.h" #include "Magnum/GL/OpenGLTester.h"
namespace Magnum { namespace GL { namespace Test { namespace Magnum { namespace GL { namespace Test { namespace {
struct AbstractObjectGLTest: OpenGLTester { struct AbstractObjectGLTest: OpenGLTester {
explicit AbstractObjectGLTest(); explicit AbstractObjectGLTest();
@ -52,6 +52,6 @@ void AbstractObjectGLTest::labelNoOp() {
MAGNUM_VERIFY_NO_GL_ERROR(); MAGNUM_VERIFY_NO_GL_ERROR();
} }
}}} }}}}
CORRADE_TEST_MAIN(Magnum::GL::Test::AbstractObjectGLTest) CORRADE_TEST_MAIN(Magnum::GL::Test::AbstractObjectGLTest)

4
src/Magnum/GL/Test/AbstractQueryGLTest.cpp

@ -28,7 +28,7 @@
#include "Magnum/GL/OpenGLTester.h" #include "Magnum/GL/OpenGLTester.h"
#include "Magnum/GL/SampleQuery.h" #include "Magnum/GL/SampleQuery.h"
namespace Magnum { namespace GL { namespace Test { namespace Magnum { namespace GL { namespace Test { namespace {
struct AbstractQueryGLTest: OpenGLTester { struct AbstractQueryGLTest: OpenGLTester {
explicit AbstractQueryGLTest(); explicit AbstractQueryGLTest();
@ -143,6 +143,6 @@ void AbstractQueryGLTest::label() {
} }
#endif #endif
}}} }}}}
CORRADE_TEST_MAIN(Magnum::GL::Test::AbstractQueryGLTest) CORRADE_TEST_MAIN(Magnum::GL::Test::AbstractQueryGLTest)

93
src/Magnum/GL/Test/AbstractShaderProgramGLTest.cpp

@ -43,7 +43,7 @@
#include "Magnum/Math/Vector4.h" #include "Magnum/Math/Vector4.h"
#include "Magnum/Math/Color.h" #include "Magnum/Math/Color.h"
namespace Magnum { namespace GL { namespace Test { namespace Magnum { namespace GL { namespace Test { namespace {
struct AbstractShaderProgramGLTest: OpenGLTester { struct AbstractShaderProgramGLTest: OpenGLTester {
explicit AbstractShaderProgramGLTest(); explicit AbstractShaderProgramGLTest();
@ -126,12 +126,10 @@ AbstractShaderProgramGLTest::AbstractShaderProgramGLTest() {
}); });
} }
namespace { class DummyShader: public AbstractShaderProgram {
class DummyShader: public AbstractShaderProgram { public:
public: explicit DummyShader() {}
explicit DummyShader() {} };
};
}
void AbstractShaderProgramGLTest::construct() { void AbstractShaderProgramGLTest::construct() {
{ {
@ -183,21 +181,19 @@ void AbstractShaderProgramGLTest::label() {
} }
#endif #endif
namespace { struct MyPublicShader: AbstractShaderProgram {
struct MyPublicShader: AbstractShaderProgram { using AbstractShaderProgram::attachShaders;
using AbstractShaderProgram::attachShaders; using AbstractShaderProgram::bindAttributeLocation;
using AbstractShaderProgram::bindAttributeLocation; #ifndef MAGNUM_TARGET_GLES
#ifndef MAGNUM_TARGET_GLES using AbstractShaderProgram::bindFragmentDataLocationIndexed;
using AbstractShaderProgram::bindFragmentDataLocationIndexed; using AbstractShaderProgram::bindFragmentDataLocation;
using AbstractShaderProgram::bindFragmentDataLocation; #endif
#endif using AbstractShaderProgram::link;
using AbstractShaderProgram::link; using AbstractShaderProgram::uniformLocation;
using AbstractShaderProgram::uniformLocation; #ifndef MAGNUM_TARGET_GLES2
#ifndef MAGNUM_TARGET_GLES2 using AbstractShaderProgram::uniformBlockIndex;
using AbstractShaderProgram::uniformBlockIndex; #endif
#endif };
};
}
void AbstractShaderProgramGLTest::create() { void AbstractShaderProgramGLTest::create() {
Utility::Resource rs("AbstractShaderProgramGLTest"); Utility::Resource rs("AbstractShaderProgramGLTest");
@ -440,18 +436,16 @@ void AbstractShaderProgramGLTest::uniformNotFound() {
"GL::AbstractShaderProgram: location of uniform 'another' cannot be retrieved\n"); "GL::AbstractShaderProgram: location of uniform 'another' cannot be retrieved\n");
} }
namespace { struct MyShader: AbstractShaderProgram {
struct MyShader: AbstractShaderProgram { explicit MyShader();
explicit MyShader();
using AbstractShaderProgram::setUniform; using AbstractShaderProgram::setUniform;
Int matrixUniform, Int matrixUniform,
multiplierUniform, multiplierUniform,
colorUniform, colorUniform,
additionsUniform; additionsUniform;
}; };
}
#ifndef DOXYGEN_GENERATING_OUTPUT #ifndef DOXYGEN_GENERATING_OUTPUT
MyShader::MyShader() { MyShader::MyShader() {
@ -546,19 +540,16 @@ void AbstractShaderProgramGLTest::uniformArray() {
} }
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES
struct MyDoubleShader: AbstractShaderProgram {
explicit MyDoubleShader();
namespace { using AbstractShaderProgram::setUniform;
struct MyDoubleShader: AbstractShaderProgram {
explicit MyDoubleShader();
using AbstractShaderProgram::setUniform;
Int matrixUniform, Int matrixUniform,
multiplierUniform, multiplierUniform,
colorUniform, colorUniform,
additionsUniform; additionsUniform;
}; };
}
#ifndef DOXYGEN_GENERATING_OUTPUT #ifndef DOXYGEN_GENERATING_OUTPUT
MyDoubleShader::MyDoubleShader() { MyDoubleShader::MyDoubleShader() {
@ -720,16 +711,14 @@ void AbstractShaderProgramGLTest::uniformBlockIndexNotFound() {
"GL::AbstractShaderProgram: index of uniform block 'another' cannot be retrieved\n"); "GL::AbstractShaderProgram: index of uniform block 'another' cannot be retrieved\n");
} }
namespace { struct UniformBlockShader: AbstractShaderProgram {
struct UniformBlockShader: AbstractShaderProgram { explicit UniformBlockShader();
explicit UniformBlockShader();
using AbstractShaderProgram::setUniformBlockBinding; using AbstractShaderProgram::setUniformBlockBinding;
Int matricesUniformBlock, Int matricesUniformBlock,
materialUniformBlock; materialUniformBlock;
}; };
}
#ifndef DOXYGEN_GENERATING_OUTPUT #ifndef DOXYGEN_GENERATING_OUTPUT
UniformBlockShader::UniformBlockShader() { UniformBlockShader::UniformBlockShader() {
@ -854,6 +843,6 @@ void AbstractShaderProgramGLTest::compute() {
#endif #endif
#endif #endif
}}} }}}}
CORRADE_TEST_MAIN(Magnum::GL::Test::AbstractShaderProgramGLTest) CORRADE_TEST_MAIN(Magnum::GL::Test::AbstractShaderProgramGLTest)

4
src/Magnum/GL/Test/AbstractShaderProgramTest.cpp

@ -27,7 +27,7 @@
#include "Magnum/GL/AbstractShaderProgram.h" #include "Magnum/GL/AbstractShaderProgram.h"
namespace Magnum { namespace GL { namespace Test { namespace Magnum { namespace GL { namespace Test { namespace {
struct AbstractShaderProgramTest: TestSuite::Tester { struct AbstractShaderProgramTest: TestSuite::Tester {
explicit AbstractShaderProgramTest(); explicit AbstractShaderProgramTest();
@ -63,6 +63,6 @@ void AbstractShaderProgramTest::constructCopy() {
CORRADE_VERIFY(!(std::is_assignable<DummyShader, const DummyShader&>{})); CORRADE_VERIFY(!(std::is_assignable<DummyShader, const DummyShader&>{}));
} }
}}} }}}}
CORRADE_TEST_MAIN(Magnum::GL::Test::AbstractShaderProgramTest) CORRADE_TEST_MAIN(Magnum::GL::Test::AbstractShaderProgramTest)

4
src/Magnum/GL/Test/AbstractTextureGLTest.cpp

@ -28,7 +28,7 @@
#include "Magnum/GL/Texture.h" #include "Magnum/GL/Texture.h"
#include "Magnum/GL/OpenGLTester.h" #include "Magnum/GL/OpenGLTester.h"
namespace Magnum { namespace GL { namespace Test { namespace Magnum { namespace GL { namespace Test { namespace {
struct AbstractTextureGLTest: OpenGLTester { struct AbstractTextureGLTest: OpenGLTester {
explicit AbstractTextureGLTest(); explicit AbstractTextureGLTest();
@ -103,6 +103,6 @@ void AbstractTextureGLTest::label() {
} }
#endif #endif
}}} }}}}
CORRADE_TEST_MAIN(Magnum::GL::Test::AbstractTextureGLTest) CORRADE_TEST_MAIN(Magnum::GL::Test::AbstractTextureGLTest)

4
src/Magnum/GL/Test/AttributeTest.cpp

@ -28,7 +28,7 @@
#include "Magnum/GL/AbstractShaderProgram.h" #include "Magnum/GL/AbstractShaderProgram.h"
namespace Magnum { namespace GL { namespace Test { namespace Magnum { namespace GL { namespace Test { namespace {
struct AttributeTest: TestSuite::Tester { struct AttributeTest: TestSuite::Tester {
explicit AttributeTest(); explicit AttributeTest();
@ -463,6 +463,6 @@ void AttributeTest::debugDataTypeVector4() {
CORRADE_COMPARE(out.str(), "GL::Attribute::DataType::HalfFloat GL::Attribute::DataType(0xdead)\n"); CORRADE_COMPARE(out.str(), "GL::Attribute::DataType::HalfFloat GL::Attribute::DataType(0xdead)\n");
} }
}}} }}}}
CORRADE_TEST_MAIN(Magnum::GL::Test::AttributeTest) CORRADE_TEST_MAIN(Magnum::GL::Test::AttributeTest)

4
src/Magnum/GL/Test/BufferGLTest.cpp

@ -33,7 +33,7 @@
#include "Magnum/GL/Extensions.h" #include "Magnum/GL/Extensions.h"
#include "Magnum/GL/OpenGLTester.h" #include "Magnum/GL/OpenGLTester.h"
namespace Magnum { namespace GL { namespace Test { namespace Magnum { namespace GL { namespace Test { namespace {
struct BufferGLTest: OpenGLTester { struct BufferGLTest: OpenGLTester {
explicit BufferGLTest(); explicit BufferGLTest();
@ -410,6 +410,6 @@ void BufferGLTest::invalidate() {
MAGNUM_VERIFY_NO_GL_ERROR(); MAGNUM_VERIFY_NO_GL_ERROR();
} }
}}} }}}}
CORRADE_TEST_MAIN(Magnum::GL::Test::BufferGLTest) CORRADE_TEST_MAIN(Magnum::GL::Test::BufferGLTest)

4
src/Magnum/GL/Test/BufferImageGLTest.cpp

@ -32,7 +32,7 @@
#include "Magnum/GL/PixelFormat.h" #include "Magnum/GL/PixelFormat.h"
#include "Magnum/GL/OpenGLTester.h" #include "Magnum/GL/OpenGLTester.h"
namespace Magnum { namespace GL { namespace Test { namespace Magnum { namespace GL { namespace Test { namespace {
struct BufferImageGLTest: OpenGLTester { struct BufferImageGLTest: OpenGLTester {
explicit BufferImageGLTest(); explicit BufferImageGLTest();
@ -606,6 +606,6 @@ void BufferImageGLTest::releaseCompressed() {
CORRADE_COMPARE(b.id(), id); CORRADE_COMPARE(b.id(), id);
} }
}}} }}}}
CORRADE_TEST_MAIN(Magnum::GL::Test::BufferImageGLTest) CORRADE_TEST_MAIN(Magnum::GL::Test::BufferImageGLTest)

4
src/Magnum/GL/Test/BufferImageTest.cpp

@ -27,7 +27,7 @@
#include "Magnum/GL/BufferImage.h" #include "Magnum/GL/BufferImage.h"
namespace Magnum { namespace GL { namespace Test { namespace Magnum { namespace GL { namespace Test { namespace {
struct BufferImageTest: TestSuite::Tester { struct BufferImageTest: TestSuite::Tester {
explicit BufferImageTest(); explicit BufferImageTest();
@ -75,6 +75,6 @@ void BufferImageTest::constructCopyCompressed() {
CORRADE_VERIFY(!(std::is_assignable<CompressedBufferImage2D, const CompressedBufferImage2D&>{})); CORRADE_VERIFY(!(std::is_assignable<CompressedBufferImage2D, const CompressedBufferImage2D&>{}));
} }
}}} }}}}
CORRADE_TEST_MAIN(Magnum::GL::Test::BufferImageTest) CORRADE_TEST_MAIN(Magnum::GL::Test::BufferImageTest)

4
src/Magnum/GL/Test/BufferTest.cpp

@ -29,7 +29,7 @@
#include "Magnum/GL/Buffer.h" #include "Magnum/GL/Buffer.h"
namespace Magnum { namespace GL { namespace Test { namespace Magnum { namespace GL { namespace Test { namespace {
struct BufferTest: TestSuite::Tester { struct BufferTest: TestSuite::Tester {
explicit BufferTest(); explicit BufferTest();
@ -82,6 +82,6 @@ void BufferTest::debugTarget() {
} }
#endif #endif
}}} }}}}
CORRADE_TEST_MAIN(Magnum::GL::Test::BufferTest) CORRADE_TEST_MAIN(Magnum::GL::Test::BufferTest)

4
src/Magnum/GL/Test/BufferTextureGLTest.cpp

@ -33,7 +33,7 @@
#include "Magnum/GL/ImageFormat.h" #include "Magnum/GL/ImageFormat.h"
#include "Magnum/GL/OpenGLTester.h" #include "Magnum/GL/OpenGLTester.h"
namespace Magnum { namespace GL { namespace Test { namespace Magnum { namespace GL { namespace Test { namespace {
struct BufferTextureGLTest: OpenGLTester { struct BufferTextureGLTest: OpenGLTester {
explicit BufferTextureGLTest(); explicit BufferTextureGLTest();
@ -215,6 +215,6 @@ void BufferTextureGLTest::setBufferOffset() {
MAGNUM_VERIFY_NO_GL_ERROR(); MAGNUM_VERIFY_NO_GL_ERROR();
} }
}}} }}}}
CORRADE_TEST_MAIN(Magnum::GL::Test::BufferTextureGLTest) CORRADE_TEST_MAIN(Magnum::GL::Test::BufferTextureGLTest)

4
src/Magnum/GL/Test/BufferTextureTest.cpp

@ -27,7 +27,7 @@
#include "Magnum/GL/BufferTexture.h" #include "Magnum/GL/BufferTexture.h"
namespace Magnum { namespace GL { namespace Test { namespace Magnum { namespace GL { namespace Test { namespace {
struct BufferTextureTest: TestSuite::Tester { struct BufferTextureTest: TestSuite::Tester {
explicit BufferTextureTest(); explicit BufferTextureTest();
@ -55,6 +55,6 @@ void BufferTextureTest::constructCopy() {
CORRADE_VERIFY(!(std::is_assignable<BufferTexture, const BufferTexture&>{})); CORRADE_VERIFY(!(std::is_assignable<BufferTexture, const BufferTexture&>{}));
} }
}}} }}}}
CORRADE_TEST_MAIN(Magnum::GL::Test::BufferTextureTest) CORRADE_TEST_MAIN(Magnum::GL::Test::BufferTextureTest)

4
src/Magnum/GL/Test/ContextGLTest.cpp

@ -29,7 +29,7 @@
#include "Magnum/GL/Extensions.h" #include "Magnum/GL/Extensions.h"
#include "Magnum/GL/OpenGLTester.h" #include "Magnum/GL/OpenGLTester.h"
namespace Magnum { namespace GL { namespace Test { namespace Magnum { namespace GL { namespace Test { namespace {
struct ContextGLTest: OpenGLTester { struct ContextGLTest: OpenGLTester {
explicit ContextGLTest(); explicit ContextGLTest();
@ -127,6 +127,6 @@ void ContextGLTest::isExtensionDisabled() {
#endif #endif
} }
}}} }}}}
CORRADE_TEST_MAIN(Magnum::GL::Test::ContextGLTest) CORRADE_TEST_MAIN(Magnum::GL::Test::ContextGLTest)

4
src/Magnum/GL/Test/ContextTest.cpp

@ -29,7 +29,7 @@
#include "Magnum/GL/Context.h" #include "Magnum/GL/Context.h"
#include "Magnum/GL/Version.h" #include "Magnum/GL/Version.h"
namespace Magnum { namespace GL { namespace Test { namespace Magnum { namespace GL { namespace Test { namespace {
struct ContextTest: TestSuite::Tester { struct ContextTest: TestSuite::Tester {
explicit ContextTest(); explicit ContextTest();
@ -154,6 +154,6 @@ void ContextTest::debugDetectedDrivers() {
#endif #endif
} }
}}} }}}}
CORRADE_TEST_MAIN(Magnum::GL::Test::ContextTest) CORRADE_TEST_MAIN(Magnum::GL::Test::ContextTest)

570
src/Magnum/GL/Test/CubeMapTextureArrayGLTest.cpp

@ -37,7 +37,7 @@
#include "Magnum/Math/Color.h" #include "Magnum/Math/Color.h"
#include "Magnum/Math/Range.h" #include "Magnum/Math/Range.h"
namespace Magnum { namespace GL { namespace Test { namespace Magnum { namespace GL { namespace Test { namespace {
struct CubeMapTextureArrayGLTest: OpenGLTester { struct CubeMapTextureArrayGLTest: OpenGLTester {
explicit CubeMapTextureArrayGLTest(); explicit CubeMapTextureArrayGLTest();
@ -83,196 +83,194 @@ struct CubeMapTextureArrayGLTest: OpenGLTester {
void invalidateSubImage(); void invalidateSubImage();
}; };
namespace { struct GenericSampler {
struct GenericSampler { typedef Magnum::SamplerFilter Filter;
typedef Magnum::SamplerFilter Filter; typedef Magnum::SamplerMipmap Mipmap;
typedef Magnum::SamplerMipmap Mipmap; typedef Magnum::SamplerWrapping Wrapping;
typedef Magnum::SamplerWrapping Wrapping; };
}; struct GLSampler {
struct GLSampler { typedef GL::SamplerFilter Filter;
typedef GL::SamplerFilter Filter; typedef GL::SamplerMipmap Mipmap;
typedef GL::SamplerMipmap Mipmap; typedef GL::SamplerWrapping Wrapping;
typedef GL::SamplerWrapping Wrapping; };
};
constexpr UnsignedByte Data[]{
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f,
0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27,
0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f,
0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37,
0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f,
0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x16, 0x47,
0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x1e, 0x4f,
0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57,
0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f
};
enum: std::size_t { PixelStorageDataCount = 2 };
const struct {
const char* name;
Containers::ArrayView<const UnsignedByte> data;
PixelStorage storage;
Containers::ArrayView<const UnsignedByte> dataSparse;
std::size_t offset;
} PixelStorageData[PixelStorageDataCount]{
{"default pixel storage",
Containers::arrayView(Data).suffix(16), {},
Containers::arrayView(Data).suffix(16), 0},
{"skip Z",
Containers::arrayView(Data).suffix(16), PixelStorage{}.setSkip({0, 0, 1}),
Containers::arrayView(Data), 16}
};
/* Just 4x4 0x00 - 0x3f compressed using RGBA DXT3 by the driver, repeated
six times */
constexpr UnsignedByte CompressedData[]{
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 17, 17, 34, 34, 51, 51, 67,
232, 57, 0, 0, 213, 255, 170, 2,
0, 17, 17, 34, 34, 51, 51, 67,
232, 57, 0, 0, 213, 255, 170, 2,
0, 17, 17, 34, 34, 51, 51, 67,
232, 57, 0, 0, 213, 255, 170, 2,
0, 17, 17, 34, 34, 51, 51, 67,
232, 57, 0, 0, 213, 255, 170, 2,
0, 17, 17, 34, 34, 51, 51, 67,
232, 57, 0, 0, 213, 255, 170, 2,
0, 17, 17, 34, 34, 51, 51, 67,
232, 57, 0, 0, 213, 255, 170, 2
};
enum: std::size_t { CompressedPixelStorageDataCount =
#ifndef MAGNUM_TARGET_GLES
2
#else
1
#endif
};
const struct { constexpr UnsignedByte Data[]{
const char* name; 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Containers::ArrayView<const UnsignedByte> data; 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
#ifndef MAGNUM_TARGET_GLES 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
CompressedPixelStorage storage;
#endif 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
Containers::ArrayView<const UnsignedByte> dataSparse; 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f,
std::size_t offset;
} CompressedPixelStorageData[CompressedPixelStorageDataCount]{ 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27,
{"default pixel storage", 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f,
Containers::arrayView(CompressedData).suffix(16*4),
#ifndef MAGNUM_TARGET_GLES 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37,
{}, 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f,
#endif
Containers::arrayView(CompressedData).suffix(16*4), 0}, 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x16, 0x47,
#ifndef MAGNUM_TARGET_GLES 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x1e, 0x4f,
{"skip Z",
Containers::arrayView(CompressedData).suffix(16*4), 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57,
CompressedPixelStorage{} 0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f
.setCompressedBlockSize({4, 4, 1}) };
.setCompressedBlockDataSize(16)
.setSkip({0, 0, 4}),
Containers::arrayView(CompressedData), 16*4}
#endif
};
constexpr UnsignedByte SubData[]{
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f,
0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27,
0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f,
0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37,
0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f
};
enum: std::size_t { SubPixelStorageDataCount = 2 };
const struct {
const char* name;
Containers::ArrayView<const UnsignedByte> data;
PixelStorage storage;
Containers::ArrayView<const UnsignedByte> dataSparse;
std::size_t offset;
} SubPixelStorageData[SubPixelStorageDataCount]{
{"default pixel storage",
Containers::arrayView(SubData).suffix(16), {},
Containers::arrayView(SubData).suffix(16), 0},
{"skip Z",
Containers::arrayView(SubData).suffix(16), PixelStorage{}.setSkip({0, 0, 1}),
Containers::arrayView(SubData), 16}
};
/* Just 4x4x4 0x00 - 0xff compressed using RGBA DXT3 by the driver */
constexpr UnsignedByte CompressedSubData[] = {
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 17, 17, 34, 34, 51, 51, 67,
232, 57, 0, 0, 213, 255, 170, 2,
68, 84, 85, 101, 102, 118, 119, 119,
239, 123, 8, 66, 213, 255, 170, 2,
136, 136, 153, 153, 170, 170, 187, 187,
247, 189, 16, 132, 213, 255, 170, 2,
203, 204, 220, 221, 237, 238, 254, 255,
255, 255, 24, 190, 213, 255, 170, 2
};
enum: std::size_t { CompressedSubPixelStorageDataCount =
#ifndef MAGNUM_TARGET_GLES
2
#else
1
#endif
};
const struct { enum: std::size_t { PixelStorageDataCount = 2 };
const char* name;
Containers::ArrayView<const UnsignedByte> data; const struct {
const char* name;
Containers::ArrayView<const UnsignedByte> data;
PixelStorage storage;
Containers::ArrayView<const UnsignedByte> dataSparse;
std::size_t offset;
} PixelStorageData[PixelStorageDataCount]{
{"default pixel storage",
Containers::arrayView(Data).suffix(16), {},
Containers::arrayView(Data).suffix(16), 0},
{"skip Z",
Containers::arrayView(Data).suffix(16), PixelStorage{}.setSkip({0, 0, 1}),
Containers::arrayView(Data), 16}
};
/* Just 4x4 0x00 - 0x3f compressed using RGBA DXT3 by the driver, repeated
six times */
constexpr UnsignedByte CompressedData[]{
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 17, 17, 34, 34, 51, 51, 67,
232, 57, 0, 0, 213, 255, 170, 2,
0, 17, 17, 34, 34, 51, 51, 67,
232, 57, 0, 0, 213, 255, 170, 2,
0, 17, 17, 34, 34, 51, 51, 67,
232, 57, 0, 0, 213, 255, 170, 2,
0, 17, 17, 34, 34, 51, 51, 67,
232, 57, 0, 0, 213, 255, 170, 2,
0, 17, 17, 34, 34, 51, 51, 67,
232, 57, 0, 0, 213, 255, 170, 2,
0, 17, 17, 34, 34, 51, 51, 67,
232, 57, 0, 0, 213, 255, 170, 2
};
enum: std::size_t { CompressedPixelStorageDataCount =
#ifndef MAGNUM_TARGET_GLES
2
#else
1
#endif
};
const struct {
const char* name;
Containers::ArrayView<const UnsignedByte> data;
#ifndef MAGNUM_TARGET_GLES
CompressedPixelStorage storage;
#endif
Containers::ArrayView<const UnsignedByte> dataSparse;
std::size_t offset;
} CompressedPixelStorageData[CompressedPixelStorageDataCount]{
{"default pixel storage",
Containers::arrayView(CompressedData).suffix(16*4),
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES
CompressedPixelStorage storage; {},
#endif #endif
Containers::ArrayView<const UnsignedByte> dataSparse; Containers::arrayView(CompressedData).suffix(16*4), 0},
std::size_t offset; #ifndef MAGNUM_TARGET_GLES
} CompressedSubPixelStorageData[CompressedSubPixelStorageDataCount]{ {"skip Z",
{"default pixel storage", Containers::arrayView(CompressedData).suffix(16*4),
Containers::arrayView(CompressedSubData).suffix(16*4), CompressedPixelStorage{}
#ifndef MAGNUM_TARGET_GLES .setCompressedBlockSize({4, 4, 1})
{}, .setCompressedBlockDataSize(16)
#endif .setSkip({0, 0, 4}),
Containers::arrayView(CompressedSubData).suffix(16*4), 0}, Containers::arrayView(CompressedData), 16*4}
#endif
};
constexpr UnsignedByte SubData[]{
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f,
0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27,
0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f,
0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37,
0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f
};
enum: std::size_t { SubPixelStorageDataCount = 2 };
const struct {
const char* name;
Containers::ArrayView<const UnsignedByte> data;
PixelStorage storage;
Containers::ArrayView<const UnsignedByte> dataSparse;
std::size_t offset;
} SubPixelStorageData[SubPixelStorageDataCount]{
{"default pixel storage",
Containers::arrayView(SubData).suffix(16), {},
Containers::arrayView(SubData).suffix(16), 0},
{"skip Z",
Containers::arrayView(SubData).suffix(16), PixelStorage{}.setSkip({0, 0, 1}),
Containers::arrayView(SubData), 16}
};
/* Just 4x4x4 0x00 - 0xff compressed using RGBA DXT3 by the driver */
constexpr UnsignedByte CompressedSubData[] = {
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 17, 17, 34, 34, 51, 51, 67,
232, 57, 0, 0, 213, 255, 170, 2,
68, 84, 85, 101, 102, 118, 119, 119,
239, 123, 8, 66, 213, 255, 170, 2,
136, 136, 153, 153, 170, 170, 187, 187,
247, 189, 16, 132, 213, 255, 170, 2,
203, 204, 220, 221, 237, 238, 254, 255,
255, 255, 24, 190, 213, 255, 170, 2
};
enum: std::size_t { CompressedSubPixelStorageDataCount =
#ifndef MAGNUM_TARGET_GLES
2
#else
1
#endif
};
const struct {
const char* name;
Containers::ArrayView<const UnsignedByte> data;
#ifndef MAGNUM_TARGET_GLES
CompressedPixelStorage storage;
#endif
Containers::ArrayView<const UnsignedByte> dataSparse;
std::size_t offset;
} CompressedSubPixelStorageData[CompressedSubPixelStorageDataCount]{
{"default pixel storage",
Containers::arrayView(CompressedSubData).suffix(16*4),
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES
{"skip Z", {},
Containers::arrayView(CompressedSubData).suffix(16*4),
CompressedPixelStorage{}
.setCompressedBlockSize({4, 4, 1})
.setCompressedBlockDataSize(16)
.setSkip({0, 0, 4}),
Containers::arrayView(CompressedSubData), 16*4}
#endif #endif
}; Containers::arrayView(CompressedSubData).suffix(16*4), 0},
} #ifndef MAGNUM_TARGET_GLES
{"skip Z",
Containers::arrayView(CompressedSubData).suffix(16*4),
CompressedPixelStorage{}
.setCompressedBlockSize({4, 4, 1})
.setCompressedBlockDataSize(16)
.setSkip({0, 0, 4}),
Containers::arrayView(CompressedSubData), 16*4}
#endif
};
CubeMapTextureArrayGLTest::CubeMapTextureArrayGLTest() { CubeMapTextureArrayGLTest::CubeMapTextureArrayGLTest() {
addTests({&CubeMapTextureArrayGLTest::construct, addTests({&CubeMapTextureArrayGLTest::construct,
@ -725,42 +723,40 @@ void CubeMapTextureArrayGLTest::compressedImageBuffer() {
#endif #endif
} }
namespace { constexpr UnsignedByte Zero[4*4*4*6]{};
constexpr UnsignedByte Zero[4*4*4*6]{}; #ifndef MAGNUM_TARGET_GLES
#ifndef MAGNUM_TARGET_GLES constexpr UnsignedByte SubDataComplete[]{
constexpr UnsignedByte SubDataComplete[]{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0, 0, 0, 0,
0, 0, 0, 0, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0, 0, 0, 0, 0, 0, 0, 0, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0, 0, 0, 0,
0, 0, 0, 0, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0, 0, 0, 0,
0, 0, 0, 0, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0, 0, 0, 0, 0, 0, 0, 0, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, 0, 0, 0, 0,
0, 0, 0, 0, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0, 0, 0, 0,
0, 0, 0, 0, 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0, 0, 0, 0, 0, 0, 0, 0, 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, 0, 0, 0, 0,
0, 0, 0, 0, 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0, 0, 0, 0,
0, 0, 0, 0, 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0, 0, 0, 0, 0, 0, 0, 0, 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, 0, 0, 0, 0,
0, 0, 0, 0, 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
}; #endif
#endif
}
void CubeMapTextureArrayGLTest::subImage() { void CubeMapTextureArrayGLTest::subImage() {
setTestCaseDescription(SubPixelStorageData[testCaseInstanceId()].name); setTestCaseDescription(SubPixelStorageData[testCaseInstanceId()].name);
@ -886,73 +882,71 @@ void CubeMapTextureArrayGLTest::subImageQueryBuffer() {
} }
#endif #endif
namespace { /* Just 12x12x6 zeros compressed using RGBA DXT3 by the driver */
/* Just 12x12x6 zeros compressed using RGBA DXT3 by the driver */ constexpr UnsignedByte CompressedZero[9*16*6]{};
constexpr UnsignedByte CompressedZero[9*16*6]{};
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES
/* Combination of CompressedZero and CompressedSubData */ /* Combination of CompressedZero and CompressedSubData */
constexpr UnsignedByte CompressedSubDataComplete[] = { constexpr UnsignedByte CompressedSubDataComplete[] = {
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 17, 17, 34, 34, 51, 51, 67, 0, 17, 17, 34, 34, 51, 51, 67,
232, 57, 0, 0, 213, 255, 170, 2, 232, 57, 0, 0, 213, 255, 170, 2,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
68, 84, 85, 101, 102, 118, 119, 119, 68, 84, 85, 101, 102, 118, 119, 119,
239, 123, 8, 66, 213, 255, 170, 2, 239, 123, 8, 66, 213, 255, 170, 2,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
136, 136, 153, 153, 170, 170, 187, 187, 136, 136, 153, 153, 170, 170, 187, 187,
247, 189, 16, 132, 213, 255, 170, 2, 247, 189, 16, 132, 213, 255, 170, 2,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
203, 204, 220, 221, 237, 238, 254, 255, 203, 204, 220, 221, 237, 238, 254, 255,
255, 255, 24, 190, 213, 255, 170, 2, 255, 255, 24, 190, 213, 255, 170, 2,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
}; };
#endif #endif
}
void CubeMapTextureArrayGLTest::compressedSubImage() { void CubeMapTextureArrayGLTest::compressedSubImage() {
setTestCaseDescription(CompressedSubPixelStorageData[testCaseInstanceId()].name); setTestCaseDescription(CompressedSubPixelStorageData[testCaseInstanceId()].name);
@ -1173,6 +1167,6 @@ void CubeMapTextureArrayGLTest::invalidateSubImage() {
MAGNUM_VERIFY_NO_GL_ERROR(); MAGNUM_VERIFY_NO_GL_ERROR();
} }
}}} }}}}
CORRADE_TEST_MAIN(Magnum::GL::Test::CubeMapTextureArrayGLTest) CORRADE_TEST_MAIN(Magnum::GL::Test::CubeMapTextureArrayGLTest)

4
src/Magnum/GL/Test/CubeMapTextureArrayTest.cpp

@ -27,7 +27,7 @@
#include "Magnum/GL/CubeMapTextureArray.h" #include "Magnum/GL/CubeMapTextureArray.h"
namespace Magnum { namespace GL { namespace Test { namespace Magnum { namespace GL { namespace Test { namespace {
struct CubeMapTextureArrayTest: TestSuite::Tester { struct CubeMapTextureArrayTest: TestSuite::Tester {
explicit CubeMapTextureArrayTest(); explicit CubeMapTextureArrayTest();
@ -55,6 +55,6 @@ void CubeMapTextureArrayTest::constructCopy() {
CORRADE_VERIFY(!(std::is_assignable<CubeMapTextureArray, const CubeMapTextureArray&>{})); CORRADE_VERIFY(!(std::is_assignable<CubeMapTextureArray, const CubeMapTextureArray&>{}));
} }
}}} }}}}
CORRADE_TEST_MAIN(Magnum::GL::Test::CubeMapTextureArrayTest) CORRADE_TEST_MAIN(Magnum::GL::Test::CubeMapTextureArrayTest)

409
src/Magnum/GL/Test/CubeMapTextureGLTest.cpp

@ -41,7 +41,7 @@
#include "Magnum/Math/Color.h" #include "Magnum/Math/Color.h"
#include "Magnum/Math/Range.h" #include "Magnum/Math/Range.h"
namespace Magnum { namespace GL { namespace Test { namespace Magnum { namespace GL { namespace Test { namespace {
struct CubeMapTextureGLTest: OpenGLTester { struct CubeMapTextureGLTest: OpenGLTester {
explicit CubeMapTextureGLTest(); explicit CubeMapTextureGLTest();
@ -117,185 +117,182 @@ struct CubeMapTextureGLTest: OpenGLTester {
void invalidateSubImage(); void invalidateSubImage();
}; };
namespace { struct GenericSampler {
struct GenericSampler { typedef Magnum::SamplerFilter Filter;
typedef Magnum::SamplerFilter Filter; typedef Magnum::SamplerMipmap Mipmap;
typedef Magnum::SamplerMipmap Mipmap; typedef Magnum::SamplerWrapping Wrapping;
typedef Magnum::SamplerWrapping Wrapping; };
}; struct GLSampler {
struct GLSampler { typedef GL::SamplerFilter Filter;
typedef GL::SamplerFilter Filter; typedef GL::SamplerMipmap Mipmap;
typedef GL::SamplerMipmap Mipmap; typedef GL::SamplerWrapping Wrapping;
typedef GL::SamplerWrapping Wrapping; };
};
constexpr UnsignedByte Data[]{
0, 0, 0, 0, 0, 0, 0, 0,
0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f };
enum: std::size_t { PixelStorageDataCount =
#if !defined(MAGNUM_TARGET_GLES2) || !defined(MAGNUM_TARGET_WEBGL)
2
#else
1
#endif
};
const struct {
const char* name;
Containers::ArrayView<const UnsignedByte> data;
PixelStorage storage;
Containers::ArrayView<const UnsignedByte> dataSparse;
std::size_t offset;
} PixelStorageData[PixelStorageDataCount]{
{"default pixel storage",
Containers::arrayView(Data).suffix(8), {},
Containers::arrayView(Data).suffix(8), 0},
#if !defined(MAGNUM_TARGET_GLES2) || !defined(MAGNUM_TARGET_WEBGL)
{"skip Y",
Containers::arrayView(Data).suffix(8), PixelStorage{}.setSkip({0, 1, 0}),
Containers::arrayView(Data), 8}
#endif
};
/* Just 4x4 0x00 - 0x3f compressed using RGBA DXT3 by the driver */ constexpr UnsignedByte Data[]{
constexpr UnsignedByte CompressedData[]{ 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
0, 17, 17, 34, 34, 51, 51, 67, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f };
232, 57, 0, 0, 213, 255, 170, 2
};
enum: std::size_t { CompressedPixelStorageDataCount = enum: std::size_t { PixelStorageDataCount =
#ifndef MAGNUM_TARGET_GLES #if !defined(MAGNUM_TARGET_GLES2) || !defined(MAGNUM_TARGET_WEBGL)
2 2
#else #else
1 1
#endif #endif
}; };
const struct { const struct {
const char* name; const char* name;
Containers::ArrayView<const UnsignedByte> data; Containers::ArrayView<const UnsignedByte> data;
#ifndef MAGNUM_TARGET_GLES PixelStorage storage;
CompressedPixelStorage storage; Containers::ArrayView<const UnsignedByte> dataSparse;
#endif std::size_t offset;
Containers::ArrayView<const UnsignedByte> dataSparse; } PixelStorageData[PixelStorageDataCount]{
std::size_t offset; {"default pixel storage",
} CompressedPixelStorageData[CompressedPixelStorageDataCount]{ Containers::arrayView(Data).suffix(8), {},
{"default pixel storage", Containers::arrayView(Data).suffix(8), 0},
Containers::arrayView(CompressedData).suffix(16), #if !defined(MAGNUM_TARGET_GLES2) || !defined(MAGNUM_TARGET_WEBGL)
#ifndef MAGNUM_TARGET_GLES {"skip Y",
{}, Containers::arrayView(Data).suffix(8), PixelStorage{}.setSkip({0, 1, 0}),
#endif Containers::arrayView(Data), 8}
Containers::arrayView(CompressedData).suffix(16), 0}, #endif
};
/* Just 4x4 0x00 - 0x3f compressed using RGBA DXT3 by the driver */
constexpr UnsignedByte CompressedData[]{
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 17, 17, 34, 34, 51, 51, 67,
232, 57, 0, 0, 213, 255, 170, 2
};
enum: std::size_t { CompressedPixelStorageDataCount =
#ifndef MAGNUM_TARGET_GLES
2
#else
1
#endif
};
const struct {
const char* name;
Containers::ArrayView<const UnsignedByte> data;
#ifndef MAGNUM_TARGET_GLES
CompressedPixelStorage storage;
#endif
Containers::ArrayView<const UnsignedByte> dataSparse;
std::size_t offset;
} CompressedPixelStorageData[CompressedPixelStorageDataCount]{
{"default pixel storage",
Containers::arrayView(CompressedData).suffix(16),
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES
{"skip Y", {},
Containers::arrayView(CompressedData).suffix(16),
CompressedPixelStorage{}
.setCompressedBlockSize({4, 4, 1})
.setCompressedBlockDataSize(16)
.setSkip({0, 4, 0}),
Containers::arrayView(CompressedData), 16}
#endif #endif
}; Containers::arrayView(CompressedData).suffix(16), 0},
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES
constexpr UnsignedByte FullData[]{ {"skip Y",
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, Containers::arrayView(CompressedData).suffix(16),
CompressedPixelStorage{}
.setCompressedBlockSize({4, 4, 1})
.setCompressedBlockDataSize(16)
.setSkip({0, 4, 0}),
Containers::arrayView(CompressedData), 16}
#endif
};
0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, #ifndef MAGNUM_TARGET_GLES
0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, constexpr UnsignedByte FullData[]{
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f,
0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27,
0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f,
0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37,
0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f,
0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47,
0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f,
};
enum: std::size_t { FullPixelStorageDataCount = 2 }; 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57,
0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f
};
const struct { enum: std::size_t { FullPixelStorageDataCount = 2 };
const char* name;
Containers::ArrayView<const UnsignedByte> data; const struct {
PixelStorage storage; const char* name;
std::size_t offset; Containers::ArrayView<const UnsignedByte> data;
} FullPixelStorageData[FullPixelStorageDataCount]{ PixelStorage storage;
{"default pixel storage", std::size_t offset;
Containers::arrayView(FullData).suffix(16), {}, 0}, } FullPixelStorageData[FullPixelStorageDataCount]{
#if !defined(MAGNUM_TARGET_GLES2) || !defined(MAGNUM_TARGET_WEBGL) {"default pixel storage",
{"skip Z", Containers::arrayView(FullData).suffix(16), {}, 0},
Containers::arrayView(FullData).suffix(16), PixelStorage{}.setSkip({0, 0, 1}), 16} #if !defined(MAGNUM_TARGET_GLES2) || !defined(MAGNUM_TARGET_WEBGL)
#endif {"skip Z",
}; Containers::arrayView(FullData).suffix(16), PixelStorage{}.setSkip({0, 0, 1}), 16}
#endif
/* Just 4x4 0x00 - 0x3f compressed using RGBA DXT3 by the driver, repeated };
six times */
constexpr UnsignedByte CompressedFullData[]{
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 17, 17, 34, 34, 51, 51, 67,
232, 57, 0, 0, 213, 255, 170, 2,
0, 17, 17, 34, 34, 51, 51, 67,
232, 57, 0, 0, 213, 255, 170, 2,
0, 17, 17, 34, 34, 51, 51, 67,
232, 57, 0, 0, 213, 255, 170, 2,
0, 17, 17, 34, 34, 51, 51, 67,
232, 57, 0, 0, 213, 255, 170, 2,
0, 17, 17, 34, 34, 51, 51, 67,
232, 57, 0, 0, 213, 255, 170, 2,
0, 17, 17, 34, 34, 51, 51, 67,
232, 57, 0, 0, 213, 255, 170, 2
};
enum: std::size_t { CompressedFullPixelStorageDataCount =
#ifndef MAGNUM_TARGET_GLES
2
#else
1
#endif
};
const struct { /* Just 4x4 0x00 - 0x3f compressed using RGBA DXT3 by the driver, repeated
const char* name; six times */
Containers::ArrayView<const UnsignedByte> data; constexpr UnsignedByte CompressedFullData[]{
#ifndef MAGNUM_TARGET_GLES 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
CompressedPixelStorage storage; 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
#endif 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
std::size_t offset; 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
} CompressedFullPixelStorageData[CompressedFullPixelStorageDataCount]{
{"default pixel storage", 0, 17, 17, 34, 34, 51, 51, 67,
Containers::arrayView(CompressedFullData).suffix(16*4), 232, 57, 0, 0, 213, 255, 170, 2,
#ifndef MAGNUM_TARGET_GLES 0, 17, 17, 34, 34, 51, 51, 67,
{}, 232, 57, 0, 0, 213, 255, 170, 2,
#endif 0, 17, 17, 34, 34, 51, 51, 67,
0}, 232, 57, 0, 0, 213, 255, 170, 2,
0, 17, 17, 34, 34, 51, 51, 67,
232, 57, 0, 0, 213, 255, 170, 2,
0, 17, 17, 34, 34, 51, 51, 67,
232, 57, 0, 0, 213, 255, 170, 2,
0, 17, 17, 34, 34, 51, 51, 67,
232, 57, 0, 0, 213, 255, 170, 2
};
enum: std::size_t { CompressedFullPixelStorageDataCount =
#ifndef MAGNUM_TARGET_GLES
2
#else
1
#endif
};
const struct {
const char* name;
Containers::ArrayView<const UnsignedByte> data;
#ifndef MAGNUM_TARGET_GLES
CompressedPixelStorage storage;
#endif
std::size_t offset;
} CompressedFullPixelStorageData[CompressedFullPixelStorageDataCount]{
{"default pixel storage",
Containers::arrayView(CompressedFullData).suffix(16*4),
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES
{"skip Z", {},
Containers::arrayView(CompressedFullData).suffix(16*4),
CompressedPixelStorage{}
.setCompressedBlockSize({4, 4, 1})
.setCompressedBlockDataSize(16)
.setSkip({0, 0, 4}), 16*4}
#endif #endif
}; 0},
#ifndef MAGNUM_TARGET_GLES
{"skip Z",
Containers::arrayView(CompressedFullData).suffix(16*4),
CompressedPixelStorage{}
.setCompressedBlockSize({4, 4, 1})
.setCompressedBlockDataSize(16)
.setSkip({0, 0, 4}), 16*4}
#endif #endif
};
} #endif
CubeMapTextureGLTest::CubeMapTextureGLTest() { CubeMapTextureGLTest::CubeMapTextureGLTest() {
addTests({&CubeMapTextureGLTest::construct, addTests({&CubeMapTextureGLTest::construct,
@ -374,11 +371,9 @@ CubeMapTextureGLTest::CubeMapTextureGLTest() {
&CubeMapTextureGLTest::invalidateSubImage}); &CubeMapTextureGLTest::invalidateSubImage});
} }
namespace { template<std::size_t size, class T> Containers::ArrayView<const T> unsafeSuffix(const T(&data)[size], std::size_t offset) {
template<std::size_t size, class T> Containers::ArrayView<const T> unsafeSuffix(const T(&data)[size], std::size_t offset) { static_assert(sizeof(T) == 1, "");
static_assert(sizeof(T) == 1, ""); return {data - offset, size + offset};
return {data - offset, size + offset};
}
} }
void CubeMapTextureGLTest::construct() { void CubeMapTextureGLTest::construct() {
@ -627,9 +622,7 @@ void CubeMapTextureGLTest::storage() {
#endif #endif
} }
namespace { constexpr UnsignedByte Zero[4*4*4]{};
constexpr UnsignedByte Zero[4*4*4]{};
}
void CubeMapTextureGLTest::image() { void CubeMapTextureGLTest::image() {
setTestCaseDescription(PixelStorageData[testCaseInstanceId()].name); setTestCaseDescription(PixelStorageData[testCaseInstanceId()].name);
@ -721,16 +714,14 @@ void CubeMapTextureGLTest::imageBuffer() {
} }
#endif #endif
namespace { #ifndef MAGNUM_TARGET_GLES
#ifndef MAGNUM_TARGET_GLES constexpr UnsignedByte SubDataComplete[]{
constexpr UnsignedByte SubDataComplete[]{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0, 0, 0, 0,
0, 0, 0, 0, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0, 0, 0, 0, 0, 0, 0, 0, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0, 0, 0, 0,
0, 0, 0, 0, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
}; #endif
#endif
}
void CubeMapTextureGLTest::subImage() { void CubeMapTextureGLTest::subImage() {
setTestCaseDescription(PixelStorageData[testCaseInstanceId()].name); setTestCaseDescription(PixelStorageData[testCaseInstanceId()].name);
@ -1037,36 +1028,34 @@ void CubeMapTextureGLTest::immutableCompressedImage() {
} }
#endif #endif
namespace { /* Just 12x12 zeros compressed using RGBA DXT3 by the driver */
/* Just 12x12 zeros compressed using RGBA DXT3 by the driver */ constexpr UnsignedByte CompressedZero[9*16]{};
constexpr UnsignedByte CompressedZero[9*16]{};
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES
/* Combination of CompressedZero and CompressedData */ /* Combination of CompressedZero and CompressedData */
constexpr UnsignedByte CompressedSubDataComplete[]{ constexpr UnsignedByte CompressedSubDataComplete[]{
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 17, 17, 34, 34, 51, 51, 67, 0, 17, 17, 34, 34, 51, 51, 67,
232, 57, 0, 0, 213, 255, 170, 2, 232, 57, 0, 0, 213, 255, 170, 2,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0 0, 0, 0, 0, 0, 0, 0, 0
}; };
#endif #endif
}
void CubeMapTextureGLTest::compressedSubImage() { void CubeMapTextureGLTest::compressedSubImage() {
setTestCaseDescription(CompressedPixelStorageData[testCaseInstanceId()].name); setTestCaseDescription(CompressedPixelStorageData[testCaseInstanceId()].name);
@ -1458,6 +1447,6 @@ void CubeMapTextureGLTest::invalidateSubImage() {
} }
} }
}}} }}}}
CORRADE_TEST_MAIN(Magnum::GL::Test::CubeMapTextureGLTest) CORRADE_TEST_MAIN(Magnum::GL::Test::CubeMapTextureGLTest)

4
src/Magnum/GL/Test/CubeMapTextureTest.cpp

@ -27,7 +27,7 @@
#include "Magnum/GL/CubeMapTexture.h" #include "Magnum/GL/CubeMapTexture.h"
namespace Magnum { namespace GL { namespace Test { namespace Magnum { namespace GL { namespace Test { namespace {
struct CubeMapTextureTest: TestSuite::Tester { struct CubeMapTextureTest: TestSuite::Tester {
explicit CubeMapTextureTest(); explicit CubeMapTextureTest();
@ -55,6 +55,6 @@ void CubeMapTextureTest::constructCopy() {
CORRADE_VERIFY(!(std::is_assignable<CubeMapTexture, const CubeMapTexture&>{})); CORRADE_VERIFY(!(std::is_assignable<CubeMapTexture, const CubeMapTexture&>{}));
} }
}}} }}}}
CORRADE_TEST_MAIN(Magnum::GL::Test::CubeMapTextureTest) CORRADE_TEST_MAIN(Magnum::GL::Test::CubeMapTextureTest)

4
src/Magnum/GL/Test/DebugOutputGLTest.cpp

@ -30,7 +30,7 @@
#include "Magnum/GL/Extensions.h" #include "Magnum/GL/Extensions.h"
#include "Magnum/GL/OpenGLTester.h" #include "Magnum/GL/OpenGLTester.h"
namespace Magnum { namespace GL { namespace Test { namespace Magnum { namespace GL { namespace Test { namespace {
struct DebugOutputGLTest: OpenGLTester { struct DebugOutputGLTest: OpenGLTester {
explicit DebugOutputGLTest(); explicit DebugOutputGLTest();
@ -173,6 +173,6 @@ void DebugOutputGLTest::groupFallback() {
MAGNUM_VERIFY_NO_GL_ERROR(); MAGNUM_VERIFY_NO_GL_ERROR();
} }
}}} }}}}
CORRADE_TEST_MAIN(Magnum::GL::Test::DebugOutputGLTest) CORRADE_TEST_MAIN(Magnum::GL::Test::DebugOutputGLTest)

4
src/Magnum/GL/Test/DebugOutputTest.cpp

@ -28,7 +28,7 @@
#include "Magnum/GL/DebugOutput.h" #include "Magnum/GL/DebugOutput.h"
namespace Magnum { namespace GL { namespace Test { namespace Magnum { namespace GL { namespace Test { namespace {
struct DebugOutputTest: TestSuite::Tester { struct DebugOutputTest: TestSuite::Tester {
explicit DebugOutputTest(); explicit DebugOutputTest();
@ -90,6 +90,6 @@ void DebugOutputTest::debugGroupSource() {
CORRADE_COMPARE(o.str(), "GL::DebugGroup::Source::ThirdParty GL::DebugGroup::Source(0xdead)\n"); CORRADE_COMPARE(o.str(), "GL::DebugGroup::Source::ThirdParty GL::DebugGroup::Source(0xdead)\n");
} }
}}} }}}}
CORRADE_TEST_MAIN(Magnum::GL::Test::DebugOutputTest) CORRADE_TEST_MAIN(Magnum::GL::Test::DebugOutputTest)

4
src/Magnum/GL/Test/DefaultFramebufferTest.cpp

@ -28,7 +28,7 @@
#include "Magnum/GL/DefaultFramebuffer.h" #include "Magnum/GL/DefaultFramebuffer.h"
namespace Magnum { namespace GL { namespace Test { namespace Magnum { namespace GL { namespace Test { namespace {
struct DefaultFramebufferTest: TestSuite::Tester { struct DefaultFramebufferTest: TestSuite::Tester {
explicit DefaultFramebufferTest(); explicit DefaultFramebufferTest();
@ -47,6 +47,6 @@ void DefaultFramebufferTest::debugStatus() {
CORRADE_COMPARE(out.str(), "GL::DefaultFramebuffer::Status::Complete GL::DefaultFramebuffer::Status(0xdead)\n"); CORRADE_COMPARE(out.str(), "GL::DefaultFramebuffer::Status::Complete GL::DefaultFramebuffer::Status(0xdead)\n");
} }
}}} }}}}
CORRADE_TEST_MAIN(Magnum::GL::Test::DefaultFramebufferTest) CORRADE_TEST_MAIN(Magnum::GL::Test::DefaultFramebufferTest)

26
src/Magnum/GL/Test/FramebufferGLTest.cpp

@ -50,7 +50,7 @@
#include "Magnum/GL/RectangleTexture.h" #include "Magnum/GL/RectangleTexture.h"
#endif #endif
namespace Magnum { namespace GL { namespace Test { namespace Magnum { namespace GL { namespace Test { namespace {
struct FramebufferGLTest: OpenGLTester { struct FramebufferGLTest: OpenGLTester {
explicit FramebufferGLTest(); explicit FramebufferGLTest();
@ -1368,10 +1368,8 @@ void FramebufferGLTest::invalidateSub() {
} }
#endif #endif
namespace { const auto DataStorage = PixelStorage{}.setSkip({0, 16, 0});
const auto DataStorage = PixelStorage{}.setSkip({0, 16, 0}); const std::size_t DataOffset = 16*8;
const std::size_t DataOffset = 16*8;
}
void FramebufferGLTest::read() { void FramebufferGLTest::read() {
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES
@ -1523,16 +1521,14 @@ void FramebufferGLTest::readBuffer() {
} }
#endif #endif
namespace { constexpr char StorageData[]{
constexpr char StorageData[]{ 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f,
0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f,
0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f
0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f };
};
constexpr char ZeroStorage[4*4*4*6]{}; constexpr char ZeroStorage[4*4*4*6]{};
}
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES
void FramebufferGLTest::copyImageTexture1D() { void FramebufferGLTest::copyImageTexture1D() {
@ -2096,6 +2092,6 @@ void FramebufferGLTest::blit() {
} }
#endif #endif
}}} }}}}
CORRADE_TEST_MAIN(Magnum::GL::Test::FramebufferGLTest) CORRADE_TEST_MAIN(Magnum::GL::Test::FramebufferGLTest)

4
src/Magnum/GL/Test/FramebufferTest.cpp

@ -28,7 +28,7 @@
#include "Magnum/GL/Framebuffer.h" #include "Magnum/GL/Framebuffer.h"
namespace Magnum { namespace GL { namespace Test { namespace Magnum { namespace GL { namespace Test { namespace {
struct FramebufferTest: TestSuite::Tester { struct FramebufferTest: TestSuite::Tester {
explicit FramebufferTest(); explicit FramebufferTest();
@ -67,6 +67,6 @@ void FramebufferTest::debugStatus() {
CORRADE_COMPARE(out.str(), "GL::Framebuffer::Status::IncompleteMissingAttachment GL::Framebuffer::Status(0xdead)\n"); CORRADE_COMPARE(out.str(), "GL::Framebuffer::Status::IncompleteMissingAttachment GL::Framebuffer::Status(0xdead)\n");
} }
}}} }}}}
CORRADE_TEST_MAIN(Magnum::GL::Test::FramebufferTest) CORRADE_TEST_MAIN(Magnum::GL::Test::FramebufferTest)

156
src/Magnum/GL/Test/MeshGLTest.cpp

@ -44,7 +44,7 @@
#include "Magnum/Math/Matrix.h" #include "Magnum/Math/Matrix.h"
#include "Magnum/Math/Vector4.h" #include "Magnum/Math/Vector4.h"
namespace Magnum { namespace GL { namespace Test { namespace Magnum { namespace GL { namespace Test { namespace {
/* Tests also the MeshView class. */ /* Tests also the MeshView class. */
@ -304,11 +304,9 @@ void MeshGLTest::construct() {
MAGNUM_VERIFY_NO_GL_ERROR(); MAGNUM_VERIFY_NO_GL_ERROR();
} }
namespace { struct FloatShader: AbstractShaderProgram {
struct FloatShader: AbstractShaderProgram { explicit FloatShader(const std::string& type, const std::string& conversion);
explicit FloatShader(const std::string& type, const std::string& conversion); };
};
}
void MeshGLTest::constructMove() { void MeshGLTest::constructMove() {
const Float data = Math::unpack<Float, UnsignedByte>(96); const Float data = Math::unpack<Float, UnsignedByte>(96);
@ -467,28 +465,26 @@ void MeshGLTest::label() {
} }
#endif #endif
namespace { #ifndef MAGNUM_TARGET_GLES2
#ifndef MAGNUM_TARGET_GLES2 struct IntegerShader: AbstractShaderProgram {
struct IntegerShader: AbstractShaderProgram { explicit IntegerShader(const std::string& type);
explicit IntegerShader(const std::string& type); };
}; #endif
#endif
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES
struct DoubleShader: AbstractShaderProgram { struct DoubleShader: AbstractShaderProgram {
explicit DoubleShader(const std::string& type, const std::string& outputType, const std::string& conversion); explicit DoubleShader(const std::string& type, const std::string& outputType, const std::string& conversion);
}; };
#endif #endif
struct Checker { struct Checker {
Checker(AbstractShaderProgram&& shader, RenderbufferFormat format, Mesh& mesh); Checker(AbstractShaderProgram&& shader, RenderbufferFormat format, Mesh& mesh);
template<class T> T get(PixelFormat format, PixelType type); template<class T> T get(PixelFormat format, PixelType type);
Renderbuffer renderbuffer; Renderbuffer renderbuffer;
Framebuffer framebuffer; Framebuffer framebuffer;
}; };
}
#ifndef DOXYGEN_GENERATING_OUTPUT #ifndef DOXYGEN_GENERATING_OUTPUT
FloatShader::FloatShader(const std::string& type, const std::string& conversion) { FloatShader::FloatShader(const std::string& type, const std::string& conversion) {
@ -1520,15 +1516,13 @@ void MeshGLTest::addVertexBufferBGRA() {
} }
#endif #endif
namespace { struct MultipleShader: AbstractShaderProgram {
struct MultipleShader: AbstractShaderProgram { typedef Attribute<0, Vector3> Position;
typedef Attribute<0, Vector3> Position; typedef Attribute<1, Vector3> Normal;
typedef Attribute<1, Vector3> Normal; typedef Attribute<2, Vector2> TextureCoordinates;
typedef Attribute<2, Vector2> TextureCoordinates;
explicit MultipleShader(); explicit MultipleShader();
}; };
}
#ifndef DOXYGEN_GENERATING_OUTPUT #ifndef DOXYGEN_GENERATING_OUTPUT
MultipleShader::MultipleShader() { MultipleShader::MultipleShader() {
@ -1811,59 +1805,57 @@ void MeshGLTest::addVertexBufferInstancedDynamicTransferOwnwership() {
CORRADE_VERIFY(!glIsBuffer(id)); CORRADE_VERIFY(!glIsBuffer(id));
} }
namespace { const Float indexedVertexData[] = {
const Float indexedVertexData[] = { 0.0f, /* Offset */
0.0f, /* Offset */
/* First vertex */ /* First vertex */
Math::unpack<Float, UnsignedByte>(64), Math::unpack<Float, UnsignedByte>(64),
Math::unpack<Float, UnsignedByte>(17),
Math::unpack<Float, UnsignedByte>(56),
Math::unpack<Float, UnsignedByte>(15),
Math::unpack<Float, UnsignedByte>(164),
Math::unpack<Float, UnsignedByte>(17), Math::unpack<Float, UnsignedByte>(17),
Math::unpack<Float, UnsignedByte>(56), Math::unpack<Float, UnsignedByte>(97),
Math::unpack<Float, UnsignedByte>(15), Math::unpack<Float, UnsignedByte>(28),
Math::unpack<Float, UnsignedByte>(164),
Math::unpack<Float, UnsignedByte>(17),
Math::unpack<Float, UnsignedByte>(97),
Math::unpack<Float, UnsignedByte>(28),
/* Second vertex */ /* Second vertex */
0.3f, 0.1f, 0.5f, 0.3f, 0.1f, 0.5f,
0.4f, 0.0f, -0.9f, 0.4f, 0.0f, -0.9f,
1.0f, -0.5f 1.0f, -0.5f
}; };
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES
const Float indexedVertexDataBaseVertex[] = { const Float indexedVertexDataBaseVertex[] = {
0.0f, 0.0f, /* Offset */ 0.0f, 0.0f, /* Offset */
/* First vertex */ /* First vertex */
0.0f, 0.0f, 0.0f,
0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f,
0.0f, 0.0f, 0.0f, 0.0f, 0.0f,
0.0f, 0.0f,
/* Second vertex */ /* Second vertex */
0.0f, 0.0f, 0.0f,
0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f,
0.0f, 0.0f, 0.0f, 0.0f, 0.0f,
0.0f, 0.0f,
/* Third vertex */
/* Third vertex */ Math::unpack<Float, UnsignedByte>(64),
Math::unpack<Float, UnsignedByte>(64), Math::unpack<Float, UnsignedByte>(17),
Math::unpack<Float, UnsignedByte>(56),
Math::unpack<Float, UnsignedByte>(15),
Math::unpack<Float, UnsignedByte>(164),
Math::unpack<Float, UnsignedByte>(17), Math::unpack<Float, UnsignedByte>(17),
Math::unpack<Float, UnsignedByte>(56), Math::unpack<Float, UnsignedByte>(97),
Math::unpack<Float, UnsignedByte>(15), Math::unpack<Float, UnsignedByte>(28),
Math::unpack<Float, UnsignedByte>(164),
Math::unpack<Float, UnsignedByte>(17),
Math::unpack<Float, UnsignedByte>(97),
Math::unpack<Float, UnsignedByte>(28),
/* Fourth vertex */ /* Fourth vertex */
0.3f, 0.1f, 0.5f, 0.3f, 0.1f, 0.5f,
0.4f, 0.0f, -0.9f, 0.4f, 0.0f, -0.9f,
1.0f, -0.5f 1.0f, -0.5f
}; };
#endif #endif
constexpr Color4ub indexedResult(64 + 15 + 97, 17 + 164 + 28, 56 + 17, 255); constexpr Color4ub indexedResult(64 + 15 + 97, 17 + 164 + 28, 56 + 17, 255);
}
template<class T> void MeshGLTest::setIndexBuffer() { template<class T> void MeshGLTest::setIndexBuffer() {
setTestCaseName(std::is_same<T, MeshIndexType>::value ? setTestCaseName(std::is_same<T, MeshIndexType>::value ?
@ -2648,16 +2640,14 @@ void MeshGLTest::resetDivisorAfterInstancedDraw() {
} }
} }
namespace { struct MultiChecker {
struct MultiChecker { MultiChecker(AbstractShaderProgram&& shader, Mesh& mesh);
MultiChecker(AbstractShaderProgram&& shader, Mesh& mesh);
template<class T> T get(PixelFormat format, PixelType type); template<class T> T get(PixelFormat format, PixelType type);
Renderbuffer renderbuffer; Renderbuffer renderbuffer;
Framebuffer framebuffer; Framebuffer framebuffer;
}; };
}
#ifndef DOXYGEN_GENERATING_OUTPUT #ifndef DOXYGEN_GENERATING_OUTPUT
MultiChecker::MultiChecker(AbstractShaderProgram&& shader, Mesh& mesh): framebuffer({{}, Vector2i(1)}) { MultiChecker::MultiChecker(AbstractShaderProgram&& shader, Mesh& mesh): framebuffer({{}, Vector2i(1)}) {
@ -2775,6 +2765,6 @@ void MeshGLTest::multiDrawBaseVertex() {
} }
#endif #endif
}}} }}}}
CORRADE_TEST_MAIN(Magnum::GL::Test::MeshGLTest) CORRADE_TEST_MAIN(Magnum::GL::Test::MeshGLTest)

12
src/Magnum/GL/Test/MeshTest.cpp

@ -31,7 +31,7 @@
#include "Magnum/GL/Mesh.h" #include "Magnum/GL/Mesh.h"
#include "Magnum/GL/MeshView.h" #include "Magnum/GL/MeshView.h"
namespace Magnum { namespace GL { namespace Test { namespace Magnum { namespace GL { namespace Test { namespace {
/* Tests MeshView as well */ /* Tests MeshView as well */
@ -131,11 +131,9 @@ void MeshTest::constructMoveNoCreate() {
CORRADE_VERIFY(true); CORRADE_VERIFY(true);
} }
namespace { struct Shader: AbstractShaderProgram {
struct Shader: AbstractShaderProgram { explicit Shader(NoCreateT): AbstractShaderProgram{NoCreate} {}
explicit Shader(NoCreateT): AbstractShaderProgram{NoCreate} {} };
};
}
void MeshTest::drawCountNotSet() { void MeshTest::drawCountNotSet() {
std::ostringstream out; std::ostringstream out;
@ -225,6 +223,6 @@ void MeshTest::debugIndexType() {
CORRADE_COMPARE(o.str(), "GL::MeshIndexType::UnsignedShort GL::MeshIndexType(0xdead)\n"); CORRADE_COMPARE(o.str(), "GL::MeshIndexType::UnsignedShort GL::MeshIndexType(0xdead)\n");
} }
}}} }}}}
CORRADE_TEST_MAIN(Magnum::GL::Test::MeshTest) CORRADE_TEST_MAIN(Magnum::GL::Test::MeshTest)

4
src/Magnum/GL/Test/MultisampleTextureGLTest.cpp

@ -34,7 +34,7 @@
#include "Magnum/Math/Vector3.h" #include "Magnum/Math/Vector3.h"
#include "Magnum/Math/Functions.h" #include "Magnum/Math/Functions.h"
namespace Magnum { namespace GL { namespace Test { namespace Magnum { namespace GL { namespace Test { namespace {
struct MultisampleTextureGLTest: OpenGLTester { struct MultisampleTextureGLTest: OpenGLTester {
explicit MultisampleTextureGLTest(); explicit MultisampleTextureGLTest();
@ -411,6 +411,6 @@ void MultisampleTextureGLTest::invalidateSubImage2DArray() {
MAGNUM_VERIFY_NO_GL_ERROR(); MAGNUM_VERIFY_NO_GL_ERROR();
} }
}}} }}}}
CORRADE_TEST_MAIN(Magnum::GL::Test::MultisampleTextureGLTest) CORRADE_TEST_MAIN(Magnum::GL::Test::MultisampleTextureGLTest)

4
src/Magnum/GL/Test/MultisampleTextureTest.cpp

@ -27,7 +27,7 @@
#include "Magnum/GL/MultisampleTexture.h" #include "Magnum/GL/MultisampleTexture.h"
namespace Magnum { namespace GL { namespace Test { namespace Magnum { namespace GL { namespace Test { namespace {
struct MultisampleTextureTest: TestSuite::Tester { struct MultisampleTextureTest: TestSuite::Tester {
explicit MultisampleTextureTest(); explicit MultisampleTextureTest();
@ -75,6 +75,6 @@ void MultisampleTextureTest::constructCopy2DArray() {
CORRADE_VERIFY(!(std::is_assignable<MultisampleTexture2DArray, const MultisampleTexture2DArray&>{})); CORRADE_VERIFY(!(std::is_assignable<MultisampleTexture2DArray, const MultisampleTexture2DArray&>{}));
} }
}}} }}}}
CORRADE_TEST_MAIN(Magnum::GL::Test::MultisampleTextureTest) CORRADE_TEST_MAIN(Magnum::GL::Test::MultisampleTextureTest)

4
src/Magnum/GL/Test/PixelFormatTest.cpp

@ -33,7 +33,7 @@
#include "Magnum/PixelStorage.h" #include "Magnum/PixelStorage.h"
#endif #endif
namespace Magnum { namespace GL { namespace Test { namespace Magnum { namespace GL { namespace Test { namespace {
struct PixelFormatTest: TestSuite::Tester { struct PixelFormatTest: TestSuite::Tester {
explicit PixelFormatTest(); explicit PixelFormatTest();
@ -523,6 +523,6 @@ void PixelFormatTest::debugCompressedPixelFormat() {
CORRADE_COMPARE(out.str(), "GL::CompressedPixelFormat::RGBS3tcDxt1 GL::CompressedPixelFormat(0xdead)\n"); CORRADE_COMPARE(out.str(), "GL::CompressedPixelFormat::RGBS3tcDxt1 GL::CompressedPixelFormat(0xdead)\n");
} }
}}} }}}}
CORRADE_TEST_MAIN(Magnum::GL::Test::PixelFormatTest) CORRADE_TEST_MAIN(Magnum::GL::Test::PixelFormatTest)

222
src/Magnum/GL/Test/PixelStorageGLTest.cpp

@ -40,7 +40,7 @@
#include "Magnum/GL/Framebuffer.h" #include "Magnum/GL/Framebuffer.h"
#endif #endif
namespace Magnum { namespace GL { namespace Test { namespace Magnum { namespace GL { namespace Test { namespace {
struct PixelStorageGLTest: OpenGLTester { struct PixelStorageGLTest: OpenGLTester {
explicit PixelStorageGLTest(); explicit PixelStorageGLTest();
@ -81,24 +81,22 @@ PixelStorageGLTest::PixelStorageGLTest() {
}); });
} }
namespace { constexpr const char Data2D[] = {
constexpr const char Data2D[] = { /* Row length ------------------------------------------------------ */ /* Alignment */
/* Row length ------------------------------------------------------ */ /* Alignment */ '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00',
'\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00',
'\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00',
'\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', /* ------------ Skip */ /* Data ------------------------------------ */ /* Alignment */
/* ------------ Skip */ /* Data ------------------------------------ */ /* Alignment */ '\x00', '\x00', '\x00', '\x00', '\x01', '\x02', '\x03', '\x04', '\x05', '\x00',
'\x00', '\x00', '\x00', '\x00', '\x01', '\x02', '\x03', '\x04', '\x05', '\x00', '\x00', '\x00', '\x00', '\x06', '\x07', '\x08', '\x09', '\x0a', '\x0b', '\x00',
'\x00', '\x00', '\x00', '\x06', '\x07', '\x08', '\x09', '\x0a', '\x0b', '\x00', '\x00', '\x00', '\x00', '\x0c', '\x0d', '\x0e', '\x0f', '\x10', '\x11', '\x00',
'\x00', '\x00', '\x00', '\x0c', '\x0d', '\x0e', '\x0f', '\x10', '\x11', '\x00', };
};
constexpr const char ActualData[] = {
constexpr const char ActualData[] = { '\x00', '\x01', '\x02', '\x03', '\x04', '\x05', '\x00', '\x00',
'\x00', '\x01', '\x02', '\x03', '\x04', '\x05', '\x00', '\x00', '\x06', '\x07', '\x08', '\x09', '\x0a', '\x0b', '\x00', '\x00',
'\x06', '\x07', '\x08', '\x09', '\x0a', '\x0b', '\x00', '\x00', '\x0c', '\x0d', '\x0e', '\x0f', '\x10', '\x11', '\x00', '\x00'
'\x0c', '\x0d', '\x0e', '\x0f', '\x10', '\x11', '\x00', '\x00' };
};
}
void PixelStorageGLTest::unpack2D() { void PixelStorageGLTest::unpack2D() {
#ifdef MAGNUM_TARGET_GLES2 #ifdef MAGNUM_TARGET_GLES2
@ -173,26 +171,24 @@ void PixelStorageGLTest::pack2D() {
} }
#ifndef MAGNUM_TARGET_GLES2 #ifndef MAGNUM_TARGET_GLES2
namespace { constexpr const char Data3D[] = {
constexpr const char Data3D[] = { /* Row length ------------------------------------------------------ */ /* Alignment */
/* Row length ------------------------------------------------------ */ /* Alignment */ '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00',
'\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00',
'\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00',
'\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00',
'\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00',
'\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00',
/* Row length ------------------------------------------------------ */ /* Alignment */
/* Row length ------------------------------------------------------ */ /* Alignment */ '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00',
'\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00',
'\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', /* ------------ Skip */ /* Data ------------------------------------ */ /* Alignment */
/* ------------ Skip */ /* Data ------------------------------------ */ /* Alignment */ '\x00', '\x00', '\x00', '\x00', '\x01', '\x02', '\x03', '\x04', '\x05', '\x00',
'\x00', '\x00', '\x00', '\x00', '\x01', '\x02', '\x03', '\x04', '\x05', '\x00', '\x00', '\x00', '\x00', '\x06', '\x07', '\x08', '\x09', '\x0a', '\x0b', '\x00',
'\x00', '\x00', '\x00', '\x06', '\x07', '\x08', '\x09', '\x0a', '\x0b', '\x00', '\x00', '\x00', '\x00', '\x0c', '\x0d', '\x0e', '\x0f', '\x10', '\x11', '\x00',
'\x00', '\x00', '\x00', '\x0c', '\x0d', '\x0e', '\x0f', '\x10', '\x11', '\x00',
/* Filling to image height not needed */
/* Filling to image height not needed */ };
};
}
void PixelStorageGLTest::unpack3D() { void PixelStorageGLTest::unpack3D() {
PixelStorage storage; PixelStorage storage;
@ -260,29 +256,27 @@ void PixelStorageGLTest::pack3D() {
#endif #endif
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES
namespace { constexpr const UnsignedByte CompressedData2D[] = {
constexpr const UnsignedByte CompressedData2D[] = { /* Skip */
/* Skip */ 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 17, 17, 34, 34, 51, 51, 67,
0, 17, 17, 34, 34, 51, 51, 67, 232, 57, 0, 0, 213, 255, 170, 2
232, 57, 0, 0, 213, 255, 170, 2 };
};
/* Just 4x4 0x00 - 0x3f compressed using RGBA DXT3 by the driver */
/* Just 4x4 0x00 - 0x3f compressed using RGBA DXT3 by the driver */ constexpr const UnsignedByte ActualCompressedData[] = {
constexpr const UnsignedByte ActualCompressedData[] = { 0, 17, 17, 34, 34, 51, 51, 67,
0, 17, 17, 34, 34, 51, 51, 67, 232, 57, 0, 0, 213, 255, 170, 2,
232, 57, 0, 0, 213, 255, 170, 2, };
};
}
void PixelStorageGLTest::unpackCompressed2D() { void PixelStorageGLTest::unpackCompressed2D() {
if(!Context::current().isExtensionSupported<Extensions::ARB::compressed_texture_pixel_storage>()) if(!Context::current().isExtensionSupported<Extensions::ARB::compressed_texture_pixel_storage>())
@ -339,58 +333,56 @@ void PixelStorageGLTest::packCompressed2D() {
TestSuite::Compare::Container); TestSuite::Compare::Container);
} }
namespace { constexpr const UnsignedByte CompressedData3D[] = {
constexpr const UnsignedByte CompressedData3D[] = { /* Skip image */
/* Skip image */ 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
/* Skip rows and pixels */
/* Skip rows and pixels */ 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 17, 17, 34, 34, 51, 51, 67,
0, 17, 17, 34, 34, 51, 51, 67, 232, 57, 0, 0, 213, 255, 170, 2
232, 57, 0, 0, 213, 255, 170, 2 };
};
}
void PixelStorageGLTest::unpackCompressed3D() { void PixelStorageGLTest::unpackCompressed3D() {
if(!Context::current().isExtensionSupported<Extensions::ARB::compressed_texture_pixel_storage>()) if(!Context::current().isExtensionSupported<Extensions::ARB::compressed_texture_pixel_storage>())
@ -450,6 +442,6 @@ void PixelStorageGLTest::packCompressed3D() {
} }
#endif #endif
}}} }}}}
CORRADE_TEST_MAIN(Magnum::GL::Test::PixelStorageGLTest) CORRADE_TEST_MAIN(Magnum::GL::Test::PixelStorageGLTest)

4
src/Magnum/GL/Test/PrimitiveQueryGLTest.cpp

@ -40,7 +40,7 @@
#include "Magnum/GL/TransformFeedback.h" #include "Magnum/GL/TransformFeedback.h"
#include "Magnum/Math/Vector2.h" #include "Magnum/Math/Vector2.h"
namespace Magnum { namespace GL { namespace Test { namespace Magnum { namespace GL { namespace Test { namespace {
struct PrimitiveQueryGLTest: OpenGLTester { struct PrimitiveQueryGLTest: OpenGLTester {
explicit PrimitiveQueryGLTest(); explicit PrimitiveQueryGLTest();
@ -404,6 +404,6 @@ void PrimitiveQueryGLTest::transformFeedbackOverflow() {
} }
#endif #endif
}}} }}}}
CORRADE_TEST_MAIN(Magnum::GL::Test::PrimitiveQueryGLTest) CORRADE_TEST_MAIN(Magnum::GL::Test::PrimitiveQueryGLTest)

4
src/Magnum/GL/Test/PrimitiveQueryTest.cpp

@ -27,7 +27,7 @@
#include "Magnum/GL/PrimitiveQuery.h" #include "Magnum/GL/PrimitiveQuery.h"
namespace Magnum { namespace GL { namespace Test { namespace Magnum { namespace GL { namespace Test { namespace {
struct PrimitiveQueryTest: TestSuite::Tester { struct PrimitiveQueryTest: TestSuite::Tester {
explicit PrimitiveQueryTest(); explicit PrimitiveQueryTest();
@ -55,6 +55,6 @@ void PrimitiveQueryTest::constructCopy() {
CORRADE_VERIFY(!(std::is_assignable<PrimitiveQuery, const PrimitiveQuery&>{})); CORRADE_VERIFY(!(std::is_assignable<PrimitiveQuery, const PrimitiveQuery&>{}));
} }
}}} }}}}
CORRADE_TEST_MAIN(Magnum::GL::Test::PrimitiveQueryTest) CORRADE_TEST_MAIN(Magnum::GL::Test::PrimitiveQueryTest)

86
src/Magnum/GL/Test/RectangleTextureGLTest.cpp

@ -38,7 +38,7 @@
#include "Magnum/Math/Color.h" #include "Magnum/Math/Color.h"
#include "Magnum/Math/Range.h" #include "Magnum/Math/Range.h"
namespace Magnum { namespace GL { namespace Test { namespace Magnum { namespace GL { namespace Test { namespace {
struct RectangleTextureGLTest: OpenGLTester { struct RectangleTextureGLTest: OpenGLTester {
explicit RectangleTextureGLTest(); explicit RectangleTextureGLTest();
@ -74,40 +74,38 @@ struct RectangleTextureGLTest: OpenGLTester {
void invalidateSubImage(); void invalidateSubImage();
}; };
namespace { struct GenericSampler {
struct GenericSampler { typedef Magnum::SamplerFilter Filter;
typedef Magnum::SamplerFilter Filter; typedef Magnum::SamplerWrapping Wrapping;
typedef Magnum::SamplerWrapping Wrapping; };
}; struct GLSampler {
struct GLSampler { typedef GL::SamplerFilter Filter;
typedef GL::SamplerFilter Filter; typedef GL::SamplerWrapping Wrapping;
typedef GL::SamplerWrapping Wrapping; };
};
constexpr UnsignedByte Data[]{
constexpr UnsignedByte Data[]{ 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f };
0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f };
enum: std::size_t { PixelStorageDataCount = 2 };
enum: std::size_t { PixelStorageDataCount = 2 };
const struct {
const struct { const char* name;
const char* name; Containers::ArrayView<const UnsignedByte> data;
Containers::ArrayView<const UnsignedByte> data; PixelStorage storage;
PixelStorage storage; Containers::ArrayView<const UnsignedByte> dataSparse;
Containers::ArrayView<const UnsignedByte> dataSparse; std::size_t offset;
std::size_t offset; } PixelStorageData[PixelStorageDataCount]{
} PixelStorageData[PixelStorageDataCount]{ {"default pixel storage",
{"default pixel storage", Containers::arrayView(Data).suffix(8), {},
Containers::arrayView(Data).suffix(8), {}, Containers::arrayView(Data).suffix(8), 0},
Containers::arrayView(Data).suffix(8), 0}, #if !defined(MAGNUM_TARGET_GLES2) || !defined(MAGNUM_TARGET_WEBGL)
#if !defined(MAGNUM_TARGET_GLES2) || !defined(MAGNUM_TARGET_WEBGL) {"skip Y",
{"skip Y", Containers::arrayView(Data).suffix(8), PixelStorage{}.setSkip({0, 1, 0}),
Containers::arrayView(Data).suffix(8), PixelStorage{}.setSkip({0, 1, 0}), Containers::arrayView(Data), 8}
Containers::arrayView(Data), 8} #endif
#endif };
};
}
RectangleTextureGLTest::RectangleTextureGLTest() { RectangleTextureGLTest::RectangleTextureGLTest() {
addTests({&RectangleTextureGLTest::construct, addTests({&RectangleTextureGLTest::construct,
@ -361,15 +359,13 @@ void RectangleTextureGLTest::imageBuffer() {
TestSuite::Compare::Container); TestSuite::Compare::Container);
} }
namespace { constexpr UnsignedByte Zero[4*4*4]{};
constexpr UnsignedByte Zero[4*4*4]{}; constexpr UnsignedByte SubDataComplete[]{
constexpr UnsignedByte SubDataComplete[]{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0, 0, 0, 0,
0, 0, 0, 0, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0, 0, 0, 0, 0, 0, 0, 0, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0, 0, 0, 0,
0, 0, 0, 0, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
};
}
void RectangleTextureGLTest::subImage() { void RectangleTextureGLTest::subImage() {
setTestCaseDescription(PixelStorageData[testCaseInstanceId()].name); setTestCaseDescription(PixelStorageData[testCaseInstanceId()].name);
@ -523,6 +519,6 @@ void RectangleTextureGLTest::invalidateSubImage() {
MAGNUM_VERIFY_NO_GL_ERROR(); MAGNUM_VERIFY_NO_GL_ERROR();
} }
}}} }}}}
CORRADE_TEST_MAIN(Magnum::GL::Test::RectangleTextureGLTest) CORRADE_TEST_MAIN(Magnum::GL::Test::RectangleTextureGLTest)

4
src/Magnum/GL/Test/RectangleTextureTest.cpp

@ -27,7 +27,7 @@
#include "Magnum/GL/RectangleTexture.h" #include "Magnum/GL/RectangleTexture.h"
namespace Magnum { namespace GL { namespace Test { namespace Magnum { namespace GL { namespace Test { namespace {
struct RectangleTextureTest: TestSuite::Tester { struct RectangleTextureTest: TestSuite::Tester {
explicit RectangleTextureTest(); explicit RectangleTextureTest();
@ -55,6 +55,6 @@ void RectangleTextureTest::constructCopy() {
CORRADE_VERIFY(!(std::is_assignable<RectangleTexture, const RectangleTexture&>{})); CORRADE_VERIFY(!(std::is_assignable<RectangleTexture, const RectangleTexture&>{}));
} }
}}} }}}}
CORRADE_TEST_MAIN(Magnum::GL::Test::RectangleTextureTest) CORRADE_TEST_MAIN(Magnum::GL::Test::RectangleTextureTest)

4
src/Magnum/GL/Test/RenderbufferGLTest.cpp

@ -30,7 +30,7 @@
#include "Magnum/GL/RenderbufferFormat.h" #include "Magnum/GL/RenderbufferFormat.h"
#include "Magnum/Math/Vector2.h" #include "Magnum/Math/Vector2.h"
namespace Magnum { namespace GL { namespace Test { namespace Magnum { namespace GL { namespace Test { namespace {
struct RenderbufferGLTest: OpenGLTester { struct RenderbufferGLTest: OpenGLTester {
explicit RenderbufferGLTest(); explicit RenderbufferGLTest();
@ -191,6 +191,6 @@ void RenderbufferGLTest::setStorageMultisample() {
} }
#endif #endif
}}} }}}}
CORRADE_TEST_MAIN(Magnum::GL::Test::RenderbufferGLTest) CORRADE_TEST_MAIN(Magnum::GL::Test::RenderbufferGLTest)

4
src/Magnum/GL/Test/RenderbufferTest.cpp

@ -27,7 +27,7 @@
#include "Magnum/GL/Renderbuffer.h" #include "Magnum/GL/Renderbuffer.h"
namespace Magnum { namespace GL { namespace Test { namespace Magnum { namespace GL { namespace Test { namespace {
struct RenderbufferTest: TestSuite::Tester { struct RenderbufferTest: TestSuite::Tester {
explicit RenderbufferTest(); explicit RenderbufferTest();
@ -55,6 +55,6 @@ void RenderbufferTest::constructNoCreate() {
CORRADE_VERIFY(true); CORRADE_VERIFY(true);
} }
}}} }}}}
CORRADE_TEST_MAIN(Magnum::GL::Test::RenderbufferTest) CORRADE_TEST_MAIN(Magnum::GL::Test::RenderbufferTest)

4
src/Magnum/GL/Test/RendererGLTest.cpp

@ -28,7 +28,7 @@
#include "Magnum/GL/OpenGLTester.h" #include "Magnum/GL/OpenGLTester.h"
#include "Magnum/Math/Range.h" #include "Magnum/Math/Range.h"
namespace Magnum { namespace GL { namespace Test { namespace Magnum { namespace GL { namespace Test { namespace {
struct RendererGLTest: OpenGLTester { struct RendererGLTest: OpenGLTester {
explicit RendererGLTest(); explicit RendererGLTest();
@ -60,6 +60,6 @@ void RendererGLTest::maxLineWidth() {
MAGNUM_VERIFY_NO_GL_ERROR(); MAGNUM_VERIFY_NO_GL_ERROR();
} }
}}} }}}}
CORRADE_TEST_MAIN(Magnum::GL::Test::RendererGLTest) CORRADE_TEST_MAIN(Magnum::GL::Test::RendererGLTest)

4
src/Magnum/GL/Test/RendererTest.cpp

@ -28,7 +28,7 @@
#include "Magnum/GL/Renderer.h" #include "Magnum/GL/Renderer.h"
namespace Magnum { namespace GL { namespace Test { namespace Magnum { namespace GL { namespace Test { namespace {
struct RendererTest: TestSuite::Tester { struct RendererTest: TestSuite::Tester {
explicit RendererTest(); explicit RendererTest();
@ -72,6 +72,6 @@ void RendererTest::debugGraphicsResetStatus() {
} }
#endif #endif
}}} }}}}
CORRADE_TEST_MAIN(Magnum::GL::Test::RendererTest) CORRADE_TEST_MAIN(Magnum::GL::Test::RendererTest)

14
src/Magnum/GL/Test/SampleQueryGLTest.cpp

@ -38,7 +38,7 @@
#include "Magnum/GL/SampleQuery.h" #include "Magnum/GL/SampleQuery.h"
#include "Magnum/GL/Shader.h" #include "Magnum/GL/Shader.h"
namespace Magnum { namespace GL { namespace Test { namespace Magnum { namespace GL { namespace Test { namespace {
struct SampleQueryGLTest: OpenGLTester { struct SampleQueryGLTest: OpenGLTester {
explicit SampleQueryGLTest(); explicit SampleQueryGLTest();
@ -89,13 +89,11 @@ void SampleQueryGLTest::wrap() {
#endif #endif
} }
namespace { struct MyShader: public AbstractShaderProgram {
struct MyShader: public AbstractShaderProgram { typedef Attribute<0, Vector2> Position;
typedef Attribute<0, Vector2> Position;
explicit MyShader(); explicit MyShader();
}; };
}
#ifndef DOXYGEN_GENERATING_OUTPUT #ifndef DOXYGEN_GENERATING_OUTPUT
MyShader::MyShader() { MyShader::MyShader() {
@ -268,6 +266,6 @@ void SampleQueryGLTest::conditionalRender() {
} }
#endif #endif
}}} }}}}
CORRADE_TEST_MAIN(Magnum::GL::Test::SampleQueryGLTest) CORRADE_TEST_MAIN(Magnum::GL::Test::SampleQueryGLTest)

4
src/Magnum/GL/Test/SampleQueryTest.cpp

@ -27,7 +27,7 @@
#include "Magnum/GL/SampleQuery.h" #include "Magnum/GL/SampleQuery.h"
namespace Magnum { namespace GL { namespace Test { namespace Magnum { namespace GL { namespace Test { namespace {
struct SampleQueryTest: TestSuite::Tester { struct SampleQueryTest: TestSuite::Tester {
explicit SampleQueryTest(); explicit SampleQueryTest();
@ -55,6 +55,6 @@ void SampleQueryTest::constructCopy() {
CORRADE_VERIFY(!(std::is_assignable<SampleQuery, const SampleQuery&>{})); CORRADE_VERIFY(!(std::is_assignable<SampleQuery, const SampleQuery&>{}));
} }
}}} }}}}
CORRADE_TEST_MAIN(Magnum::GL::Test::SampleQueryTest) CORRADE_TEST_MAIN(Magnum::GL::Test::SampleQueryTest)

4
src/Magnum/GL/Test/SamplerTest.cpp

@ -29,7 +29,7 @@
#include "Magnum/Sampler.h" #include "Magnum/Sampler.h"
#include "Magnum/GL/Sampler.h" #include "Magnum/GL/Sampler.h"
namespace Magnum { namespace GL { namespace Test { namespace Magnum { namespace GL { namespace Test { namespace {
struct SamplerTest: TestSuite::Tester { struct SamplerTest: TestSuite::Tester {
explicit SamplerTest(); explicit SamplerTest();
@ -205,6 +205,6 @@ void SamplerTest::debugDepthStencilMode() {
} }
#endif #endif
}}} }}}}
CORRADE_TEST_MAIN(Magnum::GL::Test::SamplerTest) CORRADE_TEST_MAIN(Magnum::GL::Test::SamplerTest)

4
src/Magnum/GL/Test/ShaderGLTest.cpp

@ -32,7 +32,7 @@
#include "configure.h" #include "configure.h"
namespace Magnum { namespace GL { namespace Test { namespace Magnum { namespace GL { namespace Test { namespace {
struct ShaderGLTest: OpenGLTester { struct ShaderGLTest: OpenGLTester {
explicit ShaderGLTest(); explicit ShaderGLTest();
@ -298,6 +298,6 @@ void ShaderGLTest::compileNoVersion() {
CORRADE_VERIFY(shader.compile()); CORRADE_VERIFY(shader.compile());
} }
}}} }}}}
CORRADE_TEST_MAIN(Magnum::GL::Test::ShaderGLTest) CORRADE_TEST_MAIN(Magnum::GL::Test::ShaderGLTest)

4
src/Magnum/GL/Test/ShaderTest.cpp

@ -28,7 +28,7 @@
#include "Magnum/GL/Shader.h" #include "Magnum/GL/Shader.h"
namespace Magnum { namespace GL { namespace Test { namespace Magnum { namespace GL { namespace Test { namespace {
struct ShaderTest: TestSuite::Tester { struct ShaderTest: TestSuite::Tester {
explicit ShaderTest(); explicit ShaderTest();
@ -54,6 +54,6 @@ void ShaderTest::debugType() {
CORRADE_COMPARE(out.str(), "GL::Shader::Type::Fragment GL::Shader::Type(0xdead)\n"); CORRADE_COMPARE(out.str(), "GL::Shader::Type::Fragment GL::Shader::Type(0xdead)\n");
} }
}}} }}}}
CORRADE_TEST_MAIN(Magnum::GL::Test::ShaderTest) CORRADE_TEST_MAIN(Magnum::GL::Test::ShaderTest)

339
src/Magnum/GL/Test/TextureArrayGLTest.cpp

@ -40,7 +40,7 @@
#include "Magnum/GL/ImageFormat.h" #include "Magnum/GL/ImageFormat.h"
#endif #endif
namespace Magnum { namespace GL { namespace Test { namespace Magnum { namespace GL { namespace Test { namespace {
struct TextureArrayGLTest: OpenGLTester { struct TextureArrayGLTest: OpenGLTester {
explicit TextureArrayGLTest(); explicit TextureArrayGLTest();
@ -155,112 +155,109 @@ struct TextureArrayGLTest: OpenGLTester {
void invalidateSubImage2D(); void invalidateSubImage2D();
}; };
namespace { struct GenericSampler {
struct GenericSampler { typedef Magnum::SamplerFilter Filter;
typedef Magnum::SamplerFilter Filter; typedef Magnum::SamplerMipmap Mipmap;
typedef Magnum::SamplerMipmap Mipmap; typedef Magnum::SamplerWrapping Wrapping;
typedef Magnum::SamplerWrapping Wrapping; };
}; struct GLSampler {
struct GLSampler { typedef GL::SamplerFilter Filter;
typedef GL::SamplerFilter Filter; typedef GL::SamplerMipmap Mipmap;
typedef GL::SamplerMipmap Mipmap; typedef GL::SamplerWrapping Wrapping;
typedef GL::SamplerWrapping Wrapping; };
};
#ifndef MAGNUM_TARGET_GLES
constexpr UnsignedByte Data1D[]{
0, 0, 0, 0, 0, 0, 0, 0,
0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f
};
enum: std::size_t { PixelStorage1DDataCount = 2 };
const struct {
const char* name;
Containers::ArrayView<const UnsignedByte> data;
PixelStorage storage;
Containers::ArrayView<const UnsignedByte> dataSparse;
std::size_t offset;
} PixelStorage1DData[PixelStorage1DDataCount]{
{"default pixel storage",
Containers::arrayView(Data1D).suffix(8), {},
Containers::arrayView(Data1D).suffix(8), 0},
{"skip Y",
Containers::arrayView(Data1D).suffix(8), PixelStorage{}.setSkip({0, 1, 0}),
Containers::arrayView(Data1D), 8}};
#endif
constexpr UnsignedByte Data2D[]{
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f
};
enum: std::size_t { PixelStorage2DDataCount = 2 };
const struct {
const char* name;
Containers::ArrayView<const UnsignedByte> data;
PixelStorage storage;
Containers::ArrayView<const UnsignedByte> dataSparse;
std::size_t offset;
} PixelStorage2DData[PixelStorage2DDataCount]{
{"default pixel storage",
Containers::arrayView(Data2D).suffix(16), {},
Containers::arrayView(Data2D).suffix(16), 0},
{"skip Z",
Containers::arrayView(Data2D).suffix(16), PixelStorage{}.setSkip({0, 0, 1}),
Containers::arrayView(Data2D), 16}};
/* Just 4x4x3 0x00 - 0x7f compressed using RGBA DXT3 by the driver */
constexpr UnsignedByte CompressedData2D[]{
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 17, 17, 34, 34, 51, 51, 67,
232, 57, 0, 0, 213, 255, 170, 2,
68, 84, 85, 101, 102, 118, 119, 119,
239, 123, 8, 66, 213, 255, 170, 2
};
enum: std::size_t { CompressedPixelStorage2DDataCount =
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES
constexpr UnsignedByte Data1D[]{ 2
0, 0, 0, 0, 0, 0, 0, 0, #else
0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 1
0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f #endif
}; };
enum: std::size_t { PixelStorage1DDataCount = 2 };
const struct {
const char* name;
Containers::ArrayView<const UnsignedByte> data;
PixelStorage storage;
Containers::ArrayView<const UnsignedByte> dataSparse;
std::size_t offset;
} PixelStorage1DData[PixelStorage1DDataCount]{
{"default pixel storage",
Containers::arrayView(Data1D).suffix(8), {},
Containers::arrayView(Data1D).suffix(8), 0},
{"skip Y",
Containers::arrayView(Data1D).suffix(8), PixelStorage{}.setSkip({0, 1, 0}),
Containers::arrayView(Data1D), 8}};
#endif
constexpr UnsignedByte Data2D[]{
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f
};
enum: std::size_t { PixelStorage2DDataCount = 2 };
const struct {
const char* name;
Containers::ArrayView<const UnsignedByte> data;
PixelStorage storage;
Containers::ArrayView<const UnsignedByte> dataSparse;
std::size_t offset;
} PixelStorage2DData[PixelStorage2DDataCount]{
{"default pixel storage",
Containers::arrayView(Data2D).suffix(16), {},
Containers::arrayView(Data2D).suffix(16), 0},
{"skip Z",
Containers::arrayView(Data2D).suffix(16), PixelStorage{}.setSkip({0, 0, 1}),
Containers::arrayView(Data2D), 16}};
/* Just 4x4x3 0x00 - 0x7f compressed using RGBA DXT3 by the driver */
constexpr UnsignedByte CompressedData2D[]{
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 17, 17, 34, 34, 51, 51, 67,
232, 57, 0, 0, 213, 255, 170, 2,
68, 84, 85, 101, 102, 118, 119, 119,
239, 123, 8, 66, 213, 255, 170, 2
};
enum: std::size_t { CompressedPixelStorage2DDataCount =
#ifndef MAGNUM_TARGET_GLES
2
#else
1
#endif
};
const struct { const struct {
const char* name; const char* name;
Containers::ArrayView<const UnsignedByte> data; Containers::ArrayView<const UnsignedByte> data;
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES
CompressedPixelStorage storage; CompressedPixelStorage storage;
#endif #endif
Containers::ArrayView<const UnsignedByte> dataSparse; Containers::ArrayView<const UnsignedByte> dataSparse;
std::size_t offset; std::size_t offset;
} CompressedPixelStorage2DData[CompressedPixelStorage2DDataCount]{ } CompressedPixelStorage2DData[CompressedPixelStorage2DDataCount]{
{"default pixel storage", {"default pixel storage",
Containers::arrayView(CompressedData2D).suffix(16), Containers::arrayView(CompressedData2D).suffix(16),
#ifndef MAGNUM_TARGET_GLES
{},
#endif
Containers::arrayView(CompressedData2D).suffix(16), 0},
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES
{"skip Y", {},
Containers::arrayView(CompressedData2D).suffix(16),
CompressedPixelStorage{}
.setCompressedBlockSize({4, 4, 1})
.setCompressedBlockDataSize(16)
.setSkip({0, 0, 1}),
Containers::arrayView(CompressedData2D), 16}
#endif #endif
}; Containers::arrayView(CompressedData2D).suffix(16), 0},
#ifndef MAGNUM_TARGET_GLES
} {"skip Y",
Containers::arrayView(CompressedData2D).suffix(16),
CompressedPixelStorage{}
.setCompressedBlockSize({4, 4, 1})
.setCompressedBlockDataSize(16)
.setSkip({0, 0, 1}),
Containers::arrayView(CompressedData2D), 16}
#endif
};
TextureArrayGLTest::TextureArrayGLTest() { TextureArrayGLTest::TextureArrayGLTest() {
addTests({ addTests({
@ -894,15 +891,13 @@ void TextureArrayGLTest::image1DBuffer() {
TestSuite::Compare::Container); TestSuite::Compare::Container);
} }
namespace { constexpr UnsignedByte Zero1D[4*4*4] = {};
constexpr UnsignedByte Zero1D[4*4*4] = {}; constexpr UnsignedByte SubData1DComplete[] = {
constexpr UnsignedByte SubData1DComplete[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0, 0, 0, 0,
0, 0, 0, 0, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0, 0, 0, 0, 0, 0, 0, 0, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0, 0, 0, 0,
0, 0, 0, 0, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
};
}
void TextureArrayGLTest::subImage1D() { void TextureArrayGLTest::subImage1D() {
setTestCaseDescription(PixelStorage1DData[testCaseInstanceId()].name); setTestCaseDescription(PixelStorage1DData[testCaseInstanceId()].name);
@ -1099,33 +1094,31 @@ void TextureArrayGLTest::image2DBuffer() {
#endif #endif
} }
namespace { constexpr UnsignedByte Zero2D[4*4*4*4]{};
constexpr UnsignedByte Zero2D[4*4*4*4]{};
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES
constexpr UnsignedByte SubData2DComplete[]{ constexpr UnsignedByte SubData2DComplete[]{
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0, 0, 0, 0, 0, 0, 0, 0, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0, 0, 0, 0,
0, 0, 0, 0, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0, 0, 0, 0, 0, 0, 0, 0, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0, 0, 0, 0, 0, 0, 0, 0, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0, 0, 0, 0,
0, 0, 0, 0, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, 0, 0, 0, 0, 0, 0, 0, 0, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
}; };
#endif #endif
}
void TextureArrayGLTest::subImage2D() { void TextureArrayGLTest::subImage2D() {
setTestCaseDescription(PixelStorage2DData[testCaseInstanceId()].name); setTestCaseDescription(PixelStorage2DData[testCaseInstanceId()].name);
@ -1332,43 +1325,41 @@ void TextureArrayGLTest::compressedImage2DBuffer() {
#endif #endif
} }
namespace { /* Just 12x4x4 zeros compressed using RGBA DXT3 by the driver */
/* Just 12x4x4 zeros compressed using RGBA DXT3 by the driver */ constexpr UnsignedByte CompressedZero2D[3*4*16]{};
constexpr UnsignedByte CompressedZero2D[3*4*16]{};
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES
/* Combination of CompressedZero2D and CompressedData2D */ /* Combination of CompressedZero2D and CompressedData2D */
constexpr UnsignedByte CompressedSubData2DComplete[]{ constexpr UnsignedByte CompressedSubData2DComplete[]{
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 17, 17, 34, 34, 51, 51, 67, 0, 17, 17, 34, 34, 51, 51, 67,
232, 57, 0, 0, 213, 255, 170, 2, 232, 57, 0, 0, 213, 255, 170, 2,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
68, 84, 85, 101, 102, 118, 119, 119, 68, 84, 85, 101, 102, 118, 119, 119,
239, 123, 8, 66, 213, 255, 170, 2, 239, 123, 8, 66, 213, 255, 170, 2,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0 0, 0, 0, 0, 0, 0, 0, 0
}; };
#endif #endif
}
void TextureArrayGLTest::compressedSubImage2D() { void TextureArrayGLTest::compressedSubImage2D() {
setTestCaseDescription(CompressedPixelStorage2DData[testCaseInstanceId()].name); setTestCaseDescription(CompressedPixelStorage2DData[testCaseInstanceId()].name);
@ -1648,6 +1639,6 @@ void TextureArrayGLTest::invalidateSubImage2D() {
MAGNUM_VERIFY_NO_GL_ERROR(); MAGNUM_VERIFY_NO_GL_ERROR();
} }
}}} }}}}
CORRADE_TEST_MAIN(Magnum::GL::Test::TextureArrayGLTest) CORRADE_TEST_MAIN(Magnum::GL::Test::TextureArrayGLTest)

4
src/Magnum/GL/Test/TextureArrayTest.cpp

@ -27,7 +27,7 @@
#include "Magnum/GL/TextureArray.h" #include "Magnum/GL/TextureArray.h"
namespace Magnum { namespace GL { namespace Test { namespace Magnum { namespace GL { namespace Test { namespace {
struct TextureArrayTest: TestSuite::Tester { struct TextureArrayTest: TestSuite::Tester {
explicit TextureArrayTest(); explicit TextureArrayTest();
@ -88,6 +88,6 @@ void TextureArrayTest::constructCopy2D() {
CORRADE_VERIFY(!(std::is_assignable<Texture2DArray, const Texture2DArray&>{})); CORRADE_VERIFY(!(std::is_assignable<Texture2DArray, const Texture2DArray&>{}));
} }
}}} }}}}
CORRADE_TEST_MAIN(Magnum::GL::Test::TextureArrayTest) CORRADE_TEST_MAIN(Magnum::GL::Test::TextureArrayTest)

568
src/Magnum/GL/Test/TextureGLTest.cpp

@ -41,7 +41,7 @@
#include "Magnum/Math/Color.h" #include "Magnum/Math/Color.h"
#include "Magnum/Math/Range.h" #include "Magnum/Math/Range.h"
namespace Magnum { namespace GL { namespace Test { namespace Magnum { namespace GL { namespace Test { namespace {
struct TextureGLTest: OpenGLTester { struct TextureGLTest: OpenGLTester {
explicit TextureGLTest(); explicit TextureGLTest();
@ -234,202 +234,200 @@ struct TextureGLTest: OpenGLTester {
void srgbAlphaStorage(); void srgbAlphaStorage();
}; };
namespace { struct GenericSampler {
struct GenericSampler { typedef Magnum::SamplerFilter Filter;
typedef Magnum::SamplerFilter Filter; typedef Magnum::SamplerMipmap Mipmap;
typedef Magnum::SamplerMipmap Mipmap; typedef Magnum::SamplerWrapping Wrapping;
typedef Magnum::SamplerWrapping Wrapping; };
}; struct GLSampler {
struct GLSampler { typedef GL::SamplerFilter Filter;
typedef GL::SamplerFilter Filter; typedef GL::SamplerMipmap Mipmap;
typedef GL::SamplerMipmap Mipmap; typedef GL::SamplerWrapping Wrapping;
typedef GL::SamplerWrapping Wrapping; };
};
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES
constexpr UnsignedByte Data1D[]{ constexpr UnsignedByte Data1D[]{
0, 0, 0, 0, 0, 0, 0, 0,
0x00, 0x01, 0x02, 0x03, 0x00, 0x01, 0x02, 0x03,
0x04, 0x05, 0x06, 0x07 0x04, 0x05, 0x06, 0x07
}; };
enum: std::size_t { PixelStorage1DDataCount = 2 };
const struct {
const char* name;
Containers::ArrayView<const UnsignedByte> data;
PixelStorage storage;
Containers::ArrayView<const UnsignedByte> dataSparse;
std::size_t offset;
} PixelStorage1DData[PixelStorage1DDataCount]{
{"default pixel storage",
Containers::arrayView(Data1D).suffix(4), {},
Containers::arrayView(Data1D).suffix(4), 0},
{"skip X",
Containers::arrayView(Data1D).suffix(4), PixelStorage{}.setSkip({1, 0, 0}),
Containers::arrayView(Data1D), 4}};
#endif
constexpr UnsignedByte Data2D[]{
0, 0, 0, 0, 0, 0, 0, 0,
0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f
};
enum: std::size_t { PixelStorage2DDataCount =
#if !defined(MAGNUM_TARGET_GLES2) || !defined(MAGNUM_TARGET_WEBGL)
2
#else
1
#endif
};
const struct {
const char* name;
Containers::ArrayView<const UnsignedByte> data;
PixelStorage storage;
Containers::ArrayView<const UnsignedByte> dataSparse;
std::size_t offset;
} PixelStorage2DData[PixelStorage2DDataCount]{
{"default pixel storage",
Containers::arrayView(Data2D).suffix(8), {},
Containers::arrayView(Data2D).suffix(8), 0},
#if !defined(MAGNUM_TARGET_GLES2) || !defined(MAGNUM_TARGET_WEBGL)
{"skip Y",
Containers::arrayView(Data2D).suffix(8), PixelStorage{}.setSkip({0, 1, 0}),
Containers::arrayView(Data2D), 8}
#endif
};
/* Just 4x8 0x00 - 0x3f compressed using RGBA DXT3 by the driver */ enum: std::size_t { PixelStorage1DDataCount = 2 };
constexpr UnsignedByte CompressedData2D[]{
0, 0, 0, 0, 0, 0, 0, 0, const struct {
0, 0, 0, 0, 0, 0, 0, 0, const char* name;
0, 17, 17, 34, 34, 51, 51, 67, Containers::ArrayView<const UnsignedByte> data;
232, 57, 0, 0, 213, 255, 170, 2 PixelStorage storage;
}; Containers::ArrayView<const UnsignedByte> dataSparse;
std::size_t offset;
} PixelStorage1DData[PixelStorage1DDataCount]{
{"default pixel storage",
Containers::arrayView(Data1D).suffix(4), {},
Containers::arrayView(Data1D).suffix(4), 0},
{"skip X",
Containers::arrayView(Data1D).suffix(4), PixelStorage{}.setSkip({1, 0, 0}),
Containers::arrayView(Data1D), 4}};
#endif
enum: std::size_t { CompressedPixelStorage2DDataCount = constexpr UnsignedByte Data2D[]{
#ifndef MAGNUM_TARGET_GLES 0, 0, 0, 0, 0, 0, 0, 0,
2 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
#else 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f
1 };
#endif
};
const struct { enum: std::size_t { PixelStorage2DDataCount =
const char* name; #if !defined(MAGNUM_TARGET_GLES2) || !defined(MAGNUM_TARGET_WEBGL)
Containers::ArrayView<const UnsignedByte> data; 2
#ifndef MAGNUM_TARGET_GLES #else
CompressedPixelStorage storage; 1
#endif #endif
Containers::ArrayView<const UnsignedByte> dataSparse; };
std::size_t offset;
} CompressedPixelStorage2DData[CompressedPixelStorage2DDataCount]{
{"default pixel storage",
Containers::arrayView(CompressedData2D).suffix(16),
#ifndef MAGNUM_TARGET_GLES
{},
#endif
Containers::arrayView(CompressedData2D).suffix(16), 0},
#ifndef MAGNUM_TARGET_GLES
{"skip Y",
Containers::arrayView(CompressedData2D).suffix(16),
CompressedPixelStorage{}
.setCompressedBlockSize({4, 4, 1})
.setCompressedBlockDataSize(16)
.setSkip({0, 4, 0}),
Containers::arrayView(CompressedData2D), 16}
#endif
};
constexpr UnsignedByte Data3D[]{ const struct {
0, 0, 0, 0, 0, 0, 0, 0, const char* name;
0, 0, 0, 0, 0, 0, 0, 0, Containers::ArrayView<const UnsignedByte> data;
PixelStorage storage;
Containers::ArrayView<const UnsignedByte> dataSparse;
std::size_t offset;
} PixelStorage2DData[PixelStorage2DDataCount]{
{"default pixel storage",
Containers::arrayView(Data2D).suffix(8), {},
Containers::arrayView(Data2D).suffix(8), 0},
#if !defined(MAGNUM_TARGET_GLES2) || !defined(MAGNUM_TARGET_WEBGL)
{"skip Y",
Containers::arrayView(Data2D).suffix(8), PixelStorage{}.setSkip({0, 1, 0}),
Containers::arrayView(Data2D), 8}
#endif
};
0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* Just 4x8 0x00 - 0x3f compressed using RGBA DXT3 by the driver */
0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, constexpr UnsignedByte CompressedData2D[]{
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 17, 17, 34, 34, 51, 51, 67,
232, 57, 0, 0, 213, 255, 170, 2
};
0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, enum: std::size_t { CompressedPixelStorage2DDataCount =
0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f }; #ifndef MAGNUM_TARGET_GLES
2
#else
1
#endif
};
enum: std::size_t { PixelStorage3DDataCount = const struct {
#if !defined(MAGNUM_TARGET_GLES2) || !defined(MAGNUM_TARGET_WEBGL) const char* name;
2 Containers::ArrayView<const UnsignedByte> data;
#else #ifndef MAGNUM_TARGET_GLES
1 CompressedPixelStorage storage;
#endif #endif
}; Containers::ArrayView<const UnsignedByte> dataSparse;
std::size_t offset;
const struct { } CompressedPixelStorage2DData[CompressedPixelStorage2DDataCount]{
const char* name; {"default pixel storage",
Containers::ArrayView<const UnsignedByte> data; Containers::arrayView(CompressedData2D).suffix(16),
PixelStorage storage;
Containers::ArrayView<const UnsignedByte> dataSparse;
std::size_t offset;
} PixelStorage3DData[PixelStorage3DDataCount]{
{"default pixel storage",
Containers::arrayView(Data3D).suffix(16), {},
Containers::arrayView(Data3D).suffix(16), 0},
#if !defined(MAGNUM_TARGET_GLES2) || !defined(MAGNUM_TARGET_WEBGL)
{"skip Z",
Containers::arrayView(Data3D).suffix(16), PixelStorage{}.setSkip({0, 0, 1}),
Containers::arrayView(Data3D), 16}
#endif
};
/* Just 4x4x8 0x00 - 0xff compressed using RGBA BPTC Unorm by the driver */
constexpr UnsignedByte CompressedData3D[]{
64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
144, 224, 128, 3, 80, 0, 129, 170,
84, 253, 73, 36, 109, 100, 107, 255,
144, 232, 161, 135, 94, 244, 129, 170,
84, 253, 65, 34, 109, 100, 107, 255,
144, 240, 194, 11, 47, 248, 130, 170,
84, 253, 65, 34, 109, 100, 107, 251,
144, 247, 223, 143, 63, 252, 131, 170,
84, 253, 73, 34, 109, 100, 91, 251
};
enum: std::size_t { CompressedPixelStorage3DDataCount =
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES
2 {},
#else
1
#endif #endif
}; Containers::arrayView(CompressedData2D).suffix(16), 0},
#ifndef MAGNUM_TARGET_GLES
{"skip Y",
Containers::arrayView(CompressedData2D).suffix(16),
CompressedPixelStorage{}
.setCompressedBlockSize({4, 4, 1})
.setCompressedBlockDataSize(16)
.setSkip({0, 4, 0}),
Containers::arrayView(CompressedData2D), 16}
#endif
};
const struct { constexpr UnsignedByte Data3D[]{
const char* name; 0, 0, 0, 0, 0, 0, 0, 0,
Containers::ArrayView<const UnsignedByte> data; 0, 0, 0, 0, 0, 0, 0, 0,
#ifndef MAGNUM_TARGET_GLES
CompressedPixelStorage storage; 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
#endif 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
Containers::ArrayView<const UnsignedByte> dataSparse;
std::size_t offset; 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
} CompressedPixelStorage3DData[CompressedPixelStorage3DDataCount]{ 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f };
{"default pixel storage",
Containers::arrayView(CompressedData3D).suffix(16*4), enum: std::size_t { PixelStorage3DDataCount =
#ifndef MAGNUM_TARGET_GLES #if !defined(MAGNUM_TARGET_GLES2) || !defined(MAGNUM_TARGET_WEBGL)
{}, 2
#endif #else
Containers::arrayView(CompressedData3D).suffix(16*4), 0}, 1
#endif
};
const struct {
const char* name;
Containers::ArrayView<const UnsignedByte> data;
PixelStorage storage;
Containers::ArrayView<const UnsignedByte> dataSparse;
std::size_t offset;
} PixelStorage3DData[PixelStorage3DDataCount]{
{"default pixel storage",
Containers::arrayView(Data3D).suffix(16), {},
Containers::arrayView(Data3D).suffix(16), 0},
#if !defined(MAGNUM_TARGET_GLES2) || !defined(MAGNUM_TARGET_WEBGL)
{"skip Z",
Containers::arrayView(Data3D).suffix(16), PixelStorage{}.setSkip({0, 0, 1}),
Containers::arrayView(Data3D), 16}
#endif
};
/* Just 4x4x8 0x00 - 0xff compressed using RGBA BPTC Unorm by the driver */
constexpr UnsignedByte CompressedData3D[]{
64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
144, 224, 128, 3, 80, 0, 129, 170,
84, 253, 73, 36, 109, 100, 107, 255,
144, 232, 161, 135, 94, 244, 129, 170,
84, 253, 65, 34, 109, 100, 107, 255,
144, 240, 194, 11, 47, 248, 130, 170,
84, 253, 65, 34, 109, 100, 107, 251,
144, 247, 223, 143, 63, 252, 131, 170,
84, 253, 73, 34, 109, 100, 91, 251
};
enum: std::size_t { CompressedPixelStorage3DDataCount =
#ifndef MAGNUM_TARGET_GLES
2
#else
1
#endif
};
const struct {
const char* name;
Containers::ArrayView<const UnsignedByte> data;
#ifndef MAGNUM_TARGET_GLES
CompressedPixelStorage storage;
#endif
Containers::ArrayView<const UnsignedByte> dataSparse;
std::size_t offset;
} CompressedPixelStorage3DData[CompressedPixelStorage3DDataCount]{
{"default pixel storage",
Containers::arrayView(CompressedData3D).suffix(16*4),
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES
{"skip Z", {},
Containers::arrayView(CompressedData3D).suffix(16*4),
CompressedPixelStorage{}
.setCompressedBlockSize({4, 4, 4})
.setCompressedBlockDataSize(16*4)
.setSkip({0, 0, 4}),
Containers::arrayView(CompressedData3D), 16*4}
#endif #endif
}; Containers::arrayView(CompressedData3D).suffix(16*4), 0},
} #ifndef MAGNUM_TARGET_GLES
{"skip Z",
Containers::arrayView(CompressedData3D).suffix(16*4),
CompressedPixelStorage{}
.setCompressedBlockSize({4, 4, 4})
.setCompressedBlockDataSize(16*4)
.setSkip({0, 0, 4}),
Containers::arrayView(CompressedData3D), 16*4}
#endif
};
TextureGLTest::TextureGLTest() { TextureGLTest::TextureGLTest() {
addTests({ addTests({
@ -1302,10 +1300,6 @@ void TextureGLTest::storage3D() {
} }
#endif #endif
namespace {
}
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES
void TextureGLTest::image1D() { void TextureGLTest::image1D() {
setTestCaseDescription(PixelStorage1DData[testCaseInstanceId()].name); setTestCaseDescription(PixelStorage1DData[testCaseInstanceId()].name);
@ -1353,12 +1347,10 @@ void TextureGLTest::image1DBuffer() {
TestSuite::Compare::Container); TestSuite::Compare::Container);
} }
namespace { constexpr UnsignedByte Zero1D[4*4] = {};
constexpr UnsignedByte Zero1D[4*4] = {}; constexpr UnsignedByte SubData1DComplete[]{
constexpr UnsignedByte SubData1DComplete[]{ 0, 0, 0, 0, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0, 0, 0, 0
0, 0, 0, 0, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0, 0, 0, 0 };
};
}
void TextureGLTest::subImage1D() { void TextureGLTest::subImage1D() {
setTestCaseDescription(PixelStorage1DData[testCaseInstanceId()].name); setTestCaseDescription(PixelStorage1DData[testCaseInstanceId()].name);
@ -1552,18 +1544,16 @@ void TextureGLTest::image2DBuffer() {
} }
#endif #endif
namespace { constexpr UnsignedByte Zero2D[4*4*4]{};
constexpr UnsignedByte Zero2D[4*4*4]{};
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES
constexpr UnsignedByte SubData2DComplete[]{ constexpr UnsignedByte SubData2DComplete[]{
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0, 0, 0, 0, 0, 0, 0, 0, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0, 0, 0, 0,
0, 0, 0, 0, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0, 0, 0, 0, 0, 0, 0, 0, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
}; };
#endif #endif
}
void TextureGLTest::subImage2D() { void TextureGLTest::subImage2D() {
setTestCaseDescription(PixelStorage2DData[testCaseInstanceId()].name); setTestCaseDescription(PixelStorage2DData[testCaseInstanceId()].name);
@ -1765,22 +1755,20 @@ void TextureGLTest::compressedImage2DBuffer() {
} }
#endif #endif
namespace { /* Just 12x4 zeros compressed using RGBA DXT3 by the driver */
/* Just 12x4 zeros compressed using RGBA DXT3 by the driver */ constexpr UnsignedByte CompressedZero2D[3*16]{};
constexpr UnsignedByte CompressedZero2D[3*16]{};
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES
/* Combination of CompressedZero2D and CompressedData2D */ /* Combination of CompressedZero2D and CompressedData2D */
constexpr UnsignedByte CompressedSubData2DComplete[]{ constexpr UnsignedByte CompressedSubData2DComplete[]{
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 17, 17, 34, 34, 51, 51, 67, 0, 17, 17, 34, 34, 51, 51, 67,
232, 57, 0, 0, 213, 255, 170, 2, 232, 57, 0, 0, 213, 255, 170, 2,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0 0, 0, 0, 0, 0, 0, 0, 0
}; };
#endif #endif
}
void TextureGLTest::compressedSubImage2D() { void TextureGLTest::compressedSubImage2D() {
setTestCaseDescription(CompressedPixelStorage2DData[testCaseInstanceId()].name); setTestCaseDescription(CompressedPixelStorage2DData[testCaseInstanceId()].name);
@ -1990,33 +1978,31 @@ void TextureGLTest::image3DBuffer() {
} }
#endif #endif
namespace { constexpr UnsignedByte Zero3D[4*4*4*4]{};
constexpr UnsignedByte Zero3D[4*4*4*4]{};
#ifndef MAGNUM_TARGET_GLES
constexpr UnsignedByte SubData3DComplete[]{
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0, 0, 0, 0,
0, 0, 0, 0, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0, 0, 0, 0,
0, 0, 0, 0, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, #ifndef MAGNUM_TARGET_GLES
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, constexpr UnsignedByte SubData3DComplete[]{
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
}; 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
#endif 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
}
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0, 0, 0, 0,
0, 0, 0, 0, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0, 0, 0, 0,
0, 0, 0, 0, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
};
#endif
void TextureGLTest::subImage3D() { void TextureGLTest::subImage3D() {
setTestCaseDescription(PixelStorage3DData[testCaseInstanceId()].name); setTestCaseDescription(PixelStorage3DData[testCaseInstanceId()].name);
@ -2205,51 +2191,49 @@ void TextureGLTest::compressedImage3DBuffer() {
} }
#endif #endif
namespace { #ifndef MAGNUM_TARGET_GLES
#ifndef MAGNUM_TARGET_GLES /* Just 12x4x4 zeros compressed using RGBA BPTC Unorm by the driver */
/* Just 12x4x4 zeros compressed using RGBA BPTC Unorm by the driver */ constexpr UnsignedByte CompressedZero3D[3*4*16]{
constexpr UnsignedByte CompressedZero3D[3*4*16]{ 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
};
/* Combination of CompressedZero3D and CompressedData3D. Note that, in
/* Combination of CompressedZero3D and CompressedData3D. Note that, in contrast to array textures, the data are ordered in "cubes" instead of
contrast to array textures, the data are ordered in "cubes" instead of slices. */
slices. */ constexpr UnsignedByte CompressedSubData3DComplete[]{
constexpr UnsignedByte CompressedSubData3DComplete[]{ 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
144, 224, 128, 3, 80, 0, 129, 170,
144, 224, 128, 3, 80, 0, 129, 170, 84, 253, 73, 36, 109, 100, 107, 255,
84, 253, 73, 36, 109, 100, 107, 255, 144, 232, 161, 135, 94, 244, 129, 170,
144, 232, 161, 135, 94, 244, 129, 170, 84, 253, 65, 34, 109, 100, 107, 255,
84, 253, 65, 34, 109, 100, 107, 255, 144, 240, 194, 11, 47, 248, 130, 170,
144, 240, 194, 11, 47, 248, 130, 170, 84, 253, 65, 34, 109, 100, 107, 251,
84, 253, 65, 34, 109, 100, 107, 251, 144, 247, 223, 143, 63, 252, 131, 170,
144, 247, 223, 143, 63, 252, 131, 170, 84, 253, 73, 34, 109, 100, 91, 251,
84, 253, 73, 34, 109, 100, 91, 251,
64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
}; #endif
#endif
}
void TextureGLTest::compressedSubImage3D() { void TextureGLTest::compressedSubImage3D() {
setTestCaseDescription(CompressedPixelStorage3DData[testCaseInstanceId()].name); setTestCaseDescription(CompressedPixelStorage3DData[testCaseInstanceId()].name);
@ -2657,6 +2641,6 @@ void TextureGLTest::srgbAlphaStorage() {
MAGNUM_VERIFY_NO_GL_ERROR(); MAGNUM_VERIFY_NO_GL_ERROR();
} }
}}} }}}}
CORRADE_TEST_MAIN(Magnum::GL::Test::TextureGLTest) CORRADE_TEST_MAIN(Magnum::GL::Test::TextureGLTest)

4
src/Magnum/GL/Test/TextureTest.cpp

@ -27,7 +27,7 @@
#include "Magnum/GL/Texture.h" #include "Magnum/GL/Texture.h"
namespace Magnum { namespace GL { namespace Test { namespace Magnum { namespace GL { namespace Test { namespace {
struct TextureTest: TestSuite::Tester { struct TextureTest: TestSuite::Tester {
explicit TextureTest(); explicit TextureTest();
@ -119,6 +119,6 @@ void TextureTest::constructCopy3D() {
} }
#endif #endif
}}} }}}}
CORRADE_TEST_MAIN(Magnum::GL::Test::TextureTest) CORRADE_TEST_MAIN(Magnum::GL::Test::TextureTest)

4
src/Magnum/GL/Test/TimeQueryGLTest.cpp

@ -30,7 +30,7 @@
#include "Magnum/GL/OpenGLTester.h" #include "Magnum/GL/OpenGLTester.h"
#include "Magnum/GL/TimeQuery.h" #include "Magnum/GL/TimeQuery.h"
namespace Magnum { namespace GL { namespace Test { namespace Magnum { namespace GL { namespace Test { namespace {
struct TimeQueryGLTest: OpenGLTester { struct TimeQueryGLTest: OpenGLTester {
explicit TimeQueryGLTest(); explicit TimeQueryGLTest();
@ -134,6 +134,6 @@ void TimeQueryGLTest::queryTimestamp() {
CORRADE_COMPARE_AS(result2 - result1, result, TestSuite::Compare::GreaterOrEqual); CORRADE_COMPARE_AS(result2 - result1, result, TestSuite::Compare::GreaterOrEqual);
} }
}}} }}}}
CORRADE_TEST_MAIN(Magnum::GL::Test::TimeQueryGLTest) CORRADE_TEST_MAIN(Magnum::GL::Test::TimeQueryGLTest)

4
src/Magnum/GL/Test/TimeQueryTest.cpp

@ -27,7 +27,7 @@
#include "Magnum/GL/TimeQuery.h" #include "Magnum/GL/TimeQuery.h"
namespace Magnum { namespace GL { namespace Test { namespace Magnum { namespace GL { namespace Test { namespace {
struct TimeQueryTest: TestSuite::Tester { struct TimeQueryTest: TestSuite::Tester {
explicit TimeQueryTest(); explicit TimeQueryTest();
@ -55,6 +55,6 @@ void TimeQueryTest::constructCopy() {
CORRADE_VERIFY(!(std::is_assignable<TimeQuery, const TimeQuery&>{})); CORRADE_VERIFY(!(std::is_assignable<TimeQuery, const TimeQuery&>{}));
} }
}}} }}}}
CORRADE_TEST_MAIN(Magnum::GL::Test::TimeQueryTest) CORRADE_TEST_MAIN(Magnum::GL::Test::TimeQueryTest)

16
src/Magnum/GL/Test/TransformFeedbackGLTest.cpp

@ -40,7 +40,7 @@
#include "Magnum/GL/TransformFeedback.h" #include "Magnum/GL/TransformFeedback.h"
#include "Magnum/Math/Vector2.h" #include "Magnum/Math/Vector2.h"
namespace Magnum { namespace GL { namespace Test { namespace Magnum { namespace GL { namespace Test { namespace {
struct TransformFeedbackGLTest: OpenGLTester { struct TransformFeedbackGLTest: OpenGLTester {
explicit TransformFeedbackGLTest(); explicit TransformFeedbackGLTest();
@ -65,8 +65,6 @@ struct TransformFeedbackGLTest: OpenGLTester {
#endif #endif
}; };
namespace {
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES
enum: std::size_t { DrawDataCount = 4 }; enum: std::size_t { DrawDataCount = 4 };
@ -85,8 +83,6 @@ const struct {
}; };
#endif #endif
}
TransformFeedbackGLTest::TransformFeedbackGLTest() { TransformFeedbackGLTest::TransformFeedbackGLTest() {
addTests({&TransformFeedbackGLTest::construct, addTests({&TransformFeedbackGLTest::construct,
&TransformFeedbackGLTest::constructMove, &TransformFeedbackGLTest::constructMove,
@ -212,8 +208,6 @@ void TransformFeedbackGLTest::label() {
} }
#endif #endif
namespace {
constexpr const Vector2 inputData[] = { constexpr const Vector2 inputData[] = {
{0.0f, 0.0f}, {0.0f, 0.0f},
{-1.0f, 1.0f} {-1.0f, 1.0f}
@ -259,8 +253,6 @@ XfbShader::XfbShader() {
CORRADE_INTERNAL_ASSERT_OUTPUT(link()); CORRADE_INTERNAL_ASSERT_OUTPUT(link());
} }
}
void TransformFeedbackGLTest::attachBase() { void TransformFeedbackGLTest::attachBase() {
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES
if(!Context::current().isExtensionSupported<Extensions::ARB::transform_feedback2>()) if(!Context::current().isExtensionSupported<Extensions::ARB::transform_feedback2>())
@ -355,8 +347,6 @@ void TransformFeedbackGLTest::attachRange() {
#endif #endif
} }
namespace {
struct XfbMultiShader: AbstractShaderProgram { struct XfbMultiShader: AbstractShaderProgram {
typedef Attribute<0, Vector2> Input; typedef Attribute<0, Vector2> Input;
@ -399,8 +389,6 @@ XfbMultiShader::XfbMultiShader() {
CORRADE_INTERNAL_ASSERT_OUTPUT(link()); CORRADE_INTERNAL_ASSERT_OUTPUT(link());
} }
}
void TransformFeedbackGLTest::attachBases() { void TransformFeedbackGLTest::attachBases() {
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES
if(!Context::current().isExtensionSupported<Extensions::ARB::transform_feedback2>()) if(!Context::current().isExtensionSupported<Extensions::ARB::transform_feedback2>())
@ -720,6 +708,6 @@ void TransformFeedbackGLTest::draw() {
} }
#endif #endif
}}} }}}}
CORRADE_TEST_MAIN(Magnum::GL::Test::TransformFeedbackGLTest) CORRADE_TEST_MAIN(Magnum::GL::Test::TransformFeedbackGLTest)

4
src/Magnum/GL/Test/TransformFeedbackTest.cpp

@ -27,7 +27,7 @@
#include "Magnum/GL/TransformFeedback.h" #include "Magnum/GL/TransformFeedback.h"
namespace Magnum { namespace GL { namespace Test { namespace Magnum { namespace GL { namespace Test { namespace {
struct TransformFeedbackTest: TestSuite::Tester { struct TransformFeedbackTest: TestSuite::Tester {
explicit TransformFeedbackTest(); explicit TransformFeedbackTest();
@ -55,6 +55,6 @@ void TransformFeedbackTest::constructCopy() {
CORRADE_VERIFY(!(std::is_assignable<TransformFeedback, const TransformFeedback&>{})); CORRADE_VERIFY(!(std::is_assignable<TransformFeedback, const TransformFeedback&>{}));
} }
}}} }}}}
CORRADE_TEST_MAIN(Magnum::GL::Test::TransformFeedbackTest) CORRADE_TEST_MAIN(Magnum::GL::Test::TransformFeedbackTest)

4
src/Magnum/GL/Test/VersionTest.cpp

@ -28,7 +28,7 @@
#include "Magnum/GL/Version.h" #include "Magnum/GL/Version.h"
namespace Magnum { namespace GL { namespace Test { namespace Magnum { namespace GL { namespace Test { namespace {
struct VersionTest: TestSuite::Tester { struct VersionTest: TestSuite::Tester {
explicit VersionTest(); explicit VersionTest();
@ -126,6 +126,6 @@ void VersionTest::debugES() {
} }
#endif #endif
}}} }}}}
CORRADE_TEST_MAIN(Magnum::GL::Test::VersionTest) CORRADE_TEST_MAIN(Magnum::GL::Test::VersionTest)

4
src/Magnum/Math/Algorithms/Test/GaussJordanTest.cpp

@ -27,7 +27,7 @@
#include "Magnum/Math/Algorithms/GaussJordan.h" #include "Magnum/Math/Algorithms/GaussJordan.h"
namespace Magnum { namespace Math { namespace Algorithms { namespace Test { namespace Magnum { namespace Math { namespace Algorithms { namespace Test { namespace {
struct GaussJordanTest: Corrade::TestSuite::Tester { struct GaussJordanTest: Corrade::TestSuite::Tester {
explicit GaussJordanTest(); explicit GaussJordanTest();
@ -92,6 +92,6 @@ void GaussJordanTest::inverted() {
CORRADE_COMPARE(inverse*m, Matrix4x4{}); CORRADE_COMPARE(inverse*m, Matrix4x4{});
} }
}}}} }}}}}
CORRADE_TEST_MAIN(Magnum::Math::Algorithms::Test::GaussJordanTest) CORRADE_TEST_MAIN(Magnum::Math::Algorithms::Test::GaussJordanTest)

4
src/Magnum/Math/Algorithms/Test/GramSchmidtTest.cpp

@ -27,7 +27,7 @@
#include "Magnum/Math/Algorithms/GramSchmidt.h" #include "Magnum/Math/Algorithms/GramSchmidt.h"
namespace Magnum { namespace Math { namespace Algorithms { namespace Test { namespace Magnum { namespace Math { namespace Algorithms { namespace Test { namespace {
struct GramSchmidtTest: Corrade::TestSuite::Tester { struct GramSchmidtTest: Corrade::TestSuite::Tester {
explicit GramSchmidtTest(); explicit GramSchmidtTest();
@ -95,6 +95,6 @@ void GramSchmidtTest::orthonormalize() {
CORRADE_COMPARE(orthonormalized, expected); CORRADE_COMPARE(orthonormalized, expected);
} }
}}}} }}}}}
CORRADE_TEST_MAIN(Magnum::Math::Algorithms::Test::GramSchmidtTest) CORRADE_TEST_MAIN(Magnum::Math::Algorithms::Test::GramSchmidtTest)

8
src/Magnum/Math/Algorithms/Test/KahanSumTest.cpp

@ -29,7 +29,7 @@
#include "Magnum/Magnum.h" #include "Magnum/Magnum.h"
#include "Magnum/Math/Algorithms/KahanSum.h" #include "Magnum/Math/Algorithms/KahanSum.h"
namespace Magnum { namespace Math { namespace Algorithms { namespace Test { namespace Magnum { namespace Math { namespace Algorithms { namespace Test { namespace {
struct KahanSumTest: TestSuite::Tester { struct KahanSumTest: TestSuite::Tester {
explicit KahanSumTest(); explicit KahanSumTest();
@ -52,8 +52,6 @@ KahanSumTest::KahanSumTest() {
&KahanSumTest::kahan100k}, 50); &KahanSumTest::kahan100k}, 50);
} }
namespace {
/* Custom iterator class to avoid allocating half a gigabyte for hundred /* Custom iterator class to avoid allocating half a gigabyte for hundred
million values */ million values */
template<class T> struct Iterator template<class T> struct Iterator
@ -84,8 +82,6 @@ template<class T> struct Iterator
std::size_t _i{}; std::size_t _i{};
}; };
}
void KahanSumTest::floats() { void KahanSumTest::floats() {
Iterator<Float> begin{1.0f}; Iterator<Float> begin{1.0f};
Iterator<Float> end{1.0f, 100000000}; Iterator<Float> end{1.0f, 100000000};
@ -165,6 +161,6 @@ void KahanSumTest::kahan100k() {
CORRADE_COMPARE(Float(a), 100000.0f); CORRADE_COMPARE(Float(a), 100000.0f);
} }
}}}} }}}}}
CORRADE_TEST_MAIN(Magnum::Math::Algorithms::Test::KahanSumTest) CORRADE_TEST_MAIN(Magnum::Math::Algorithms::Test::KahanSumTest)

4
src/Magnum/Math/Algorithms/Test/QrTest.cpp

@ -30,7 +30,7 @@
#include "Magnum/Math/Matrix4.h" #include "Magnum/Math/Matrix4.h"
#include "Magnum/Math/Algorithms/Qr.h" #include "Magnum/Math/Algorithms/Qr.h"
namespace Magnum { namespace Math { namespace Algorithms { namespace Test { namespace Magnum { namespace Math { namespace Algorithms { namespace Test { namespace {
struct QrTest: Corrade::TestSuite::Tester { struct QrTest: Corrade::TestSuite::Tester {
explicit QrTest(); explicit QrTest();
@ -84,6 +84,6 @@ void QrTest::decomposeRotationShear() {
CORRADE_COMPARE(r4.rotationShear(), Matrix4::shearingXZ(0.274077f, 0.0f).rotationShear()); CORRADE_COMPARE(r4.rotationShear(), Matrix4::shearingXZ(0.274077f, 0.0f).rotationShear());
} }
}}}} }}}}}
CORRADE_TEST_MAIN(Magnum::Math::Algorithms::Test::QrTest) CORRADE_TEST_MAIN(Magnum::Math::Algorithms::Test::QrTest)

4
src/Magnum/Math/Algorithms/Test/SvdTest.cpp

@ -28,7 +28,7 @@
#include "Magnum/Math/Matrix4.h" #include "Magnum/Math/Matrix4.h"
#include "Magnum/Math/Algorithms/Svd.h" #include "Magnum/Math/Algorithms/Svd.h"
namespace Magnum { namespace Math { namespace Algorithms { namespace Test { namespace Magnum { namespace Math { namespace Algorithms { namespace Test { namespace {
struct SvdTest: Corrade::TestSuite::Tester { struct SvdTest: Corrade::TestSuite::Tester {
explicit SvdTest(); explicit SvdTest();
@ -116,6 +116,6 @@ void SvdTest::decomposeRotationShear() {
CORRADE_COMPARE(Matrix4::from(u*v.transposed(), {}), Matrix4::rotationZ(35.0_degf)); CORRADE_COMPARE(Matrix4::from(u*v.transposed(), {}), Matrix4::rotationZ(35.0_degf));
} }
}}}} }}}}}
CORRADE_TEST_MAIN(Magnum::Math::Algorithms::Test::SvdTest) CORRADE_TEST_MAIN(Magnum::Math::Algorithms::Test::SvdTest)

8
src/Magnum/Math/Test/AngleTest.cpp

@ -35,7 +35,7 @@
#include "Magnum/Math/Angle.h" #include "Magnum/Math/Angle.h"
namespace Magnum { namespace Math { namespace Test { namespace Magnum { namespace Math { namespace Test { namespace {
struct AngleTest: Corrade::TestSuite::Tester { struct AngleTest: Corrade::TestSuite::Tester {
explicit AngleTest(); explicit AngleTest();
@ -67,8 +67,6 @@ typedef Math::Rad<Double> Radd;
using namespace Literals; using namespace Literals;
#if defined(DOXYGEN_GENERATING_OUTPUT) || defined(CORRADE_TARGET_UNIX) || (defined(CORRADE_TARGET_WINDOWS) && !defined(CORRADE_TARGET_WINDOWS_RT)) || defined(CORRADE_TARGET_EMSCRIPTEN) #if defined(DOXYGEN_GENERATING_OUTPUT) || defined(CORRADE_TARGET_UNIX) || (defined(CORRADE_TARGET_WINDOWS) && !defined(CORRADE_TARGET_WINDOWS_RT)) || defined(CORRADE_TARGET_EMSCRIPTEN)
namespace {
constexpr struct { constexpr struct {
const char* name; const char* name;
const char* data; const char* data;
@ -114,8 +112,6 @@ template<> struct TweakableTraits<Radd> {
static const char* name() { return "Radd"; } static const char* name() { return "Radd"; }
static const char* literal() { return "rad"; } static const char* literal() { return "rad"; }
}; };
}
#endif #endif
AngleTest::AngleTest() { AngleTest::AngleTest() {
@ -340,6 +336,6 @@ template<class T> void AngleTest::tweakableError() {
} }
#endif #endif
}}} }}}}
CORRADE_TEST_MAIN(Magnum::Math::Test::AngleTest) CORRADE_TEST_MAIN(Magnum::Math::Test::AngleTest)

4
src/Magnum/Math/Test/BezierTest.cpp

@ -54,7 +54,7 @@ template<> struct BezierConverter<2, 2, Float, QBezier2D> {
} }
namespace Test { namespace Test { namespace {
typedef Math::Vector2<Float> Vector2; typedef Math::Vector2<Float> Vector2;
typedef Math::Vector2<Double> Vector2d; typedef Math::Vector2<Double> Vector2d;
@ -349,6 +349,6 @@ void BezierTest::configuration() {
CORRADE_COMPARE(c.value<CubicBezier2D>("bezier"), bezier); CORRADE_COMPARE(c.value<CubicBezier2D>("bezier"), bezier);
} }
}}} }}}}
CORRADE_TEST_MAIN(Magnum::Math::Test::BezierTest) CORRADE_TEST_MAIN(Magnum::Math::Test::BezierTest)

4
src/Magnum/Math/Test/BoolVectorTest.cpp

@ -49,7 +49,7 @@ template<> struct BoolVectorConverter<3, BVec3> {
} }
namespace Test { namespace Test { namespace {
struct BoolVectorTest: Corrade::TestSuite::Tester { struct BoolVectorTest: Corrade::TestSuite::Tester {
explicit BoolVectorTest(); explicit BoolVectorTest();
@ -335,6 +335,6 @@ void BoolVectorTest::debug() {
CORRADE_COMPARE(o.str(), "BoolVector(10100100 11001010 010)\n"); CORRADE_COMPARE(o.str(), "BoolVector(10100100 11001010 010)\n");
} }
}}} }}}}
CORRADE_TEST_MAIN(Magnum::Math::Test::BoolVectorTest) CORRADE_TEST_MAIN(Magnum::Math::Test::BoolVectorTest)

8
src/Magnum/Math/Test/ColorTest.cpp

@ -69,7 +69,7 @@ template<> struct VectorConverter<4, float, Vec4> {
} }
namespace Test { namespace Test { namespace {
struct ColorTest: Corrade::TestSuite::Tester { struct ColorTest: Corrade::TestSuite::Tester {
explicit ColorTest(); explicit ColorTest();
@ -147,8 +147,6 @@ typedef Math::Deg<Float> Deg;
using namespace Literals; using namespace Literals;
#if defined(DOXYGEN_GENERATING_OUTPUT) || defined(CORRADE_TARGET_UNIX) || (defined(CORRADE_TARGET_WINDOWS) && !defined(CORRADE_TARGET_WINDOWS_RT)) || defined(CORRADE_TARGET_EMSCRIPTEN) #if defined(DOXYGEN_GENERATING_OUTPUT) || defined(CORRADE_TARGET_UNIX) || (defined(CORRADE_TARGET_WINDOWS) && !defined(CORRADE_TARGET_WINDOWS_RT)) || defined(CORRADE_TARGET_EMSCRIPTEN)
namespace {
const struct { const struct {
const char* name; const char* name;
const char* dataRgb; const char* dataRgb;
@ -180,8 +178,6 @@ constexpr struct {
{"bad size", "0x333_{1}", Corrade::Utility::TweakableState::Error, {"bad size", "0x333_{1}", Corrade::Utility::TweakableState::Error,
"Utility::TweakableParser: 0x333_{2}{1} doesn't have expected number of digits\n"}, "Utility::TweakableParser: 0x333_{2}{1} doesn't have expected number of digits\n"},
}; };
}
#endif #endif
ColorTest::ColorTest() { ColorTest::ColorTest() {
@ -1130,6 +1126,6 @@ void ColorTest::tweakableErrorSrgbaf() {
} }
#endif #endif
}}} }}}}
CORRADE_TEST_MAIN(Magnum::Math::Test::ColorTest) CORRADE_TEST_MAIN(Magnum::Math::Test::ColorTest)

4
src/Magnum/Math/Test/ComplexTest.cpp

@ -51,7 +51,7 @@ template<> struct ComplexConverter<Float, Cmpl> {
} }
namespace Test { namespace Test { namespace {
struct ComplexTest: Corrade::TestSuite::Tester { struct ComplexTest: Corrade::TestSuite::Tester {
explicit ComplexTest(); explicit ComplexTest();
@ -575,6 +575,6 @@ void ComplexTest::configuration() {
CORRADE_COMPARE(c.value<Complex>("overflow"), (Complex{2.0f, 9.0f})); CORRADE_COMPARE(c.value<Complex>("overflow"), (Complex{2.0f, 9.0f}));
} }
}}} }}}}
CORRADE_TEST_MAIN(Magnum::Math::Test::ComplexTest) CORRADE_TEST_MAIN(Magnum::Math::Test::ComplexTest)

4
src/Magnum/Math/Test/ConstantsTest.cpp

@ -29,7 +29,7 @@
#include "Magnum/Math/Constants.h" #include "Magnum/Math/Constants.h"
#include "Magnum/Math/Functions.h" #include "Magnum/Math/Functions.h"
namespace Magnum { namespace Math { namespace Test { namespace Magnum { namespace Math { namespace Test { namespace {
struct ConstantsTest: Corrade::TestSuite::Tester { struct ConstantsTest: Corrade::TestSuite::Tester {
explicit ConstantsTest(); explicit ConstantsTest();
@ -87,6 +87,6 @@ template<class T> void ConstantsTest::specials() {
CORRADE_VERIFY(h != h); CORRADE_VERIFY(h != h);
} }
}}} }}}}
CORRADE_TEST_MAIN(Magnum::Math::Test::ConstantsTest) CORRADE_TEST_MAIN(Magnum::Math::Test::ConstantsTest)

4
src/Magnum/Math/Test/CubicHermiteTest.cpp

@ -33,7 +33,7 @@
#include "Magnum/Math/StrictWeakOrdering.h" #include "Magnum/Math/StrictWeakOrdering.h"
namespace Magnum { namespace Math { namespace Test { namespace Magnum { namespace Math { namespace Test { namespace {
struct CubicHermiteTest: Corrade::TestSuite::Tester { struct CubicHermiteTest: Corrade::TestSuite::Tester {
explicit CubicHermiteTest(); explicit CubicHermiteTest();
@ -1181,6 +1181,6 @@ void CubicHermiteTest::debugQuaternion() {
CORRADE_COMPARE(out.str(), "CubicHermite(Quaternion({2, 1.5, 0.3}, 1.1), Quaternion({3, 0.1, 2.3}, 0.7), Quaternion({-1, 0, 0.3}, 0.4))\n"); CORRADE_COMPARE(out.str(), "CubicHermite(Quaternion({2, 1.5, 0.3}, 1.1), Quaternion({3, 0.1, 2.3}, 0.7), Quaternion({-1, 0, 0.3}, 0.4))\n");
} }
}}} }}}}
CORRADE_TEST_MAIN(Magnum::Math::Test::CubicHermiteTest) CORRADE_TEST_MAIN(Magnum::Math::Test::CubicHermiteTest)

4
src/Magnum/Math/Test/DistanceTest.cpp

@ -30,7 +30,7 @@
#include "Magnum/Math/Constants.h" #include "Magnum/Math/Constants.h"
#include "Magnum/Math/Distance.h" #include "Magnum/Math/Distance.h"
namespace Magnum { namespace Math { namespace Test { namespace Magnum { namespace Math { namespace Test { namespace {
struct DistanceTest: Corrade::TestSuite::Tester { struct DistanceTest: Corrade::TestSuite::Tester {
explicit DistanceTest(); explicit DistanceTest();
@ -199,6 +199,6 @@ void DistanceTest::pointPlaneNormalizedNotNormalized() {
CORRADE_COMPARE(out.str(), "Math::Distance::pointPlaneNormalized(): plane normal Vector(2, 2, 2) is not normalized\n"); CORRADE_COMPARE(out.str(), "Math::Distance::pointPlaneNormalized(): plane normal Vector(2, 2, 2) is not normalized\n");
} }
}}} }}}}
CORRADE_TEST_MAIN(Magnum::Math::Test::DistanceTest) CORRADE_TEST_MAIN(Magnum::Math::Test::DistanceTest)

20
src/Magnum/Math/Test/DualComplexTest.cpp

@ -51,7 +51,7 @@ template<> struct DualComplexConverter<Float, DualCmpl> {
} }
namespace Test { namespace Test { namespace {
struct DualComplexTest: Corrade::TestSuite::Tester { struct DualComplexTest: Corrade::TestSuite::Tester {
explicit DualComplexTest(); explicit DualComplexTest();
@ -318,15 +318,13 @@ void DualComplexTest::normalized() {
CORRADE_COMPARE(a.normalized(), b); CORRADE_COMPARE(a.normalized(), b);
} }
namespace { template<class> struct NormalizedIterativeData;
template<class> struct NormalizedIterativeData; template<> struct NormalizedIterativeData<Float> {
template<> struct NormalizedIterativeData<Float> { static Math::Vector2<Float> translation() { return {10000.0f, -50.0f}; }
static Math::Vector2<Float> translation() { return {10000.0f, -50.0f}; } };
}; template<> struct NormalizedIterativeData<Double> {
template<> struct NormalizedIterativeData<Double> { static Math::Vector2<Double> translation() { return {10000000.0, -500.0}; }
static Math::Vector2<Double> translation() { return {10000000.0, -500.0}; } };
};
}
template<class T> void DualComplexTest::normalizedIterative() { template<class T> void DualComplexTest::normalizedIterative() {
setTestCaseName(std::string{"normalizedIterative<"} + TypeTraits<T>::name() + ">"); setTestCaseName(std::string{"normalizedIterative<"} + TypeTraits<T>::name() + ">");
@ -491,6 +489,6 @@ void DualComplexTest::configuration() {
CORRADE_COMPARE(c.value<DualComplex>("overflow"), (DualComplex{{2.0f, 1.0f}, {8.0f, 9.0f}})); CORRADE_COMPARE(c.value<DualComplex>("overflow"), (DualComplex{{2.0f, 1.0f}, {8.0f, 9.0f}}));
} }
}}} }}}}
CORRADE_TEST_MAIN(Magnum::Math::Test::DualComplexTest) CORRADE_TEST_MAIN(Magnum::Math::Test::DualComplexTest)

20
src/Magnum/Math/Test/DualQuaternionTest.cpp

@ -53,7 +53,7 @@ template<> struct DualQuaternionConverter<Float, DualQuat> {
} }
namespace Test { namespace Test { namespace {
struct DualQuaternionTest: Corrade::TestSuite::Tester { struct DualQuaternionTest: Corrade::TestSuite::Tester {
explicit DualQuaternionTest(); explicit DualQuaternionTest();
@ -348,15 +348,13 @@ void DualQuaternionTest::normalized() {
CORRADE_COMPARE(a.normalized(), b); CORRADE_COMPARE(a.normalized(), b);
} }
namespace { template<class> struct NormalizedIterativeData;
template<class> struct NormalizedIterativeData; template<> struct NormalizedIterativeData<Float> {
template<> struct NormalizedIterativeData<Float> { static Math::Vector3<Float> translation() { return {10000.0f, -50.0f, 20000.0f}; }
static Math::Vector3<Float> translation() { return {10000.0f, -50.0f, 20000.0f}; } };
}; template<> struct NormalizedIterativeData<Double> {
template<> struct NormalizedIterativeData<Double> { static Math::Vector3<Double> translation() { return {10000000000000.0, -500.0, 20000000000000.0}; }
static Math::Vector3<Double> translation() { return {10000000000000.0, -500.0, 20000000000000.0}; } };
};
}
template<class T> void DualQuaternionTest::normalizedIterative() { template<class T> void DualQuaternionTest::normalizedIterative() {
setTestCaseName(std::string{"normalizedIterative<"} + TypeTraits<T>::name() + ">"); setTestCaseName(std::string{"normalizedIterative<"} + TypeTraits<T>::name() + ">");
@ -666,6 +664,6 @@ void DualQuaternionTest::configuration() {
CORRADE_COMPARE(c.value<DualQuaternion>("overflow"), (DualQuaternion{{{2.0f, 1.0f, 8.0f}, 9.0f}, {{16.0f, 33.0f, -1.0f}, 5.0f}})); CORRADE_COMPARE(c.value<DualQuaternion>("overflow"), (DualQuaternion{{{2.0f, 1.0f, 8.0f}, 9.0f}, {{16.0f, 33.0f, -1.0f}, 5.0f}}));
} }
}}} }}}}
CORRADE_TEST_MAIN(Magnum::Math::Test::DualQuaternionTest) CORRADE_TEST_MAIN(Magnum::Math::Test::DualQuaternionTest)

8
src/Magnum/Math/Test/DualTest.cpp

@ -31,7 +31,7 @@
#include "Magnum/Math/Vector2.h" #include "Magnum/Math/Vector2.h"
#include "Magnum/Math/StrictWeakOrdering.h" #include "Magnum/Math/StrictWeakOrdering.h"
namespace Magnum { namespace Math { namespace Test { namespace Magnum { namespace Math { namespace Test { namespace {
struct DualTest: Corrade::TestSuite::Tester { struct DualTest: Corrade::TestSuite::Tester {
explicit DualTest(); explicit DualTest();
@ -298,8 +298,6 @@ void DualTest::strictWeakOrdering() {
CORRADE_VERIFY(!o(a, a)); CORRADE_VERIFY(!o(a, a));
} }
namespace {
template<class T> class BasicDualVec2: public Math::Dual<Math::Vector2<T>> { template<class T> class BasicDualVec2: public Math::Dual<Math::Vector2<T>> {
public: public:
template<class ...U> constexpr BasicDualVec2(U&&... args): Math::Dual<Math::Vector2<T>>{args...} {} template<class ...U> constexpr BasicDualVec2(U&&... args): Math::Dual<Math::Vector2<T>>{args...} {}
@ -312,8 +310,6 @@ MAGNUM_DUAL_OPERATOR_IMPLEMENTATION(BasicDualVec2, Math::Vector2, T)
typedef BasicDualVec2<Float> DualVec2; typedef BasicDualVec2<Float> DualVec2;
}
void DualTest::subclassTypes() { void DualTest::subclassTypes() {
const DualVec2 a; const DualVec2 a;
CORRADE_VERIFY((std::is_same<decltype(-a), DualVec2>::value)); CORRADE_VERIFY((std::is_same<decltype(-a), DualVec2>::value));
@ -373,6 +369,6 @@ void DualTest::debug() {
CORRADE_COMPARE(o.str(), "Dual(2.5, -0.3)\n"); CORRADE_COMPARE(o.str(), "Dual(2.5, -0.3)\n");
} }
}}} }}}}
CORRADE_TEST_MAIN(Magnum::Math::Test::DualTest) CORRADE_TEST_MAIN(Magnum::Math::Test::DualTest)

4
src/Magnum/Math/Test/FrustumTest.cpp

@ -61,7 +61,7 @@ template<> struct FrustumConverter<Float, Frstm> {
} }
namespace Test { namespace Test { namespace {
struct FrustumTest: Corrade::TestSuite::Tester { struct FrustumTest: Corrade::TestSuite::Tester {
explicit FrustumTest(); explicit FrustumTest();
@ -368,6 +368,6 @@ void FrustumTest::debug() {
" {7, -8, 9, 0.6})\n"); " {7, -8, 9, 0.6})\n");
} }
}}} }}}}
CORRADE_TEST_MAIN(Magnum::Math::Test::FrustumTest) CORRADE_TEST_MAIN(Magnum::Math::Test::FrustumTest)

4
src/Magnum/Math/Test/FunctionsTest.cpp

@ -29,7 +29,7 @@
#include "Magnum/Math/Functions.h" #include "Magnum/Math/Functions.h"
#include "Magnum/Math/Vector4.h" #include "Magnum/Math/Vector4.h"
namespace Magnum { namespace Math { namespace Test { namespace Magnum { namespace Math { namespace Test { namespace {
struct FunctionsTest: Corrade::TestSuite::Tester { struct FunctionsTest: Corrade::TestSuite::Tester {
explicit FunctionsTest(); explicit FunctionsTest();
@ -445,6 +445,6 @@ void FunctionsTest::trigonometricWithBase() {
CORRADE_COMPARE(Math::tan(2*Rad(Constants::pi()/8)), 1.0f); CORRADE_COMPARE(Math::tan(2*Rad(Constants::pi()/8)), 1.0f);
} }
}}} }}}}
CORRADE_TEST_MAIN(Magnum::Math::Test::FunctionsTest) CORRADE_TEST_MAIN(Magnum::Math::Test::FunctionsTest)

12
src/Magnum/Math/Test/HalfTest.cpp

@ -35,7 +35,7 @@
#include "Magnum/Math/Vector3.h" #include "Magnum/Math/Vector3.h"
#include "Magnum/Math/StrictWeakOrdering.h" #include "Magnum/Math/StrictWeakOrdering.h"
namespace Magnum { namespace Math { namespace Test { namespace Magnum { namespace Math { namespace Test { namespace {
struct HalfTest: Corrade::TestSuite::Tester { struct HalfTest: Corrade::TestSuite::Tester {
explicit HalfTest(); explicit HalfTest();
@ -94,8 +94,6 @@ typedef Math::Constants<Float> Constants;
using namespace Literals; using namespace Literals;
#if defined(DOXYGEN_GENERATING_OUTPUT) || defined(CORRADE_TARGET_UNIX) || (defined(CORRADE_TARGET_WINDOWS) && !defined(CORRADE_TARGET_WINDOWS_RT)) || defined(CORRADE_TARGET_EMSCRIPTEN) #if defined(DOXYGEN_GENERATING_OUTPUT) || defined(CORRADE_TARGET_UNIX) || (defined(CORRADE_TARGET_WINDOWS) && !defined(CORRADE_TARGET_WINDOWS_RT)) || defined(CORRADE_TARGET_EMSCRIPTEN)
namespace {
const struct { const struct {
const char* name; const char* name;
const char* data; const char* data;
@ -125,8 +123,6 @@ constexpr struct {
{"different suffix", "42.0u", Corrade::Utility::TweakableState::Recompile, /* not for double */ {"different suffix", "42.0u", Corrade::Utility::TweakableState::Recompile, /* not for double */
"Utility::TweakableParser: 42.0u has an unexpected suffix, expected _h\n"} "Utility::TweakableParser: 42.0u has an unexpected suffix, expected _h\n"}
}; };
}
#endif #endif
HalfTest::HalfTest() { HalfTest::HalfTest() {
@ -221,8 +217,6 @@ HalfTest::HalfTest() {
} }
} }
namespace {
union FloatBits { union FloatBits {
UnsignedInt u; UnsignedInt u;
Float f; Float f;
@ -242,8 +236,6 @@ union HalfBits {
} bits; } bits;
}; };
}
/* float_to_half_full() from https://gist.github.com/rygorous/2156668, /* float_to_half_full() from https://gist.github.com/rygorous/2156668,
originally from ISPC */ originally from ISPC */
UnsignedShort HalfTest::packNaive(Float value) { UnsignedShort HalfTest::packNaive(Float value) {
@ -708,6 +700,6 @@ void HalfTest::tweakableError() {
} }
#endif #endif
}}} }}}}
CORRADE_TEST_MAIN(Magnum::Math::Test::HalfTest) CORRADE_TEST_MAIN(Magnum::Math::Test::HalfTest)

4
src/Magnum/Math/Test/InterpolationBenchmark.cpp

@ -28,7 +28,7 @@
#define CORRADE_NO_ASSERT #define CORRADE_NO_ASSERT
#include "Magnum/Math/DualQuaternion.h" #include "Magnum/Math/DualQuaternion.h"
namespace Magnum { namespace Math { namespace Test { namespace Magnum { namespace Math { namespace Test { namespace {
struct InterpolationBenchmark: Corrade::TestSuite::Tester { struct InterpolationBenchmark: Corrade::TestSuite::Tester {
explicit InterpolationBenchmark(); explicit InterpolationBenchmark();
@ -147,6 +147,6 @@ void InterpolationBenchmark::dualQuaternionSclerpShortestPath() {
CORRADE_VERIFY(!c.isNormalized()); CORRADE_VERIFY(!c.isNormalized());
} }
}}} }}}}
CORRADE_TEST_MAIN(Magnum::Math::Test::InterpolationBenchmark) CORRADE_TEST_MAIN(Magnum::Math::Test::InterpolationBenchmark)

4
src/Magnum/Math/Test/IntersectionBenchmark.cpp

@ -32,7 +32,7 @@
#include "Magnum/Math/Angle.h" #include "Magnum/Math/Angle.h"
#include "Magnum/Math/Intersection.h" #include "Magnum/Math/Intersection.h"
namespace Magnum { namespace Math { namespace Test { namespace Magnum { namespace Math { namespace Test { namespace {
template<class T> bool rangeFrustumNaive(const Math::Range3D<T>& box, const Math::Frustum<T>& frustum) { template<class T> bool rangeFrustumNaive(const Math::Range3D<T>& box, const Math::Frustum<T>& frustum) {
for(const Math::Vector4<T>& plane: frustum.planes()) { for(const Math::Vector4<T>& plane: frustum.planes()) {
@ -218,6 +218,6 @@ void IntersectionBenchmark::sphereConeView() {
} }
} }
}}} }}}}
CORRADE_TEST_MAIN(Magnum::Math::Test::IntersectionBenchmark) CORRADE_TEST_MAIN(Magnum::Math::Test::IntersectionBenchmark)

4
src/Magnum/Math/Test/IntersectionTest.cpp

@ -29,7 +29,7 @@
#include "Magnum/Math/Intersection.h" #include "Magnum/Math/Intersection.h"
namespace Magnum { namespace Math { namespace Test { namespace Magnum { namespace Math { namespace Test { namespace {
using namespace Literals; using namespace Literals;
@ -451,6 +451,6 @@ void IntersectionTest::aabbCone() {
CORRADE_VERIFY(!Intersection::aabbCone(-15.0f*normal, Vector3{1.0f}, center, normal, angle)); CORRADE_VERIFY(!Intersection::aabbCone(-15.0f*normal, Vector3{1.0f}, center, normal, angle));
} }
}}} }}}}
CORRADE_TEST_MAIN(Magnum::Math::Test::IntersectionTest) CORRADE_TEST_MAIN(Magnum::Math::Test::IntersectionTest)

4
src/Magnum/Math/Test/Matrix3Test.cpp

@ -55,7 +55,7 @@ template<> struct RectangularMatrixConverter<3, 3, float, Mat3> {
} }
namespace Test { namespace Test { namespace {
struct Matrix3Test: Corrade::TestSuite::Tester { struct Matrix3Test: Corrade::TestSuite::Tester {
explicit Matrix3Test(); explicit Matrix3Test();
@ -638,6 +638,6 @@ void Matrix3Test::configuration() {
CORRADE_COMPARE(c.value<Matrix3>("matrix"), m); CORRADE_COMPARE(c.value<Matrix3>("matrix"), m);
} }
}}} }}}}
CORRADE_TEST_MAIN(Magnum::Math::Test::Matrix3Test) CORRADE_TEST_MAIN(Magnum::Math::Test::Matrix3Test)

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save