summaryrefslogtreecommitdiff
path: root/test/test-render.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'test/test-render.cpp')
-rw-r--r--test/test-render.cpp17
1 files changed, 17 insertions, 0 deletions
diff --git a/test/test-render.cpp b/test/test-render.cpp
index 77501ac..1150a67 100644
--- a/test/test-render.cpp
+++ b/test/test-render.cpp
@@ -10,6 +10,7 @@
#include <gfx/models/texture.h>
#include <lib/glArrays.h>
#include <maths.h>
+#include <stream_support.hpp>
#include <ui/applicationBase.h>
#include <ui/window.h>
@@ -95,6 +96,22 @@ class TestScene : public SceneProvider {
BOOST_GLOBAL_FIXTURE(ApplicationBase);
BOOST_GLOBAL_FIXTURE(TestMainWindow);
+BOOST_DATA_TEST_CASE(cam,
+ boost::unit_test::data::xrange(0.5F, 30.F, 1.3F) * boost::unit_test::data::xrange(0.5F, 10.F, 0.3F)
+ * boost::unit_test::data::xrange(50.F, 500.F, 70.F),
+ dist, near, far)
+{
+ static constexpr glm::vec3 pos {-10, -10, 60};
+ Camera cam {pos, half_pi, 1.f, near, far};
+
+ const auto e = cam.extentsAtDist(dist);
+
+ BOOST_CHECK_CLOSE_VEC(e[0], pos + glm::vec3(-dist, dist, -dist));
+ BOOST_CHECK_CLOSE_VEC(e[1], pos + glm::vec3(-dist, dist, dist));
+ BOOST_CHECK_CLOSE_VEC(e[2], pos + glm::vec3(dist, dist, -dist));
+ BOOST_CHECK_CLOSE_VEC(e[3], pos + glm::vec3(dist, dist, dist));
+}
+
BOOST_FIXTURE_TEST_SUITE(w, TestRenderOutput);
BOOST_AUTO_TEST_CASE(basic)