Commit 1068c4a0 authored by Xiaocheng Hu's avatar Xiaocheng Hu Committed by Commit Bot

Add new LocalCaretRectTest cases of caret rects at empty line

Change-Id: I7380a6b36ed8212c2fe78ba0a1ea5f68237e8efa
Reviewed-on: https://chromium-review.googlesource.com/875320
Commit-Queue: Xiaocheng Hu <xiaochengh@chromium.org>
Reviewed-by: default avatarYoshifumi Inoue <yosin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#530638}
parent 251b6cf4
...@@ -170,6 +170,33 @@ TEST_F(LocalCaretRectTest, TwoLinesOfTextWithSoftWrap) { ...@@ -170,6 +170,33 @@ TEST_F(LocalCaretRectTest, TwoLinesOfTextWithSoftWrap) {
LocalCaretRectOfPosition({Position(foo, 6), TextAffinity::kDownstream})); LocalCaretRectOfPosition({Position(foo, 6), TextAffinity::kDownstream}));
} }
TEST_F(LocalCaretRectTest, CaretRectAtBR) {
// This test only records the current behavior. Future changes are allowed.
LoadAhem();
SetBodyContent(
"<div style='font: 10px/10px Ahem; width: 30px'><br>foo</div>");
const Element& br = *GetDocument().QuerySelector("br");
EXPECT_EQ(LocalCaretRect(br.GetLayoutObject(), LayoutRect(0, 0, 1, 10)),
LocalCaretRectOfPosition(
{Position::BeforeNode(br), TextAffinity::kDownstream}));
}
TEST_F(LocalCaretRectTest, CaretRectAtRtlBR) {
// This test only records the current behavior. Future changes are allowed.
LoadAhem();
SetBodyContent(
"<bdo dir=rtl style='display: block; font: 10px/10px Ahem; width: 30px'>"
"<br>foo</bdo>");
const Element& br = *GetDocument().QuerySelector("br");
EXPECT_EQ(LocalCaretRect(br.GetLayoutObject(), LayoutRect(29, 0, 1, 10)),
LocalCaretRectOfPosition(
{Position::BeforeNode(br), TextAffinity::kDownstream}));
}
TEST_F(LocalCaretRectTest, Images) { TEST_F(LocalCaretRectTest, Images) {
// This test only records the current behavior. Future changes are allowed. // This test only records the current behavior. Future changes are allowed.
......
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