Chromium Code Reviews| Index: third_party/WebKit/Source/core/editing/VisibleUnitsTest.cpp |
| diff --git a/third_party/WebKit/Source/core/editing/VisibleUnitsTest.cpp b/third_party/WebKit/Source/core/editing/VisibleUnitsTest.cpp |
| index 127fdc983857351037aa2d0a3366ee6229ed8dda..a5d7f1077ba1f34b842a6838000c5de4251b4e05 100644 |
| --- a/third_party/WebKit/Source/core/editing/VisibleUnitsTest.cpp |
| +++ b/third_party/WebKit/Source/core/editing/VisibleUnitsTest.cpp |
| @@ -1980,4 +1980,34 @@ TEST_F(VisibleUnitsTest, |
| EXPECT_EQ(Position(text, 2), start); |
| } |
| +TEST_F(VisibleUnitsTest, computeTextQuadDOM) { |
|
yosin_UTC9
2017/05/16 10:05:07
nit: s/compute/Compute/
|
| + const char* bodyContent = |
| + "<p id='host'>00" |
|
yosin_UTC9
2017/05/16 10:05:07
I guess We need to have |<style>font-family: Ahem;
|
| + "<b id='one'>11111</b>" |
| + "<b id='two'>22</b>" |
| + "<b id='three'>33</b>" |
| + "</p>"; |
| + SetBodyContent(bodyContent); |
| + |
| + const Position start_position(GetDocument().getElementById("host"), 0); |
| + const Position mid_position(GetDocument().getElementById("two"), 0); |
| + const Position end_position(GetDocument().getElementById("three"), 0); |
| + const EphemeralRange range_start_to_two(start_position, mid_position); |
| + const EphemeralRange range_start_to_three(start_position, end_position); |
| + Vector<FloatQuad> quads_start_to_two; |
| + Vector<FloatQuad> quads_start_to_three; |
| + quads_start_to_two.AppendVector(ComputeTextQuads(range_start_to_two)); |
| + quads_start_to_three.AppendVector(ComputeTextQuads(range_start_to_three)); |
| + |
| + EXPECT_EQ(2u, quads_start_to_two.size()); |
| + EXPECT_EQ(3u, quads_start_to_three.size()); |
| + EXPECT_EQ(quads_start_to_three[0], quads_start_to_two[0]); |
| + EXPECT_EQ(quads_start_to_three[1], quads_start_to_two[1]); |
| + EXPECT_EQ("8,8; 10,8; 10,9; 8,9", quads_start_to_two[0].ToString()); |
| + EXPECT_EQ("10,8; 15,8; 15,9; 10,9", quads_start_to_two[1].ToString()); |
| + EXPECT_EQ("8,8; 10,8; 10,9; 8,9", quads_start_to_three[0].ToString()); |
| + EXPECT_EQ("10,8; 15,8; 15,9; 10,9", quads_start_to_three[1].ToString()); |
| + EXPECT_EQ("15,8; 17,8; 17,9; 15,9", quads_start_to_three[2].ToString()); |
| +} |
| + |
| } // namespace blink |