summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2014-01-23 00:22:20 +0000
committerCarl Hetherington <cth@carlh.net>2014-01-23 00:22:20 +0000
commitb299c1873bf23414061d551843275c77a9256a05 (patch)
tree3e17f87bf23c11db74c2939018cd5553255f940b /test
parent015fe447cfe25babc55cf8ed282bb909e4713aa0 (diff)
parent797c7543dc7fe5a9f9ddaf4c2035f9b9a7188758 (diff)
Merge master.
Diffstat (limited to 'test')
-rw-r--r--test/recover_test.cc71
-rw-r--r--test/test.cc2
-rw-r--r--test/test.h1
-rw-r--r--test/wscript1
4 files changed, 74 insertions, 1 deletions
diff --git a/test/recover_test.cc b/test/recover_test.cc
new file mode 100644
index 000000000..d8caf17fa
--- /dev/null
+++ b/test/recover_test.cc
@@ -0,0 +1,71 @@
+/*
+ Copyright (C) 2014 Carl Hetherington <cth@carlh.net>
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+#include <boost/test/unit_test.hpp>
+#include <libdcp/stereo_picture_asset.h>
+#include "lib/film.h"
+#include "lib/dcp_content_type.h"
+#include "lib/image_content.h"
+#include "lib/ratio.h"
+#include "test.h"
+
+using std::cout;
+using std::string;
+using boost::shared_ptr;
+
+static void
+note (libdcp::NoteType, string n)
+{
+ cout << n << "\n";
+}
+
+/** Test recovery of a DCP transcode after a crash */
+BOOST_AUTO_TEST_CASE (recover_test)
+{
+ shared_ptr<Film> film = new_test_film ("recover_test");
+ film->set_dcp_content_type (DCPContentType::from_dci_name ("FTR"));
+ film->set_container (Ratio::from_id ("185"));
+ film->set_name ("recover_test");
+ film->set_three_d (true);
+
+ shared_ptr<ImageContent> content (new ImageContent (film, "test/data/3d_test"));
+ content->set_video_frame_type (VIDEO_FRAME_TYPE_3D_LEFT_RIGHT);
+ film->examine_and_add_content (content);
+ wait_for_jobs ();
+
+ film->make_dcp ();
+ wait_for_jobs ();
+
+ boost::filesystem::copy_file (
+ "build/test/recover_test/video/185_2K_58a090f8d70a2b410c534120d35e5256_24_bicubic_200000000_P_S_3D.mxf",
+ "build/test/recover_test/original.mxf"
+ );
+
+ boost::filesystem::resize_file ("build/test/recover_test/video/185_2K_58a090f8d70a2b410c534120d35e5256_24_bicubic_200000000_P_S_3D.mxf", 2 * 1024 * 1024);
+
+ film->make_dcp ();
+ wait_for_jobs ();
+
+ shared_ptr<libdcp::StereoPictureAsset> A (new libdcp::StereoPictureAsset ("build/test/recover_test", "original.mxf"));
+ shared_ptr<libdcp::StereoPictureAsset> B (new libdcp::StereoPictureAsset ("build/test/recover_test/video", "185_2K_58a090f8d70a2b410c534120d35e5256_24_bicubic_200000000_P_S_3D.mxf"));
+
+ libdcp::EqualityOptions eq;
+ eq.mxf_names_can_differ = true;
+ BOOST_CHECK (A->equals (B, eq, boost::bind (&note, _1, _2)));
+}
diff --git a/test/test.cc b/test/test.cc
index f9d761da3..e43db71ef 100644
--- a/test/test.cc
+++ b/test/test.cc
@@ -104,7 +104,7 @@ check_file (boost::filesystem::path ref, boost::filesystem::path check)
BOOST_CHECK_EQUAL (N, boost::filesystem::file_size (check));
FILE* ref_file = fopen (ref.c_str(), "rb");
BOOST_CHECK (ref_file);
- FILE* check_file = fopen (check.c_str(), "rb");
+ FILE* check_file = fopen_boost (check, "rb");
BOOST_CHECK (check_file);
int const buffer_size = 65536;
diff --git a/test/test.h b/test/test.h
index b6347a5ca..a42b41577 100644
--- a/test/test.h
+++ b/test/test.h
@@ -27,5 +27,6 @@ extern boost::shared_ptr<Film> new_test_film (std::string);
extern void check_dcp (boost::filesystem::path, boost::filesystem::path);
extern void check_file (boost::filesystem::path ref, boost::filesystem::path check);
extern void check_xml (boost::filesystem::path, boost::filesystem::path, std::list<std::string>);
+extern void check_file (boost::filesystem::path, boost::filesystem::path);
extern boost::filesystem::path test_film_dir (std::string);
extern void write_image (boost::shared_ptr<const Image> image, boost::filesystem::path file);
diff --git a/test/wscript b/test/wscript
index de9e9f25a..24daa7762 100644
--- a/test/wscript
+++ b/test/wscript
@@ -38,6 +38,7 @@ def build(bld):
play_test.cc
ratio_test.cc
repeat_frame_test.cc
+ recover_test.cc
resampler_test.cc
scaling_test.cc
seek_zero_test.cc