summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2025-04-02 23:22:12 +0100
committerDan Goodliffe <dan@randomdan.homeip.net>2025-04-02 23:22:12 +0100
commit2245fc8a3bb521afc2e6dd575cd1757ecab23558 (patch)
treec4565e14b2e9b01c970b3ee5816f6ec849b61e92 /test
parentMerge remote-tracking branch 'origin/ptrs' (diff)
parentRemove the old unused network.png icon (diff)
downloadilt-2245fc8a3bb521afc2e6dd575cd1757ecab23558.tar.bz2
ilt-2245fc8a3bb521afc2e6dd575cd1757ecab23558.tar.xz
ilt-2245fc8a3bb521afc2e6dd575cd1757ecab23558.zip
Merge branch 'imgui'HEADmain
Diffstat (limited to 'test')
-rw-r--r--test/Jamfile.jam1
-rw-r--r--test/test-lib.cpp4
-rw-r--r--test/test-text.cpp14
-rw-r--r--test/test-ui.cpp20
4 files changed, 23 insertions, 16 deletions
diff --git a/test/Jamfile.jam b/test/Jamfile.jam
index 5189add..bdaaa45 100644
--- a/test/Jamfile.jam
+++ b/test/Jamfile.jam
@@ -75,6 +75,7 @@ perfrun perf-instancing.cpp : : test-instancing ;
run test-glContainer.cpp : : : <library>test ;
run test-pack.cpp : : : <library>test ;
run test-environment.cpp : : : <library>test ;
+run test-ui.cpp : : : <library>test ;
compile test-static-enumDetails.cpp ;
compile test-static-stream_support.cpp ;
alias perf : perf-assetFactory perf-persistence perf-geoData perf-instancing perf-terrain ;
diff --git a/test/test-lib.cpp b/test/test-lib.cpp
index ec91f6e..a1a8c80 100644
--- a/test/test-lib.cpp
+++ b/test/test-lib.cpp
@@ -46,9 +46,9 @@ BOOST_AUTO_TEST_CASE(generate_move_and_delete)
{
{
TestArray a;
- BOOST_CHECK_EQUAL(TestArray::size, active.size());
+ BOOST_CHECK_EQUAL(TestArray::size(), active.size());
const TestArray b {std::move(a)};
- BOOST_CHECK_EQUAL(TestArray::size, active.size());
+ BOOST_CHECK_EQUAL(TestArray::size(), active.size());
}
BOOST_CHECK(active.empty());
}
diff --git a/test/test-text.cpp b/test/test-text.cpp
index b0a9503..0729ce8 100644
--- a/test/test-text.cpp
+++ b/test/test-text.cpp
@@ -7,7 +7,6 @@
#include "testMainWindow.h"
#include "testRenderOutput.h"
-#include "ui/text.h"
#include <array>
#include <gfx/models/texture.h>
#include <glm/glm.hpp>
@@ -112,19 +111,6 @@ BOOST_AUTO_TEST_CASE(render_font)
}
}
-BOOST_AUTO_TEST_CASE(render_text)
-{
- TestRenderOutput output;
- glBindFramebuffer(GL_FRAMEBUFFER, output.output);
- glViewport(0, 0, 640, 480);
- glEnable(GL_BLEND);
- glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
- Text t {"I Like Trains", *this, {{10, 10}, {200, 40}}, {1, 1, 1}};
- UIShader s {640, 480};
- t.render(s, {});
- Texture::save(output.outImage, "/tmp/text.tga");
-}
-
BOOST_AUTO_TEST_SUITE_END()
BOOST_AUTO_TEST_CASE(stream_vec)
diff --git a/test/test-ui.cpp b/test/test-ui.cpp
new file mode 100644
index 0000000..2810cda
--- /dev/null
+++ b/test/test-ui.cpp
@@ -0,0 +1,20 @@
+#define BOOST_TEST_MODULE UI
+#include <boost/test/unit_test.hpp>
+#include <stream_support.h>
+
+#include "testMainWindow.h"
+#include <gfx/models/texture.h>
+#include <resource.h>
+#include <ui/svgIcon.h>
+
+constexpr GLsizei RENDER_SIZE = 64;
+
+BOOST_GLOBAL_FIXTURE(TestMainWindowAppBase);
+
+BOOST_AUTO_TEST_CASE(LoadFromFile)
+{
+ SvgIcon svg(ImageDimensions {RENDER_SIZE}, Resource::mapPath("ui/icon/rails.svg"));
+ const auto size = Texture::getSize(svg.texture);
+ BOOST_CHECK_EQUAL(size, TextureDimensions(RENDER_SIZE, RENDER_SIZE, 1));
+ Texture::save(svg.texture, "/tmp/rails.tga");
+}