OLD | NEW |
---|---|
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 "config.h" | 5 #include "config.h" |
6 #include "core/editing/EditingUtilities.h" | 6 #include "core/editing/EditingUtilities.h" |
7 | 7 |
8 #include "core/editing/EditingTestBase.h" | 8 #include "core/editing/EditingTestBase.h" |
9 | 9 |
10 namespace blink { | 10 namespace blink { |
11 | 11 |
12 class EditingUtilitiesTest : public EditingTestBase { | 12 class EditingUtilitiesTest : public EditingTestBase { |
13 }; | 13 }; |
14 | 14 |
15 TEST_F(EditingUtilitiesTest, NextNodeIndex) | 15 TEST_F(EditingUtilitiesTest, NextNodeIndex) |
16 { | 16 { |
17 const char* bodyContent = "<p id='host'>00<b id='one'>11</b><b id='two'>22</ b>33</p>"; | 17 const char* bodyContent = "<p id='host'>00<b id='one'>11</b><b id='two'>22</ b>33</p>"; |
18 const char* shadowContent = "<content select=#two></content><content select= #one></content>"; | 18 const char* shadowContent = "<content select=#two></content><content select= #one></content>"; |
19 setBodyContent(bodyContent); | 19 setBodyContent(bodyContent); |
20 setShadowContent(shadowContent); | 20 setShadowContent(shadowContent); |
21 Node* host = document().getElementById("host"); | 21 Node* host = document().getElementById("host"); |
22 Node* two = document().getElementById("two"); | 22 Node* two = document().getElementById("two"); |
23 | 23 |
24 EXPECT_EQ(Position(host, 3), nextPositionOf(Position(two, 2), PositionMoveTy pe::CodePoint)); | 24 EXPECT_EQ(Position(host, 3), nextPositionOf(Position(two, 2), PositionMoveTy pe::CodePoint)); |
25 EXPECT_EQ(PositionInComposedTree(host, 1), nextPositionOf(PositionInComposed Tree(two, 2), PositionMoveType::CodePoint)); | 25 EXPECT_EQ(PositionInComposedTree(host, 1), nextPositionOf(PositionInComposed Tree(two, 2), PositionMoveType::CodePoint)); |
26 } | 26 } |
27 | 27 |
28 TEST_F(EditingUtilitiesTest, NextVisuallyDistinctCandidate) | |
29 { | |
30 const char* bodyContent = "<p id='host'>00<b id='one'>11</b><b id='two'>22</ b><b id='three'>33</b></p>"; | |
31 const char* shadowContent = "<content select=#two></content><content select= #one></content><content select=#three></content>"; | |
32 setBodyContent(bodyContent); | |
33 setShadowContent(shadowContent); | |
34 updateLayoutAndStyleForPainting(); | |
35 Node* one = document().getElementById("one"); | |
36 Node* two = document().getElementById("two"); | |
37 Node* three = document().getElementById("three"); | |
38 | |
39 EXPECT_EQ(Position(two->firstChild(), 1), nextVisuallyDistinctCandidate(Posi tion(one, 2))); | |
yoichio
2015/08/25 05:22:33
'one' has only 1 child so what is |Position(one, 2
yosin_UTC9
2015/08/25 05:44:24
Done.
| |
40 EXPECT_EQ(PositionInComposedTree(three->firstChild(), 1), nextVisuallyDistin ctCandidate(PositionInComposedTree(one, 2))); | |
41 } | |
42 | |
28 } // namespace blink | 43 } // namespace blink |
OLD | NEW |