Commit 0931dc80 authored by Yoichi Osato's avatar Yoichi Osato Committed by Commit Bot

Add ComputeLayerSelectionTests for line break.

This patch adds some tests to confirm selection rect including
block end linebreaks.

Bug: 789870
Cq-Include-Trybots: luci.chromium.try:linux_layout_tests_layout_ng
Change-Id: Ia0b30c333944c86d27bf6568e550645d60f5e319
Reviewed-on: https://chromium-review.googlesource.com/1205752Reviewed-by: default avatarXiaocheng Hu <xiaochengh@chromium.org>
Commit-Queue: Yoichi Osato <yoichio@chromium.org>
Cr-Commit-Position: refs/heads/master@{#589078}
parent e6bd9834
...@@ -263,4 +263,55 @@ TEST_F(ComputeLayerSelectionTest, RangeBeginAtBlockEnd) { ...@@ -263,4 +263,55 @@ TEST_F(ComputeLayerSelectionTest, RangeBeginAtBlockEnd) {
EXPECT_EQ(composited_selection.end.edge_bottom, gfx::Point(28, 28)); EXPECT_EQ(composited_selection.end.edge_bottom, gfx::Point(28, 28));
} }
TEST_F(ComputeLayerSelectionTest, BlockEndBR1) {
// LayerSelection should be:
// ^test<br>
// |<br>
SetBodyContent(
"<div style='font: 10px/10px Ahem;'>"
"test<br><br></div>");
Element* target = GetDocument().QuerySelector("div");
FocusAndSelectAll(target, *target);
const cc::LayerSelection& layer_selection =
ComputeLayerSelection(Selection());
EXPECT_EQ(layer_selection.start.edge_top, gfx::Point(8, 8));
EXPECT_EQ(layer_selection.start.edge_bottom, gfx::Point(8, 18));
EXPECT_EQ(layer_selection.end.edge_top, gfx::Point(8, 18));
EXPECT_EQ(layer_selection.end.edge_bottom, gfx::Point(8, 28));
}
TEST_F(ComputeLayerSelectionTest, BlockEndBR2) {
// LayerSelection should be:
// ^test<br>
// |<br>
SetBodyContent(
"<div style='font: 10px/10px Ahem;'>"
"<div><span>test<br></span><br></div>");
Element* target = GetDocument().QuerySelector("div");
FocusAndSelectAll(target, *target);
const cc::LayerSelection& layer_selection =
ComputeLayerSelection(Selection());
EXPECT_EQ(layer_selection.start.edge_top, gfx::Point(8, 8));
EXPECT_EQ(layer_selection.start.edge_bottom, gfx::Point(8, 18));
EXPECT_EQ(layer_selection.end.edge_top, gfx::Point(8, 18));
EXPECT_EQ(layer_selection.end.edge_bottom, gfx::Point(8, 28));
}
TEST_F(ComputeLayerSelectionTest, BlockEndBR3) {
// LayerSelection should be:
// ^test<br>
// |<br>
SetBodyContent(
"<div style='font: 10px/10px Ahem;'>"
"<div><div>test<br></div><br></div>");
Element* target = GetDocument().QuerySelector("div");
FocusAndSelectAll(target, *target);
const cc::LayerSelection& layer_selection =
ComputeLayerSelection(Selection());
EXPECT_EQ(layer_selection.start.edge_top, gfx::Point(8, 8));
EXPECT_EQ(layer_selection.start.edge_bottom, gfx::Point(8, 18));
EXPECT_EQ(layer_selection.end.edge_top, gfx::Point(8, 18));
EXPECT_EQ(layer_selection.end.edge_bottom, gfx::Point(8, 28));
}
} // namespace blink } // namespace blink
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