Switch to testing on Ubuntu 16.04 and 22.04.
[libdcp.git] / test / reel_asset_test.cc
index bf609c2c059669e2ef96c6d9f17eb7449e9c0812..9dd2f8c3fa10fce4cb59f66f4263ef707e186384 100644 (file)
@@ -1,5 +1,5 @@
 /*
-    Copyright (C) 2015-2020 Carl Hetherington <cth@carlh.net>
+    Copyright (C) 2015-2021 Carl Hetherington <cth@carlh.net>
 
     This file is part of libdcp.
 
     files in the program, then also delete it here.
 */
 
+
 #include "reel_mono_picture_asset.h"
-#include "reel_subtitle_asset.h"
+#include "reel_smpte_subtitle_asset.h"
 #include <libcxml/cxml.h>
 #include <boost/test/unit_test.hpp>
+#include "stream_operators.h"
 #include "test.h"
 
 
+using std::make_shared;
 using std::string;
-using boost::optional;
 using std::shared_ptr;
+using boost::optional;
 
 
 /** Test the XML constructor of ReelPictureAsset */
 BOOST_AUTO_TEST_CASE (reel_picture_asset_test)
 {
-       shared_ptr<cxml::Document> doc (new cxml::Document ("MainPicture"));
+       auto doc = make_shared<cxml::Document>("MainPicture");
 
        doc->read_string (
                "<MainPicture>"
@@ -64,7 +67,7 @@ BOOST_AUTO_TEST_CASE (reel_picture_asset_test)
 
        dcp::ReelMonoPictureAsset pa (doc);
        BOOST_CHECK_EQUAL (pa.id(), "06ac1ca7-9c46-4107-8864-a6448e24b04b");
-       BOOST_CHECK_EQUAL (pa.annotation_text(), "Hello world!");
+       BOOST_CHECK_EQUAL (pa.annotation_text().get_value_or(""), "Hello world!");
        BOOST_CHECK_EQUAL (pa.edit_rate(), dcp::Fraction(24, 1));
        BOOST_CHECK_EQUAL (pa.intrinsic_duration(), 187048);
        BOOST_CHECK_EQUAL (pa.entry_point().get(), 42L);
@@ -75,10 +78,10 @@ BOOST_AUTO_TEST_CASE (reel_picture_asset_test)
 }
 
 
-/** Test the XML constructor of ReelSubtitleAsset */
-BOOST_AUTO_TEST_CASE (reel_subtitle_asset_test)
+/** Test the XML constructor of ReelSMPTESubtitleAsset */
+BOOST_AUTO_TEST_CASE (reel_smpte_subtitle_asset_test)
 {
-       shared_ptr<cxml::Document> doc (new cxml::Document("MainSubtitle"));
+       auto doc = make_shared<cxml::Document>("MainSubtitle");
 
        doc->read_string (
                "<MainSubtitle>"
@@ -94,9 +97,9 @@ BOOST_AUTO_TEST_CASE (reel_subtitle_asset_test)
                "</MainSubtitle>"
                );
 
-       dcp::ReelSubtitleAsset ps (doc);
+       dcp::ReelSMPTESubtitleAsset ps (doc);
        BOOST_CHECK_EQUAL (ps.id(), "8bca1489-aab1-9259-a4fd-8150abc1de12");
-       BOOST_CHECK_EQUAL (ps.annotation_text(), "Goodbye world!");
+       BOOST_CHECK_EQUAL (ps.annotation_text().get_value_or(""), "Goodbye world!");
        BOOST_CHECK_EQUAL (ps.edit_rate(), dcp::Fraction(25, 1));
        BOOST_CHECK_EQUAL (ps.intrinsic_duration(), 1870);
        BOOST_CHECK_EQUAL (ps.entry_point().get(), 0L);