diff options
| author | Carl Hetherington <cth@carlh.net> | 2024-06-10 01:05:43 +0200 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2024-06-11 09:52:28 +0200 |
| commit | a224ef26f48e1a9a9189c2b935abb06147b342bc (patch) | |
| tree | 86d3facabe1beb33d87fa99c35200abc9ac8cb4f /test | |
| parent | f37099ba3e9157c3ef74ffcc87c34d3fc54ccfe5 (diff) | |
Simplify the FontIDAllocator a lot (#2827).
This is at the expense of forward compatibility, and the need to
re-examine subtitle content (losing custom fonts as we do so).
But it does mean that the code is simpler, and there's not this weird
growth of IDs where a DCP gets imported with some font, and then the ID
becomes 0_font, and if you do it again it's 0_0_font, and so on.
Diffstat (limited to 'test')
| m--------- | test/data | 0 | ||||
| -rw-r--r-- | test/dcp_subtitle_test.cc | 2 | ||||
| -rw-r--r-- | test/font_id_allocator_test.cc | 19 | ||||
| -rw-r--r-- | test/hints_test.cc | 2 | ||||
| -rw-r--r-- | test/subtitle_font_id_test.cc | 4 |
5 files changed, 13 insertions, 14 deletions
diff --git a/test/data b/test/data -Subproject 722dd8023aa1f4657328aa228ea146679cf7fab +Subproject 7a5254c53354ea8aaa5c60ae44965e510dd9651 diff --git a/test/dcp_subtitle_test.cc b/test/dcp_subtitle_test.cc index f7a9450f5..22e4fd9ff 100644 --- a/test/dcp_subtitle_test.cc +++ b/test/dcp_subtitle_test.cc @@ -232,7 +232,7 @@ BOOST_AUTO_TEST_CASE (test_font_override) content->only_text()->set_language(dcp::LanguageTag("de")); BOOST_REQUIRE_EQUAL(content->text.size(), 1U); - auto font = content->text.front()->get_font("0_theFontId"); + auto font = content->text.front()->get_font("theFontId"); BOOST_REQUIRE(font); font->set_file("test/data/Inconsolata-VF.ttf"); diff --git a/test/font_id_allocator_test.cc b/test/font_id_allocator_test.cc index 07110346b..19c4a2154 100644 --- a/test/font_id_allocator_test.cc +++ b/test/font_id_allocator_test.cc @@ -43,12 +43,12 @@ BOOST_AUTO_TEST_CASE(font_id_allocator_test_without_disambiguation) allocator.allocate(); - BOOST_CHECK(allocator.font_id(0, "asset1", "font") == "0_font"); - BOOST_CHECK(allocator.font_id(0, "asset1", "font2") == "0_font2"); - BOOST_CHECK(allocator.font_id(1, "asset2", "font") == "1_font"); - BOOST_CHECK(allocator.font_id(1, "asset2", "font2") == "1_font2"); - BOOST_CHECK(allocator.font_id(1, "asset3", "font3") == "1_font3"); - BOOST_CHECK(allocator.font_id(1, "asset3", "font4") == "1_font4"); + BOOST_CHECK_EQUAL(allocator.font_id(0, "asset1", "font"), "font"); + BOOST_CHECK_EQUAL(allocator.font_id(0, "asset1", "font2"), "font2"); + BOOST_CHECK_EQUAL(allocator.font_id(1, "asset2", "font"), "0_font"); + BOOST_CHECK_EQUAL(allocator.font_id(1, "asset2", "font2"), "0_font2"); + BOOST_CHECK_EQUAL(allocator.font_id(1, "asset3", "font3"), "font3"); + BOOST_CHECK_EQUAL(allocator.font_id(1, "asset3", "font4"), "font4"); } @@ -68,10 +68,9 @@ BOOST_AUTO_TEST_CASE(font_id_allocator_test_with_disambiguation) allocator.allocate(); - BOOST_CHECK(allocator.font_id(0, "asset1", "font") == "0_font"); - /* This should get a prefix that is higher than any reel index */ - BOOST_CHECK(allocator.font_id(0, "asset2", "font") == "2_font"); - BOOST_CHECK(allocator.font_id(1, "asset3", "font1") == "1_font1"); + BOOST_CHECK(allocator.font_id(0, "asset1", "font") == "font"); + BOOST_CHECK(allocator.font_id(0, "asset2", "font") == "0_font"); + BOOST_CHECK(allocator.font_id(1, "asset3", "font1") == "font1"); } diff --git a/test/hints_test.cc b/test/hints_test.cc index 8768815ad..56a0964c4 100644 --- a/test/hints_test.cc +++ b/test/hints_test.cc @@ -198,7 +198,7 @@ BOOST_AUTO_TEST_CASE (hint_subtitle_mxf_too_big) content->text[0]->set_language(dcp::LanguageTag("en-US")); film->examine_and_add_content(content); BOOST_REQUIRE (!wait_for_jobs()); - auto const font = content->text[0]->get_font(String::compose("0_font_%1", i)); + auto const font = content->text[0]->get_font(String::compose("font_%1", i)); BOOST_REQUIRE(font); font->set_file("build/test/hint_subtitle_mxf_too_big.ttf"); } diff --git a/test/subtitle_font_id_test.cc b/test/subtitle_font_id_test.cc index a93145163..49ad4ea05 100644 --- a/test/subtitle_font_id_test.cc +++ b/test/subtitle_font_id_test.cc @@ -51,7 +51,7 @@ BOOST_AUTO_TEST_CASE(full_dcp_subtitle_font_id_test) BOOST_REQUIRE_EQUAL(text->fonts().size(), 1U); auto font = text->fonts().front(); - BOOST_CHECK_EQUAL(font->id(), "0_theFontId"); + BOOST_CHECK_EQUAL(font->id(), "theFontId"); BOOST_REQUIRE(font->data()); BOOST_CHECK_EQUAL(font->data()->size(), 367112); } @@ -69,7 +69,7 @@ BOOST_AUTO_TEST_CASE(dcp_subtitle_font_id_test) BOOST_REQUIRE_EQUAL(text->fonts().size(), 1U); auto font = text->fonts().front(); - BOOST_CHECK_EQUAL(font->id(), "0_theFontId"); + BOOST_CHECK_EQUAL(font->id(), "theFontId"); BOOST_REQUIRE(font->data()); BOOST_CHECK_EQUAL(font->data()->size(), 367112); } |
