@@ -27,7 +27,8 @@ class ClosureGlyphSegmenterTest : public ::testing::Test {
2727 protected:
2828 ClosureGlyphSegmenterTest ()
2929 : roboto(make_hb_face(nullptr )),
30- noto_nastaliq_urdu (make_hb_face(nullptr )) {
30+ noto_nastaliq_urdu (make_hb_face(nullptr )),
31+ segmenter(8 , 8 ) {
3132 roboto = from_file (" common/testdata/Roboto-Regular.ttf" );
3233 noto_nastaliq_urdu =
3334 from_file (" common/testdata/NotoNastaliqUrdu.subset.ttf" );
@@ -402,7 +403,7 @@ TEST_F(ClosureGlyphSegmenterTest,
402403 UnmappedGlyphs_FallbackSegmentMovedToInitFont) {
403404 auto segmentation = segmenter.CodepointToGlyphSegments (
404405 noto_nastaliq_urdu.get (), {}, {{0x62a }, {0x62b }, {0x62c }, {0x62d }},
405- btree_map<SegmentSet, MergeStrategy>{}, 8 , true );
406+ btree_map<SegmentSet, MergeStrategy>{}, true );
406407 ASSERT_TRUE (segmentation.ok ()) << segmentation.status ();
407408
408409 ASSERT_EQ (segmentation->UnmappedGlyphs ().size (), 0 );
@@ -789,7 +790,7 @@ TEST_F(ClosureGlyphSegmenterTest, TotalCost) {
789790 GlyphSegmentation::GroupsToSegmentation ({}, {}, {}, {}, segmentation1);
790791 ASSERT_TRUE (sc.ok ()) << sc;
791792
792- ClosureGlyphSegmenter segmenter;
793+ ClosureGlyphSegmenter segmenter ( 8 , 8 ) ;
793794 SegmentationCost base_cost =
794795 *segmenter.TotalCost (roboto.get (), segmentation1, calculator);
795796 ASSERT_GT (base_cost.total_cost , 1000 );
@@ -1071,24 +1072,23 @@ TEST_F(ClosureGlyphSegmenterTest, MultipleMergeGroups) {
10711072 *MergeStrategy::CostBased (std::move (group2_freq), 75 , 2 )},
10721073 };
10731074
1074- auto segmentation =
1075- segmenter.CodepointToGlyphSegments (roboto.get (), {},
1076- {{' a' },
1077- {' b' },
1078- {' c' },
1079- {' d' },
1080- {' e' },
1081- {' f' },
1082- {' g' },
1083- {' h' },
1084- {' i' },
1085- {' j' },
1086- {' k' },
1087- {' l' },
1088- {' m' },
1089- {' n' },
1090- {' o' }},
1091- merge_groups, 8 , false );
1075+ auto segmentation = segmenter.CodepointToGlyphSegments (roboto.get (), {},
1076+ {{' a' },
1077+ {' b' },
1078+ {' c' },
1079+ {' d' },
1080+ {' e' },
1081+ {' f' },
1082+ {' g' },
1083+ {' h' },
1084+ {' i' },
1085+ {' j' },
1086+ {' k' },
1087+ {' l' },
1088+ {' m' },
1089+ {' n' },
1090+ {' o' }},
1091+ merge_groups, false );
10921092 ASSERT_TRUE (segmentation.ok ()) << segmentation.status ();
10931093
10941094 std::vector<SubsetDefinition> expected_segments = {
@@ -1168,24 +1168,23 @@ TEST_F(ClosureGlyphSegmenterTest, MultipleMergeGroups_InitFontMove) {
11681168 {{0 , 1 , 7 , 8 , 9 , 10 , 11 , 12 , 13 , 14 }, s2},
11691169 };
11701170
1171- auto segmentation =
1172- segmenter.CodepointToGlyphSegments (roboto.get (), {},
1173- {{' a' },
1174- {' b' },
1175- {' c' },
1176- {' d' },
1177- {' e' },
1178- {' f' },
1179- {' g' },
1180- {' h' },
1181- {' i' },
1182- {' j' },
1183- {' k' },
1184- {' l' },
1185- {' m' },
1186- {' n' },
1187- {' o' }},
1188- merge_groups, 8 , false );
1171+ auto segmentation = segmenter.CodepointToGlyphSegments (roboto.get (), {},
1172+ {{' a' },
1173+ {' b' },
1174+ {' c' },
1175+ {' d' },
1176+ {' e' },
1177+ {' f' },
1178+ {' g' },
1179+ {' h' },
1180+ {' i' },
1181+ {' j' },
1182+ {' k' },
1183+ {' l' },
1184+ {' m' },
1185+ {' n' },
1186+ {' o' }},
1187+ merge_groups, false );
11891188 ASSERT_TRUE (segmentation.ok ()) << segmentation.status ();
11901189
11911190 // Only segments from the groups that set a threshold are eligible to be moved
@@ -1255,15 +1254,14 @@ TEST_F(ClosureGlyphSegmenterTest, MultipleMergeGroups_CompositesRespectGroups) {
12551254 {{2 , 3 }, *MergeStrategy::CostBased (std::move (group2_freq), 75 , 1 )},
12561255 };
12571256
1258- auto segmentation =
1259- segmenter.CodepointToGlyphSegments (roboto.get (), {},
1260- {
1261- {' f' },
1262- {' g' },
1263- {' i' },
1264- {' j' },
1265- },
1266- merge_groups, 8 , false );
1257+ auto segmentation = segmenter.CodepointToGlyphSegments (roboto.get (), {},
1258+ {
1259+ {' f' },
1260+ {' g' },
1261+ {' i' },
1262+ {' j' },
1263+ },
1264+ merge_groups, false );
12671265 ASSERT_TRUE (segmentation.ok ()) << segmentation.status ();
12681266
12691267 // f + i would normally be a good merge, but here it's skipped since it
@@ -1297,15 +1295,14 @@ TEST_F(ClosureGlyphSegmenterTest, MultipleMergeGroups_Heuristic) {
12971295 {{2 , 3 }, MergeStrategy::Heuristic (10000 )},
12981296 };
12991297
1300- auto segmentation =
1301- segmenter.CodepointToGlyphSegments (roboto.get (), {},
1302- {
1303- {' f' },
1304- {' g' },
1305- {' i' },
1306- {' j' },
1307- },
1308- merge_groups, 8 , false );
1298+ auto segmentation = segmenter.CodepointToGlyphSegments (roboto.get (), {},
1299+ {
1300+ {' f' },
1301+ {' g' },
1302+ {' i' },
1303+ {' j' },
1304+ },
1305+ merge_groups, false );
13091306 ASSERT_TRUE (segmentation.ok ()) << segmentation.status ();
13101307
13111308 // f + i would normally be a good merge, but here it's skipped since it
@@ -1416,7 +1413,7 @@ if (s2) then p2
14161413 {{0 , 1 }, *MergeStrategy::CostBased (std::move (frequencies), 75 , 3 )},
14171414 {{2 }, MergeStrategy::None ()},
14181415 },
1419- 8 , false );
1416+ false );
14201417 ASSERT_TRUE (segmentation.ok ()) << segmentation.status ();
14211418
14221419 ASSERT_EQ (segmentation->ToString (),
0 commit comments