Skip to content
Snippets Groups Projects
Commit 21ce5574 authored by Jan Müller's avatar Jan Müller
Browse files

add some kind of test for texture1D creation

#470
parent 6b894217
Branches
No related tags found
1 merge request!151Feature/#470 create a color lookup table
......@@ -20,19 +20,24 @@
// limitations under the License.
//------------------------------------------------------------------------------
#include "catch/catch.hpp"
#include "phx/resources/types/lookup_table.hpp"
#include "phx/resources/types/transfer_function.hpp"
#include "catch/catch.hpp"
#include "trompeloeil.hpp"
#include "mocks/opengl_mock.hpp"
SCENARIO("Creating and accesing a Lookup Table", "[phx][phx::LookupTable]") {
OPENGL_MOCK_ALLOW_ANY_CALL
GIVEN("A test transfer function") {
phx::TransferFunction transfer_function;
glm::vec4 red_color{1.0f, 0.0f, 0.0f, 0.0f};
glm::vec4 black_color{0.0f, 0.0f, 0.0f, 0.0f};
transfer_function.SetEntries({{0.0f, red_color}, {1.0f, black_color}});
WHEN("We create Lookup Table from the given Transfer function") {
WHEN("We create Lookup Table with the given Transfer function") {
phx::LookupTable lut(transfer_function, 11);
THEN("The Lookup Table is generated correctly") {
......@@ -48,6 +53,11 @@ SCENARIO("Creating and accesing a Lookup Table", "[phx][phx::LookupTable]") {
REQUIRE(lut.GetIndex(1.0f) == 10);
REQUIRE(lut.GetIndex(0.56f) == 6);
}
THEN("We can ask for a lookup table as texture1D") {
REQUIRE_CALL(open_gl_mock, glCreateTextures(_, _, _));
auto lookup_texture = lut.GetTexture1D();
}
}
WHEN("We ask for a nearest neighbor interpolated Lookup Table") {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment