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