diff options
| author | Carl Hetherington <cth@carlh.net> | 2021-04-14 01:00:05 +0200 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2021-04-14 01:00:05 +0200 |
| commit | 274dd30f2b11fe8ea563a2ac7436c9d463865b0b (patch) | |
| tree | 199e7447606339d461f6f87d16095376d8f809b3 /test | |
| parent | 4bd57fbbac67ac04ec47a9765b9f278aa1691851 (diff) | |
Fix/hide some warnings.
Diffstat (limited to 'test')
| -rw-r--r-- | test/asset_test.cc | 22 | ||||
| -rw-r--r-- | test/cpl_sar_test.cc | 50 | ||||
| -rw-r--r-- | test/interop_load_font_test.cc | 12 | ||||
| -rw-r--r-- | test/kdm_test.cc | 28 | ||||
| -rw-r--r-- | test/mca_test.cc | 3 | ||||
| -rw-r--r-- | test/smpte_load_font_test.cc | 12 | ||||
| -rw-r--r-- | test/test.cc | 5 |
7 files changed, 89 insertions, 43 deletions
diff --git a/test/asset_test.cc b/test/asset_test.cc index a6fa4b33..d6257ebc 100644 --- a/test/asset_test.cc +++ b/test/asset_test.cc @@ -36,36 +36,36 @@ #include <boost/bind.hpp> #include <boost/test/unit_test.hpp> + using std::string; using std::shared_ptr; +using std::make_shared; + class DummyAsset : public dcp::Asset { protected: - std::string pkl_type (dcp::Standard) const { + std::string pkl_type (dcp::Standard) const override { return "none"; } }; -static void -note_handler (dcp::NoteType, string) -{ - -} /** Test a few dusty corners of Asset */ BOOST_AUTO_TEST_CASE (asset_test) { - shared_ptr<DummyAsset> a (new DummyAsset); + auto a = make_shared<DummyAsset>(); a->_hash = "abc"; - shared_ptr<DummyAsset> b (new DummyAsset); + auto b = make_shared<DummyAsset>(); b->_hash = "def"; - BOOST_CHECK (!a->equals (b, dcp::EqualityOptions (), boost::bind (¬e_handler, _1, _2))); + auto ignore = [](dcp::NoteType, string) {}; + + BOOST_CHECK (!a->equals(b, dcp::EqualityOptions(), ignore)); b->_hash = "abc"; - BOOST_CHECK (a->equals (b, dcp::EqualityOptions (), boost::bind (¬e_handler, _1, _2))); + BOOST_CHECK (a->equals(b, dcp::EqualityOptions(), ignore)); b->_file = "foo/bar/baz"; - BOOST_CHECK (a->equals (b, dcp::EqualityOptions (), boost::bind (¬e_handler, _1, _2))); + BOOST_CHECK (a->equals(b, dcp::EqualityOptions(), ignore)); } diff --git a/test/cpl_sar_test.cc b/test/cpl_sar_test.cc index 65f01900..1bf53686 100644 --- a/test/cpl_sar_test.cc +++ b/test/cpl_sar_test.cc @@ -31,13 +31,18 @@ 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 <libcxml/cxml.h> +LIBDCP_DISABLE_WARNINGS #include <libxml++/libxml++.h> +LIBDCP_ENABLE_WARNINGS #include <boost/test/unit_test.hpp> + using std::string; using std::shared_ptr; using std::make_shared; @@ -47,13 +52,14 @@ check (shared_ptr<dcp::ReelMonoPictureAsset> pa, dcp::Fraction far, string sar) { pa->set_screen_aspect_ratio (far); xmlpp::Document doc; - xmlpp::Element* el = doc.create_root_node ("Test"); + 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 <ScreenAspectRatio> in Interop files uses * excessive decimal places and (sometimes) the wrong decimal point character. * Also check that we correctly use one of the allowed <ScreenAspectRatio> @@ -66,38 +72,38 @@ BOOST_AUTO_TEST_CASE (cpl_sar) ); /* 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"); } diff --git a/test/interop_load_font_test.cc b/test/interop_load_font_test.cc index 0a5a0f6c..50e53a07 100644 --- a/test/interop_load_font_test.cc +++ b/test/interop_load_font_test.cc @@ -31,11 +31,19 @@ files in the program, then also delete it here. */ + #include "interop_load_font_node.h" +#include "warnings.h" #include <libcxml/cxml.h> +LIBDCP_DISABLE_WARNINGS #include <libxml++/libxml++.h> +LIBDCP_ENABLE_WARNINGS #include <boost/test/unit_test.hpp> + +using std::make_shared; + + /** Test dcp::InteropLoadFont's simple constructor */ BOOST_AUTO_TEST_CASE (interop_load_font_test1) { @@ -52,7 +60,7 @@ BOOST_AUTO_TEST_CASE (interop_load_font_test2) text->set_attribute("Id", "my-great-id"); text->set_attribute("URI", "my-great-uri"); - dcp::InteropLoadFontNode lf (cxml::ConstNodePtr (new cxml::Node (text))); + dcp::InteropLoadFontNode lf (make_shared<cxml::Node>(text)); BOOST_CHECK_EQUAL (lf.id, "my-great-id"); } @@ -65,7 +73,7 @@ BOOST_AUTO_TEST_CASE (interop_load_font_test3) text->set_attribute("ID", "my-great-id"); text->set_attribute("URI", "my-great-uri"); - dcp::InteropLoadFontNode lf (cxml::ConstNodePtr (new cxml::Node (text))); + dcp::InteropLoadFontNode lf (make_shared<cxml::Node>(text)); BOOST_CHECK_EQUAL (lf.id, "my-great-id"); } diff --git a/test/kdm_test.cc b/test/kdm_test.cc index ce589a8c..5b0ae622 100644 --- a/test/kdm_test.cc +++ b/test/kdm_test.cc @@ -31,21 +31,26 @@ files in the program, then also delete it here. */ -#include "encrypted_kdm.h" -#include "decrypted_kdm.h" + #include "certificate_chain.h" -#include "util.h" -#include "test.h" #include "cpl.h" +#include "decrypted_kdm.h" +#include "encrypted_kdm.h" #include "mono_picture_asset.h" -#include "reel_mono_picture_asset.h" +#include "picture_asset_writer.h" #include "reel.h" +#include "reel_mono_picture_asset.h" +#include "test.h" #include "types.h" -#include "picture_asset_writer.h" +#include "util.h" +#include "warnings.h" #include <libcxml/cxml.h> +LIBDCP_DISABLE_WARNINGS #include <libxml++/libxml++.h> +LIBDCP_ENABLE_WARNINGS #include <boost/test/unit_test.hpp> + using std::list; using std::string; using std::vector; @@ -53,6 +58,7 @@ using std::make_shared; using std::shared_ptr; using boost::optional; + /** Check reading and decryption of a KDM */ BOOST_AUTO_TEST_CASE (kdm_test) { @@ -76,6 +82,7 @@ BOOST_AUTO_TEST_CASE (kdm_test) BOOST_CHECK_EQUAL (keys.back().key().hex(), "5327fb7ec2e807bd57059615bf8a169d"); } + /** Check that we can read in a KDM and then write it back out again the same */ BOOST_AUTO_TEST_CASE (kdm_passthrough_test) { @@ -94,6 +101,7 @@ BOOST_AUTO_TEST_CASE (kdm_passthrough_test) ); } + /** Test some of the utility methods of DecryptedKDM */ BOOST_AUTO_TEST_CASE (decrypted_kdm_test) { @@ -124,6 +132,7 @@ BOOST_AUTO_TEST_CASE (decrypted_kdm_test) delete[] data; } + /** Check that <KeyType> tags have the scope attribute. * Wolfgang Woehl believes this is compulsory and I am more-or-less inclined to agree. */ @@ -149,6 +158,7 @@ BOOST_AUTO_TEST_CASE (kdm_key_type_scope) } } + static cxml::ConstNodePtr kdm_forensic_test (cxml::Document& doc, bool picture, optional<int> audio) { @@ -177,6 +187,7 @@ kdm_forensic_test (cxml::Document& doc, bool picture, optional<int> audio) optional_node_child("ForensicMarkFlagList"); } + /** Check ForensicMarkFlagList handling: disable picture and all audio */ BOOST_AUTO_TEST_CASE (kdm_forensic_test1) { @@ -189,6 +200,7 @@ BOOST_AUTO_TEST_CASE (kdm_forensic_test1) BOOST_CHECK_EQUAL (flags.back()->content(), "http://www.smpte-ra.org/430-1/2006/KDM#mrkflg-audio-disable"); } + /** Check ForensicMarkFlagList handling: disable picture but not audio */ BOOST_AUTO_TEST_CASE (kdm_forensic_test2) { @@ -200,6 +212,7 @@ BOOST_AUTO_TEST_CASE (kdm_forensic_test2) BOOST_CHECK_EQUAL (flags.front()->content(), "http://www.smpte-ra.org/430-1/2006/KDM#mrkflg-picture-disable"); } + /** Check ForensicMarkFlagList handling: disable audio but not picture */ BOOST_AUTO_TEST_CASE (kdm_forensic_test3) { @@ -211,6 +224,7 @@ BOOST_AUTO_TEST_CASE (kdm_forensic_test3) BOOST_CHECK_EQUAL (flags.front()->content(), "http://www.smpte-ra.org/430-1/2006/KDM#mrkflg-audio-disable"); } + /** Check ForensicMarkFlagList handling: disable picture and audio above channel 3 */ BOOST_AUTO_TEST_CASE (kdm_forensic_test4) { @@ -223,6 +237,7 @@ BOOST_AUTO_TEST_CASE (kdm_forensic_test4) BOOST_CHECK_EQUAL (flags.back()->content(), "http://www.smpte-ra.org/430-1/2006/KDM#mrkflg-audio-disable-above-channel-3"); } + /** Check ForensicMarkFlagList handling: disable neither */ BOOST_AUTO_TEST_CASE (kdm_forensic_test5) { @@ -231,6 +246,7 @@ BOOST_AUTO_TEST_CASE (kdm_forensic_test5) BOOST_CHECK (!forensic); } + /** Check that KDM validity periods are checked for being within the certificate validity */ BOOST_AUTO_TEST_CASE (validity_period_test1) { diff --git a/test/mca_test.cc b/test/mca_test.cc index decbf581..bcedce78 100644 --- a/test/mca_test.cc +++ b/test/mca_test.cc @@ -39,8 +39,11 @@ #include "sound_asset.h" #include "sound_asset_writer.h" #include "test.h" +#include "warnings.h" #include <libcxml/cxml.h> +LIBDCP_DISABLE_WARNINGS #include <libxml++/libxml++.h> +LIBDCP_ENABLE_WARNINGS #include <boost/test/unit_test.hpp> diff --git a/test/smpte_load_font_test.cc b/test/smpte_load_font_test.cc index a9cc327d..adcbb0aa 100644 --- a/test/smpte_load_font_test.cc +++ b/test/smpte_load_font_test.cc @@ -31,20 +31,28 @@ files in the program, then also delete it here. */ + #include "smpte_load_font_node.h" +#include "warnings.h" #include <libcxml/cxml.h> +LIBDCP_DISABLE_WARNINGS #include <libxml++/libxml++.h> +LIBDCP_ENABLE_WARNINGS #include <boost/test/unit_test.hpp> + +using std::make_shared; + + /** Test dcp::SMPTELoadFontNode */ BOOST_AUTO_TEST_CASE (smpte_load_font_test1) { xmlpp::Document doc; - xmlpp::Element* text = doc.create_root_node("Font"); + auto text = doc.create_root_node("Font"); text->set_attribute ("ID", "my-great-id"); text->add_child_text ("urn:uuid:my-great-urn"); - dcp::SMPTELoadFontNode lf (cxml::ConstNodePtr (new cxml::Node (text))); + dcp::SMPTELoadFontNode lf (make_shared<cxml::Node>(text)); BOOST_CHECK_EQUAL (lf.id, "my-great-id"); BOOST_CHECK_EQUAL (lf.urn, "my-great-urn"); diff --git a/test/test.cc b/test/test.cc index d46c657b..3cb40aaf 100644 --- a/test/test.cc +++ b/test/test.cc @@ -58,10 +58,15 @@ #include "sound_asset_writer.h" #include "test.h" #include "util.h" +#include "warnings.h" +LIBDCP_DISABLE_WARNINGS #include <asdcp/KM_util.h> #include <asdcp/KM_prng.h> +LIBDCP_ENABLE_WARNINGS #include <sndfile.h> +LIBDCP_DISABLE_WARNINGS #include <libxml++/libxml++.h> +LIBDCP_ENABLE_WARNINGS #include <boost/test/unit_test.hpp> #include <cstdio> #include <iostream> |
