From c1827995b1c6bea454683cfd21ee6607481db9e0 Mon Sep 17 00:00:00 2001 From: Jason Simmons Date: Tue, 30 Jan 2018 13:30:47 -0800 Subject: [PATCH] libtxt: update some unit tests (flutter/engine#4603) * GetGlyphPositionAtCoordinate maps points within the right half of a glyph to the next position * The second pass in RepeatLayoutParagraph was at the borderline between 5 and 6 lines in the Minikin line breaker. Add text to ensure that the text fills 12 lines at half width and 6 lines at full width. --- .../src/flutter/third_party/txt/tests/paragraph_unittests.cc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/engine/src/flutter/third_party/txt/tests/paragraph_unittests.cc b/engine/src/flutter/third_party/txt/tests/paragraph_unittests.cc index 754c094995..e0234e97b3 100644 --- a/engine/src/flutter/third_party/txt/tests/paragraph_unittests.cc +++ b/engine/src/flutter/third_party/txt/tests/paragraph_unittests.cc @@ -902,7 +902,7 @@ TEST_F(ParagraphTest, GetGlyphPositionAtCoordinateParagraph) { 36ull); ASSERT_EQ(paragraph->GetGlyphPositionAtCoordinate(-100000, 90).position, 18ull); - ASSERT_EQ(paragraph->GetGlyphPositionAtCoordinate(20, -80).position, 0ull); + ASSERT_EQ(paragraph->GetGlyphPositionAtCoordinate(20, -80).position, 1ull); ASSERT_EQ(paragraph->GetGlyphPositionAtCoordinate(1, 90).position, 18ull); ASSERT_EQ(paragraph->GetGlyphPositionAtCoordinate(1, 180).position, 36ull); ASSERT_EQ(paragraph->GetGlyphPositionAtCoordinate(10000, 180).position, @@ -1449,7 +1449,8 @@ TEST_F(ParagraphTest, RepeatLayoutParagraph) { const char* text = "Sentence to layout at diff widths to get diff line counts. short words " "short words short words short words short words short words short words " - "short words short words short words short words short words short words"; + "short words short words short words short words short words short words " + "end"; auto icu_text = icu::UnicodeString::fromUTF8(text); std::u16string u16_text(icu_text.getBuffer(), icu_text.getBuffer() + icu_text.length());