Commit ad9bbcc0 authored by Xiaocheng Hu's avatar Xiaocheng Hu Committed by Commit Bot

[LayoutNG] Make all CharacterIteratorTest pass with LayoutNG

CharacterIteratorTest.GetPositionWithEmitChar16Before used to fail with
LayoutNG enabled, because it's actually a buggy case in legacy layout
where TextIterator emits an extra character.

This patch makes the test case skip the extra character when LayoutNG
is enabled, and hence allows it to pass.

Bug: 810579
Change-Id: Ie111735af3c94fe7b47eed7a993d1d374612caa6
Reviewed-on: https://chromium-review.googlesource.com/c/1340862Reviewed-by: default avatarYoichi Osato <yoichio@chromium.org>
Reviewed-by: default avatarYoshifumi Inoue <yosin@chromium.org>
Commit-Queue: Xiaocheng Hu <xiaochengh@chromium.org>
Cr-Commit-Position: refs/heads/master@{#609478}
parent 83b5153c
...@@ -283,8 +283,7 @@ TEST_P(ParameterizedCharacterIteratorTest, ...@@ -283,8 +283,7 @@ TEST_P(ParameterizedCharacterIteratorTest,
EXPECT_TRUE(it.AtEnd()); EXPECT_TRUE(it.AtEnd());
} }
// TODO(xiaochengh): Fix it in LayoutNG TEST_P(ParameterizedCharacterIteratorTest, GetPositionWithEmitChar16Before) {
TEST_F(CharacterIteratorTest, GetPositionWithEmitChar16Before) {
InsertStyleElement("b { white-space: pre; }"); InsertStyleElement("b { white-space: pre; }");
SetBodyContent("a <b> c</b>"); SetBodyContent("a <b> c</b>");
...@@ -307,15 +306,17 @@ TEST_F(CharacterIteratorTest, GetPositionWithEmitChar16Before) { ...@@ -307,15 +306,17 @@ TEST_F(CharacterIteratorTest, GetPositionWithEmitChar16Before) {
EXPECT_EQ(Position(text_a, 1), it.StartPosition()); EXPECT_EQ(Position(text_a, 1), it.StartPosition());
EXPECT_EQ(Position(text_a, 2), it.EndPosition()); EXPECT_EQ(Position(text_a, 2), it.EndPosition());
// TODO(editing-dev): We should know why we emit a space character for if (!LayoutNGEnabled()) {
// "white-space: pre" element after trailing whitespace. // TODO(editing-dev): TextIterator with legacy layout incorrectly emits a
// A space character emitted by |EmitChar16Before()|. // space character for "white-space: pre" element after trailing whitespace.
// A space character emitted by |EmitChar16Before()|. Fix it.
ASSERT_FALSE(it.AtEnd()); ASSERT_FALSE(it.AtEnd());
it.Advance(1); it.Advance(1);
EXPECT_EQ(Position(text_c, 0), it.GetPositionBefore()); EXPECT_EQ(Position(text_c, 0), it.GetPositionBefore());
EXPECT_EQ(Position(text_c, 0), it.GetPositionAfter()); EXPECT_EQ(Position(text_c, 0), it.GetPositionAfter());
EXPECT_EQ(Position(text_c, 0), it.StartPosition()); EXPECT_EQ(Position(text_c, 0), it.StartPosition());
EXPECT_EQ(Position(text_c, 0), it.EndPosition()); EXPECT_EQ(Position(text_c, 0), it.EndPosition());
}
ASSERT_FALSE(it.AtEnd()); ASSERT_FALSE(it.AtEnd());
it.Advance(1); it.Advance(1);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment