OLD | NEW |
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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/markers/CompositionMarkerListImpl.h" | 5 #include "core/editing/markers/CompositionMarkerListImpl.h" |
6 | 6 |
7 #include "core/editing/EditingTestBase.h" | 7 #include "core/editing/EditingTestBase.h" |
8 #include "core/editing/markers/CompositionMarker.h" | 8 #include "core/editing/markers/CompositionMarker.h" |
9 | 9 |
10 namespace blink { | 10 namespace blink { |
11 | 11 |
12 class CompositionMarkerListImplTest : public EditingTestBase { | 12 class CompositionMarkerListImplTest : public EditingTestBase { |
13 protected: | 13 protected: |
14 CompositionMarkerListImplTest() | 14 CompositionMarkerListImplTest() |
15 : marker_list_(new CompositionMarkerListImpl()) {} | 15 : marker_list_(new CompositionMarkerListImpl()) {} |
16 | 16 |
17 DocumentMarker* CreateMarker(unsigned start_offset, unsigned end_offset) { | 17 DocumentMarker* CreateMarker(unsigned start_offset, unsigned end_offset) { |
18 return new CompositionMarker(start_offset, end_offset, Color::kBlack, | 18 return new CompositionMarker(start_offset, end_offset, Color::kBlack, |
19 CompositionMarker::Thickness::kThin, | 19 StyleableMarker::Thickness::kThin, |
20 Color::kBlack); | 20 Color::kBlack); |
21 } | 21 } |
22 | 22 |
23 Persistent<CompositionMarkerListImpl> marker_list_; | 23 Persistent<CompositionMarkerListImpl> marker_list_; |
24 }; | 24 }; |
25 | 25 |
26 // CompositionMarkerListImpl shouldn't merge markers with touching endpoints | 26 // CompositionMarkerListImpl shouldn't merge markers with touching endpoints |
27 TEST_F(CompositionMarkerListImplTest, Add) { | 27 TEST_F(CompositionMarkerListImplTest, Add) { |
28 EXPECT_EQ(0u, marker_list_->GetMarkers().size()); | 28 EXPECT_EQ(0u, marker_list_->GetMarkers().size()); |
29 | 29 |
30 marker_list_->Add(CreateMarker(0, 1)); | 30 marker_list_->Add(CreateMarker(0, 1)); |
31 marker_list_->Add(CreateMarker(1, 2)); | 31 marker_list_->Add(CreateMarker(1, 2)); |
32 | 32 |
33 EXPECT_EQ(2u, marker_list_->GetMarkers().size()); | 33 EXPECT_EQ(2u, marker_list_->GetMarkers().size()); |
34 | 34 |
35 EXPECT_EQ(0u, marker_list_->GetMarkers()[0]->StartOffset()); | 35 EXPECT_EQ(0u, marker_list_->GetMarkers()[0]->StartOffset()); |
36 EXPECT_EQ(1u, marker_list_->GetMarkers()[0]->EndOffset()); | 36 EXPECT_EQ(1u, marker_list_->GetMarkers()[0]->EndOffset()); |
37 | 37 |
38 EXPECT_EQ(1u, marker_list_->GetMarkers()[1]->StartOffset()); | 38 EXPECT_EQ(1u, marker_list_->GetMarkers()[1]->StartOffset()); |
39 EXPECT_EQ(2u, marker_list_->GetMarkers()[1]->EndOffset()); | 39 EXPECT_EQ(2u, marker_list_->GetMarkers()[1]->EndOffset()); |
40 } | 40 } |
41 | 41 |
42 } // namespace blink | 42 } // namespace blink |
OLD | NEW |