More test fixes.
authorCarl Hetherington <cth@carlh.net>
Tue, 17 Jul 2018 22:03:45 +0000 (22:03 +0000)
committerCarl Hetherington <cth@carlh.net>
Tue, 17 Jul 2018 22:03:45 +0000 (22:03 +0000)
test/data
test/image_test.cc
test/player_test.cc
test/test.cc
test/test.h

index 1ca4c6914264f433f3e76f193828793c0d27a62c..e5472ceee4b68737cdf10157c6a5d2018c98e66d 160000 (submodule)
--- a/test/data
+++ b/test/data
@@ -1 +1 @@
-Subproject commit 1ca4c6914264f433f3e76f193828793c0d27a62c
+Subproject commit e5472ceee4b68737cdf10157c6a5d2018c98e66d
index 5adc3560330623f8e4f6e44245043a7c7d5a9d24..28afbe84062c3c7a3ae6ab748f995c9b64560c66 100644 (file)
@@ -174,7 +174,7 @@ alpha_blend_test_one (AVPixelFormat format, string suffix)
        shared_ptr<Image> save = background->convert_pixel_format (dcp::YUV_TO_RGB_REC709, AV_PIX_FMT_RGB24, false, false);
 
        write_image (save, "build/test/image_test_" + suffix + ".png", "RGB");
-       check_image ("build/test/image_test_" + suffix + ".png", private_data / ("image_test_" + suffix + ".png"));
+       check_image ("build/test/image_test_" + suffix + ".png", private_data / ("image_test_" + suffix + ".png"), 0.01);
 }
 
 /** Test Image::alpha_blend */
@@ -265,5 +265,5 @@ BOOST_AUTO_TEST_CASE (crop_scale_window_test)
        shared_ptr<Image> out = raw->crop_scale_window(Crop(), dcp::Size(1998, 836), dcp::Size(1998, 1080), dcp::YUV_TO_RGB_REC709, AV_PIX_FMT_YUV420P, true, false);
        shared_ptr<Image> save = out->scale(dcp::Size(1998, 1080), dcp::YUV_TO_RGB_REC709, AV_PIX_FMT_RGB24, false, false);
        write_image(save, "build/test/crop_scale_window_test.png", "RGB");
-       check_image("test/data/crop_scale_window_test.png", "build/test/crop_scale_window_test.png");
+       check_image("test/data/crop_scale_window_test.png", "build/test/crop_scale_window_test.png", 0.01);
 }
index e22570bc0b95b121ccb460cedc83c314c599b6d9..865fbef45b908a0157d3dfa8e543aed797b06fc1 100644 (file)
@@ -227,7 +227,7 @@ 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));
+               check_image(String::compose("test/data/player_seek_test_%1.png", i), String::compose("build/test/player_seek_test_%1.png", i), 0.01);
        }
 }
 
@@ -256,6 +256,7 @@ BOOST_AUTO_TEST_CASE (player_seek_test2)
                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_test2_%1.png", i), "RGB");
-               check_image(String::compose("test/data/player_seek_test2_%1.png", i), String::compose("build/test/player_seek_test2_%1.png", i));
+               /* Differences in font rendering appear here sometimes */
+               check_image(String::compose("test/data/player_seek_test2_%1.png", i), String::compose("build/test/player_seek_test2_%1.png", i), 0.015);
        }
 }
index f829a86f6892b5c441ba130b8e91ad6aedd08a2c..b0bd0bda7e6404026d677590e2fcd85cbd8090e2 100644 (file)
@@ -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 dist_tolerance)
 {
 #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 < dist_tolerance, ref << " differs from " << check << " " << dist);
 #else
        BOOST_CHECK_MESSAGE (!ref_image.compare(check_image), ref << " differs from " << check);
 #endif
index 78fa26b4361497f39f34dab478f2bff6cdfa8042..2f206269299acae14c7b447f0a6951879ead4a56 100644 (file)
@@ -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 dist_tolerance);
 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);