OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/paint/TextPainter.h" | 6 #include "core/paint/TextPainter.h" |
7 | 7 |
8 #include "core/CSSPropertyNames.h" | 8 #include "core/CSSPropertyNames.h" |
9 #include "core/CSSValueKeywords.h" | 9 #include "core/CSSValueKeywords.h" |
10 #include "core/css/CSSPrimitiveValue.h" | 10 #include "core/css/CSSPrimitiveValue.h" |
11 #include "core/frame/Settings.h" | 11 #include "core/frame/Settings.h" |
12 #include "core/layout/LayoutTestHelper.h" | 12 #include "core/layout/LayoutTestHelper.h" |
13 #include "core/layout/LayoutText.h" | 13 #include "core/layout/LayoutText.h" |
14 #include "core/style/ShadowData.h" | 14 #include "core/style/ShadowData.h" |
15 #include "core/style/ShadowList.h" | 15 #include "core/style/ShadowList.h" |
16 #include <gtest/gtest.h> | 16 #include <gtest/gtest.h> |
17 | 17 |
18 namespace blink { | 18 namespace blink { |
19 namespace { | 19 namespace { |
20 | 20 |
21 class TextPainterTest : public RenderingTest { | 21 class TextPainterTest : public RenderingTest { |
22 public: | 22 public: |
23 TextPainterTest() : m_layoutText(nullptr) { } | 23 TextPainterTest() : m_layoutText(nullptr) { } |
24 | 24 |
25 protected: | 25 protected: |
26 LayoutText* layoutText() { return m_layoutText; } | 26 LayoutText* layoutText() { return m_layoutText; } |
27 | 27 |
28 private: | 28 private: |
29 virtual void SetUp() override | 29 void SetUp() override |
30 { | 30 { |
31 RenderingTest::SetUp(); | 31 RenderingTest::SetUp(); |
32 setBodyInnerHTML("Hello world"); | 32 setBodyInnerHTML("Hello world"); |
33 m_layoutText = toLayoutText(document().body()->firstChild()->layoutObjec
t()); | 33 m_layoutText = toLayoutText(document().body()->firstChild()->layoutObjec
t()); |
34 ASSERT_TRUE(m_layoutText); | 34 ASSERT_TRUE(m_layoutText); |
35 ASSERT_EQ("Hello world", m_layoutText->text()); | 35 ASSERT_EQ("Hello world", m_layoutText->text()); |
36 } | 36 } |
37 | 37 |
38 LayoutText* m_layoutText; | 38 LayoutText* m_layoutText; |
39 }; | 39 }; |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
122 | 122 |
123 TextPainter::Style textStyle = TextPainter::textPaintingStyle( | 123 TextPainter::Style textStyle = TextPainter::textPaintingStyle( |
124 *layoutText(), layoutText()->styleRef(), false /* usesTextAsClip */, tru
e /* isPrinting */); | 124 *layoutText(), layoutText()->styleRef(), false /* usesTextAsClip */, tru
e /* isPrinting */); |
125 EXPECT_EQ(Color(255, 220, 220).dark(), textStyle.fillColor); | 125 EXPECT_EQ(Color(255, 220, 220).dark(), textStyle.fillColor); |
126 EXPECT_EQ(Color(220, 255, 220).dark(), textStyle.strokeColor); | 126 EXPECT_EQ(Color(220, 255, 220).dark(), textStyle.strokeColor); |
127 EXPECT_EQ(Color(220, 220, 255).dark(), textStyle.emphasisMarkColor); | 127 EXPECT_EQ(Color(220, 220, 255).dark(), textStyle.emphasisMarkColor); |
128 } | 128 } |
129 | 129 |
130 } // namespace | 130 } // namespace |
131 } // namespace blink | 131 } // namespace blink |
OLD | NEW |