diff options
Diffstat (limited to 'test')
| -rw-r--r-- | test/bv20_test.cc | 3 | ||||
| -rw-r--r-- | test/client_server_test.cc | 36 | ||||
| -rw-r--r-- | test/config_test.cc | 114 | ||||
| -rw-r--r-- | test/content_test.cc | 2 | ||||
| m--------- | test/data | 0 | ||||
| -rw-r--r-- | test/disk_writer_test.cc | 107 | ||||
| -rw-r--r-- | test/ffmpeg_decoder_seek_test.cc | 55 | ||||
| -rw-r--r-- | test/ffmpeg_encoder_test.cc | 4 | ||||
| -rw-r--r-- | test/ffmpeg_examiner_test.cc | 2 | ||||
| -rw-r--r-- | test/film_metadata_test.cc | 2 | ||||
| -rw-r--r-- | test/image_filename_sorter_test.cc | 9 | ||||
| -rw-r--r-- | test/j2k_encode_threading_test.cc | 117 | ||||
| -rw-r--r-- | test/kdm_cli_test.cc | 143 | ||||
| -rw-r--r-- | test/kdm_naming_test.cc | 26 | ||||
| -rw-r--r-- | test/low_bitrate_test.cc | 3 | ||||
| -rw-r--r-- | test/map_cli_test.cc | 1 | ||||
| -rw-r--r-- | test/player_test.cc | 29 | ||||
| -rw-r--r-- | test/reels_test.cc | 36 | ||||
| -rw-r--r-- | test/remake_with_subtitle_test.cc | 6 | ||||
| -rw-r--r-- | test/shuffler_test.cc | 8 | ||||
| -rw-r--r-- | test/stream_test.cc | 36 | ||||
| -rw-r--r-- | test/test.cc | 45 | ||||
| -rw-r--r-- | test/test.h | 3 | ||||
| -rw-r--r-- | test/text_entry_point_test.cc | 70 | ||||
| -rw-r--r-- | test/torture_test.cc | 2 | ||||
| -rw-r--r-- | test/video_level_test.cc | 8 | ||||
| -rw-r--r-- | test/wscript | 2 |
27 files changed, 619 insertions, 250 deletions
diff --git a/test/bv20_test.cc b/test/bv20_test.cc index 5530a05d0..7f4e98aa7 100644 --- a/test/bv20_test.cc +++ b/test/bv20_test.cc @@ -49,7 +49,8 @@ has_mxf_mca_subdescriptors(shared_ptr<const Film> film) * whether they exist. */ - ASDCP::PCM::MXFReader reader; + Kumu::FileReaderFactory factory; + ASDCP::PCM::MXFReader reader(factory); auto r = reader.OpenRead(find_file(film->dir(film->dcp_name()), "pcm_").string()); BOOST_REQUIRE(!ASDCP_FAILURE(r)); diff --git a/test/client_server_test.cc b/test/client_server_test.cc index 596668aae..1bfa4c5a6 100644 --- a/test/client_server_test.cc +++ b/test/client_server_test.cc @@ -20,20 +20,18 @@ /** @file test/client_server_test.cc - * @brief Test the server class. + * @brief Test the remote encoding code. * @ingroup feature - * - * Create a test image and then encode it using the standard mechanism - * and also using a EncodeServer object running on localhost. Compare the resulting - * encoded data to check that they are the same. */ +#include "lib/content_factory.h" #include "lib/cross.h" #include "lib/dcp_video.h" #include "lib/dcpomatic_log.h" #include "lib/encode_server.h" #include "lib/encode_server_description.h" +#include "lib/encode_server_finder.h" #include "lib/file_log.h" #include "lib/image.h" #include "lib/j2k_image_proxy.h" @@ -51,6 +49,7 @@ using std::weak_ptr; using boost::thread; using boost::optional; using dcp::ArrayData; +using namespace dcpomatic; void @@ -105,7 +104,7 @@ BOOST_AUTO_TEST_CASE (client_server_test_rgb) ColourConversion(), VideoRange::FULL, weak_ptr<Content>(), - optional<Frame>(), + optional<ContentTime>(), false ); @@ -184,7 +183,7 @@ BOOST_AUTO_TEST_CASE (client_server_test_yuv) ColourConversion(), VideoRange::FULL, weak_ptr<Content>(), - optional<Frame>(), + optional<ContentTime>(), false ); @@ -250,7 +249,7 @@ BOOST_AUTO_TEST_CASE (client_server_test_j2k) ColourConversion(), VideoRange::FULL, weak_ptr<Content>(), - optional<Frame>(), + optional<ContentTime>(), false ); @@ -275,7 +274,7 @@ BOOST_AUTO_TEST_CASE (client_server_test_j2k) PresetColourConversion::all().front().conversion, VideoRange::FULL, weak_ptr<Content>(), - optional<Frame>(), + optional<ContentTime>(), false ); @@ -315,3 +314,22 @@ BOOST_AUTO_TEST_CASE (client_server_test_j2k) } +BOOST_AUTO_TEST_CASE(real_encode_with_server) +{ + auto content = content_factory(TestPaths::private_data() / "dolby_aurora.vob"); + auto film = new_test_film2("real_encode_with_server", content); + + EncodeServerFinder::instance(); + + EncodeServer server(true, 4); + thread server_thread(boost::bind(&EncodeServer::run, &server)); + + make_and_verify_dcp(film); + + server.stop(); + server_thread.join(); + + BOOST_CHECK(server.frames_encoded() > 0); + EncodeServerFinder::drop(); +} + diff --git a/test/config_test.cc b/test/config_test.cc index 103a6a585..00adb7b09 100644 --- a/test/config_test.cc +++ b/test/config_test.cc @@ -38,7 +38,7 @@ rewrite_bad_config (string filename, string extra_line) { using namespace boost::filesystem; - auto base = path("build/test/bad_config/2.16"); + auto base = path("build/test/bad_config/2.18"); auto file = base / filename; boost::system::error_code ec; @@ -73,47 +73,49 @@ BOOST_AUTO_TEST_CASE (config_backup_test) */ Config::instance(); - BOOST_CHECK ( boost::filesystem::exists("build/test/bad_config/2.16/config.xml.1")); - BOOST_CHECK (dcp::file_to_string("build/test/bad_config/2.16/config.xml.1") == first_write_xml); - BOOST_CHECK (!boost::filesystem::exists("build/test/bad_config/2.16/config.xml.2")); - BOOST_CHECK (!boost::filesystem::exists("build/test/bad_config/2.16/config.xml.3")); - BOOST_CHECK (!boost::filesystem::exists("build/test/bad_config/2.16/config.xml.4")); + boost::filesystem::path const prefix = "build/test/bad_config/2.18"; + + BOOST_CHECK(boost::filesystem::exists(prefix / "config.xml.1")); + BOOST_CHECK(dcp::file_to_string(prefix / "config.xml.1") == first_write_xml); + BOOST_CHECK(!boost::filesystem::exists(prefix / "config.xml.2")); + BOOST_CHECK(!boost::filesystem::exists(prefix / "config.xml.3")); + BOOST_CHECK(!boost::filesystem::exists(prefix / "config.xml.4")); Config::drop(); auto const second_write_xml = rewrite_bad_config("config.xml", "second write"); Config::instance(); - BOOST_CHECK ( boost::filesystem::exists("build/test/bad_config/2.16/config.xml.1")); - BOOST_CHECK (dcp::file_to_string("build/test/bad_config/2.16/config.xml.1") == first_write_xml); - BOOST_CHECK ( boost::filesystem::exists("build/test/bad_config/2.16/config.xml.2")); - BOOST_CHECK (dcp::file_to_string("build/test/bad_config/2.16/config.xml.2") == second_write_xml); - BOOST_CHECK (!boost::filesystem::exists("build/test/bad_config/2.16/config.xml.3")); - BOOST_CHECK (!boost::filesystem::exists("build/test/bad_config/2.16/config.xml.4")); + BOOST_CHECK(boost::filesystem::exists(prefix / "config.xml.1")); + BOOST_CHECK(dcp::file_to_string(prefix / "config.xml.1") == first_write_xml); + BOOST_CHECK(boost::filesystem::exists(prefix / "config.xml.2")); + BOOST_CHECK(dcp::file_to_string(prefix / "config.xml.2") == second_write_xml); + BOOST_CHECK(!boost::filesystem::exists(prefix / "config.xml.3")); + BOOST_CHECK(!boost::filesystem::exists(prefix / "config.xml.4")); Config::drop(); auto const third_write_xml = rewrite_bad_config("config.xml", "third write"); Config::instance(); - BOOST_CHECK ( boost::filesystem::exists("build/test/bad_config/2.16/config.xml.1")); - BOOST_CHECK (dcp::file_to_string("build/test/bad_config/2.16/config.xml.1") == first_write_xml); - BOOST_CHECK ( boost::filesystem::exists("build/test/bad_config/2.16/config.xml.2")); - BOOST_CHECK (dcp::file_to_string("build/test/bad_config/2.16/config.xml.2") == second_write_xml); - BOOST_CHECK ( boost::filesystem::exists("build/test/bad_config/2.16/config.xml.3")); - BOOST_CHECK (dcp::file_to_string("build/test/bad_config/2.16/config.xml.3") == third_write_xml); - BOOST_CHECK (!boost::filesystem::exists("build/test/bad_config/2.16/config.xml.4")); + BOOST_CHECK(boost::filesystem::exists(prefix / "config.xml.1")); + BOOST_CHECK(dcp::file_to_string(prefix / "config.xml.1") == first_write_xml); + BOOST_CHECK(boost::filesystem::exists(prefix / "config.xml.2")); + BOOST_CHECK(dcp::file_to_string(prefix / "config.xml.2") == second_write_xml); + BOOST_CHECK(boost::filesystem::exists(prefix / "config.xml.3")); + BOOST_CHECK(dcp::file_to_string(prefix / "config.xml.3") == third_write_xml); + BOOST_CHECK(!boost::filesystem::exists(prefix / "config.xml.4")); Config::drop(); auto const fourth_write_xml = rewrite_bad_config("config.xml", "fourth write"); Config::instance(); - BOOST_CHECK (boost::filesystem::exists("build/test/bad_config/2.16/config.xml.1")); - BOOST_CHECK (dcp::file_to_string("build/test/bad_config/2.16/config.xml.1") == first_write_xml); - BOOST_CHECK (boost::filesystem::exists("build/test/bad_config/2.16/config.xml.2")); - BOOST_CHECK (dcp::file_to_string("build/test/bad_config/2.16/config.xml.2") == second_write_xml); - BOOST_CHECK (boost::filesystem::exists("build/test/bad_config/2.16/config.xml.3")); - BOOST_CHECK (dcp::file_to_string("build/test/bad_config/2.16/config.xml.3") == third_write_xml); - BOOST_CHECK (boost::filesystem::exists("build/test/bad_config/2.16/config.xml.4")); - BOOST_CHECK (dcp::file_to_string("build/test/bad_config/2.16/config.xml.4") == fourth_write_xml); + BOOST_CHECK(boost::filesystem::exists(prefix / "config.xml.1")); + BOOST_CHECK(dcp::file_to_string(prefix / "config.xml.1") == first_write_xml); + BOOST_CHECK(boost::filesystem::exists(prefix / "config.xml.2")); + BOOST_CHECK(dcp::file_to_string(prefix / "config.xml.2") == second_write_xml); + BOOST_CHECK(boost::filesystem::exists(prefix / "config.xml.3")); + BOOST_CHECK(dcp::file_to_string(prefix / "config.xml.3") == third_write_xml); + BOOST_CHECK(boost::filesystem::exists(prefix / "config.xml.4")); + BOOST_CHECK(dcp::file_to_string(prefix / "config.xml.4") == fourth_write_xml); } @@ -124,7 +126,7 @@ BOOST_AUTO_TEST_CASE (config_backup_with_link_test) ConfigRestorer cr; auto base = path("build/test/bad_config"); - auto version = base / "2.16"; + auto version = base / "2.18"; Config::override_path = base; Config::drop(); @@ -163,7 +165,8 @@ BOOST_AUTO_TEST_CASE (config_write_utf8_test) } -BOOST_AUTO_TEST_CASE (config_upgrade_test) +/* 2.14 -> 2.18 */ +BOOST_AUTO_TEST_CASE (config_upgrade_test1) { ConfigRestorer cr; @@ -185,12 +188,49 @@ BOOST_AUTO_TEST_CASE (config_upgrade_test) check_xml (dir / "cinemas.xml", "test/data/2.14.cinemas.xml", {}); #ifdef DCPOMATIC_WINDOWS /* This file has the windows path for dkdm_recipients.xml (with backslashes) */ - check_xml (dir / "2.16" / "config.xml", "test/data/2.16.config.windows.xml", {}); + check_xml(dir / "2.18" / "config.xml", "test/data/2.18.config.windows.xml", {}); +#else + check_xml(dir / "2.18" / "config.xml", "test/data/2.18.config.xml", {}); +#endif + /* cinemas.xml is not copied into 2.18 as its format has not changed */ + BOOST_REQUIRE (!boost::filesystem::exists(dir / "2.18" / "cinemas.xml")); +} + + +/* 2.16 -> 2.18 */ +BOOST_AUTO_TEST_CASE (config_upgrade_test2) +{ + ConfigRestorer cr; + + boost::filesystem::path dir = "build/test/config_upgrade_test"; + Config::override_path = dir; + Config::drop (); + boost::filesystem::remove_all (dir); + boost::filesystem::create_directories (dir); + +#ifdef DCPOMATIC_WINDOWS + boost::filesystem::copy_file("test/data/2.16.config.windows.xml", dir / "config.xml"); +#else + boost::filesystem::copy_file("test/data/2.16.config.xml", dir / "config.xml"); +#endif + boost::filesystem::copy_file("test/data/2.14.cinemas.xml", dir / "cinemas.xml"); + Config::instance(); + try { + /* This will fail to write cinemas.xml since the link is to a non-existent directory */ + Config::instance()->write(); + } catch (...) {} + + check_xml(dir / "cinemas.xml", "test/data/2.14.cinemas.xml", {}); +#ifdef DCPOMATIC_WINDOWS + /* This file has the windows path for dkdm_recipients.xml (with backslashes) */ + check_xml(dir / "2.18" / "config.xml", "test/data/2.18.config.windows.xml", {}); + check_xml(dir / "config.xml", "test/data/2.16.config.windows.xml", {}); #else - check_xml (dir / "2.16" / "config.xml", "test/data/2.16.config.xml", {}); + check_xml(dir / "2.18" / "config.xml", "test/data/2.18.config.xml", {}); + check_xml(dir / "config.xml", "test/data/2.16.config.xml", {}); #endif - /* cinemas.xml is not copied into 2.16 as its format has not changed */ - BOOST_REQUIRE (!boost::filesystem::exists(dir / "2.16" / "cinemas.xml")); + /* cinemas.xml is not copied into 2.18 as its format has not changed */ + BOOST_REQUIRE (!boost::filesystem::exists(dir / "2.18" / "cinemas.xml")); } @@ -206,13 +246,13 @@ BOOST_AUTO_TEST_CASE (config_keep_cinemas_if_making_new_config) Config::instance()->write(); - Config::instance()->add_cinema(make_shared<Cinema>("My Great Cinema", vector<string>(), "", 0, 0)); + Config::instance()->add_cinema(make_shared<Cinema>("My Great Cinema", vector<string>(), "")); Config::instance()->write(); boost::filesystem::copy_file (dir / "cinemas.xml", dir / "backup_for_test.xml"); Config::drop (); - boost::filesystem::remove (dir / "2.16" / "config.xml"); + boost::filesystem::remove (dir / "2.18" / "config.xml"); Config::instance(); check_text_file(dir / "backup_for_test.xml", dir / "cinemas.xml"); @@ -234,7 +274,7 @@ BOOST_AUTO_TEST_CASE(keep_config_if_cinemas_fail_to_load) auto const cinemas = dir / "cinemas.xml"; /* Back things up */ - boost::filesystem::copy_file(dir / "2.16" / "config.xml", dir / "config_backup_for_test.xml"); + boost::filesystem::copy_file(dir / "2.18" / "config.xml", dir / "config_backup_for_test.xml"); boost::filesystem::copy_file(cinemas, dir / "cinemas_backup_for_test.xml"); /* Corrupt the cinemas */ @@ -245,7 +285,7 @@ BOOST_AUTO_TEST_CASE(keep_config_if_cinemas_fail_to_load) Config::instance(); /* We should have a new cinemas.xml and the old config.xml */ - check_text_file(dir / "2.16" / "config.xml", dir / "config_backup_for_test.xml"); + check_text_file(dir / "2.18" / "config.xml", dir / "config_backup_for_test.xml"); check_text_file(cinemas, dir / "cinemas_backup_for_test.xml"); } diff --git a/test/content_test.cc b/test/content_test.cc index 5ab714b47..dce7643dc 100644 --- a/test/content_test.cc +++ b/test/content_test.cc @@ -154,7 +154,7 @@ BOOST_AUTO_TEST_CASE (content_test6) film->set_audio_channels(16); make_and_verify_dcp (film); - check_dcp (TestPaths::private_data() / "fha", film); + check_dcp (TestPaths::private_data() / "v2.18.x" / "fha", film); cl.run (); } diff --git a/test/data b/test/data -Subproject 4cb08962ba07e99c442cb12091c0347d84d8fd8 +Subproject ddf878730354cdec8a802a59543591f6f943f5c diff --git a/test/disk_writer_test.cc b/test/disk_writer_test.cc index 553adcae7..ff39eaaea 100644 --- a/test/disk_writer_test.cc +++ b/test/disk_writer_test.cc @@ -228,110 +228,3 @@ BOOST_AUTO_TEST_CASE (disk_writer_test3) cl.run(); } - - -BOOST_AUTO_TEST_CASE (osx_drive_identification_test) -{ - vector<OSXDisk> disks; - - auto disk = [&disks](string mount_point, string media_path, bool whole, std::vector<boost::filesystem::path> mount_points) - { - auto mp = analyse_osx_media_path (media_path); - if (mp) { - disks.push_back({mount_point, {}, {}, *mp, whole, mount_points, 0}); - } - }; - - auto find_unmounted = [](vector<OSXDisk> disks) { - auto drives = osx_disks_to_drives (disks); - vector<Drive> unmounted; - std::copy_if (drives.begin(), drives.end(), std::back_inserter(unmounted), [](Drive const& drive) { return !drive.mounted(); }); - return unmounted; - }; - - disk("/dev/disk4s1", "IODeviceTree:/arm-io@10F00000/apcie@90000000/pci-bridge1@1/pcie-xhci@0/@7:1", false, {}); - disk("/dev/disk4", "IODeviceTree:/arm-io@10F00000/apcie@90000000/pci-bridge1@1/pcie-xhci@0/@7:0", true, {}); - disk("/dev/disk0", "IODeviceTree:/arm-io@10F00000/ans@77400000/iop-ans-nub/AppleANS3NVMeController/@1:0", true, {}); - disk("/dev/disk0s1", "IODeviceTree:/arm-io@10F00000/ans@77400000/iop-ans-nub/AppleANS3NVMeController/@1:1", false, {}); - disk("/dev/disk0s2", "IODeviceTree:/arm-io@10F00000/ans@77400000/iop-ans-nub/AppleANS3NVMeController/@1:2", false, {}); - disk("/dev/disk0s3", "IODeviceTree:/arm-io@10F00000/ans@77400000/iop-ans-nub/AppleANS3NVMeController/@1:3", false, {}); - disk("/dev/disk1", "IOService:/AppleARMPE/arm-io@10F00000/AppleT810xIO/ans@77400000/AppleASCWrapV4/iop-ans-nub/RTBuddyV2/RTBuddyService/AppleANS3NVMeController/NS_01@1/IOBlockStorageDriver/APPLE SSD AP0512Q Media/IOGUIDPartitionScheme/iBootSystemContainer@1/AppleAPFSContainerScheme/AppleAPFSMedia", true, {}); - disk("/dev/disk2", "IOService:/AppleARMPE/arm-io@10F00000/AppleT810xIO/ans@77400000/AppleASCWrapV4/iop-ans-nub/RTBuddyV2/RTBuddyService/AppleANS3NVMeController/NS_01@1/IOBlockStorageDriver/APPLE SSD AP0512Q Media/IOGUIDPartitionScheme/RecoveryOSContainer@3/AppleAPFSContainerScheme/AppleAPFSMedia", true, {}); - disk("/dev/disk3", "IOService:/AppleARMPE/arm-io@10F00000/AppleT810xIO/ans@77400000/AppleASCWrapV4/iop-ans-nub/RTBuddyV2/RTBuddyService/AppleANS3NVMeController/NS_01@1/IOBlockStorageDriver/APPLE SSD AP0512Q Media/IOGUIDPartitionScheme/Container@2/AppleAPFSContainerScheme/AppleAPFSMedia", false, {}); - disk("/dev/disk1s1", "IOService:/AppleARMPE/arm-io@10F00000/AppleT810xIO/ans@77400000/AppleASCWrapV4/iop-ans-nub/RTBuddyV2/RTBuddyService/AppleANS3NVMeController/NS_01@1/IOBlockStorageDriver/APPLE SSD AP0512Q Media/IOGUIDPartitionScheme/iBootSystemContainer@1/AppleAPFSContainerScheme/AppleAPFSMedia/AppleAPFSContainer/iSCPreboot@1", false, {}); - disk("/dev/disk1s2", "IOService:/AppleARMPE/arm-io@10F00000/AppleT810xIO/ans@77400000/AppleASCWrapV4/iop-ans-nub/RTBuddyV2/RTBuddyService/AppleANS3NVMeController/NS_01@1/IOBlockStorageDriver/APPLE SSD AP0512Q Media/IOGUIDPartitionScheme/iBootSystemContainer@1/AppleAPFSContainerScheme/AppleAPFSMedia/AppleAPFSContainer/xART@2", false, {}); - disk("/dev/disk1s3", "IOService:/AppleARMPE/arm-io@10F00000/AppleT810xIO/ans@77400000/AppleASCWrapV4/iop-ans-nub/RTBuddyV2/RTBuddyService/AppleANS3NVMeController/NS_01@1/IOBlockStorageDriver/APPLE SSD AP0512Q Media/IOGUIDPartitionScheme/iBootSystemContainer@1/AppleAPFSContainerScheme/AppleAPFSMedia/AppleAPFSContainer/Hardware@3", false, {}); - disk("/dev/disk1s4", "IOService:/AppleARMPE/arm-io@10F00000/AppleT810xIO/ans@77400000/AppleASCWrapV4/iop-ans-nub/RTBuddyV2/RTBuddyService/AppleANS3NVMeController/NS_01@1/IOBlockStorageDriver/APPLE SSD AP0512Q Media/IOGUIDPartitionScheme/iBootSystemContainer@1/AppleAPFSContainerScheme/AppleAPFSMedia/AppleAPFSContainer/Recovery@4", false, {}); - disk("/dev/disk2s1", "IOService:/AppleARMPE/arm-io@10F00000/AppleT810xIO/ans@77400000/AppleASCWrapV4/iop-ans-nub/RTBuddyV2/RTBuddyService/AppleANS3NVMeController/NS_01@1/IOBlockStorageDriver/APPLE SSD AP0512Q Media/IOGUIDPartitionScheme/RecoveryOSContainer@3/AppleAPFSContainerScheme/AppleAPFSMedia/AppleAPFSContainer/Recovery@1", false, {}); - disk("/dev/disk2s2", "IOService:/AppleARMPE/arm-io@10F00000/AppleT810xIO/ans@77400000/AppleASCWrapV4/iop-ans-nub/RTBuddyV2/RTBuddyService/AppleANS3NVMeController/NS_01@1/IOBlockStorageDriver/APPLE SSD AP0512Q Media/IOGUIDPartitionScheme/RecoveryOSContainer@3/AppleAPFSContainerScheme/AppleAPFSMedia/AppleAPFSContainer/Update@2", false, {}); - disk("/dev/disk3s1", "IOService:/AppleARMPE/arm-io@10F00000/AppleT810xIO/ans@77400000/AppleASCWrapV4/iop-ans-nub/RTBuddyV2/RTBuddyService/AppleANS3NVMeController/NS_01@1/IOBlockStorageDriver/APPLE SSD AP0512Q Media/IOGUIDPartitionScheme/Container@2/AppleAPFSContainerScheme/AppleAPFSMedia/AppleAPFSContainer/Macintosh HD@1", false, {}); - disk("/dev/disk3s4", "IOService:/AppleARMPE/arm-io@10F00000/AppleT810xIO/ans@77400000/AppleASCWrapV4/iop-ans-nub/RTBuddyV2/RTBuddyService/AppleANS3NVMeController/NS_01@1/IOBlockStorageDriver/APPLE SSD AP0512Q Media/IOGUIDPartitionScheme/Container@2/AppleAPFSContainerScheme/AppleAPFSMedia/AppleAPFSContainer/Update@4", false, {"/System/Volumes/Update"}); - disk("/dev/disk3s5", "IOService:/AppleARMPE/arm-io@10F00000/AppleT810xIO/ans@77400000/AppleASCWrapV4/iop-ans-nub/RTBuddyV2/RTBuddyService/AppleANS3NVMeController/NS_01@1/IOBlockStorageDriver/APPLE SSD AP0512Q Media/IOGUIDPartitionScheme/Container@2/AppleAPFSContainerScheme/AppleAPFSMedia/AppleAPFSContainer/Data@5", false, {"/System/Volumes/Data"}); - disk("/dev/disk3s2", "IOService:/AppleARMPE/arm-io@10F00000/AppleT810xIO/ans@77400000/AppleASCWrapV4/iop-ans-nub/RTBuddyV2/RTBuddyService/AppleANS3NVMeController/NS_01@1/IOBlockStorageDriver/APPLE SSD AP0512Q Media/IOGUIDPartitionScheme/Container@2/AppleAPFSContainerScheme/AppleAPFSMedia/AppleAPFSContainer/Preboot@2", false, {"/System/Volumes/Preboot"}); - disk("/dev/disk3s3", "IOService:/AppleARMPE/arm-io@10F00000/AppleT810xIO/ans@77400000/AppleASCWrapV4/iop-ans-nub/RTBuddyV2/RTBuddyService/AppleANS3NVMeController/NS_01@1/IOBlockStorageDriver/APPLE SSD AP0512Q Media/IOGUIDPartitionScheme/Container@2/AppleAPFSContainerScheme/AppleAPFSMedia/AppleAPFSContainer/Recovery@3", false, {}); - disk("/dev/disk3s6", "IOService:/AppleARMPE/arm-io@10F00000/AppleT810xIO/ans@77400000/AppleASCWrapV4/iop-ans-nub/RTBuddyV2/RTBuddyService/AppleANS3NVMeController/NS_01@1/IOBlockStorageDriver/APPLE SSD AP0512Q Media/IOGUIDPartitionScheme/Container@2/AppleAPFSContainerScheme/AppleAPFSMedia/AppleAPFSContainer/VM@6", false, {"/System/Volumes/VM"}); - disk("/dev/disk3s1s1", "IOService:/AppleARMPE/arm-io@10F00000/AppleT810xIO/ans@77400000/AppleASCWrapV4/iop-ans-nub/RTBuddyV2/RTBuddyService/AppleANS3NVMeController/NS_01@1/IOBlockStorageDriver/APPLE SSD AP0512Q Media/IOGUIDPartitionScheme/Container@2/AppleAPFSContainerScheme/AppleAPFSMedia/AppleAPFSContainer/Macintosh HD@1/com.apple.os.update-EA882DCA7A28EBA0A6E94689836BB10D77D84D1AEE2468E17775A447AA815278@1", false, {"/"}); - - vector<Drive> writeable = find_unmounted (disks); - BOOST_REQUIRE_EQUAL (writeable.size(), 1U); - BOOST_CHECK_EQUAL (writeable[0].device(), "/dev/disk4"); - - disks.clear (); - disk("/dev/disk4s1", "IOService:/IOResources/IOHDIXController/IOHDIXHDDriveOutKernel@0/IODiskImageBlockStorageDeviceOutKernel/IOBlockStorageDriver/Apple UDIF read-only compressed (zlib) Media/IOGUIDPartitionScheme/disk image@1", false, {}); - disk("/dev/disk4", "IOService:/IOResources/IOHDIXController/IOHDIXHDDriveOutKernel@0/IODiskImageBlockStorageDeviceOutKernel/IOBlockStorageDriver/Apple UDIF read-only compressed (zlib) Media", true, {}); - disk("/dev/disk3s1", "IODeviceTree:/PCI0@0/XHC1@14/@2:1", false, {}); - disk("/dev/disk3", "IODeviceTree:/PCI0@0/XHC1@14/@2:0", true, {}); - disk("/dev/disk0", "IODeviceTree:/PCI0@0/SATA@1F,2/PRT1@1/PMP@0/@0:0", true, {}); - disk("/dev/disk0s1", "IODeviceTree:/PCI0@0/SATA@1F,2/PRT1@1/PMP@0/@0:1", false, {}); - disk("/dev/disk0s2", "IODeviceTree:/PCI0@0/SATA@1F,2/PRT1@1/PMP@0/@0:2", false, {"/Volumes/Macintosh HD"}); - disk("/dev/disk0s3", "IODeviceTree:/PCI0@0/SATA@1F,2/PRT1@1/PMP@0/@0:3", false, {}); - disk("/dev/disk0s4", "IODeviceTree:/PCI0@0/SATA@1F,2/PRT1@1/PMP@0/@0:4", false, {}); - disk("/dev/disk0s5", "IODeviceTree:/PCI0@0/SATA@1F,2/PRT1@1/PMP@0/@0:5", false, {"/Volumes/High Sierra"}); - disk("/dev/disk0s6", "IODeviceTree:/PCI0@0/SATA@1F,2/PRT1@1/PMP@0/@0:6", false, {}); - disk("/dev/disk0s7", "IODeviceTree:/PCI0@0/SATA@1F,2/PRT1@1/PMP@0/@0:7", false, {"/Volumes/Recovery HD"}); - disk("/dev/disk1", "IOService:/AppleACPIPlatformExpert/PCI0@0/AppleACPIPCI/SATA@1F,2/AppleIntelPchSeriesAHCI/PRT1@1/IOAHCIDevice@0/AppleAHCIDiskDriver/IOAHCIBlockStorageDevice/IOBlockStorageDriver/APPLE HDD ST500LM012 Media/IOGUIDPartitionScheme/Untitled 3@3/AppleAPFSContainerScheme/AppleAPFSMedia", true, {}); - disk("/dev/disk", "IOService:/AppleACPIPlatformExpert/PCI0@0/AppleACPIPCI/SATA@1F,2/AppleIntelPchSeriesAHCI/PRT1@1/IOAHCIDevice@0/AppleAHCIDiskDriver/IOAHCIBlockStorageDevice/IOBlockStorageDriver/APPLE HDD ST500LM012 Media/IOGUIDPartitionScheme/Untitled 4@4/AppleAPFSContainerScheme/AppleAPFSMedia", true, {}); - disk("/dev/disk1s1", "IOService:/AppleACPIPlatformExpert/PCI0@0/AppleACPIPCI/SATA@1F,2/AppleIntelPchSeriesAHCI/PRT1@1/IOAHCIDevice@0/AppleAHCIDiskDriver/IOAHCIBlockStorageDevice/IOBlockStorageDriver/APPLE HDD ST500LM012 Media/IOGUIDPartitionScheme/Untitled 3@3/AppleAPFSContainerScheme/AppleAPFSMedia/AppleAPFSContainer/Untitled - Data@1", false, {"/Volumes/Untitled - Data"}); - disk("/dev/disk1s2", "IOService:/AppleACPIPlatformExpert/PCI0@0/AppleACPIPCI/SATA@1F,2/AppleIntelPchSeriesAHCI/PRT1@1/IOAHCIDevice@0/AppleAHCIDiskDriver/IOAHCIBlockStorageDevice/IOBlockStorageDriver/APPLE HDD ST500LM012 Media/IOGUIDPartitionScheme/Untitled 3@3/AppleAPFSContainerScheme/AppleAPFSMedia/AppleAPFSContainer/Preboot@2", false, {}); - disk("/dev/disk1s3", "IOService:/AppleACPIPlatformExpert/PCI0@0/AppleACPIPCI/SATA@1F,2/AppleIntelPchSeriesAHCI/PRT1@1/IOAHCIDevice@0/AppleAHCIDiskDriver/IOAHCIBlockStorageDevice/IOBlockStorageDriver/APPLE HDD ST500LM012 Media/IOGUIDPartitionScheme/Untitled 3@3/AppleAPFSContainerScheme/AppleAPFSMedia/AppleAPFSContainer/Recovery@3", false, {}); - disk("/dev/disk1s4", "IOService:/AppleACPIPlatformExpert/PCI0@0/AppleACPIPCI/SATA@1F,2/AppleIntelPchSeriesAHCI/PRT1@1/IOAHCIDevice@0/AppleAHCIDiskDriver/IOAHCIBlockStorageDevice/IOBlockStorageDriver/APPLE HDD ST500LM012 Media/IOGUIDPartitionScheme/Untitled 3@3/AppleAPFSContainerScheme/AppleAPFSMedia/AppleAPFSContainer/VM@4", false, {}); - disk("/dev/disk1s5", "IOService:/AppleACPIPlatformExpert/PCI0@0/AppleACPIPCI/SATA@1F,2/AppleIntelPchSeriesAHCI/PRT1@1/IOAHCIDevice@0/AppleAHCIDiskDriver/IOAHCIBlockStorageDevice/IOBlockStorageDriver/APPLE HDD ST500LM012 Media/IOGUIDPartitionScheme/Untitled 3@3/AppleAPFSContainerScheme/AppleAPFSMedia/AppleAPFSContainer/Untitled@5", false, {"/Volumes/Untitled"}); - disk("/dev/disk2s1", "IOService:/AppleACPIPlatformExpert/PCI0@0/AppleACPIPCI/SATA@1F,2/AppleIntelPchSeriesAHCI/PRT1@1/IOAHCIDevice@0/AppleAHCIDiskDriver/IOAHCIBlockStorageDevice/IOBlockStorageDriver/APPLE HDD ST500LM012 Media/IOGUIDPartitionScheme/Untitled 4@4/AppleAPFSContainerScheme/AppleAPFSMedia/AppleAPFSContainer/Catalina - Data@1", false, {}); - disk("/dev/disk2s2", "IOService:/AppleACPIPlatformExpert/PCI0@0/AppleACPIPCI/SATA@1F,2/AppleIntelPchSeriesAHCI/PRT1@1/IOAHCIDevice@0/AppleAHCIDiskDriver/IOAHCIBlockStorageDevice/IOBlockStorageDriver/APPLE HDD ST500LM012 Media/IOGUIDPartitionScheme/Untitled 4@4/AppleAPFSContainerScheme/AppleAPFSMedia/AppleAPFSContainer/Preboot@2", false, {}); - disk("/dev/disk2s3", "IOService:/AppleACPIPlatformExpert/PCI0@0/AppleACPIPCI/SATA@1F,2/AppleIntelPchSeriesAHCI/PRT1@1/IOAHCIDevice@0/AppleAHCIDiskDriver/IOAHCIBlockStorageDevice/IOBlockStorageDriver/APPLE HDD ST500LM012 Media/IOGUIDPartitionScheme/Untitled 4@4/AppleAPFSContainerScheme/AppleAPFSMedia/AppleAPFSContainer/Recovery@3", false, {}); - disk("/dev/disk2s4", "IOService:/AppleACPIPlatformExpert/PCI0@0/AppleACPIPCI/SATA@1F,2/AppleIntelPchSeriesAHCI/PRT1@1/IOAHCIDevice@0/AppleAHCIDiskDriver/IOAHCIBlockStorageDevice/IOBlockStorageDriver/APPLE HDD ST500LM012 Media/IOGUIDPartitionScheme/Untitled 4@4/AppleAPFSContainerScheme/AppleAPFSMedia/AppleAPFSContainer/VM@4", false, {"/private/var/vm"}); - disk("/dev/disk2s5", "IOService:/AppleACPIPlatformExpert/PCI0@0/AppleACPIPCI/SATA@1F,2/AppleIntelPchSeriesAHCI/PRT1@1/IOAHCIDevice@0/AppleAHCIDiskDriver/IOAHCIBlockStorageDevice/IOBlockStorageDriver/APPLE HDD ST500LM012 Media/IOGUIDPartitionScheme/Untitled 4@4/AppleAPFSContainerScheme/AppleAPFSMedia/AppleAPFSContainer/Catalina@5", false, {"/"}); - - writeable = find_unmounted (disks); - BOOST_REQUIRE_EQUAL (writeable.size(), 1U); - BOOST_CHECK_EQUAL (writeable[0].device(), "/dev/disk3"); - - disks.clear (); - disk("/dev/disk7", "IOService:/IOResources/IOHDIXController/IOHDIXHDDriveOutKernel@3/IODiskImageBlockStorageDeviceOutKernel/IOBlockStorageDriver/Apple UDIF read-only compressed (zlib) Media", true, {}); - disk("/dev/disk7s1", "IOService:/IOResources/IOHDIXController/IOHDIXHDDriveOutKernel@3/IODiskImageBlockStorageDeviceOutKernel/IOBlockStorageDriver/Apple UDIF read-only compressed (zlib) Media/IOGUIDPartitionScheme/disk image@1", false, {}); - disk("/dev/disk6s1", "MediaPathKey is IOService:/IOResources/IOHDIXController/IOHDIXHDDriveOutKernel@2/IODiskImageBlockStorageDeviceOutKernel/IOBlockStorageDriver/Apple UDIF read-only compressed (zlib) Media/IOGUIDPartitionScheme/disk image@1", false, {}); - disk("/dev/disk6", "IOService:/IOResources/IOHDIXController/IOHDIXHDDriveOutKernel@2/IODiskImageBlockStorageDeviceOutKernel/IOBlockStorageDriver/Apple UDIF read-only compressed (zlib) Media", true, {}); - disk("/dev/disk5s1", "IOService:/IOResources/IOHDIXController/IOHDIXHDDriveOutKernel@1/IODiskImageBlockStorageDeviceOutKernel/IOBlockStorageDriver/Apple UDIF read-only compressed (zlib) Media/IOGUIDPartitionScheme/disk image@1", false, {}); - disk("/dev/disk5", "IOService:/IOResources/IOHDIXController/IOHDIXHDDriveOutKernel@1/IODiskImageBlockStorageDeviceOutKernel/IOBlockStorageDriver/Apple UDIF read-only compressed (zlib) Media", true, {}); - disk("/dev/disk4s1", "IOService:/IOResources/IOHDIXController/IOHDIXHDDriveOutKernel@0/IODiskImageBlockStorageDeviceOutKernel/IOBlockStorageDriver/Apple UDIF read-only compressed (zlib) Media/IOGUIDPartitionScheme/disk image@1", false, {}); - disk("/dev/disk4", "IOService:/IOResources/IOHDIXController/IOHDIXHDDriveOutKernel@0/IODiskImageBlockStorageDeviceOutKernel/IOBlockStorageDriver/Apple UDIF read-only compressed (zlib) Media", true, {}); - disk("/dev/disk0", "IODeviceTree:/PCI0@1e0000/pci8086,2829@1F,2/PRT3@3/PMP@0/@0:0", true, {}); - disk("/dev/disk2", "IODeviceTree:/PCI0@1e0000/pci8086,2829@1F,2/PRT1@1/PMP@0/@0:0", true, {}); - disk("/dev/disk1", "IODeviceTree:/PCI0@1e0000/pci8086,2829@1F,2/PRT0@0/PMP@0/@0:0", true, {}); - disk("/dev/disk1s1", "IODeviceTree:/PCI0@1e0000/pci8086,2829@1F,2/PRT0@0/PMP@0/@0:1", false, {"/Volumes/EFI"}); - disk("/dev/disk2s1", "IODeviceTree:/PCI0@1e0000/pci8086,2829@1F,2/PRT1@1/PMP@0/@0:1", false, {}); - disk("/dev/disk2s2", "IODeviceTree:/PCI0@1e0000/pci8086,2829@1F,2/PRT1@1/PMP@0/@0:2", false, {}); - disk("/dev/disk3", "IOService:/AppleACPIPlatformExpert/PCI0@1e0000/AppleACPIPCI/pci8086,2829@1F,2/AppleAHCI/PRT1@1/IOAHCIDevice@0/AppleAHCIDiskDriver/IOAHCIBlockStorageDevice/IOBlockStorageDriver/VBOX HARDDISK Media/IOGUIDPartitionScheme/disk image@2/AppleAPFSContainerScheme/AppleAPFSMedia", false, {}); - disk("/dev/disk3s1", "IOService:/AppleACPIPlatformExpert/PCI0@1e0000/AppleACPIPCI/pci8086,2829@1F,2/AppleAHCI/PRT1@1/IOAHCIDevice@0/AppleAHCIDiskDriver/IOAHCIBlockStorageDevice/IOBlockStorageDriver/VBOX HARDDISK Media/IOGUIDPartitionScheme/disk image@2/AppleAPFSContainerScheme/AppleAPFSMedia/AppleAPFSContainer/macOS - Data@1", false, {"/System/Volumes/Data"}); - disk("/dev/disk3s2", "IOService:/AppleACPIPlatformExpert/PCI0@1e0000/AppleACPIPCI/pci8086,2829@1F,2/AppleAHCI/PRT1@1/IOAHCIDevice@0/AppleAHCIDiskDriver/IOAHCIBlockStorageDevice/IOBlockStorageDriver/VBOX HARDDISK Media/IOGUIDPartitionScheme/disk image@2/AppleAPFSContainerScheme/AppleAPFSMedia/AppleAPFSContainer/Preboot@2", false, {"/System/Volumes/Preboot"}); - disk("/dev/disk3s3", "IOService:/AppleACPIPlatformExpert/PCI0@1e0000/AppleACPIPCI/pci8086,2829@1F,2/AppleAHCI/PRT1@1/IOAHCIDevice@0/AppleAHCIDiskDriver/IOAHCIBlockStorageDevice/IOBlockStorageDriver/VBOX HARDDISK Media/IOGUIDPartitionScheme/disk image@2/AppleAPFSContainerScheme/AppleAPFSMedia/AppleAPFSContainer/Recovery@3", false, {}); - disk("/dev/disk3s4", "IOService:/AppleACPIPlatformExpert/PCI0@1e0000/AppleACPIPCI/pci8086,2829@1F,2/AppleAHCI/PRT1@1/IOAHCIDevice@0/AppleAHCIDiskDriver/IOAHCIBlockStorageDevice/IOBlockStorageDriver/VBOX HARDDISK Media/IOGUIDPartitionScheme/disk image@2/AppleAPFSContainerScheme/AppleAPFSMedia/AppleAPFSContainer/VM@4", false, {"/System/Volumes/VM"}); - disk("/dev/disk3s5", "IOService:/AppleACPIPlatformExpert/PCI0@1e0000/AppleACPIPCI/pci8086,2829@1F,2/AppleAHCI/PRT1@1/IOAHCIDevice@0/AppleAHCIDiskDriver/IOAHCIBlockStorageDevice/IOBlockStorageDriver/VBOX HARDDISK Media/IOGUIDPartitionScheme/disk image@2/AppleAPFSContainerScheme/AppleAPFSMedia/AppleAPFSContainer/macOS@5", false, {}); - disk("/dev/disk3s6", "IOService:/AppleACPIPlatformExpert/PCI0@1e0000/AppleACPIPCI/pci8086,2829@1F,2/AppleAHCI/PRT1@1/IOAHCIDevice@0/AppleAHCIDiskDriver/IOAHCIBlockStorageDevice/IOBlockStorageDriver/VBOX HARDDISK Media/IOGUIDPartitionScheme/disk image@2/AppleAPFSContainerScheme/AppleAPFSMedia/AppleAPFSContainer/Update@6", false, {"/System/Volumes/Update"}); - disk("/dev/disk3s5s1", "IOService:/AppleACPIPlatformExpert/PCI0@1e0000/AppleACPIPCI/pci8086,2829@1F,2/AppleAHCI/PRT1@1/IOAHCIDevice@0/AppleAHCIDiskDriver/IOAHCIBlockStorageDevice/IOBlockStorageDriver/VBOX HARDDISK Media/IOGUIDPartitionScheme/disk image@2/AppleAPFSContainerScheme/AppleAPFSMedia/AppleAPFSContainer/macOS@5/com.apple.os.update-5523D8E63431315F9F949CCDD0274BF797F5CEE4EAF616D4C66A01B8D6A83C7B@1", false, {"/"}); - - writeable = find_unmounted (disks); - BOOST_REQUIRE_EQUAL (writeable.size(), 1U); - BOOST_CHECK_EQUAL (writeable[0].device(), "/dev/disk0"); -} - diff --git a/test/ffmpeg_decoder_seek_test.cc b/test/ffmpeg_decoder_seek_test.cc index 4dceae86b..f38ef3564 100644 --- a/test/ffmpeg_decoder_seek_test.cc +++ b/test/ffmpeg_decoder_seek_test.cc @@ -64,18 +64,18 @@ store (ContentVideo v) static void -check (shared_ptr<FFmpegDecoder> decoder, int frame) +check (shared_ptr<FFmpegDecoder> decoder, ContentTime time) { BOOST_REQUIRE (decoder->ffmpeg_content()->video_frame_rate ()); - decoder->seek (ContentTime::from_frames (frame, decoder->ffmpeg_content()->video_frame_rate().get()), true); + decoder->seek(time, true); stored = optional<ContentVideo> (); while (!decoder->pass() && !stored) {} - BOOST_CHECK (stored->frame <= frame); + BOOST_CHECK(stored->time <= time); } static void -test (boost::filesystem::path file, vector<int> frames) +test (boost::filesystem::path file, vector<ContentTime> times) { auto path = TestPaths::private_data() / file; BOOST_REQUIRE (boost::filesystem::exists (path)); @@ -87,7 +87,7 @@ test (boost::filesystem::path file, vector<int> frames) auto decoder = make_shared<FFmpegDecoder>(film, content, false); decoder->video->Data.connect (bind (&store, _1)); - for (auto i: frames) { + for (auto i: times) { check (decoder, i); } } @@ -95,10 +95,43 @@ test (boost::filesystem::path file, vector<int> frames) BOOST_AUTO_TEST_CASE (ffmpeg_decoder_seek_test) { - vector<int> frames = { 0, 42, 999, 0 }; - - test ("boon_telly.mkv", frames); - test ("Sintel_Trailer1.480p.DivX_Plus_HD.mkv", frames); - test ("prophet_long_clip.mkv", { 15, 42, 999, 15 }); - test ("dolby_aurora.vob", { 0, 125, 250, 41 }); + test( + "boon_telly.mkv", + { + ContentTime::from_frames(0, 29.97), + ContentTime::from_frames(42, 29.97), + ContentTime::from_frames(999, 29.97), + ContentTime::from_frames(0, 29.97), + } + ); + + test( + "Sintel_Trailer1.480p.DivX_Plus_HD.mkv", + { + ContentTime::from_frames(0, 24), + ContentTime::from_frames(42, 24), + ContentTime::from_frames(999, 24), + ContentTime::from_frames(0, 24), + } + ); + + test( + "prophet_long_clip.mkv", + { + ContentTime::from_frames(15, 23.976), + ContentTime::from_frames(42, 23.976), + ContentTime::from_frames(999, 23.976), + ContentTime::from_frames(15, 23.976) + } + ); + + test( + "dolby_aurora.vob", + { + ContentTime::from_frames(0, 25), + ContentTime::from_frames(125, 25), + ContentTime::from_frames(250, 25), + ContentTime::from_frames(41, 25) + } + ); } diff --git a/test/ffmpeg_encoder_test.cc b/test/ffmpeg_encoder_test.cc index dc57b473b..f0133ff66 100644 --- a/test/ffmpeg_encoder_test.cc +++ b/test/ffmpeg_encoder_test.cc @@ -259,8 +259,8 @@ BOOST_AUTO_TEST_CASE (ffmpeg_encoder_h264_test4) /** Test mixdown from 5.1 to stereo */ BOOST_AUTO_TEST_CASE (ffmpeg_encoder_h264_test5) { - auto film = new_test_film ("ffmpeg_transcoder_h264_test5"); - film->set_name ("ffmpeg_transcoder_h264_test5"); + auto film = new_test_film("ffmpeg_encoder_h264_test5"); + film->set_name("ffmpeg_encoder_h264_test5"); film->set_container (Ratio::from_id ("185")); film->set_audio_channels (6); diff --git a/test/ffmpeg_examiner_test.cc b/test/ffmpeg_examiner_test.cc index c745335ae..231bd16e0 100644 --- a/test/ffmpeg_examiner_test.cc +++ b/test/ffmpeg_examiner_test.cc @@ -64,7 +64,7 @@ BOOST_AUTO_TEST_CASE (ffmpeg_examiner_probesize_test) BOOST_CHECK_EQUAL (examiner->audio_streams()[0]->frame_rate(), 48000); BOOST_CHECK_EQUAL (examiner->audio_streams()[0]->channels(), 2); BOOST_CHECK_EQUAL (examiner->audio_streams()[1]->frame_rate(), 48000); - BOOST_CHECK_EQUAL (examiner->audio_streams()[1]->channels(), 5); + BOOST_CHECK_EQUAL (examiner->audio_streams()[1]->channels(), 6); } diff --git a/test/film_metadata_test.cc b/test/film_metadata_test.cc index 878e60254..2bd60dc81 100644 --- a/test/film_metadata_test.cc +++ b/test/film_metadata_test.cc @@ -66,7 +66,7 @@ BOOST_AUTO_TEST_CASE (film_metadata_test) film->set_audio_channels(6); film->write_metadata (); - list<string> ignore = { "Key", "ContextID", "LastWrittenBy" }; + list<Glib::ustring> ignore = { "Key", "ContextID", "LastWrittenBy" }; check_xml ("test/data/metadata.xml.ref", dir.string() + "/metadata.xml", ignore); auto g = make_shared<Film>(dir); diff --git a/test/image_filename_sorter_test.cc b/test/image_filename_sorter_test.cc index eb662a120..29b550753 100644 --- a/test/image_filename_sorter_test.cc +++ b/test/image_filename_sorter_test.cc @@ -28,9 +28,10 @@ #include "lib/image_filename_sorter.h" #include "lib/compose.hpp" #include <boost/test/unit_test.hpp> +#include <algorithm> +#include <random> -using std::random_shuffle; using std::sort; using std::vector; @@ -69,7 +70,11 @@ BOOST_AUTO_TEST_CASE (image_filename_sorter_test2) for (int i = 0; i < 100000; ++i) { paths.push_back(String::compose("some.filename.with.%1.number.tiff", i)); } - random_shuffle (paths.begin(), paths.end()); + + std::random_device rd; + std::mt19937 generator(rd()); + std::shuffle(paths.begin(), paths.end(), generator); + sort (paths.begin(), paths.end(), ImageFilenameSorter()); for (int i = 0; i < 100000; ++i) { BOOST_CHECK_EQUAL(paths[i].string(), String::compose("some.filename.with.%1.number.tiff", i)); diff --git a/test/j2k_encode_threading_test.cc b/test/j2k_encode_threading_test.cc new file mode 100644 index 000000000..ff2e7b0dc --- /dev/null +++ b/test/j2k_encode_threading_test.cc @@ -0,0 +1,117 @@ +/* + Copyright (C) 2023 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/config.h" +#include "lib/content_factory.h" +#include "lib/dcp_encoder.h" +#include "lib/dcp_transcode_job.h" +#include "lib/encode_server_description.h" +#include "lib/film.h" +#include "lib/j2k_encoder.h" +#include "lib/job_manager.h" +#include "lib/make_dcp.h" +#include "lib/transcode_job.h" +#include "test.h" +#include <dcp/cpl.h> +#include <dcp/dcp.h> +#include <dcp/reel.h> +#include <dcp/reel_picture_asset.h> +#include <boost/test/unit_test.hpp> + + +using std::dynamic_pointer_cast; +using std::list; + + +BOOST_AUTO_TEST_CASE(local_threads_created_and_destroyed) +{ + auto film = new_test_film2("local_threads_created_and_destroyed", {}); + Writer writer(film, {}); + J2KEncoder encoder(film, writer); + + encoder.remake_threads(32, 0, {}); + BOOST_CHECK_EQUAL(encoder._threads.size(), 32U); + + encoder.remake_threads(9, 0, {}); + BOOST_CHECK_EQUAL(encoder._threads.size(), 9U); + + encoder.end(); + BOOST_CHECK_EQUAL(encoder._threads.size(), 0U); +} + + +BOOST_AUTO_TEST_CASE(remote_threads_created_and_destroyed) +{ + auto film = new_test_film2("remote_threads_created_and_destroyed", {}); + Writer writer(film, {}); + J2KEncoder encoder(film, writer); + + list<EncodeServerDescription> servers = { + { "fred", 7, SERVER_LINK_VERSION }, + { "jim", 2, SERVER_LINK_VERSION }, + { "sheila", 14, SERVER_LINK_VERSION }, + }; + + encoder.remake_threads(0, 0, servers); + BOOST_CHECK_EQUAL(encoder._threads.size(), 7U + 2U + 14U); + + servers = { + { "fred", 7, SERVER_LINK_VERSION }, + { "jim", 5, SERVER_LINK_VERSION }, + { "sheila", 14, SERVER_LINK_VERSION }, + }; + + encoder.remake_threads(0, 0, servers); + BOOST_CHECK_EQUAL(encoder._threads.size(), 7U + 5U + 14U); + + servers = { + { "fred", 0, SERVER_LINK_VERSION }, + { "jim", 0, SERVER_LINK_VERSION }, + { "sheila", 11, SERVER_LINK_VERSION }, + }; + + encoder.remake_threads(0, 0, servers); + BOOST_CHECK_EQUAL(encoder._threads.size(), 11U); +} + + +BOOST_AUTO_TEST_CASE(frames_not_lost_when_threads_disappear) +{ + auto content = content_factory(TestPaths::private_data() / "clapperboard.mp4"); + auto film = new_test_film2("frames_not_lost", content); + film->write_metadata(); + auto job = make_dcp(film, TranscodeJob::ChangedBehaviour::IGNORE); + auto& encoder = dynamic_pointer_cast<DCPEncoder>(job->_encoder)->_j2k_encoder; + + while (JobManager::instance()->work_to_do()) { + encoder.remake_threads(rand() % 8, 0, {}); + dcpomatic_sleep_seconds(1); + } + + BOOST_CHECK(!JobManager::instance()->errors()); + + dcp::DCP dcp(film->dir(film->dcp_name())); + dcp.read(); + BOOST_REQUIRE_EQUAL(dcp.cpls().size(), 1U); + BOOST_REQUIRE_EQUAL(dcp.cpls()[0]->reels().size(), 1U); + BOOST_REQUIRE_EQUAL(dcp.cpls()[0]->reels()[0]->main_picture()->intrinsic_duration(), 423U); +} + diff --git a/test/kdm_cli_test.cc b/test/kdm_cli_test.cc index e79e37b2d..303f2b0d4 100644 --- a/test/kdm_cli_test.cc +++ b/test/kdm_cli_test.cc @@ -22,6 +22,8 @@ #include "lib/cinema.h" #include "lib/config.h" #include "lib/content_factory.h" +#include "lib/cross.h" +#include "lib/dkdm_wrapper.h" #include "lib/film.h" #include "lib/kdm_cli.h" #include "lib/screen.h" @@ -33,13 +35,14 @@ #include <iostream> +using std::dynamic_pointer_cast; using std::string; using std::vector; using boost::optional; optional<string> -run(vector<string> const& args, vector<string>& output) +run(vector<string> const& args, vector<string>& output, bool dump_errors = true) { std::vector<char*> argv(args.size()); for (auto i = 0U; i < args.size(); ++i) { @@ -47,7 +50,7 @@ run(vector<string> const& args, vector<string>& output) } auto error = kdm_cli(args.size(), argv.data(), [&output](string s) { output.push_back(s); }); - if (error) { + if (error && dump_errors) { std::cout << *error << "\n"; } @@ -62,7 +65,7 @@ BOOST_AUTO_TEST_CASE (kdm_cli_test_certificate) "--verbose", "--valid-from", "now", "--valid-duration", "2 weeks", - "--certificate", "test/data/cert.pem", + "--projector-certificate", "test/data/cert.pem", "-S", "my great screen", "-o", "build/test", "test/data/dkdm.xml" @@ -80,6 +83,70 @@ BOOST_AUTO_TEST_CASE (kdm_cli_test_certificate) } +BOOST_AUTO_TEST_CASE(kdm_cli_specify_decryption_key_test) +{ + using boost::filesystem::path; + + ConfigRestorer cr; + + path const dir = "build/test/kdm_cli_specify_decryption_key_test"; + + boost::system::error_code ec; + boost::filesystem::remove_all(dir, ec); + boost::filesystem::create_directories(dir); + + dcp::CertificateChain chain(openssl_path(), 365); + dcp::write_string_to_file(chain.leaf().certificate(true), dir / "cert.pem"); + dcp::write_string_to_file(*chain.key(), dir / "key.pem"); + + vector<string> make_args = { + "kdm_cli", + "--valid-from", "now", + "--valid-duration", "2 weeks", + "--projector-certificate", path(dir / "cert.pem").string(), + "-S", "base", + "-o", dir.string(), + "test/data/dkdm.xml" + }; + + vector<string> output; + auto error = run(make_args, output); + BOOST_CHECK(!error); + + vector<string> bad_args = { + "kdm_cli", + "--valid-from", "now", + "--valid-duration", "2 weeks", + "--projector-certificate", path(dir / "cert.pem").string(), + "-S", "bad", + "-o", dir.string(), + path(dir / "KDM_Test_FTR-1_F-133_XX-XX_MOS_2K_20220109_SMPTE_OV__base.xml").string() + }; + + /* This should fail because we're using the wrong decryption certificate */ + output.clear(); + error = run(bad_args, output, false); + BOOST_REQUIRE(error); + BOOST_CHECK(error->find("oaep decoding error") != string::npos); + + vector<string> good_args = { + "kdm_cli", + "--valid-from", "now", + "--valid-duration", "2 weeks", + "--projector-certificate", path(dir / "cert.pem").string(), + "--decryption-key", path(dir / "key.pem").string(), + "-S", "good", + "-o", dir.string(), + path(dir / "KDM_Test_FTR-1_F-133_XX-XX_MOS_2K_20220109_SMPTE_OV__base.xml").string() + }; + + /* This should succeed */ + output.clear(); + error = run(good_args, output); + BOOST_CHECK(!error); +} + + static void setup_test_config() @@ -87,13 +154,13 @@ setup_test_config() auto config = Config::instance(); auto const cert = dcp::Certificate(dcp::file_to_string("test/data/cert.pem")); - auto cinema_a = std::make_shared<Cinema>("Dean's Screens", vector<string>(), "", 0, 0); + auto cinema_a = std::make_shared<Cinema>("Dean's Screens", vector<string>(), ""); cinema_a->add_screen(std::make_shared<dcpomatic::Screen>("Screen 1", "", cert, boost::none, std::vector<TrustedDevice>())); cinema_a->add_screen(std::make_shared<dcpomatic::Screen>("Screen 2", "", cert, boost::none, std::vector<TrustedDevice>())); cinema_a->add_screen(std::make_shared<dcpomatic::Screen>("Screen 3", "", cert, boost::none, std::vector<TrustedDevice>())); config->add_cinema(cinema_a); - auto cinema_b = std::make_shared<Cinema>("Floyd's Celluloid", vector<string>(), "", 0, 0); + auto cinema_b = std::make_shared<Cinema>("Floyd's Celluloid", vector<string>(), ""); cinema_b->add_screen(std::make_shared<dcpomatic::Screen>("Foo", "", cert, boost::none, std::vector<TrustedDevice>())); cinema_b->add_screen(std::make_shared<dcpomatic::Screen>("Bar", "", cert, boost::none, std::vector<TrustedDevice>())); config->add_cinema(cinema_b); @@ -184,7 +251,7 @@ BOOST_AUTO_TEST_CASE(kdm_cli_specify_cinemas_file) "kdm_cli", "--cinemas-file", "test/data/cinemas.xml", - "--list-cinemas" + "list-cinemas" }; vector<string> output; @@ -217,6 +284,7 @@ BOOST_AUTO_TEST_CASE(kdm_cli_specify_cert) "--valid-duration", "2 weeks", "-C", "test/data/cert.pem", "-o", "build/test", + "create", "build/test/kdm_cli_specify_cert" }; @@ -228,3 +296,66 @@ BOOST_AUTO_TEST_CASE(kdm_cli_specify_cert) BOOST_CHECK(boost::filesystem::exists(kdm_filename)); } + +BOOST_AUTO_TEST_CASE(kdm_cli_time) +{ + ConfigRestorer cr; + + setup_test_config(); + + boost::filesystem::path kdm_filename = "build/test/KDM_Test_FTR-1_F-133_XX-XX_MOS_2K_20220109_SMPTE_OV_Deans_Screens_Screen_2.xml"; + + boost::system::error_code ec; + boost::filesystem::remove(kdm_filename, ec); + + dcp::LocalTime now; + now.add_days(2); + + vector<string> args = { + "kdm_cli", + "--verbose", + "--valid-from", now.as_string(), + "--valid-duration", "2 weeks", + "-c", "Dean's Screens", + "-S", "Screen 2", + "-o", "build/test", + "test/data/dkdm.xml" + }; + + vector<string> output; + auto error = run(args, output); + BOOST_CHECK(!error); + + BOOST_REQUIRE_EQUAL(output.size(), 2U); + BOOST_CHECK(boost::algorithm::starts_with(output[0], "Making KDMs valid from")); + BOOST_CHECK_EQUAL(output[1], "Wrote 1 KDM files to build/test"); + + BOOST_CHECK(boost::filesystem::exists(kdm_filename)); +} + + +BOOST_AUTO_TEST_CASE(kdm_cli_add_dkdm) +{ + ConfigRestorer cr; + + setup_test_config(); + + BOOST_CHECK_EQUAL(Config::instance()->dkdms()->children().size(), 0U); + + vector<string> args = { + "kdm_cli", + "add-dkdm", + "test/data/dkdm.xml" + }; + + vector<string> output; + auto error = run(args, output); + BOOST_CHECK(!error); + + auto dkdms = Config::instance()->dkdms()->children(); + BOOST_CHECK_EQUAL(dkdms.size(), 1U); + auto dkdm = dynamic_pointer_cast<DKDM>(dkdms.front()); + BOOST_CHECK(dkdm); + BOOST_CHECK_EQUAL(dkdm->dkdm().as_xml(), dcp::file_to_string("test/data/dkdm.xml")); +} + diff --git a/test/kdm_naming_test.cc b/test/kdm_naming_test.cc index 32500553e..0f44fe2ea 100644 --- a/test/kdm_naming_test.cc +++ b/test/kdm_naming_test.cc @@ -59,16 +59,14 @@ BOOST_AUTO_TEST_CASE (single_kdm_naming_test) auto crypt_cert = c->decryption_chain()->leaf(); - /* Cinema A: UTC +4:30 */ - auto cinema_a = make_shared<Cinema>("Cinema A", vector<string>(), "", 4, 30); + auto cinema_a = make_shared<Cinema>("Cinema A", vector<string>(), ""); cinema_a_screen_1 = std::make_shared<dcpomatic::Screen>("Screen 1", "", crypt_cert, boost::none, vector<TrustedDevice>()); cinema_a->add_screen (cinema_a_screen_1); cinema_a_screen_2 = std::make_shared<dcpomatic::Screen>("Screen 2", "", crypt_cert, boost::none, vector<TrustedDevice>()); cinema_a->add_screen (cinema_a_screen_2); c->add_cinema (cinema_a); - /* Cinema B: UTC -1:00 */ - auto cinema_b = make_shared<Cinema>("Cinema B", vector<string>(), "", -1, 0); + auto cinema_b = make_shared<Cinema>("Cinema B", vector<string>(), ""); cinema_b_screen_x = std::make_shared<dcpomatic::Screen>("Screen X", "", crypt_cert, boost::none, vector<TrustedDevice>()); cinema_b->add_screen (cinema_b_screen_x); cinema_b_screen_y = std::make_shared<dcpomatic::Screen>("Screen Y", "", crypt_cert, boost::none, vector<TrustedDevice>()); @@ -90,14 +88,13 @@ BOOST_AUTO_TEST_CASE (single_kdm_naming_test) auto sign_cert = c->signer_chain()->leaf(); - dcp::LocalTime from (sign_cert.not_before()); + dcp::LocalTime from = sign_cert.not_before(); + from.set_offset({ 4, 30 }); from.add_months (2); - dcp::LocalTime until (sign_cert.not_after()); + dcp::LocalTime until = sign_cert.not_after(); + until.set_offset({ 4, 30 }); until.add_months (-2); - auto const from_string = from.date() + " " + from.time_of_day(true, false); - auto const until_string = until.date() + " " + until.time_of_day(true, false); - std::vector<KDMCertificatePeriod> period_checks; auto cpl = cpls.front().cpl_file; @@ -107,8 +104,8 @@ BOOST_AUTO_TEST_CASE (single_kdm_naming_test) auto kdm = kdm_for_screen ( make_kdm, cinema_a_screen_1, - boost::posix_time::time_from_string(from_string), - boost::posix_time::time_from_string(until_string), + from, + until, dcp::Formulation::MODIFIED_TRANSITIONAL_1, false, optional<int>(), @@ -157,9 +154,6 @@ BOOST_AUTO_TEST_CASE (directory_kdm_naming_test, * boost::unit_test::depends_on( dcp::LocalTime until (sign_cert.not_after()); until.add_months (-2); - string const from_string = from.date() + " " + from.time_of_day(true, false); - string const until_string = until.date() + " " + until.time_of_day(true, false); - vector<shared_ptr<dcpomatic::Screen>> screens = { cinema_a_screen_2, cinema_b_screen_x, cinema_a_screen_1, (cinema_b_screen_z) }; @@ -178,8 +172,8 @@ BOOST_AUTO_TEST_CASE (directory_kdm_naming_test, * boost::unit_test::depends_on( auto kdm = kdm_for_screen ( make_kdm, i, - boost::posix_time::time_from_string(from_string), - boost::posix_time::time_from_string(until_string), + from, + until, dcp::Formulation::MODIFIED_TRANSITIONAL_1, false, optional<int>(), diff --git a/test/low_bitrate_test.cc b/test/low_bitrate_test.cc index 7050dd771..52b8d54be 100644 --- a/test/low_bitrate_test.cc +++ b/test/low_bitrate_test.cc @@ -31,6 +31,7 @@ extern "C" { using std::make_shared; +using namespace dcpomatic; BOOST_AUTO_TEST_CASE (low_bitrate_test) @@ -51,7 +52,7 @@ BOOST_AUTO_TEST_CASE (low_bitrate_test) boost::optional<ColourConversion>(), VideoRange::FULL, std::weak_ptr<Content>(), - boost::optional<Frame>(), + boost::optional<ContentTime>(), false ); diff --git a/test/map_cli_test.cc b/test/map_cli_test.cc index ed2a7e5ec..0600de31e 100644 --- a/test/map_cli_test.cc +++ b/test/map_cli_test.cc @@ -466,6 +466,7 @@ BOOST_AUTO_TEST_CASE(map_with_given_config) }; boost::filesystem::remove_all(out); + boost::filesystem::remove_all("test/data/map_with_given_config/2.18"); Config::instance()->drop(); vector<string> output_messages; diff --git a/test/player_test.cc b/test/player_test.cc index 5120c0180..530dfc770 100644 --- a/test/player_test.cc +++ b/test/player_test.cc @@ -54,6 +54,7 @@ using std::cout; using std::list; using std::shared_ptr; using std::make_shared; +using std::vector; using boost::bind; using boost::optional; #if BOOST_VERSION >= 106100 @@ -710,3 +711,31 @@ BOOST_AUTO_TEST_CASE(three_d_in_two_d_chooses_left) while (!player->pass()) {} } + +BOOST_AUTO_TEST_CASE(check_seek_with_no_video) +{ + auto content = content_factory(TestPaths::private_data() / "Fight.Club.1999.720p.BRRip.x264-x0r.srt")[0]; + auto film = new_test_film2("check_seek_with_no_video", { content }); + auto player = std::make_shared<Player>(film, film->playlist()); + + boost::signals2::signal<void (std::shared_ptr<PlayerVideo>, dcpomatic::DCPTime)> Video; + + optional<dcpomatic::DCPTime> earliest; + + player->Video.connect( + [&earliest](shared_ptr<PlayerVideo>, dcpomatic::DCPTime time) { + if (!earliest || time < *earliest) { + earliest = time; + } + }); + + player->seek(dcpomatic::DCPTime::from_seconds(60 * 60), false); + + for (int i = 0; i < 10; ++i) { + player->pass(); + } + + BOOST_REQUIRE(earliest); + BOOST_CHECK(*earliest >= dcpomatic::DCPTime(60 * 60)); +} + diff --git a/test/reels_test.cc b/test/reels_test.cc index d4a783f91..df4bbbbe6 100644 --- a/test/reels_test.cc +++ b/test/reels_test.cc @@ -54,6 +54,14 @@ using std::vector; using namespace dcpomatic; +static +void +filter_ok(std::vector<dcp::VerificationNote>& notes) +{ + notes.erase(std::remove_if(notes.begin(), notes.end(), [](dcp::VerificationNote const& note) { return note.type() == dcp::VerificationNote::Type::OK; }), notes.end()); +} + + /** Test Film::reels() */ BOOST_AUTO_TEST_CASE (reels_test1) { @@ -508,9 +516,10 @@ BOOST_AUTO_TEST_CASE (reels_should_not_be_short1) make_and_verify_dcp (film); vector<boost::filesystem::path> dirs = { film->dir(film->dcp_name(false)) }; - auto notes = dcp::verify(dirs, {}, boost::bind(&no_op), boost::bind(&no_op), {}, TestPaths::xsd()); - dump_notes (notes); - BOOST_REQUIRE (notes.empty()); + auto result = dcp::verify(dirs, {}, boost::bind(&no_op), boost::bind(&no_op), {}, TestPaths::xsd()); + filter_ok(result.notes); + dump_notes(result.notes); + BOOST_REQUIRE(result.notes.empty()); } @@ -533,9 +542,10 @@ BOOST_AUTO_TEST_CASE (reels_should_not_be_short2) make_and_verify_dcp (film); vector<boost::filesystem::path> dirs = { film->dir(film->dcp_name(false)) }; - auto const notes = dcp::verify(dirs, {}, boost::bind(&no_op), boost::bind(&no_op), {}, TestPaths::xsd()); - dump_notes (notes); - BOOST_REQUIRE (notes.empty()); + auto result = dcp::verify(dirs, {}, boost::bind(&no_op), boost::bind(&no_op), {}, TestPaths::xsd()); + filter_ok(result.notes); + dump_notes(result.notes); + BOOST_REQUIRE(result.notes.empty()); } @@ -554,9 +564,10 @@ BOOST_AUTO_TEST_CASE (reels_should_not_be_short3) make_and_verify_dcp (film); - auto const notes = dcp::verify({}, {}, boost::bind(&no_op), boost::bind(&no_op), {}, TestPaths::xsd()); - dump_notes (notes); - BOOST_REQUIRE (notes.empty()); + auto result = dcp::verify({}, {}, boost::bind(&no_op), boost::bind(&no_op), {}, TestPaths::xsd()); + filter_ok(result.notes); + dump_notes(result.notes); + BOOST_REQUIRE(result.notes.empty()); } @@ -584,9 +595,10 @@ BOOST_AUTO_TEST_CASE (reels_should_not_be_short4) BOOST_REQUIRE (!wait_for_jobs()); vector<boost::filesystem::path> dirs = { film->dir(film->dcp_name(false)) }; - auto const notes = dcp::verify(dirs, {}, boost::bind(&no_op), boost::bind(&no_op), {}, TestPaths::xsd()); - dump_notes (notes); - BOOST_REQUIRE (notes.empty()); + auto result = dcp::verify(dirs, {}, boost::bind(&no_op), boost::bind(&no_op), {}, TestPaths::xsd()); + filter_ok(result.notes); + dump_notes(result.notes); + BOOST_REQUIRE(result.notes.empty()); } diff --git a/test/remake_with_subtitle_test.cc b/test/remake_with_subtitle_test.cc index 57322d3ac..70d38c1eb 100644 --- a/test/remake_with_subtitle_test.cc +++ b/test/remake_with_subtitle_test.cc @@ -48,5 +48,9 @@ BOOST_AUTO_TEST_CASE (remake_with_subtitle_test) content->only_text()->set_use (false); make_and_verify_dcp (film); - check_one_frame (film->dir(film->dcp_name()), 325, TestPaths::private_data() / "prophet_frame_325_no_subs.j2c"); +#ifdef DCPOMATIC_OSX + check_one_frame(film->dir(film->dcp_name()), 325, TestPaths::private_data() / "v2.18.x" / "prophet_frame_325_no_subs_mac.j2c"); +#else + check_one_frame(film->dir(film->dcp_name()), 325, TestPaths::private_data() / "v2.18.x" / "prophet_frame_325_no_subs.j2c"); +#endif } diff --git a/test/shuffler_test.cc b/test/shuffler_test.cc index 2099a0923..37d6749c3 100644 --- a/test/shuffler_test.cc +++ b/test/shuffler_test.cc @@ -33,14 +33,15 @@ using boost::optional; #if BOOST_VERSION >= 106100 using namespace boost::placeholders; #endif +using namespace dcpomatic; static void -push (Shuffler& s, int frame, Eyes eyes) +push(Shuffler& s, int frame, Eyes eyes) { auto piece = make_shared<Piece>(shared_ptr<Content>(), shared_ptr<Decoder>(), FrameRateChange(24, 24)); ContentVideo cv; - cv.frame = frame; + cv.time = ContentTime::from_frames(frame, 24); cv.eyes = eyes; s.video (piece, cv); } @@ -56,8 +57,9 @@ receive (weak_ptr<Piece>, ContentVideo cv) static void check (int frame, Eyes eyes, int line) { + auto const time = ContentTime::from_frames(frame, 24); BOOST_REQUIRE_MESSAGE (!pending_cv.empty(), "Check at " << line << " failed."); - BOOST_CHECK_MESSAGE (pending_cv.front().frame == frame, "Check at " << line << " failed."); + BOOST_CHECK_MESSAGE (pending_cv.front().time == time, "Check at " << line << " failed."); BOOST_CHECK_MESSAGE (pending_cv.front().eyes == eyes, "Check at " << line << " failed."); pending_cv.pop_front(); } diff --git a/test/stream_test.cc b/test/stream_test.cc index a180739ab..ecd2deac8 100644 --- a/test/stream_test.cc +++ b/test/stream_test.cc @@ -43,38 +43,38 @@ BOOST_AUTO_TEST_CASE (stream_test) { xmlpp::Document doc; auto root = doc.create_root_node("FFmpegAudioStream"); - root->add_child("Name")->add_child_text ("hello there world"); - root->add_child("Id")->add_child_text ("4"); - root->add_child("FrameRate")->add_child_text ("44100"); - root->add_child("Channels")->add_child_text ("2"); + cxml::add_text_child(root, "Name", "hello there world"); + cxml::add_text_child(root, "Id", "4"); + cxml::add_text_child(root, "FrameRate", "44100"); + cxml::add_text_child(root, "Channels", "2"); /* This is the state file version 5 description of the mapping */ - auto mapping = root->add_child("Mapping"); - mapping->add_child("ContentChannels")->add_child_text ("2"); + auto mapping = cxml::add_child(root, "Mapping"); + cxml::add_text_child(mapping, "ContentChannels", "2"); { /* L -> L */ - auto map = mapping->add_child("Map"); - map->add_child("ContentIndex")->add_child_text ("0"); - map->add_child("DCP")->add_child_text ("0"); + auto map = cxml::add_child(mapping, "Map"); + cxml::add_text_child(map, "ContentIndex", "0"); + cxml::add_text_child(map, "DCP", "0"); } { /* L -> C */ - auto map = mapping->add_child("Map"); - map->add_child("ContentIndex")->add_child_text ("0"); - map->add_child("DCP")->add_child_text ("2"); + auto map = cxml::add_child(mapping, "Map"); + cxml::add_text_child(map, "ContentIndex", "0"); + cxml::add_text_child(map, "DCP", "2"); } { /* R -> R */ - auto map = mapping->add_child("Map"); - map->add_child("ContentIndex")->add_child_text ("1"); - map->add_child("DCP")->add_child_text ("1"); + auto map = cxml::add_child(mapping, "Map"); + cxml::add_text_child(map, "ContentIndex", "1"); + cxml::add_text_child(map, "DCP", "1"); } { /* R -> C */ - auto map = mapping->add_child("Map"); - map->add_child("ContentIndex")->add_child_text ("1"); - map->add_child("DCP")->add_child_text ("2"); + auto map = cxml::add_child(mapping, "Map"); + cxml::add_text_child(map, "ContentIndex", "1"); + cxml::add_text_child(map, "DCP", "2"); } FFmpegAudioStream a (cxml::NodePtr (new cxml::Node (root)), 5); diff --git a/test/test.cc b/test/test.cc index fc5d9dc83..4064f9b0e 100644 --- a/test/test.cc +++ b/test/test.cc @@ -163,11 +163,21 @@ struct TestConfig setup_test_config (); capture_ffmpeg_logs(); - EncodeServerFinder::instance()->stop (); + EncodeServerFinder::drop(); signal_manager = new TestSignalManager (); dcpomatic_log.reset (new FileLog("build/test/log")); + + auto const& suite = boost::unit_test::framework::master_test_suite(); + int types = LogEntry::TYPE_GENERAL | LogEntry::TYPE_WARNING | LogEntry::TYPE_ERROR; + for (int i = 1; i < suite.argc; ++i) { + if (string(suite.argv[i]) == "--log=debug-player") { + types |= LogEntry::TYPE_DEBUG_PLAYER; + } + } + + dcpomatic_log->set_types(types); } ~TestConfig () @@ -277,13 +287,14 @@ check_wav_file (boost::filesystem::path ref, boost::filesystem::path check) void check_mxf_audio_file (boost::filesystem::path ref, boost::filesystem::path check) { - ASDCP::PCM::MXFReader ref_reader; + Kumu::FileReaderFactory factory; + ASDCP::PCM::MXFReader ref_reader(factory); BOOST_REQUIRE (!ASDCP_FAILURE (ref_reader.OpenRead (ref.string().c_str()))); ASDCP::PCM::AudioDescriptor ref_desc; BOOST_REQUIRE (!ASDCP_FAILURE (ref_reader.FillAudioDescriptor (ref_desc))); - ASDCP::PCM::MXFReader check_reader; + ASDCP::PCM::MXFReader check_reader(factory); BOOST_REQUIRE (!ASDCP_FAILURE (check_reader.OpenRead (check.string().c_str()))); ASDCP::PCM::AudioDescriptor check_desc; @@ -306,13 +317,14 @@ check_mxf_audio_file (boost::filesystem::path ref, boost::filesystem::path check bool mxf_atmos_files_same (boost::filesystem::path ref, boost::filesystem::path check, bool verbose) { - ASDCP::ATMOS::MXFReader ref_reader; + Kumu::FileReaderFactory factory; + ASDCP::ATMOS::MXFReader ref_reader(factory); BOOST_REQUIRE (!ASDCP_FAILURE(ref_reader.OpenRead(ref.string().c_str()))); ASDCP::ATMOS::AtmosDescriptor ref_desc; BOOST_REQUIRE (!ASDCP_FAILURE(ref_reader.FillAtmosDescriptor(ref_desc))); - ASDCP::ATMOS::MXFReader check_reader; + ASDCP::ATMOS::MXFReader check_reader(factory); BOOST_REQUIRE (!ASDCP_FAILURE(check_reader.OpenRead(check.string().c_str()))); ASDCP::ATMOS::AtmosDescriptor check_desc; @@ -574,7 +586,7 @@ check_dcp(boost::filesystem::path ref, boost::filesystem::path check, bool sound } void -check_xml (xmlpp::Element* ref, xmlpp::Element* test, list<string> ignore) +check_xml(xmlpp::Element* ref, xmlpp::Element* test, list<Glib::ustring> ignore) { BOOST_CHECK_EQUAL (ref->get_name (), test->get_name ()); BOOST_CHECK_EQUAL (ref->get_namespace_prefix (), test->get_namespace_prefix ()); @@ -630,7 +642,7 @@ check_xml (xmlpp::Element* ref, xmlpp::Element* test, list<string> ignore) } void -check_xml (boost::filesystem::path ref, boost::filesystem::path test, list<string> ignore) +check_xml(boost::filesystem::path ref, boost::filesystem::path test, list<Glib::ustring> ignore) { auto ref_parser = new xmlpp::DomParser(ref.string()); auto ref_root = ref_parser->get_document()->get_root_node(); @@ -820,19 +832,22 @@ check_one_frame (boost::filesystem::path dcp_dir, int64_t index, boost::filesyst auto asset = dynamic_pointer_cast<dcp::MonoPictureAsset> (dcp.cpls().front()->reels().front()->main_picture()->asset()); BOOST_REQUIRE (asset); auto frame = asset->start_read()->get_frame(index); - auto ref_frame (new dcp::MonoPictureFrame (ref)); + dcp::MonoPictureFrame ref_frame(ref); auto image = frame->xyz_image (); - auto ref_image = ref_frame->xyz_image (); + auto ref_image = ref_frame.xyz_image(); BOOST_REQUIRE (image->size() == ref_image->size()); int off = 0; for (int y = 0; y < ref_image->size().height; ++y) { for (int x = 0; x < ref_image->size().width; ++x) { - BOOST_REQUIRE_EQUAL (ref_image->data(0)[off], image->data(0)[off]); - BOOST_REQUIRE_EQUAL (ref_image->data(1)[off], image->data(1)[off]); - BOOST_REQUIRE_EQUAL (ref_image->data(2)[off], image->data(2)[off]); + auto x_error = std::abs(ref_image->data(0)[off] - image->data(0)[off]); + BOOST_REQUIRE_MESSAGE(x_error == 0, "x component at " << x << "," << y << " differs by " << x_error); + auto y_error = std::abs(ref_image->data(1)[off] - image->data(1)[off]); + BOOST_REQUIRE_MESSAGE(y_error == 0, "y component at " << x << "," << y << " differs by " << y_error); + auto z_error = std::abs(ref_image->data(2)[off] - image->data(2)[off]); + BOOST_REQUIRE_MESSAGE(z_error == 0, "z component at " << x << "," << y << " differs by " << z_error); ++off; } } @@ -950,10 +965,10 @@ void progress (float) {} void verify_dcp(boost::filesystem::path dir, vector<dcp::VerificationNote::Code> ignore) { - auto notes = dcp::verify({dir}, {}, &stage, &progress, {}, TestPaths::xsd()); + auto result = dcp::verify({dir}, {}, &stage, &progress, {}, TestPaths::xsd()); bool ok = true; - for (auto i: notes) { - if (find(ignore.begin(), ignore.end(), i.code()) == ignore.end()) { + for (auto i: result.notes) { + if (i.type() != dcp::VerificationNote::Type::OK && find(ignore.begin(), ignore.end(), i.code()) == ignore.end()) { std::cout << "\t" << dcp::note_to_string(i) << "\n"; ok = false; } diff --git a/test/test.h b/test/test.h index 6687affea..0776d6e5a 100644 --- a/test/test.h +++ b/test/test.h @@ -22,6 +22,7 @@ #include "lib/video_frame_type.h" #include <dcp/types.h> #include <dcp/verify.h> +#include <glibmm.h> #include <boost/filesystem.hpp> #include <vector> @@ -66,7 +67,7 @@ extern void check_text_file (boost::filesystem::path ref, boost::filesystem::pat extern void check_wav_file (boost::filesystem::path ref, boost::filesystem::path check); extern void check_mxf_audio_file (boost::filesystem::path ref, boost::filesystem::path check); extern bool mxf_atmos_files_same (boost::filesystem::path ref, boost::filesystem::path check, bool verbose = false); -extern void check_xml (boost::filesystem::path, boost::filesystem::path, std::list<std::string>); +extern void check_xml(boost::filesystem::path, boost::filesystem::path, std::list<Glib::ustring>); extern void check_ffmpeg (boost::filesystem::path, boost::filesystem::path, int audio_tolerance); extern void check_image (boost::filesystem::path, boost::filesystem::path, double threshold = 4); extern boost::filesystem::path test_film_dir (std::string); diff --git a/test/text_entry_point_test.cc b/test/text_entry_point_test.cc new file mode 100644 index 000000000..ce4f6148e --- /dev/null +++ b/test/text_entry_point_test.cc @@ -0,0 +1,70 @@ +/* + 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 "test.h" +#include "lib/dcp_content.h" +#include "lib/film.h" +#include <dcp/cpl.h> +#include <dcp/dcp.h> +#include <dcp/reel.h> +#include <dcp/reel_smpte_subtitle_asset.h> +#include <dcp/smpte_subtitle_asset.h> +#include <boost/test/unit_test.hpp> + + +using std::make_shared; +using std::string; + + +BOOST_AUTO_TEST_CASE(test_text_entry_point) +{ + auto const path = boost::filesystem::path("build/test/test_text_entry_point"); + boost::filesystem::remove_all(path); + boost::filesystem::create_directories(path); + + /* Make a "bad" DCP with a non-zero text entry point */ + dcp::DCP bad_dcp(path / "dcp"); + auto sub = make_shared<dcp::SMPTESubtitleAsset>(); + sub->write(path / "dcp" / "subs.mxf"); + auto reel_sub = make_shared<dcp::ReelSMPTESubtitleAsset>(sub, dcp::Fraction{24, 1}, 42, 6); + auto reel = make_shared<dcp::Reel>(); + reel->add(reel_sub); + + auto cpl = make_shared<dcp::CPL>("foo", dcp::ContentKind::FEATURE, dcp::Standard::SMPTE); + bad_dcp.add(cpl); + cpl->add(reel); + + bad_dcp.write_xml(); + + /* Make a film and add the bad DCP, so that the examiner spots the problem */ + auto dcp_content = make_shared<DCPContent>(path / "dcp"); + auto film = new_test_film2("test_text_entry_point/film", { dcp_content }); + film->write_metadata(); + + /* Reload the film to check that the examiner's output is saved and recovered */ + auto film2 = make_shared<Film>(path / "film"); + film2->read_metadata(); + + string why_not; + BOOST_CHECK(!dcp_content->can_reference_text(film2, TextType::OPEN_SUBTITLE, why_not)); + BOOST_CHECK_EQUAL(why_not, "one of its subtitle reels has a non-zero entry point so it must be re-written."); +} + diff --git a/test/torture_test.cc b/test/torture_test.cc index 0c781fdb1..8e6a516bd 100644 --- a/test/torture_test.cc +++ b/test/torture_test.cc @@ -248,7 +248,7 @@ BOOST_AUTO_TEST_CASE (torture_test1) for (int c = 0; c < 3; ++c) { for (int y = 0; y < size.height; ++y) { for (int x = 0; x < size.width; ++x) { - BOOST_REQUIRE (image->data(c)[y * size.height + x] <= 3); + BOOST_REQUIRE (image->data(c)[y * size.height + x] <= 5); } } } diff --git a/test/video_level_test.cc b/test/video_level_test.cc index e2419d8e7..0ff2c4732 100644 --- a/test/video_level_test.cc +++ b/test/video_level_test.cc @@ -480,7 +480,7 @@ BOOST_AUTO_TEST_CASE (movie_V_to_dcp) { auto range = dcp_range (movie_V("movie_V_to_dcp")); /* Video range has been correctly expanded to full for the DCP */ - check_int_close (range, {0, 4083}, 2); + check_int_close(range, {0, 4081}, 2); } @@ -498,7 +498,7 @@ BOOST_AUTO_TEST_CASE (movie_F_to_dcp) { auto range = dcp_range (movie_F("movie_F_to_dcp")); /* The nearly-full-range of the input has been preserved */ - check_int_close (range, {0, 4083}, 2); + check_int_close(range, {0, 4080}, 2); } @@ -506,14 +506,14 @@ BOOST_AUTO_TEST_CASE (video_FoV_to_dcp) { auto range = dcp_range (movie_FoV("video_FoV_to_dcp")); /* The nearly-full-range of the input has become even more full, and clipped */ - check_int_close (range, {0, 4095}, 2); + check_int_close(range, {0, 4093}, 2); } BOOST_AUTO_TEST_CASE (image_F_to_dcp) { auto range = dcp_range (image_F("image_F_to_dcp")); - check_int_close (range, {0, 4083}, 3); + check_int_close(range, {0, 4080}, 3); } diff --git a/test/wscript b/test/wscript index bb66d1a5f..eb8901338 100644 --- a/test/wscript +++ b/test/wscript @@ -112,6 +112,7 @@ def build(bld): interrupt_encoder_test.cc isdcf_name_test.cc j2k_bandwidth_test.cc + j2k_encode_threading_test.cc job_manager_test.cc kdm_cli_test.cc kdm_naming_test.cc @@ -161,6 +162,7 @@ def build(bld): template_test.cc test.cc text_decoder_test.cc + text_entry_point_test.cc threed_test.cc time_calculation_test.cc torture_test.cc |
