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 "third_party/blink/renderer/core/editing/markers/active_suggestion_marker.h"
6
7 #include "testing/gtest/include/gtest/gtest.h"
8
9 using ui::mojom::ImeTextSpanThickness;
10 using ui::mojom::ImeTextSpanUnderlineStyle;
11
12 namespace blink {
13
14 class ActiveSuggestionMarkerTest : public testing::Test {};
15
TEST_F(ActiveSuggestionMarkerTest,MarkerType)16 TEST_F(ActiveSuggestionMarkerTest, MarkerType) {
17 DocumentMarker* marker = MakeGarbageCollected<ActiveSuggestionMarker>(
18 0, 1, Color::kTransparent, ImeTextSpanThickness::kNone,
19 ImeTextSpanUnderlineStyle::kNone, Color::kTransparent,
20 Color::kTransparent);
21 EXPECT_EQ(DocumentMarker::kActiveSuggestion, marker->GetType());
22 }
23
TEST_F(ActiveSuggestionMarkerTest,IsStyleableMarker)24 TEST_F(ActiveSuggestionMarkerTest, IsStyleableMarker) {
25 DocumentMarker* marker = MakeGarbageCollected<ActiveSuggestionMarker>(
26 0, 1, Color::kTransparent, ImeTextSpanThickness::kNone,
27 ImeTextSpanUnderlineStyle::kNone, Color::kTransparent,
28 Color::kTransparent);
29 EXPECT_TRUE(IsStyleableMarker(*marker));
30 }
31
TEST_F(ActiveSuggestionMarkerTest,ConstructorAndGetters)32 TEST_F(ActiveSuggestionMarkerTest, ConstructorAndGetters) {
33 ActiveSuggestionMarker* marker = MakeGarbageCollected<ActiveSuggestionMarker>(
34 0, 1, Color::kDarkGray, ImeTextSpanThickness::kThin,
35 ImeTextSpanUnderlineStyle::kSolid, Color::kTransparent, Color::kGray);
36 EXPECT_EQ(Color::kDarkGray, marker->UnderlineColor());
37 EXPECT_FALSE(marker->HasThicknessThick());
38 EXPECT_EQ(ImeTextSpanUnderlineStyle::kSolid, marker->UnderlineStyle());
39 EXPECT_EQ(Color::kTransparent, marker->TextColor());
40 EXPECT_EQ(Color::kGray, marker->BackgroundColor());
41
42 ActiveSuggestionMarker* thick_marker =
43 MakeGarbageCollected<ActiveSuggestionMarker>(
44 0, 1, Color::kDarkGray, ImeTextSpanThickness::kThick,
45 ImeTextSpanUnderlineStyle::kSolid, Color::kTransparent, Color::kGray);
46 EXPECT_EQ(true, thick_marker->HasThicknessThick());
47 EXPECT_EQ(ImeTextSpanUnderlineStyle::kSolid, marker->UnderlineStyle());
48 EXPECT_EQ(Color::kTransparent, marker->TextColor());
49 }
50
51 } // namespace blink
52