summaryrefslogtreecommitdiff
path: root/test/verify_test.cc
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2022-04-12 22:34:04 +0200
committerCarl Hetherington <cth@carlh.net>2022-04-20 20:04:21 +0200
commit05bfa3d1fe9e274ed195647c6f74cb272f00c23d (patch)
tree1372760463b288ff4e10ef7fb6e7414e202829f5 /test/verify_test.cc
parent0338e7a7c19617f9ebb64ee02fbf3cceab8cf03f (diff)
Add and use new File class.master
It was always a bit troubling that fopen_boost wasn't exception safe, and this also fixes a leak where load_ratings_list would never close the ratings file.
Diffstat (limited to 'test/verify_test.cc')
-rw-r--r--test/verify_test.cc26
1 files changed, 14 insertions, 12 deletions
diff --git a/test/verify_test.cc b/test/verify_test.cc
index 4b4aeea7..23b96c32 100644
--- a/test/verify_test.cc
+++ b/test/verify_test.cc
@@ -31,9 +31,11 @@
files in the program, then also delete it here.
*/
+
#include "compose.hpp"
#include "cpl.h"
#include "dcp.h"
+#include "file.h"
#include "interop_subtitle_asset.h"
#include "j2k_transcode.h"
#include "mono_picture_asset.h"
@@ -63,14 +65,14 @@
using std::list;
+using std::make_pair;
+using std::make_shared;
using std::pair;
+using std::shared_ptr;
using std::string;
using std::vector;
-using std::make_pair;
-using std::make_shared;
using boost::optional;
using namespace boost::filesystem;
-using std::shared_ptr;
static list<pair<string, optional<path>>> stages;
@@ -1392,10 +1394,10 @@ BOOST_AUTO_TEST_CASE (verify_missing_subtitle_language)
"</SubtitleList>"
"</SubtitleReel>";
- auto xml_file = dcp::fopen_boost (dir / "subs.xml", "w");
+ dcp::File xml_file(dir / "subs.xml", "w");
BOOST_REQUIRE (xml_file);
- fwrite (xml.c_str(), xml.size(), 1, xml_file);
- fclose (xml_file);
+ xml_file.write(xml.c_str(), xml.size(), 1);
+ xml_file.close();
auto subs = make_shared<dcp::SMPTESubtitleAsset>(dir / "subs.xml");
subs->write (dir / "subs.mxf");
@@ -1527,10 +1529,10 @@ BOOST_AUTO_TEST_CASE (verify_missing_subtitle_start_time)
"</SubtitleList>"
"</SubtitleReel>";
- auto xml_file = dcp::fopen_boost (dir / "subs.xml", "w");
+ dcp::File xml_file(dir / "subs.xml", "w");
BOOST_REQUIRE (xml_file);
- fwrite (xml.c_str(), xml.size(), 1, xml_file);
- fclose (xml_file);
+ xml_file.write(xml.c_str(), xml.size(), 1);
+ xml_file.close();
auto subs = make_shared<dcp::SMPTESubtitleAsset>(dir / "subs.xml");
subs->write (dir / "subs.mxf");
@@ -1580,10 +1582,10 @@ BOOST_AUTO_TEST_CASE (verify_invalid_subtitle_start_time)
"</SubtitleList>"
"</SubtitleReel>";
- auto xml_file = dcp::fopen_boost (dir / "subs.xml", "w");
+ dcp::File xml_file(dir / "subs.xml", "w");
BOOST_REQUIRE (xml_file);
- fwrite (xml.c_str(), xml.size(), 1, xml_file);
- fclose (xml_file);
+ xml_file.write(xml.c_str(), xml.size(), 1);
+ xml_file.close();
auto subs = make_shared<dcp::SMPTESubtitleAsset>(dir / "subs.xml");
subs->write (dir / "subs.mxf");