diff options
| author | Carl Hetherington <cth@carlh.net> | 2023-10-14 21:48:25 +0200 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2023-10-15 09:10:18 +0200 |
| commit | 3c802dd6d1451c2c8a7e188f8379738d72e907eb (patch) | |
| tree | 454396cf5451535b8708a0c4961c7d5c2b30ea1f /test/writer_test.cc | |
| parent | 1bfe44b1503fb0f5cffda135076709014337de52 (diff) | |
Fix DCP content font ID allocation to cope with DCPs that have multiple fonts
with the same name in the same reel (#2600).
Previously we had this id_for_font_in_reel() which would give an ID
of N_font-ID. This means we got duplicate font IDs.
Here we replace that method with FontAllocator, which gives an ID of
N_font-ID for the first font and M_font-ID, where M is a number higher than
the highest reel index. The idea is to support the required new IDs
without breaking exisiting projects.
There is some documentation of how it works in doc/design/fonts
Diffstat (limited to 'test/writer_test.cc')
| -rw-r--r-- | test/writer_test.cc | 60 |
1 files changed, 0 insertions, 60 deletions
diff --git a/test/writer_test.cc b/test/writer_test.cc index d5cafe1fb..7b2a2db00 100644 --- a/test/writer_test.cc +++ b/test/writer_test.cc @@ -101,63 +101,3 @@ BOOST_AUTO_TEST_CASE (interrupt_writer) dcpomatic_sleep_seconds (1); cl.run (); } - - -BOOST_AUTO_TEST_CASE (writer_disambiguate_font_ids1) -{ - auto film = new_test_film2("writer_disambiguate_font_ids1", {}); - Writer writer(film, {}); - - auto fonts = vector<shared_ptr<dcpomatic::Font>> { - make_shared<dcpomatic::Font>("a"), - make_shared<dcpomatic::Font>("b"), - make_shared<dcpomatic::Font>("c") - }; - - writer.write(fonts); - - BOOST_CHECK_EQUAL(writer._fonts.get(fonts[0]), "a"); - BOOST_CHECK_EQUAL(writer._fonts.get(fonts[1]), "b"); - BOOST_CHECK_EQUAL(writer._fonts.get(fonts[2]), "c"); -} - - -BOOST_AUTO_TEST_CASE (writer_disambiguate_font_ids2) -{ - auto film = new_test_film2("writer_disambiguate_font_ids2", {}); - Writer writer(film, {}); - - auto fonts = vector<shared_ptr<dcpomatic::Font>> { - make_shared<dcpomatic::Font>("a"), - make_shared<dcpomatic::Font>("a"), - make_shared<dcpomatic::Font>("a") - }; - - writer.write(fonts); - - BOOST_CHECK_EQUAL(writer._fonts.get(fonts[0]), "a"); - BOOST_CHECK_EQUAL(writer._fonts.get(fonts[1]), "a_0"); - BOOST_CHECK_EQUAL(writer._fonts.get(fonts[2]), "a_1"); -} - - -BOOST_AUTO_TEST_CASE (writer_disambiguate_font_ids3) -{ - auto film = new_test_film2("writer_disambiguate_font_ids3", {}); - Writer writer(film, {}); - - auto fonts = vector<shared_ptr<dcpomatic::Font>> { - make_shared<dcpomatic::Font>("a_2"), - make_shared<dcpomatic::Font>("a_1"), - make_shared<dcpomatic::Font>("a_1"), - make_shared<dcpomatic::Font>("b") - }; - - writer.write(fonts); - - BOOST_CHECK_EQUAL(writer._fonts.get(fonts[1]), "a_1"); - BOOST_CHECK_EQUAL(writer._fonts.get(fonts[0]), "a_2"); - BOOST_CHECK_EQUAL(writer._fonts.get(fonts[2]), "a_3"); - BOOST_CHECK_EQUAL(writer._fonts.get(fonts[3]), "b"); -} - |
