diff options
Diffstat (limited to 'test')
| -rw-r--r-- | test/dcp_examiner_test.cc | 52 | ||||
| -rw-r--r-- | test/video_content_scale_test.cc | 50 | ||||
| -rw-r--r-- | test/wscript | 1 |
3 files changed, 78 insertions, 25 deletions
diff --git a/test/dcp_examiner_test.cc b/test/dcp_examiner_test.cc new file mode 100644 index 000000000..7275a33c7 --- /dev/null +++ b/test/dcp_examiner_test.cc @@ -0,0 +1,52 @@ +/* + Copyright (C) 2024 Carl Hetherington <cth@carlh.net> + + This file is part of DCP-o-matic. + + DCP-o-matic is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + DCP-o-matic is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with DCP-o-matic. If not, see <http://www.gnu.org/licenses/>. + +*/ + + +#include "lib/content_factory.h" +#include "lib/dcp_content.h" +#include "lib/dcp_examiner.h" +#include "lib/film.h" +#include "lib/ratio.h" +#include "test.h" +#include <boost/test/unit_test.hpp> + + +using std::make_shared; + + +BOOST_AUTO_TEST_CASE(check_examine_vfs) +{ + auto image = content_factory("test/data/scope_red.png")[0]; + auto ov = new_test_film2("check_examine_vfs_ov", { image }); + ov->set_container(Ratio::from_id("239")); + make_and_verify_dcp(ov); + + auto ov_dcp = make_shared<DCPContent>(ov->dir(ov->dcp_name())); + auto second_reel = content_factory("test/data/scope_red.png")[0]; + auto vf = new_test_film2("check_examine_vfs_vf", { ov_dcp, second_reel }); + vf->set_container(Ratio::from_id("239")); + vf->set_reel_type(ReelType::BY_VIDEO_CONTENT); + ov_dcp->set_reference_video(true); + make_and_verify_dcp(vf, { dcp::VerificationNote::Code::EXTERNAL_ASSET }, false); + + auto vf_dcp = make_shared<DCPContent>(vf->dir(vf->dcp_name())); + DCPExaminer examiner(vf_dcp, false); +} + diff --git a/test/video_content_scale_test.cc b/test/video_content_scale_test.cc index 73feb7dc6..c82392f81 100644 --- a/test/video_content_scale_test.cc +++ b/test/video_content_scale_test.cc @@ -38,37 +38,37 @@ BOOST_AUTO_TEST_CASE (scaled_size_test1) /* Images at full size and in DCP-approved sizes that will not be scaled */ // Flat/scope content into flat/scope container vc._size = FLAT; - BOOST_CHECK_EQUAL (vc.scaled_size(FLAT), FLAT); + BOOST_CHECK_EQUAL(*vc.scaled_size(FLAT), FLAT); vc._size = SCOPE; - BOOST_CHECK_EQUAL (vc.scaled_size(SCOPE), SCOPE); + BOOST_CHECK_EQUAL(*vc.scaled_size(SCOPE), SCOPE); // 1.33:1 into flat container vc._size = FOUR_TO_THREE; - BOOST_CHECK_EQUAL (vc.scaled_size(FLAT), dcp::Size(FOUR_TO_THREE)); + BOOST_CHECK_EQUAL(*vc.scaled_size(FLAT), dcp::Size(FOUR_TO_THREE)); // Scope into flat container vc._size = SCOPE; - BOOST_CHECK_EQUAL (vc.scaled_size(FLAT), dcp::Size(1998, 837)); + BOOST_CHECK_EQUAL(*vc.scaled_size(FLAT), dcp::Size(1998, 837)); /* Smaller images but in the same ratios */ vc._size = dcp::Size(185, 100); - BOOST_CHECK_EQUAL (vc.scaled_size(FLAT), FLAT); + BOOST_CHECK_EQUAL(*vc.scaled_size(FLAT), FLAT); vc._size = dcp::Size(955, 400); - BOOST_CHECK_EQUAL (vc.scaled_size(SCOPE), SCOPE); + BOOST_CHECK_EQUAL(*vc.scaled_size(SCOPE), SCOPE); // 1.33:1 into flat container vc._size = dcp::Size(133, 100); - BOOST_CHECK_EQUAL (vc.scaled_size(FLAT), dcp::Size(FOUR_TO_THREE)); + BOOST_CHECK_EQUAL(*vc.scaled_size(FLAT), dcp::Size(FOUR_TO_THREE)); // Scope into flat container vc._size = dcp::Size(239, 100); - BOOST_CHECK_EQUAL (vc.scaled_size(FLAT), dcp::Size(1998, 836)); + BOOST_CHECK_EQUAL(*vc.scaled_size(FLAT), dcp::Size(1998, 836)); /* Images at full size that are not DCP-approved but will still remain unscaled */ vc._size = dcp::Size(600, 1080); - BOOST_CHECK_EQUAL (vc.scaled_size(FLAT), dcp::Size(600, 1080)); + BOOST_CHECK_EQUAL(*vc.scaled_size(FLAT), dcp::Size(600, 1080)); vc._size = dcp::Size(1700, 1080); - BOOST_CHECK_EQUAL (vc.scaled_size(FLAT), dcp::Size(1700, 1080)); + BOOST_CHECK_EQUAL(*vc.scaled_size(FLAT), dcp::Size(1700, 1080)); /* Image at full size that is too big for the container and will be shrunk */ vc._size = dcp::Size(3000, 1080); - BOOST_CHECK_EQUAL (vc.scaled_size(FLAT), dcp::Size(1998, 719)); + BOOST_CHECK_EQUAL(*vc.scaled_size(FLAT), dcp::Size(1998, 719)); } @@ -82,37 +82,37 @@ BOOST_AUTO_TEST_CASE (scaled_size_test2) /* Images at full size and in DCP-approved sizes that will not be scaled */ // Flat/scope content into flat/scope container vc._size = dcp::Size (1998 / 2, 1080); - BOOST_CHECK_EQUAL (vc.scaled_size(FLAT), FLAT); + BOOST_CHECK_EQUAL(*vc.scaled_size(FLAT), FLAT); vc._size = dcp::Size (2048 / 2, 858); - BOOST_CHECK_EQUAL (vc.scaled_size(SCOPE), SCOPE); + BOOST_CHECK_EQUAL(*vc.scaled_size(SCOPE), SCOPE); // 1.33:1 into flat container vc._size = dcp::Size (1436 / 2, 1080); - BOOST_CHECK_EQUAL (vc.scaled_size(FLAT), dcp::Size(FOUR_TO_THREE)); + BOOST_CHECK_EQUAL(*vc.scaled_size(FLAT), dcp::Size(FOUR_TO_THREE)); // Scope into flat container vc._size = dcp::Size (2048 / 2, 858); - BOOST_CHECK_EQUAL (vc.scaled_size(FLAT), dcp::Size(1998, 837)); + BOOST_CHECK_EQUAL(*vc.scaled_size(FLAT), dcp::Size(1998, 837)); /* Smaller images but in the same ratios */ vc._size = dcp::Size(185, 200); - BOOST_CHECK_EQUAL (vc.scaled_size(FLAT), FLAT); + BOOST_CHECK_EQUAL(*vc.scaled_size(FLAT), FLAT); vc._size = dcp::Size(955, 800); - BOOST_CHECK_EQUAL (vc.scaled_size(SCOPE), SCOPE); + BOOST_CHECK_EQUAL(*vc.scaled_size(SCOPE), SCOPE); // 4:3 into flat container vc._size = dcp::Size(133, 200); - BOOST_CHECK_EQUAL (vc.scaled_size(FLAT), dcp::Size(FOUR_TO_THREE)); + BOOST_CHECK_EQUAL(*vc.scaled_size(FLAT), dcp::Size(FOUR_TO_THREE)); // Scope into flat container vc._size = dcp::Size(239, 200); - BOOST_CHECK_EQUAL (vc.scaled_size(FLAT), dcp::Size(1998, 836)); + BOOST_CHECK_EQUAL(*vc.scaled_size(FLAT), dcp::Size(1998, 836)); /* Images at full size that are not DCP-approved but will still remain unscaled */ vc._size = dcp::Size(600 / 2, 1080); - BOOST_CHECK_EQUAL (vc.scaled_size(FLAT), dcp::Size(600, 1080)); + BOOST_CHECK_EQUAL(*vc.scaled_size(FLAT), dcp::Size(600, 1080)); vc._size = dcp::Size(1700 / 2, 1080); - BOOST_CHECK_EQUAL (vc.scaled_size(FLAT), dcp::Size(1700, 1080)); + BOOST_CHECK_EQUAL(*vc.scaled_size(FLAT), dcp::Size(1700, 1080)); /* Image at full size that is too big for the container and will be shrunk */ vc._size = dcp::Size(3000 / 2, 1080); - BOOST_CHECK_EQUAL (vc.scaled_size(FLAT), dcp::Size(1998, 719)); + BOOST_CHECK_EQUAL(*vc.scaled_size(FLAT), dcp::Size(1998, 719)); } @@ -124,7 +124,7 @@ BOOST_AUTO_TEST_CASE (scaled_size_legacy_test) VideoContent vc (0); vc._size = dcp::Size(640, 480); vc._legacy_ratio = Ratio::from_id("185")->ratio(); - BOOST_CHECK_EQUAL (vc.scaled_size(FLAT), FLAT); + BOOST_CHECK_EQUAL(*vc.scaled_size(FLAT), FLAT); } { @@ -132,7 +132,7 @@ BOOST_AUTO_TEST_CASE (scaled_size_legacy_test) VideoContent vc (0); vc._size = dcp::Size(640, 480); vc._legacy_ratio = 1.33; - BOOST_CHECK_EQUAL (vc.scaled_size(FLAT), FOUR_TO_THREE); + BOOST_CHECK_EQUAL(*vc.scaled_size(FLAT), FOUR_TO_THREE); } { @@ -140,7 +140,7 @@ BOOST_AUTO_TEST_CASE (scaled_size_legacy_test) VideoContent vc (0); vc._size = dcp::Size(640, 480); vc._custom_size = dcp::Size(640, 480); - BOOST_CHECK_EQUAL (vc.scaled_size(FLAT), dcp::Size(640, 480)); + BOOST_CHECK_EQUAL(*vc.scaled_size(FLAT), dcp::Size(640, 480)); } } diff --git a/test/wscript b/test/wscript index ab10fe838..400d8ea74 100644 --- a/test/wscript +++ b/test/wscript @@ -73,6 +73,7 @@ def build(bld): dcpomatic_time_test.cc dcp_decoder_test.cc dcp_digest_file_test.cc + dcp_examiner_test.cc dcp_metadata_test.cc dcp_playback_test.cc dcp_subtitle_test.cc |
