C++11 tidying.
[dcpomatic.git] / test / config_test.cc
index ec67a200a3462a556e666733b109bf1bea0dd4ad..d78b9357b86dc8943fcb5021255392c813fa09ed 100644 (file)
@@ -1,5 +1,5 @@
 /*
-    Copyright (C) 2018 Carl Hetherington <cth@carlh.net>
+    Copyright (C) 2018-2021 Carl Hetherington <cth@carlh.net>
 
     This file is part of DCP-o-matic.
 
 
 */
 
+
 #include "lib/config.h"
 #include "test.h"
 #include <boost/test/unit_test.hpp>
 #include <fstream>
 
+
 using std::ofstream;
 
+
 static void
 rewrite_bad_config ()
 {
@@ -91,3 +94,21 @@ BOOST_AUTO_TEST_CASE (config_backup_test)
        */
        setup_test_config ();
 }
+
+
+BOOST_AUTO_TEST_CASE (config_write_utf8_test)
+{
+       boost::filesystem::remove_all ("build/test/config.xml");
+       boost::filesystem::copy_file ("test/data/utf8_config.xml", "build/test/config.xml");
+       Config::override_path = "build/test";
+       Config::drop ();
+       Config::instance()->write();
+
+       check_text_file ("test/data/utf8_config.xml", "build/test/config.xml");
+
+       /* This test has called Config::set_defaults(), so take us back
+          to the config that we want for our tests.
+       */
+       setup_test_config ();
+}
+