Browse Source

Shaders: test compilation of *Vector shaders.

pull/23/head
Vladimír Vondruš 13 years ago
parent
commit
c13f8a77f5
  1. 4
      src/Shaders/CMakeLists.txt
  2. 28
      src/Shaders/Test/CMakeLists.txt
  3. 55
      src/Shaders/Test/DistanceFieldVectorTest.cpp
  4. 55
      src/Shaders/Test/VectorTest.cpp

4
src/Shaders/CMakeLists.txt

@ -58,3 +58,7 @@ target_link_libraries(MagnumShaders Magnum)
install(TARGETS MagnumShaders DESTINATION ${MAGNUM_LIBRARY_INSTALL_DIR})
install(FILES ${MagnumShaders_HEADERS} DESTINATION ${MAGNUM_INCLUDE_INSTALL_DIR}/Shaders)
if(BUILD_TESTS)
add_subdirectory(Test)
endif()

28
src/Shaders/Test/CMakeLists.txt

@ -0,0 +1,28 @@
#
# This file is part of Magnum.
#
# Copyright © 2010, 2011, 2012, 2013 Vladimír Vondruš <mosra@centrum.cz>
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the "Software"),
# to deal in the Software without restriction, including without limitation
# the rights to use, copy, modify, merge, publish, distribute, sublicense,
# and/or sell copies of the Software, and to permit persons to whom the
# Software is furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included
# in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
# DEALINGS IN THE SOFTWARE.
#
if(BUILD_GL_TESTS)
corrade_add_test(ShadersDistanceFieldVectorTest DistanceFieldVectorTest.cpp LIBRARIES MagnumShaders ${GL_TEST_LIBRARIES})
corrade_add_test(ShadersVectorTest VectorTest.cpp LIBRARIES MagnumShaders ${GL_TEST_LIBRARIES})
endif()

55
src/Shaders/Test/DistanceFieldVectorTest.cpp

@ -0,0 +1,55 @@
/*
This file is part of Magnum.
Copyright © 2010, 2011, 2012, 2013 Vladimír Vondruš <mosra@centrum.cz>
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
*/
#include "Shaders/DistanceFieldVector.h"
#include "Test/AbstractOpenGLTester.h"
namespace Magnum { namespace Shaders { namespace Test {
class DistanceFieldVectorTest: public Magnum::Test::AbstractOpenGLTester {
public:
explicit DistanceFieldVectorTest();
void compile2D();
void compile3D();
};
DistanceFieldVectorTest::DistanceFieldVectorTest() {
addTests({&DistanceFieldVectorTest::compile2D,
&DistanceFieldVectorTest::compile3D});
}
void DistanceFieldVectorTest::compile2D() {
Shaders::DistanceFieldVector2D shader;
CORRADE_VERIFY(shader.validate().first);
}
void DistanceFieldVectorTest::compile3D() {
Shaders::DistanceFieldVector3D shader;
CORRADE_VERIFY(shader.validate().first);
}
}}}
CORRADE_TEST_MAIN(Magnum::Shaders::Test::DistanceFieldVectorTest)

55
src/Shaders/Test/VectorTest.cpp

@ -0,0 +1,55 @@
/*
This file is part of Magnum.
Copyright © 2010, 2011, 2012, 2013 Vladimír Vondruš <mosra@centrum.cz>
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
*/
#include "Shaders/Vector.h"
#include "Test/AbstractOpenGLTester.h"
namespace Magnum { namespace Shaders { namespace Test {
class VectorTest: public Magnum::Test::AbstractOpenGLTester {
public:
explicit VectorTest();
void compile2D();
void compile3D();
};
VectorTest::VectorTest() {
addTests({&VectorTest::compile2D,
&VectorTest::compile3D});
}
void VectorTest::compile2D() {
Shaders::Vector2D shader;
CORRADE_VERIFY(shader.validate().first);
}
void VectorTest::compile3D() {
Shaders::Vector3D shader;
CORRADE_VERIFY(shader.validate().first);
}
}}}
CORRADE_TEST_MAIN(Magnum::Shaders::Test::VectorTest)
Loading…
Cancel
Save