+BOOST_AUTO_TEST_CASE (colour_conversion_test3)
+{
+ ColourConversion A (dcp::ColourConversion::rec709_to_xyz ());
+ xmlpp::Document doc;
+ xmlpp::Element* root = doc.create_root_node ("Test");
+ A.as_xml (root);
+ BOOST_CHECK_EQUAL (
+ doc.write_to_string_formatted ("UTF-8"),
+ "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
+ "<Test>\n"
+ " <InputTransferFunction>\n"
+ " <Type>Gamma</Type>\n"
+ " <Gamma>2.2</Gamma>\n"
+ " </InputTransferFunction>\n"
+ " <YUVToRGB>1</YUVToRGB>\n"
+ " <RedX>0.64</RedX>\n"
+ " <RedY>0.33</RedY>\n"
+ " <GreenX>0.3</GreenX>\n"
+ " <GreenY>0.6</GreenY>\n"
+ " <BlueX>0.15</BlueX>\n"
+ " <BlueY>0.06</BlueY>\n"
+ " <WhiteX>0.3127</WhiteX>\n"
+ " <WhiteY>0.329</WhiteY>\n"
+ " <OutputGamma>2.6</OutputGamma>\n"
+ "</Test>\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<cxml::Document> 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);
+ }