From c30eda289b5815b6b62799ef986eaf3c462fd72d Mon Sep 17 00:00:00 2001
From: Dan Goodliffe <dan@randomdan.homeip.net>
Date: Mon, 31 Mar 2025 01:18:03 +0100
Subject: Add SvgIcon class

Based on Icon class, but constructor replaced with calls to lunasvg.
---
 test/Jamfile.jam |  1 +
 test/test-ui.cpp | 20 ++++++++++++++++++++
 2 files changed, 21 insertions(+)
 create mode 100644 test/test-ui.cpp

(limited to 'test')

diff --git a/test/Jamfile.jam b/test/Jamfile.jam
index bedc2ad..c922187 100644
--- a/test/Jamfile.jam
+++ b/test/Jamfile.jam
@@ -65,6 +65,7 @@ run perf-instancing.cpp : \< : test-instancing : <library>benchmark <library>tes
 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 ;
 explicit perf-assetFactory ;
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");
+}
-- 
cgit v1.2.3