summaryrefslogtreecommitdiff
path: root/test/test-assetFactory.cpp
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2023-02-27 19:38:14 +0000
committerDan Goodliffe <dan@randomdan.homeip.net>2023-02-27 19:38:14 +0000
commitb7b9eb7bb9deb6704f276fb3b8fd67ba370caf3e (patch)
treecfbb3bac94271c04a44610f5f40751e74ea4d227 /test/test-assetFactory.cpp
parentoperator*= can work on any iterable collection (diff)
downloadilt-b7b9eb7bb9deb6704f276fb3b8fd67ba370caf3e.tar.bz2
ilt-b7b9eb7bb9deb6704f276fb3b8fd67ba370caf3e.tar.xz
ilt-b7b9eb7bb9deb6704f276fb3b8fd67ba370caf3e.zip
Load the X11 RGB colour definitions into a map
Diffstat (limited to 'test/test-assetFactory.cpp')
-rw-r--r--test/test-assetFactory.cpp30
1 files changed, 30 insertions, 0 deletions
diff --git a/test/test-assetFactory.cpp b/test/test-assetFactory.cpp
index fd7a41d..89f6bf0 100644
--- a/test/test-assetFactory.cpp
+++ b/test/test-assetFactory.cpp
@@ -11,6 +11,7 @@
#include "gfx/gl/sceneRenderer.h"
#include "lib/collection.hpp"
#include "lib/location.hpp"
+#include "lib/stream_support.hpp"
#include "testMainWindow.h"
#include "ui/applicationBase.h"
@@ -180,3 +181,32 @@ BOOST_AUTO_TEST_CASE(brush47xml)
render(20);
}
BOOST_AUTO_TEST_SUITE_END();
+
+template<typename T> using InOut = std::tuple<T, T>;
+BOOST_DATA_TEST_CASE(normalizeColourName,
+ boost::unit_test::data::make<InOut<std::string>>({
+ {"", ""},
+ {"black", "black"},
+ {" black ", "black"},
+ {" b l a c k ", "black"},
+ {" B L A c k ", "black"},
+ {"BLAck ", "black"},
+ {"BLACK ", "black"},
+ {"BlAck ", "black"},
+ {"Bl Ack ", "black"},
+ }),
+ in_, exp)
+{
+ auto in {in_};
+ BOOST_CHECK_NO_THROW(AssetFactory::normalizeColourName(in));
+ BOOST_CHECK_EQUAL(in, exp);
+}
+
+BOOST_AUTO_TEST_CASE(parseX11RGB)
+{
+ const auto parsedColours = AssetFactory::parseX11RGB(FIXTURESDIR "rgb.txt");
+ BOOST_REQUIRE_EQUAL(parsedColours.size(), 20);
+ BOOST_CHECK_EQUAL(parsedColours.at("cyan"), AssetFactory::Colour(0, 255, 255));
+ BOOST_CHECK_EQUAL(parsedColours.at("slategrey"), AssetFactory::Colour(112, 128, 144));
+ BOOST_CHECK_EQUAL(parsedColours.at("lightsteelblue1"), AssetFactory::Colour(202, 225, 255));
+}