summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/remake_with_subtitle_test.cc4
-rw-r--r--test/test.cc18
-rw-r--r--test/test.h2
3 files changed, 15 insertions, 9 deletions
diff --git a/test/remake_with_subtitle_test.cc b/test/remake_with_subtitle_test.cc
index 0528f8e75..b8b7a0f04 100644
--- a/test/remake_with_subtitle_test.cc
+++ b/test/remake_with_subtitle_test.cc
@@ -50,8 +50,8 @@ BOOST_AUTO_TEST_CASE (remake_with_subtitle_test)
make_and_verify_dcp (film);
#ifdef DCPOMATIC_OSX
- check_one_frame(film->dir(film->dcp_name()), 325, TestPaths::private_data() / "v2.18.x" / "prophet_frame_325_no_subs_mac.j2c");
+ check_one_frame_against_j2c(film->dir(film->dcp_name()), 325, TestPaths::private_data() / "v2.18.x" / "prophet_frame_325_no_subs_mac.j2c");
#else
- check_one_frame(film->dir(film->dcp_name()), 325, TestPaths::private_data() / "v2.18.x" / "prophet_frame_325_no_subs.j2c");
+ check_one_frame_against_j2c(film->dir(film->dcp_name()), 325, TestPaths::private_data() / "v2.18.x" / "prophet_frame_325_no_subs.j2c");
#endif
}
diff --git a/test/test.cc b/test/test.cc
index 143b00ca2..fb5f11902 100644
--- a/test/test.cc
+++ b/test/test.cc
@@ -823,8 +823,6 @@ check_ffmpeg (boost::filesystem::path ref, boost::filesystem::path check, int au
BOOST_REQUIRE_EQUAL (WEXITSTATUS(r), 0);
}
-void
-check_one_frame(boost::filesystem::path dcp_dir, int64_t index, boost::filesystem::path ref, int tolerance)
{
dcp::DCP dcp (dcp_dir);
dcp.read ();
@@ -834,18 +832,26 @@ check_one_frame(boost::filesystem::path dcp_dir, int64_t index, boost::filesyste
dcp::MonoJ2KPictureFrame ref_frame(ref);
auto image = frame->xyz_image ();
+void
+check_one_frame_against_j2c(boost::filesystem::path test, int64_t test_index, boost::filesystem::path ref, int tolerance)
+{
+ auto test_image = get_dcp_frame(test, test_index);
+ dcp::MonoJ2KPictureFrame ref_frame(ref);
auto ref_image = ref_frame.xyz_image();
- BOOST_REQUIRE (image->size() == ref_image->size());
+ BOOST_REQUIRE_MESSAGE(
+ test_image->size() == ref_image->size(),
+ "Reference is " << ref_image->size().width << "x" << ref_image->size().height
+ << ", test image is " << test_image->size().width << "x" << test_image->size().height);
int off = 0;
for (int y = 0; y < ref_image->size().height; ++y) {
for (int x = 0; x < ref_image->size().width; ++x) {
- auto x_error = std::abs(ref_image->data(0)[off] - image->data(0)[off]);
+ auto x_error = std::abs(ref_image->data(0)[off] - test_image->data(0)[off]);
BOOST_REQUIRE_MESSAGE(x_error <= tolerance, "x component at " << x << "," << y << " differs by " << x_error);
- auto y_error = std::abs(ref_image->data(1)[off] - image->data(1)[off]);
+ auto y_error = std::abs(ref_image->data(1)[off] - test_image->data(1)[off]);
BOOST_REQUIRE_MESSAGE(y_error <= tolerance, "y component at " << x << "," << y << " differs by " << y_error);
- auto z_error = std::abs(ref_image->data(2)[off] - image->data(2)[off]);
+ auto z_error = std::abs(ref_image->data(2)[off] - test_image->data(2)[off]);
BOOST_REQUIRE_MESSAGE(z_error <= tolerance, "z component at " << x << "," << y << " differs by " << z_error);
++off;
}
diff --git a/test/test.h b/test/test.h
index e26a0a690..2856cc01d 100644
--- a/test/test.h
+++ b/test/test.h
@@ -72,7 +72,7 @@ extern void check_image(boost::filesystem::path ref, boost::filesystem::path che
extern boost::filesystem::path test_film_dir (std::string);
extern void write_image (std::shared_ptr<const Image> image, boost::filesystem::path file);
boost::filesystem::path dcp_file (std::shared_ptr<const Film> film, std::string prefix);
-void check_one_frame (boost::filesystem::path dcp, int64_t index, boost::filesystem::path ref, int tolerance = 0);
+void check_one_frame_against_j2c(boost::filesystem::path test, int64_t test_index, boost::filesystem::path ref, int tolerance = 0);
extern boost::filesystem::path subtitle_file (std::shared_ptr<Film> film);
extern void make_random_file (boost::filesystem::path path, size_t size);
extern void verify_dcp(boost::filesystem::path dir, std::vector<dcp::VerificationNote::Code> ignore);