| Index: Source/core/editing/FrameSelectionTest.cpp
|
| diff --git a/Source/core/editing/FrameSelectionTest.cpp b/Source/core/editing/FrameSelectionTest.cpp
|
| index 2aea63be379eab58fcfb09c86e29415cfadeeaae..0751de893c5e3ed980b47c50965ace8c6066a176 100644
|
| --- a/Source/core/editing/FrameSelectionTest.cpp
|
| +++ b/Source/core/editing/FrameSelectionTest.cpp
|
| @@ -138,4 +138,25 @@ TEST_F(FrameSelectionTest, PaintCaretShouldNotLayout)
|
| EXPECT_EQ(startCount, layoutCount());
|
| }
|
|
|
| +#define EXPECT_EQ_SELECTEDTEXT(text) \
|
| + EXPECT_EQ(text, WebString(selection().selectedText()).utf8());
|
| +
|
| +TEST_F(FrameSelectionTest, SelectWordAroundPosition)
|
| +{
|
| + // "Foo Bar Baz,"
|
| + RefPtrWillBeRawPtr<Text> text = document().createTextNode("Foo Bar Baz,");
|
| + document().body()->appendChild(text);
|
| + // "Fo|o Bar Baz,"
|
| + EXPECT_TRUE(selection().selectWordAroundPosition(VisiblePosition(Position(text, 2))));
|
| + EXPECT_EQ_SELECTEDTEXT("Foo");
|
| + // "Foo| Bar Baz,"
|
| + EXPECT_TRUE(selection().selectWordAroundPosition(VisiblePosition(Position(text, 3))));
|
| + EXPECT_EQ_SELECTEDTEXT("Foo");
|
| + // "Foo Bar | Baz,"
|
| + EXPECT_FALSE(selection().selectWordAroundPosition(VisiblePosition(Position(text, 13))));
|
| + // "Foo Bar Baz|,"
|
| + EXPECT_TRUE(selection().selectWordAroundPosition(VisiblePosition(Position(text, 22))));
|
| + EXPECT_EQ_SELECTEDTEXT("Baz");
|
| +}
|
| +
|
| }
|
|
|