summaryrefslogtreecommitdiff
path: root/test/dcp_font_test.cc
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2021-01-21 01:57:06 +0100
committerCarl Hetherington <cth@carlh.net>2021-01-21 01:57:06 +0100
commit76e3325a16cdf6d7220a61e2b5cfdb9c804cc32c (patch)
tree8c1b5e5dc2cec265469a0d8018b6d7396b089432 /test/dcp_font_test.cc
parent6c3db78c3d20ef064fa2a0ef38e65ca1ae69adb3 (diff)
Use enum class for the things in types.h
Diffstat (limited to 'test/dcp_font_test.cc')
-rw-r--r--test/dcp_font_test.cc33
1 files changed, 17 insertions, 16 deletions
diff --git a/test/dcp_font_test.cc b/test/dcp_font_test.cc
index 1a78bfd2..da9d3000 100644
--- a/test/dcp_font_test.cc
+++ b/test/dcp_font_test.cc
@@ -46,6 +46,7 @@ using std::list;
using std::string;
using std::shared_ptr;
using std::dynamic_pointer_cast;
+using std::make_shared;
using boost::shared_array;
/** Create a DCP with interop subtitles and check that the font is written and read back correctly */
@@ -59,25 +60,25 @@ BOOST_AUTO_TEST_CASE (interop_dcp_font_test)
subs->write (directory / "frobozz.xml");
check_file ("test/data/dummy.ttf", "build/test/interop_dcp_font_test/font_0.ttf");
- shared_ptr<dcp::Reel> reel (new dcp::Reel ());
- reel->add (shared_ptr<dcp::ReelAsset> (new dcp::ReelSubtitleAsset (subs, dcp::Fraction (24, 1), 24, 0)));
+ auto reel = make_shared<dcp::Reel>();
+ reel->add (make_shared<dcp::ReelSubtitleAsset>(subs, dcp::Fraction (24, 1), 24, 0));
- shared_ptr<dcp::CPL> cpl (new dcp::CPL ("", dcp::TRAILER));
+ auto cpl = make_shared<dcp::CPL>("", dcp::ContentKind::TRAILER);
cpl->add (reel);
dcp.add (cpl);
- dcp.write_xml (dcp::INTEROP);
+ dcp.write_xml (dcp::Standard::INTEROP);
dcp::DCP dcp2 (directory);
dcp2.read ();
- shared_ptr<dcp::SubtitleAsset> subs2 = dynamic_pointer_cast<dcp::SubtitleAsset> (
- dcp2.cpls().front()->reels().front()->main_subtitle()->asset_ref().asset()
+ auto subs2 = dynamic_pointer_cast<dcp::SubtitleAsset> (
+ dcp2.cpls()[0]->reels()[0]->main_subtitle()->asset_ref().asset()
);
BOOST_REQUIRE (subs2);
BOOST_REQUIRE_EQUAL (subs2->_fonts.size(), 1);
- boost::uintmax_t const size = boost::filesystem::file_size ("test/data/dummy.ttf");
- FILE* f = dcp::fopen_boost ("test/data/dummy.ttf", "rb");
+ auto const size = boost::filesystem::file_size ("test/data/dummy.ttf");
+ auto f = dcp::fopen_boost ("test/data/dummy.ttf", "rb");
BOOST_REQUIRE (f);
shared_array<uint8_t> ref (new uint8_t[size]);
fread (ref.get(), 1, size, f);
@@ -92,29 +93,29 @@ BOOST_AUTO_TEST_CASE (smpte_dcp_font_test)
boost::filesystem::path directory = "build/test/smpte_dcp_font_test";
dcp::DCP dcp (directory);
- shared_ptr<dcp::SMPTESubtitleAsset> subs (new dcp::SMPTESubtitleAsset ());
+ auto subs = make_shared<dcp::SMPTESubtitleAsset>();
subs->add_font ("theFontId", dcp::ArrayData("test/data/dummy.ttf"));
subs->write (directory / "frobozz.mxf");
- shared_ptr<dcp::Reel> reel (new dcp::Reel ());
- reel->add (shared_ptr<dcp::ReelAsset> (new dcp::ReelSubtitleAsset (subs, dcp::Fraction (24, 1), 24, 0)));
+ auto reel = make_shared<dcp::Reel>();
+ reel->add (make_shared<dcp::ReelSubtitleAsset>(subs, dcp::Fraction (24, 1), 24, 0));
- shared_ptr<dcp::CPL> cpl (new dcp::CPL ("", dcp::TRAILER));
+ auto cpl = make_shared<dcp::CPL>("", dcp::ContentKind::TRAILER);
cpl->add (reel);
dcp.add (cpl);
- dcp.write_xml (dcp::SMPTE);
+ dcp.write_xml (dcp::Standard::SMPTE);
dcp::DCP dcp2 (directory);
dcp2.read ();
- shared_ptr<dcp::SubtitleAsset> subs2 = dynamic_pointer_cast<dcp::SubtitleAsset> (
+ auto subs2 = dynamic_pointer_cast<dcp::SubtitleAsset> (
dcp2.cpls().front()->reels().front()->main_subtitle()->asset_ref().asset()
);
BOOST_REQUIRE (subs2);
BOOST_REQUIRE_EQUAL (subs2->_fonts.size(), 1);
- boost::uintmax_t const size = boost::filesystem::file_size ("test/data/dummy.ttf");
- FILE* f = dcp::fopen_boost ("test/data/dummy.ttf", "rb");
+ auto const size = boost::filesystem::file_size ("test/data/dummy.ttf");
+ auto f = dcp::fopen_boost ("test/data/dummy.ttf", "rb");
BOOST_REQUIRE (f);
shared_array<uint8_t> ref (new uint8_t[size]);
fread (ref.get(), 1, size, f);