Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(144)

Unified Diff: third_party/WebKit/Source/core/editing/VisibleUnitsTest.cpp

Issue 2126743002: Make previousPositionOf() to handle yet another no previous position case (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 2016-07-06T16:42:17 Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/WebKit/Source/core/editing/VisibleUnits.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 4c5d43212cafe3576c65dbb799e8de1137dd80e7..4ffe01bc3feab8e3600c449b10b737ce123e3d57 100644
--- a/third_party/WebKit/Source/core/editing/VisibleUnitsTest.cpp
+++ b/third_party/WebKit/Source/core/editing/VisibleUnitsTest.cpp
@@ -1048,6 +1048,18 @@ TEST_F(VisibleUnitsTest, previousPositionOfOneCharPerLine)
EXPECT_EQ(PositionWithAffinity(Position(sample, 1)), previousPositionOf(createVisiblePosition(Position(sample, 2), TextAffinity::Upstream)).toPositionWithAffinity());
}
+TEST_F(VisibleUnitsTest, previousPositionOfNoPreviousPosition)
+{
+ setBodyContent(
+ "<span contenteditable='true'>"
+ "<span> </span>"
+ " " // This whitespace causes no previous position.
+ "<div id='anchor'> bar</div>"
+ "</span>");
+ const Position position(document().getElementById("anchor")->firstChild(), 1);
+ EXPECT_EQ(Position(), previousPositionOf(createVisiblePosition(position)).deepEquivalent());
+}
+
TEST_F(VisibleUnitsTest, rendersInDifferentPositionAfterAnchor)
{
const char* bodyContent = "<p id='sample'>00</p>";
« no previous file with comments | « third_party/WebKit/Source/core/editing/VisibleUnits.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698