summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2026-04-08 23:41:34 +0200
committerCarl Hetherington <cth@carlh.net>2026-04-08 23:41:34 +0200
commitf06ad30918394cf1fdd614b2c8403752841adc51 (patch)
treed7d1cf6ff1c6f3f98b19affe361dde18f7636831 /test
parentd5ec98da90b81a57cc4c885facf320c2c9b3eb5b (diff)
Fix incorrect fade outs (#3145).
Diffstat (limited to 'test')
-rw-r--r--test/image_content_fade_test.cc34
1 files changed, 34 insertions, 0 deletions
diff --git a/test/image_content_fade_test.cc b/test/image_content_fade_test.cc
index 4586edb5d..b033050e5 100644
--- a/test/image_content_fade_test.cc
+++ b/test/image_content_fade_test.cc
@@ -24,9 +24,17 @@
#include "lib/film.h"
#include "lib/video_content.h"
#include "test.h"
+#include <dcp/cpl.h>
+#include <dcp/dcp.h>
+#include <dcp/mono_j2k_picture_asset.h>
+#include <dcp/mono_j2k_picture_asset_reader.h>
+#include <dcp/openjpeg_image.h>
+#include <dcp/reel.h>
+#include <dcp/reel_picture_asset.h>
#include <boost/test/unit_test.hpp>
+using std::dynamic_pointer_cast;
using std::string;
using std::list;
@@ -47,3 +55,29 @@ BOOST_AUTO_TEST_CASE(image_content_fade_in_test)
*/
check_dcp("test/data/image_content_fade_in_test", film->dir(film->dcp_name()), true);
}
+
+
+BOOST_AUTO_TEST_CASE(image_content_fade_out_test)
+{
+ auto content = content_factory("test/data/flat_red.png")[0];
+ auto film = new_test_film("image_content_fade_out_test", {content});
+ content->video->set_fade_out(12);
+ make_and_verify_dcp(film);
+
+ dcp::DCP dcp(film->dir(film->dcp_name()));
+ dcp.read();
+ auto picture = dynamic_pointer_cast<dcp::MonoJ2KPictureAsset>(dcp.cpls()[0]->reels()[0]->main_picture()->asset());
+ auto reader = picture->start_read();
+ auto frame = reader->get_frame(239)->xyz_image();
+
+ auto const width = frame->size().width;
+ auto const height = frame->size().height;
+
+ for (int y = 0; y < height; ++y) {
+ for (int x = 0; x < width; ++x) {
+ for (int c = 0; c < 2; ++c) {
+ BOOST_REQUIRE(frame->data(c)[y * width + x] <= 4);
+ }
+ }
+ }
+}