diff options
| author | Carl Hetherington <cth@carlh.net> | 2018-02-28 00:52:42 +0000 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2018-02-28 00:52:42 +0000 |
| commit | 44b97d718fa4b487641a983fa0b6ae485470eef8 (patch) | |
| tree | 131e1149439f30a496c6184e0ac65a076092e8cb | |
| parent | 3c88c626399fff9b95c89065d3b8ee9de1148d52 (diff) | |
Tweak error threshold for an image comparison involving subtitles.
| -rw-r--r-- | test/player_test.cc | 6 | ||||
| -rw-r--r-- | test/test.cc | 4 | ||||
| -rw-r--r-- | test/test.h | 2 |
3 files changed, 8 insertions, 4 deletions
diff --git a/test/player_test.cc b/test/player_test.cc index e22570bc0..585d357df 100644 --- a/test/player_test.cc +++ b/test/player_test.cc @@ -227,7 +227,11 @@ BOOST_AUTO_TEST_CASE (player_seek_test) pair<shared_ptr<PlayerVideo>, DCPTime> video = butler->get_video(); BOOST_CHECK_EQUAL(video.second.get(), t.get()); write_image(video.first->image(note_handler, PlayerVideo::always_rgb, false, true), String::compose("build/test/player_seek_test_%1.png", i), "RGB"); - check_image(String::compose("test/data/player_seek_test_%1.png", i), String::compose("build/test/player_seek_test_%1.png", i)); + /* This 0.011 is empirically chosen (hopefully) to accept changes in rendering between the reference and a test machine + (17.10 and 16.04 seem to anti-alias a little differently) but to reject gross errors e.g. missing fonts or missing + text altogether. + */ + check_image(String::compose("test/data/player_seek_test_%1.png", i), String::compose("build/test/player_seek_test_%1.png", i), 0.011); } } diff --git a/test/test.cc b/test/test.cc index 9e168b1e2..68c1cfccd 100644 --- a/test/test.cc +++ b/test/test.cc @@ -231,7 +231,7 @@ check_mxf_audio_file (boost::filesystem::path ref, boost::filesystem::path check } void -check_image (boost::filesystem::path ref, boost::filesystem::path check) +check_image (boost::filesystem::path ref, boost::filesystem::path check, double threshold) { #ifdef DCPOMATIC_IMAGE_MAGICK using namespace MagickCore; @@ -248,7 +248,7 @@ check_image (boost::filesystem::path ref, boost::filesystem::path check) */ #ifdef DCPOMATIC_ADVANCED_MAGICK_COMPARE double const dist = ref_image.compare(check_image, Magick::RootMeanSquaredErrorMetric); - BOOST_CHECK_MESSAGE (dist < 0.01, ref << " differs from " << check << " " << dist); + BOOST_CHECK_MESSAGE (dist < threshold, ref << " differs from " << check << " " << dist); #else BOOST_CHECK_MESSAGE (!ref_image.compare(check_image), ref << " differs from " << check); #endif diff --git a/test/test.h b/test/test.h index 78fa26b43..5e030f0cc 100644 --- a/test/test.h +++ b/test/test.h @@ -36,7 +36,7 @@ extern void check_mxf_audio_file (boost::filesystem::path ref, boost::filesystem 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 void check_ffmpeg (boost::filesystem::path, boost::filesystem::path, int audio_tolerance); -extern void check_image (boost::filesystem::path, boost::filesystem::path); +extern void check_image (boost::filesystem::path, boost::filesystem::path, double threshold = 0.01); extern boost::filesystem::path test_film_dir (std::string); extern void write_image (boost::shared_ptr<const Image> image, boost::filesystem::path file, std::string format); boost::filesystem::path dcp_file (boost::shared_ptr<const Film> film, std::string prefix); |
