From 21ce5574ffd5348c3f3d9c8fef63f20fa2e937f4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20M=C3=BCller?= <j.mueller@vr.rwth-aachen.de> Date: Wed, 25 Jul 2018 15:01:16 +0200 Subject: [PATCH] add some kind of test for texture1D creation #470 --- tests/src/test_lookup_table.cpp | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/tests/src/test_lookup_table.cpp b/tests/src/test_lookup_table.cpp index e3def80b..17d21d98 100644 --- a/tests/src/test_lookup_table.cpp +++ b/tests/src/test_lookup_table.cpp @@ -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") { -- GitLab