diff options
author | Dan Goodliffe <dan@randomdan.homeip.net> | 2024-01-27 21:47:41 +0000 |
---|---|---|
committer | Dan Goodliffe <dan@randomdan.homeip.net> | 2024-01-27 21:47:41 +0000 |
commit | e0ac130808d9bed5443115ee91e9cccda713ae3c (patch) | |
tree | dad2b2cbe2bc8bf5560f4859880549472f808671 /test/test-text.cpp | |
parent | Remove the static texture cache (diff) | |
parent | Render text in N draw calls (diff) | |
download | ilt-e0ac130808d9bed5443115ee91e9cccda713ae3c.tar.bz2 ilt-e0ac130808d9bed5443115ee91e9cccda713ae3c.tar.xz ilt-e0ac130808d9bed5443115ee91e9cccda713ae3c.zip |
Merge branch 'text2'
Diffstat (limited to 'test/test-text.cpp')
-rw-r--r-- | test/test-text.cpp | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/test/test-text.cpp b/test/test-text.cpp index 166a6fa..f652670 100644 --- a/test/test-text.cpp +++ b/test/test-text.cpp @@ -6,10 +6,12 @@ #include <stream_support.h> #include "testMainWindow.h" +#include "testRenderOutput.h" #include "ui/applicationBase.h" +#include "ui/text.h" #include <array> +#include <gfx/models/texture.h> #include <glm/glm.hpp> -#include <span> #include <ui/font.h> #include <unicode.h> #include <vector> @@ -86,7 +88,7 @@ BOOST_DATA_TEST_CASE(initialize_chardata_A, static_assert(glm::vec2 {862, 0} / glm::vec2 {2048, 64} == glm::vec2 {0.4208984375, 0}); static_assert(glm::vec2 {866, 35} / glm::vec2 {2048, 64} == glm::vec2 {0.4228515625, 0.546875}); -BOOST_AUTO_TEST_CASE(render_text) +BOOST_AUTO_TEST_CASE(render_font) { constexpr std::string_view text {"I Like Trains"}; const auto spaces = static_cast<std::size_t>(std::count_if(text.begin(), text.end(), isspace)); @@ -112,6 +114,19 @@ BOOST_AUTO_TEST_CASE(render_text) } } +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) |