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 "platform/fonts/GlyphBuffer.h" | 5 #include "platform/fonts/GlyphBuffer.h" |
6 | 6 |
7 #include "platform/fonts/SimpleFontData.h" | 7 #include "platform/fonts/SimpleFontData.h" |
8 #include "testing/gtest/include/gtest/gtest.h" | 8 #include "testing/gtest/include/gtest/gtest.h" |
9 #include "wtf/PassRefPtr.h" | 9 #include "wtf/PassRefPtr.h" |
10 #include "wtf/RefPtr.h" | 10 #include "wtf/RefPtr.h" |
11 | 11 |
12 namespace blink { | 12 namespace blink { |
13 | 13 |
14 namespace { | 14 namespace { |
15 | 15 |
16 // Minimal TestSimpleFontData implementation. | 16 // Minimal TestSimpleFontData implementation. |
17 // Font has no glyphs, but that's okay. | 17 // Font has no glyphs, but that's okay. |
18 class TestSimpleFontData : public SimpleFontData { | 18 class TestSimpleFontData : public SimpleFontData { |
19 public: | 19 public: |
20 static PassRefPtr<TestSimpleFontData> create() { | 20 static PassRefPtr<TestSimpleFontData> create() { |
21 return adoptRef(new TestSimpleFontData); | 21 return adoptRef(new TestSimpleFontData); |
22 } | 22 } |
23 | 23 |
24 private: | 24 private: |
25 TestSimpleFontData() : SimpleFontData(nullptr, 10, false, false) {} | 25 TestSimpleFontData() : SimpleFontData(nullptr, 10, false, false) {} |
26 | |
27 bool fillGlyphPage(GlyphPage* pageToFill, | |
28 unsigned offset, | |
29 unsigned length, | |
30 UChar* buffer, | |
31 unsigned bufferLength) const override { | |
32 return false; | |
33 } | |
34 }; | 26 }; |
35 | 27 |
36 } // anonymous namespace | 28 } // anonymous namespace |
37 | 29 |
38 TEST(GlyphBufferTest, StartsEmpty) { | 30 TEST(GlyphBufferTest, StartsEmpty) { |
39 GlyphBuffer glyphBuffer; | 31 GlyphBuffer glyphBuffer; |
40 EXPECT_TRUE(glyphBuffer.isEmpty()); | 32 EXPECT_TRUE(glyphBuffer.isEmpty()); |
41 EXPECT_EQ(0u, glyphBuffer.size()); | 33 EXPECT_EQ(0u, glyphBuffer.size()); |
42 } | 34 } |
43 | 35 |
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
210 EXPECT_EQ(42, glyphBuffer.glyphAt(2)); | 202 EXPECT_EQ(42, glyphBuffer.glyphAt(2)); |
211 EXPECT_EQ(font2.get(), glyphBuffer.fontDataAt(0)); | 203 EXPECT_EQ(font2.get(), glyphBuffer.fontDataAt(0)); |
212 EXPECT_EQ(font1.get(), glyphBuffer.fontDataAt(1)); | 204 EXPECT_EQ(font1.get(), glyphBuffer.fontDataAt(1)); |
213 EXPECT_EQ(font1.get(), glyphBuffer.fontDataAt(2)); | 205 EXPECT_EQ(font1.get(), glyphBuffer.fontDataAt(2)); |
214 EXPECT_EQ(70, glyphBuffer.xOffsetAt(0)); | 206 EXPECT_EQ(70, glyphBuffer.xOffsetAt(0)); |
215 EXPECT_EQ(75, glyphBuffer.xOffsetAt(1)); | 207 EXPECT_EQ(75, glyphBuffer.xOffsetAt(1)); |
216 EXPECT_EQ(85, glyphBuffer.xOffsetAt(2)); | 208 EXPECT_EQ(85, glyphBuffer.xOffsetAt(2)); |
217 } | 209 } |
218 | 210 |
219 } // namespace blink | 211 } // namespace blink |
OLD | NEW |