From 73d54683d5e034b56e2edca968b477bb1b3a9603 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Wed, 2 Sep 2015 12:37:54 +0100 Subject: [PATCH] Add another unit test. --- test/colour_conversion_test.cc | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/test/colour_conversion_test.cc b/test/colour_conversion_test.cc index da6600f08..eb4b79ef8 100644 --- a/test/colour_conversion_test.cc +++ b/test/colour_conversion_test.cc @@ -22,10 +22,12 @@ */ #include "lib/colour_conversion.h" +#include "lib/film.h" #include #include #include #include +#include using std::cout; using boost::shared_ptr; @@ -97,3 +99,16 @@ BOOST_AUTO_TEST_CASE (colour_conversion_test3) "\n" ); } + +/** Test a round trip via the XML representation */ +BOOST_AUTO_TEST_CASE (colour_conversion_test4) +{ + BOOST_FOREACH (PresetColourConversion const & i, PresetColourConversion::all ()) { + xmlpp::Document out; + xmlpp::Element* out_root = out.create_root_node ("Test"); + i.conversion.as_xml (out_root); + shared_ptr in (new cxml::Document ("Test")); + in->read_string (out.write_to_string ("UTF-8")); + BOOST_CHECK (ColourConversion::from_xml (in, Film::current_state_version).get () == i.conversion); + } +} -- 2.30.2