summaryrefslogtreecommitdiff
path: root/test/dcp_font_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/dcp_font_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/dcp_font_test.cc')
-rw-r--r--test/dcp_font_test.cc23
1 files changed, 12 insertions, 11 deletions
diff --git a/test/dcp_font_test.cc b/test/dcp_font_test.cc
index 047e0266..361f5011 100644
--- a/test/dcp_font_test.cc
+++ b/test/dcp_font_test.cc
@@ -32,15 +32,16 @@
*/
-#include "interop_subtitle_asset.h"
-#include "smpte_subtitle_asset.h"
-#include "dcp.h"
#include "cpl.h"
-#include "test.h"
+#include "dcp.h"
+#include "file.h"
+#include "interop_subtitle_asset.h"
#include "reel.h"
-#include "util.h"
#include "reel_interop_subtitle_asset.h"
#include "reel_smpte_subtitle_asset.h"
+#include "smpte_subtitle_asset.h"
+#include "test.h"
+#include "util.h"
#include <boost/test/unit_test.hpp>
#include <cstdio>
@@ -81,11 +82,11 @@ BOOST_AUTO_TEST_CASE (interop_dcp_font_test)
BOOST_REQUIRE_EQUAL (subs2->_fonts.size(), 1);
auto const size = boost::filesystem::file_size ("test/data/dummy.ttf");
- auto f = dcp::fopen_boost ("test/data/dummy.ttf", "rb");
+ dcp::File f("test/data/dummy.ttf", "rb");
BOOST_REQUIRE (f);
shared_array<uint8_t> ref (new uint8_t[size]);
- fread (ref.get(), 1, size, f);
- fclose (f);
+ f.read(ref.get(), 1, size);
+ f.close();
BOOST_CHECK_EQUAL (memcmp (subs2->_fonts.front().data.data(), ref.get(), size), 0);
}
@@ -118,11 +119,11 @@ BOOST_AUTO_TEST_CASE (smpte_dcp_font_test)
BOOST_REQUIRE_EQUAL (subs2->_fonts.size(), 1);
auto const size = boost::filesystem::file_size ("test/data/dummy.ttf");
- auto f = dcp::fopen_boost ("test/data/dummy.ttf", "rb");
+ dcp::File f("test/data/dummy.ttf", "rb");
BOOST_REQUIRE (f);
shared_array<uint8_t> ref (new uint8_t[size]);
- fread (ref.get(), 1, size, f);
- fclose (f);
+ f.read(ref.get(), 1, size);
+ f.close();
BOOST_REQUIRE (subs2->_fonts.front().data.data());
BOOST_CHECK_EQUAL (memcmp (subs2->_fonts.front().data.data(), ref.get(), size), 0);