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

Unified Diff: Source/core/editing/EditingUtilitiesTest.cpp

Issue 1309963003: Introduce composed tree version of isFirstPositionAfterTable() (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: 2015-09-08T15:06:09 Created 5 years, 3 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 | « Source/core/editing/EditingUtilities.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/editing/EditingUtilitiesTest.cpp
diff --git a/Source/core/editing/EditingUtilitiesTest.cpp b/Source/core/editing/EditingUtilitiesTest.cpp
index 3775dcb560c07fff64afc43af3bf7a8ecb042d95..3ce640cda1d81ce2b66cf45b5a9caae412ccc824 100644
--- a/Source/core/editing/EditingUtilitiesTest.cpp
+++ b/Source/core/editing/EditingUtilitiesTest.cpp
@@ -79,6 +79,32 @@ TEST_F(EditingUtilitiesTest, enclosingNodeOfType)
EXPECT_EQ(three, enclosingNodeOfType(PositionInComposedTree(one, 0), isEnclosingBlock));
}
+TEST_F(EditingUtilitiesTest, isFirstPositionAfterTable)
+{
+ const char* bodyContent = "<div contenteditable id=host><table id=table><tr><td>1</td></tr></table><b id=two>22</b></div>";
+ const char* shadowContent = "<content select=#two></content><content select=#table></content>";
+ setBodyContent(bodyContent);
+ RefPtrWillBeRawPtr<ShadowRoot> shadowRoot = setShadowContent(shadowContent, "host");
+ updateLayoutAndStyleForPainting();
+ Node* host = document().getElementById("host");
+ Node* table = document().getElementById("table");
+
+ EXPECT_EQ(table, isFirstPositionAfterTable(createVisiblePosition(Position::afterNode(table))));
+ EXPECT_EQ(table, isFirstPositionAfterTable(createVisiblePosition(PositionInComposedTree::afterNode(table))));
+
+ EXPECT_EQ(table, isFirstPositionAfterTable(createVisiblePosition(Position::lastPositionInNode(table))));
+ EXPECT_EQ(table, isFirstPositionAfterTable(createVisiblePosition(PositionInComposedTree::lastPositionInNode(table))));
+
+ EXPECT_EQ(nullptr, isFirstPositionAfterTable(createVisiblePosition(Position(host, 2))));
+ EXPECT_EQ(table, isFirstPositionAfterTable(createVisiblePosition(PositionInComposedTree(host, 2))));
+
+ EXPECT_EQ(nullptr, isFirstPositionAfterTable(createVisiblePosition(Position::afterNode(host))));
+ EXPECT_EQ(nullptr, isFirstPositionAfterTable(createVisiblePosition(PositionInComposedTree::afterNode(host))));
+
+ EXPECT_EQ(nullptr, isFirstPositionAfterTable(createVisiblePosition(Position::lastPositionInNode(host))));
+ EXPECT_EQ(table, isFirstPositionAfterTable(createVisiblePosition(PositionInComposedTree::lastPositionInNode(host))));
+}
+
TEST_F(EditingUtilitiesTest, NextNodeIndex)
{
const char* bodyContent = "<p id='host'>00<b id='one'>11</b><b id='two'>22</b>33</p>";
« no previous file with comments | « Source/core/editing/EditingUtilities.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698