summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2024-06-08 20:18:40 +0200
committerCarl Hetherington <cth@carlh.net>2024-06-08 20:18:40 +0200
commitd80abe28dde8d8579c9ad790a75bd096b8b46ec1 (patch)
tree8cd754a880c54542d47b5a989097a6be9cba0a59 /test
parent1c0dab32ab9185aa082fe281704adef661299126 (diff)
parent2d89772ba5b5bc3b2e010b3bbbafe2efa9300353 (diff)
Merge remote-tracking branch 'origin/main' into v2.17.x
Diffstat (limited to 'test')
-rw-r--r--test/font_id_allocator_test.cc29
1 files changed, 29 insertions, 0 deletions
diff --git a/test/font_id_allocator_test.cc b/test/font_id_allocator_test.cc
index 7c93c6b78..07110346b 100644
--- a/test/font_id_allocator_test.cc
+++ b/test/font_id_allocator_test.cc
@@ -23,6 +23,10 @@
#include <boost/test/unit_test.hpp>
+using std::string;
+using std::vector;
+
+
BOOST_AUTO_TEST_CASE(font_id_allocator_test_without_disambiguation)
{
FontIDAllocator allocator;
@@ -70,3 +74,28 @@ BOOST_AUTO_TEST_CASE(font_id_allocator_test_with_disambiguation)
BOOST_CHECK(allocator.font_id(1, "asset3", "font1") == "1_font1");
}
+
+/* Bug #2822: multiple reels, each with subs + closed captions, and each using the same
+ * basic font ID.
+ */
+BOOST_AUTO_TEST_CASE(font_id_allocator_test_with_disambiguation2)
+{
+ FontIDAllocator allocator;
+
+ allocator.add_font(0, "asset1", "font");
+ allocator.add_font(0, "asset2", "font");
+
+ allocator.add_font(1, "asset1", "font");
+ allocator.add_font(1, "asset2", "font");
+
+ allocator.allocate();
+ vector<string> ids = {
+ allocator.font_id(0, "asset1", "font"),
+ allocator.font_id(0, "asset2", "font"),
+ allocator.font_id(1, "asset1", "font"),
+ allocator.font_id(1, "asset2", "font")
+ };
+
+ std::sort(ids.begin(), ids.end());
+ BOOST_CHECK(std::adjacent_find(ids.begin(), ids.end()) == ids.end());
+}