Index: Source/core/editing/VisibleUnitsTest.cpp |
diff --git a/Source/core/editing/VisibleUnitsTest.cpp b/Source/core/editing/VisibleUnitsTest.cpp |
index 520ecd6c8cc362b9f18833eab0b7d8f94da2779c..83d154b677878533e39de674d757412afbee04e4 100644 |
--- a/Source/core/editing/VisibleUnitsTest.cpp |
+++ b/Source/core/editing/VisibleUnitsTest.cpp |
@@ -55,6 +55,24 @@ TEST_F(VisibleUnitsTest, absoluteCaretBoundsOf) |
EXPECT_EQ(boundsInDOMTree, boundsInComposedTree); |
} |
+TEST_F(VisibleUnitsTest, characterAfter) |
+{ |
+ const char* bodyContent = "<p id='host'><b id='one'>1</b><b id='two'>22</b></p><b id='three'>333</b>"; |
+ const char* shadowContent = "<b id='four'>4444</b><content select=#two></content><content select=#one></content><b id='five'>5555</b>"; |
+ setBodyContent(bodyContent); |
+ setShadowContent(shadowContent, "host"); |
+ updateLayoutAndStyleForPainting(); |
+ |
+ RefPtrWillBeRawPtr<Element> one = document().getElementById("one"); |
+ RefPtrWillBeRawPtr<Element> two = document().getElementById("two"); |
+ |
+ EXPECT_EQ('2', characterAfter(createVisiblePositionInDOMTree(*one->firstChild(), 1))); |
+ EXPECT_EQ('5', characterAfter(createVisiblePositionInComposedTree(*one->firstChild(), 1))); |
+ |
+ EXPECT_EQ(0, characterAfter(createVisiblePositionInDOMTree(*two->firstChild(), 2))); |
+ EXPECT_EQ('1', characterAfter(createVisiblePositionInComposedTree(*two->firstChild(), 2))); |
+} |
+ |
TEST_F(VisibleUnitsTest, inSameLine) |
{ |
const char* bodyContent = "<p id='host'>00<b id='one'>11</b><b id='two'>22</b>33</p>"; |