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

Side by Side Diff: third_party/WebKit/Source/core/editing/EditingUtilitiesTest.cpp

Issue 1868473002: Use PositionMoveType::GraphemeBoundary (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove PositionMoveType::CodePoint Created 4 years, 8 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 unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "core/editing/EditingUtilities.h" 5 #include "core/editing/EditingUtilities.h"
6 6
7 #include "core/dom/StaticNodeList.h" 7 #include "core/dom/StaticNodeList.h"
8 #include "core/editing/EditingTestBase.h" 8 #include "core/editing/EditingTestBase.h"
9 9
10 namespace blink { 10 namespace blink {
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 149
150 TEST_F(EditingUtilitiesTest, NextNodeIndex) 150 TEST_F(EditingUtilitiesTest, NextNodeIndex)
151 { 151 {
152 const char* bodyContent = "<p id='host'>00<b id='one'>11</b><b id='two'>22</ b>33</p>"; 152 const char* bodyContent = "<p id='host'>00<b id='one'>11</b><b id='two'>22</ b>33</p>";
153 const char* shadowContent = "<content select=#two></content><content select= #one></content>"; 153 const char* shadowContent = "<content select=#two></content><content select= #one></content>";
154 setBodyContent(bodyContent); 154 setBodyContent(bodyContent);
155 setShadowContent(shadowContent, "host"); 155 setShadowContent(shadowContent, "host");
156 Node* host = document().getElementById("host"); 156 Node* host = document().getElementById("host");
157 Node* two = document().getElementById("two"); 157 Node* two = document().getElementById("two");
158 158
159 EXPECT_EQ(Position(host, 3), nextPositionOf(Position(two, 2), PositionMoveTy pe::CodePoint)); 159 EXPECT_EQ(Position(host, 3), nextPositionOf(Position(two, 2), PositionMoveTy pe::GraphemeCluster));
160 EXPECT_EQ(PositionInFlatTree(host, 1), nextPositionOf(PositionInFlatTree(two , 2), PositionMoveType::CodePoint)); 160 EXPECT_EQ(PositionInFlatTree(host, 1), nextPositionOf(PositionInFlatTree(two , 2), PositionMoveType::GraphemeCluster));
161 } 161 }
162 162
163 TEST_F(EditingUtilitiesTest, NextVisuallyDistinctCandidate) 163 TEST_F(EditingUtilitiesTest, NextVisuallyDistinctCandidate)
164 { 164 {
165 const char* bodyContent = "<p id='host'>00<b id='one'>11</b><b id='two'>22</ b><b id='three'>33</b></p>"; 165 const char* bodyContent = "<p id='host'>00<b id='one'>11</b><b id='two'>22</ b><b id='three'>33</b></p>";
166 const char* shadowContent = "<content select=#two></content><content select= #one></content><content select=#three></content>"; 166 const char* shadowContent = "<content select=#two></content><content select= #one></content><content select=#three></content>";
167 setBodyContent(bodyContent); 167 setBodyContent(bodyContent);
168 setShadowContent(shadowContent, "host"); 168 setShadowContent(shadowContent, "host");
169 updateLayoutAndStyleForPainting(); 169 updateLayoutAndStyleForPainting();
170 Node* one = document().getElementById("one"); 170 Node* one = document().getElementById("one");
(...skipping 553 matching lines...) Expand 10 before | Expand all | Expand 10 after
724 724
725 // Edge case: specify middle of surrogate pairs. 725 // Edge case: specify middle of surrogate pairs.
726 setBodyContent("<p id='target'>&#x1F441;&#x1F441;&#x1F441</p>"); 726 setBodyContent("<p id='target'>&#x1F441;&#x1F441;&#x1F441</p>");
727 node = document().getElementById("target")->firstChild(); 727 node = document().getElementById("target")->firstChild();
728 EXPECT_EQ(Position(node, 4), previousPositionOf(Position(node, 5), PositionM oveType::BackwardDeletion)); 728 EXPECT_EQ(Position(node, 4), previousPositionOf(Position(node, 5), PositionM oveType::BackwardDeletion));
729 EXPECT_EQ(Position(node, 2), previousPositionOf(Position(node, 3), PositionM oveType::BackwardDeletion)); 729 EXPECT_EQ(Position(node, 2), previousPositionOf(Position(node, 3), PositionM oveType::BackwardDeletion));
730 EXPECT_EQ(Position(node, 0), previousPositionOf(Position(node, 1), PositionM oveType::BackwardDeletion)); 730 EXPECT_EQ(Position(node, 0), previousPositionOf(Position(node, 1), PositionM oveType::BackwardDeletion));
731 } 731 }
732 732
733 } // namespace blink 733 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/editing/EditingUtilities.cpp ('k') | third_party/WebKit/Source/core/editing/Editor.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698