Fix some incorrect alpha blending; may help with #1155.
[dcpomatic.git] / test / test.cc
index 0c2f324e05de99126375bba104bd508cb23091d9..edeb89925dd7d2bbe599b26d4c34873dfa9d92d3 100644 (file)
@@ -236,11 +236,15 @@ check_image (boost::filesystem::path ref, boost::filesystem::path check)
        ref_image.read (ref.string ());
        Magick::Image check_image;
        check_image.read (check.string ());
-       BOOST_CHECK_MESSAGE (
-               !ref_image.compare(check_image),
-               ref << " differs from " << check << " "
-                   << ref_image.meanErrorPerPixel() << " " << ref_image.normalizedMaxError() << " " << ref_image.normalizedMeanError()
-               );
+       /* XXX: this is a hack; we really want the ImageMagick call but GraphicsMagick doesn't have it;
+          this may cause random test failures on platforms that use GraphicsMagick.
+       */
+#ifdef DCPOMATIC_ADVANCED_MAGICK_COMPARE
+       double const dist = ref_image.compare(check_image, Magick::RootMeanSquaredErrorMetric);
+       BOOST_CHECK_MESSAGE (dist < 0.001, ref << " differs from " << check << " " << dist);
+#else
+       BOOST_CHECK_MESSAGE (!ref_image.compare(check_image), ref << " differs from " << check);
+#endif
 }
 
 void