X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=test%2Fcpl_sar_test.cc;h=0ecc87e0239cb6890f7421bee4b8ea5691551fa0;hb=5d3d4fbd355d8d422a4ac17f93d57ab8ef0a22ee;hp=60945aaed0b1c7b87006c02076097682e9afe2a9;hpb=d39880eef211a296fa8ef4712cdef5945d08527c;p=libdcp.git diff --git a/test/cpl_sar_test.cc b/test/cpl_sar_test.cc index 60945aae..0ecc87e0 100644 --- a/test/cpl_sar_test.cc +++ b/test/cpl_sar_test.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2014-2019 Carl Hetherington + Copyright (C) 2014-2021 Carl Hetherington This file is part of libdcp. @@ -31,28 +31,35 @@ files in the program, then also delete it here. */ + #include "cpl.h" -#include "reel_mono_picture_asset.h" #include "mono_picture_asset.h" +#include "reel_mono_picture_asset.h" +#include "warnings.h" #include +LIBDCP_DISABLE_WARNINGS #include +LIBDCP_ENABLE_WARNINGS #include + using std::string; using std::shared_ptr; +using std::make_shared; static void -check (shared_ptr pa, dcp::Fraction far, string sar) +check (shared_ptr pa, dcp::Fraction frac, string sar) { - pa->set_screen_aspect_ratio (far); + pa->set_screen_aspect_ratio (frac); xmlpp::Document doc; - xmlpp::Element* el = doc.create_root_node ("Test"); - pa->write_to_cpl (el, dcp::INTEROP); + auto el = doc.create_root_node ("Test"); + pa->write_to_cpl (el, dcp::Standard::INTEROP); cxml::Node node (el); BOOST_CHECK_EQUAL (node.node_child("MainPicture")->string_child ("ScreenAspectRatio"), sar); } + /** Test for a reported bug where in Interop files uses * excessive decimal places and (sometimes) the wrong decimal point character. * Also check that we correctly use one of the allowed @@ -60,46 +67,43 @@ check (shared_ptr pa, dcp::Fraction far, string sar) */ BOOST_AUTO_TEST_CASE (cpl_sar) { - shared_ptr pa ( - new dcp::ReelMonoPictureAsset ( - shared_ptr (new dcp::MonoPictureAsset ("test/ref/DCP/dcp_test1/video.mxf")), - 0 - ) + auto pa = make_shared( + make_shared("test/ref/DCP/dcp_test1/video.mxf"), 0 ); /* Easy ones */ - check (pa, dcp::Fraction (1998, 1080), "1.85"); - check (pa, dcp::Fraction (2048, 858), "2.39"); + check (pa, dcp::Fraction(1998, 1080), "1.85"); + check (pa, dcp::Fraction(2048, 858), "2.39"); /* Check the use of the allowed values */ /* Just less then, equal to and just more than 1.33 */ - check (pa, dcp::Fraction (1200, 1000), "1.33"); - check (pa, dcp::Fraction (1330, 1000), "1.33"); - check (pa, dcp::Fraction (1430, 1000), "1.33"); + check (pa, dcp::Fraction(1200, 1000), "1.33"); + check (pa, dcp::Fraction(1330, 1000), "1.33"); + check (pa, dcp::Fraction(1430, 1000), "1.33"); /* Same for 1.66 */ - check (pa, dcp::Fraction (1600, 1000), "1.66"); - check (pa, dcp::Fraction (1660, 1000), "1.66"); - check (pa, dcp::Fraction (1670, 1000), "1.66"); + check (pa, dcp::Fraction(1600, 1000), "1.66"); + check (pa, dcp::Fraction(1660, 1000), "1.66"); + check (pa, dcp::Fraction(1670, 1000), "1.66"); /* 1.77 */ - check (pa, dcp::Fraction (1750, 1000), "1.77"); - check (pa, dcp::Fraction (1770, 1000), "1.77"); - check (pa, dcp::Fraction (1800, 1000), "1.77"); + check (pa, dcp::Fraction(1750, 1000), "1.77"); + check (pa, dcp::Fraction(1770, 1000), "1.77"); + check (pa, dcp::Fraction(1800, 1000), "1.77"); /* 1.85 */ - check (pa, dcp::Fraction (1820, 1000), "1.85"); - check (pa, dcp::Fraction (1850, 1000), "1.85"); - check (pa, dcp::Fraction (1910, 1000), "1.85"); + check (pa, dcp::Fraction(1820, 1000), "1.85"); + check (pa, dcp::Fraction(1850, 1000), "1.85"); + check (pa, dcp::Fraction(1910, 1000), "1.85"); /* 2.00 */ - check (pa, dcp::Fraction (1999, 1000), "2.00"); - check (pa, dcp::Fraction (2000, 1000), "2.00"); - check (pa, dcp::Fraction (2001, 1000), "2.00"); + check (pa, dcp::Fraction(1999, 1000), "2.00"); + check (pa, dcp::Fraction(2000, 1000), "2.00"); + check (pa, dcp::Fraction(2001, 1000), "2.00"); /* 2.39 */ - check (pa, dcp::Fraction (2350, 1000), "2.39"); - check (pa, dcp::Fraction (2390, 1000), "2.39"); - check (pa, dcp::Fraction (2500, 1000), "2.39"); + check (pa, dcp::Fraction(2350, 1000), "2.39"); + check (pa, dcp::Fraction(2390, 1000), "2.39"); + check (pa, dcp::Fraction(2500, 1000), "2.39"); }