OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/CompositionUnderline.h" | 5 #include "core/editing/CompositionUnderline.h" |
6 | 6 |
7 #include "testing/gtest/include/gtest/gtest.h" | 7 #include "testing/gtest/include/gtest/gtest.h" |
8 | 8 |
9 namespace blink { | 9 namespace blink { |
10 namespace { | 10 namespace { |
11 | 11 |
12 CompositionUnderline createCompositionUnderline(unsigned startOffset, | 12 CompositionUnderline createCompositionUnderline(unsigned startOffset, |
13 unsigned endOffset) { | 13 unsigned endOffset) { |
14 return CompositionUnderline(startOffset, endOffset, Color::transparent, false, | 14 return CompositionUnderline(startOffset, endOffset, Color::transparent, false, |
15 Color::transparent); | 15 Color::transparent, false); |
16 } | 16 } |
17 | 17 |
18 TEST(CompositionUnderlineTest, OneChar) { | 18 TEST(CompositionUnderlineTest, OneChar) { |
19 CompositionUnderline underline = createCompositionUnderline(0, 1); | 19 CompositionUnderline underline = createCompositionUnderline(0, 1); |
20 EXPECT_EQ(0u, underline.startOffset()); | 20 EXPECT_EQ(0u, underline.startOffset()); |
21 EXPECT_EQ(1u, underline.endOffset()); | 21 EXPECT_EQ(1u, underline.endOffset()); |
22 } | 22 } |
23 | 23 |
24 TEST(CompositionUnderlineTest, MultiChar) { | 24 TEST(CompositionUnderlineTest, MultiChar) { |
25 CompositionUnderline underline = createCompositionUnderline(0, 5); | 25 CompositionUnderline underline = createCompositionUnderline(0, 5); |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 | 63 |
64 TEST(CompositionUnderlineTest, LastCharEndBeforeStartZeroEnd) { | 64 TEST(CompositionUnderlineTest, LastCharEndBeforeStartZeroEnd) { |
65 CompositionUnderline underline = | 65 CompositionUnderline underline = |
66 createCompositionUnderline(std::numeric_limits<unsigned>::max(), 0); | 66 createCompositionUnderline(std::numeric_limits<unsigned>::max(), 0); |
67 EXPECT_EQ(std::numeric_limits<unsigned>::max() - 1, underline.startOffset()); | 67 EXPECT_EQ(std::numeric_limits<unsigned>::max() - 1, underline.startOffset()); |
68 EXPECT_EQ(std::numeric_limits<unsigned>::max(), underline.endOffset()); | 68 EXPECT_EQ(std::numeric_limits<unsigned>::max(), underline.endOffset()); |
69 } | 69 } |
70 | 70 |
71 } // namespace | 71 } // namespace |
72 } // namespace blink | 72 } // namespace blink |
OLD | NEW |