@@ -24,9 +24,6 @@ using ift::freq::UnigramProbabilityCalculator;
2424
2525namespace ift ::encoder {
2626
27- // TODO XXXXX add full roboto type test which uses the alternate closure analysis modes.
28- // verify result is the same as pure closure.
29-
3027class ClosureGlyphSegmenterTest : public ::testing::Test {
3128 protected:
3229 ClosureGlyphSegmenterTest ()
@@ -35,7 +32,8 @@ class ClosureGlyphSegmenterTest : public ::testing::Test {
3532 noto_sans_jp(make_hb_face(nullptr )),
3633 segmenter(8 , 8 , PATCH, CLOSURE_ONLY),
3734 segmenter_find_conditions(8 , 8 , FIND_CONDITIONS, CLOSURE_ONLY),
38- segmenter_move_to_init_font(8 , 8 , MOVE_TO_INIT_FONT, CLOSURE_ONLY) {
35+ segmenter_move_to_init_font(8 , 8 , MOVE_TO_INIT_FONT, CLOSURE_ONLY),
36+ segmenter_dep_graph(8 , 8 , PATCH, CLOSURE_AND_DEP_GRAPH) {
3937 roboto = from_file (" common/testdata/Roboto-Regular.ttf" );
4038 noto_nastaliq_urdu =
4139 from_file (" common/testdata/NotoNastaliqUrdu.subset.ttf" );
@@ -59,6 +57,7 @@ class ClosureGlyphSegmenterTest : public ::testing::Test {
5957 ClosureGlyphSegmenter segmenter;
6058 ClosureGlyphSegmenter segmenter_find_conditions;
6159 ClosureGlyphSegmenter segmenter_move_to_init_font;
60+ ClosureGlyphSegmenter segmenter_dep_graph;
6261};
6362
6463TEST_F (ClosureGlyphSegmenterTest, SimpleSegmentation) {
@@ -515,7 +514,7 @@ if ((s2 OR s3)) then p5
515514)" );
516515}
517516
518- TEST_F (ClosureGlyphSegmenterTest, FullRoboto_WithFeatures ) {
517+ TEST_F (ClosureGlyphSegmenterTest, FullRoboto_WithFeaturesAndDepGraph ) {
519518 auto codepoints = common::FontHelper::ToCodepointsSet (roboto.get ());
520519
521520 uint32_t num_segments = 412 ;
@@ -545,6 +544,14 @@ TEST_F(ClosureGlyphSegmenterTest, FullRoboto_WithFeatures) {
545544 auto segmentation = segmenter.CodepointToGlyphSegments (
546545 roboto.get (), {}, segments, MergeStrategy::Heuristic (4000 , 12000 ));
547546 ASSERT_TRUE (segmentation.ok ()) << segmentation.status ();
547+
548+ auto segmentation_dep_graph = segmenter_dep_graph.CodepointToGlyphSegments (
549+ roboto.get (), {}, segments, MergeStrategy::Heuristic (4000 , 12000 ));
550+ ASSERT_TRUE (segmentation_dep_graph.ok ()) << segmentation_dep_graph.status ();
551+
552+ // Dep graph should produce identical results.
553+ ASSERT_EQ (segmentation->Segments (), segmentation_dep_graph->Segments ());
554+ ASSERT_EQ (segmentation->GidSegments (), segmentation_dep_graph->GidSegments ());
548555}
549556
550557TEST_F (ClosureGlyphSegmenterTest, CostRequiresFrequencies) {
0 commit comments