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 eef817703aad94da2366eb80bb9ba0f3301ebe54..7e98f47c4a5c9470289c388c6ef6d4212cf72283 100644 |
| --- a/third_party/WebKit/Source/core/editing/VisibleUnitsTest.cpp |
| +++ b/third_party/WebKit/Source/core/editing/VisibleUnitsTest.cpp |
| @@ -2037,4 +2037,63 @@ TEST_F(VisibleUnitsTest, |
| EXPECT_EQ(Position(text, 2), start); |
| } |
| +TEST_F(VisibleUnitsTest, textQuadDOM) { |
| + const char* bodyContent = |
| + "<p id='host'>00" |
| + "<b id='one'>11111</b>" |
| + "<b id='two'>22</b>" |
| + "<b id='three'>33</b>" |
| + "</p>"; |
| + setBodyContent(bodyContent); |
| + |
| + const Position startPosition(document().getElementById("host"), 0); |
| + const Position midPosition(document().getElementById("two"), 0); |
| + const Position endPosition(document().getElementById("three"), 0); |
| + const EphemeralRange rangeStartToTwo(startPosition, midPosition); |
| + const EphemeralRange rangeStartToThree(startPosition, endPosition); |
| + Vector<FloatQuad> quadsStartToTwo; |
| + Vector<FloatQuad> quadsStartToThree; |
| + textQuad(quadsStartToTwo, rangeStartToTwo); |
| + textQuad(quadsStartToThree, rangeStartToThree); |
| + |
| + EXPECT_EQ(2.0, quadsStartToTwo.size()); |
|
Xiaocheng
2017/03/28 21:29:34
s/2.0/2u/
Ditto for all other vector size validat
tanvir
2017/03/30 19:11:06
Done.
|
| + EXPECT_EQ(3.0, quadsStartToThree.size()); |
| + EXPECT_EQ(quadsStartToThree[0], quadsStartToTwo[0]); |
|
Xiaocheng
2017/03/28 21:29:34
Please also verify the actual values of these two
tanvir
2017/03/30 19:11:05
Done.
|
| + EXPECT_EQ(quadsStartToThree[1], quadsStartToTwo[1]); |
| + EXPECT_EQ("15,8; 17,8; 17,9; 15,9", quadsStartToThree[2].toString()); |
| +} |
| + |
| +TEST_F(VisibleUnitsTest, textQuadFlatTree) { |
| + const char* bodyContent = |
| + "<b id='zero'>0</b>" |
| + "<p id='host'>" |
| + "<b id='one'>1</b>" |
| + "<b id='two'>22</b>" |
| + "</p>" |
| + "<b id='three'>333</b>"; |
| + const char* shadowContent = |
| + "<p id='four'>4444</p>" |
| + "<content select=#two></content>" |
| + "<content select=#one></content>" |
| + "<p id='five'>55555</p>"; |
| + setBodyContent(bodyContent); |
| + ShadowRoot* shadowRoot = setShadowContent(shadowContent, "host"); |
| + |
| + const PositionInFlatTree startPosition(document().getElementById("host"), 0); |
| + const PositionInFlatTree threePosition(document().getElementById("three"), 0); |
| + const PositionInFlatTree fivePosition(shadowRoot->getElementById("five"), 0); |
| + const EphemeralRangeInFlatTree rangeStartToThree(startPosition, |
| + threePosition); |
| + const EphemeralRangeInFlatTree rangeStartToFive(startPosition, fivePosition); |
| + Vector<FloatQuad> quadsStartToThree; |
| + Vector<FloatQuad> quadsStartToFive; |
| + textQuad(quadsStartToThree, rangeStartToThree); |
| + textQuad(quadsStartToFive, rangeStartToFive); |
| + |
| + EXPECT_EQ(4.0, quadsStartToThree.size()); |
| + EXPECT_EQ(3.0, quadsStartToFive.size()); |
| + EXPECT_EQ(quadsStartToThree[0], quadsStartToFive[0]); |
| + EXPECT_EQ(quadsStartToThree[1], quadsStartToFive[1]); |
| + EXPECT_EQ("8,10; 12,10; 12,11; 8,11", quadsStartToFive[0].toString()); |
|
Xiaocheng
2017/03/28 21:29:34
Please also verify the actual values of all other
tanvir
2017/03/30 19:11:06
Done.
|
| +} |
| } // namespace blink |