summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--test/cpl_sar.cc40
-rw-r--r--test/wscript1
2 files changed, 41 insertions, 0 deletions
diff --git a/test/cpl_sar.cc b/test/cpl_sar.cc
new file mode 100644
index 00000000..064d9510
--- /dev/null
+++ b/test/cpl_sar.cc
@@ -0,0 +1,40 @@
+/*
+ Copyright (C) 2014 Carl Hetherington <cth@carlh.net>
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+#include <boost/test/unit_test.hpp>
+#include <libcxml/cxml.h>
+#include "cpl.h"
+#include "mono_picture_asset.h"
+
+using boost::shared_ptr;
+
+/* Test for a reported bug where <ScreenAspectRatio> in Interop files uses
+ excessive decimal places and (sometimes) the wrong decimal point character.
+*/
+BOOST_AUTO_TEST_CASE (cpl_sar)
+{
+ shared_ptr<libdcp::MonoPictureAsset> mp (new libdcp::MonoPictureAsset ("build/test/foo", "video.mxf"));
+ mp->set_size (libdcp::Size (1998, 1080));
+ xmlpp::Document doc;
+ xmlpp::Element* el = doc.create_root_node ("Test");
+ mp->write_to_cpl (el, true);
+
+ cxml::Node node (el);
+ BOOST_CHECK_EQUAL (node.node_child("MainPicture")->string_child ("ScreenAspectRatio"), "1.85");
+}
diff --git a/test/wscript b/test/wscript
index 23469203..7bb68252 100644
--- a/test/wscript
+++ b/test/wscript
@@ -23,6 +23,7 @@ def build(bld):
obj.source = """
certificates_test.cc
color_test.cc
+ cpl_sar.cc
dcp_test.cc
dcp_time_test.cc
decryption_test.cc