Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(29)

Side by Side Diff: third_party/WebKit/Source/core/css/CSSFontFaceSourceTest.cpp

Issue 2066323002: Remove SK_SUPPORT_LEGACY_TYPEFACE_PTR (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: moar Mac fixes Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « skia/config/SkUserConfig.h ('k') | third_party/WebKit/Source/platform/fonts/WebFontDecoder.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/css/CSSFontFaceSource.h" 5 #include "core/css/CSSFontFaceSource.h"
6 6
7 #include "platform/fonts/FontCacheKey.h" 7 #include "platform/fonts/FontCacheKey.h"
8 #include "platform/fonts/FontDescription.h" 8 #include "platform/fonts/FontDescription.h"
9 #include "platform/fonts/FontPlatformData.h" 9 #include "platform/fonts/FontPlatformData.h"
10 #include "platform/fonts/SimpleFontData.h" 10 #include "platform/fonts/SimpleFontData.h"
11 #include "platform/graphics/skia/SkiaUtils.h"
11 #include "testing/gtest/include/gtest/gtest.h" 12 #include "testing/gtest/include/gtest/gtest.h"
12 13
13 namespace blink { 14 namespace blink {
14 15
15 class DummyFontFaceSource : public CSSFontFaceSource { 16 class DummyFontFaceSource : public CSSFontFaceSource {
16 public: 17 public:
17 PassRefPtr<SimpleFontData> createFontData(const FontDescription&) override 18 PassRefPtr<SimpleFontData> createFontData(const FontDescription&) override
18 { 19 {
19 return SimpleFontData::create(FontPlatformData(adoptRef(SkTypeface::RefD efault()), "", 0, false, false)); 20 return SimpleFontData::create(FontPlatformData(fromSkSp(SkTypeface::Make Default()), "", 0, false, false));
20 } 21 }
21 22
22 DummyFontFaceSource() { } 23 DummyFontFaceSource() { }
23 24
24 PassRefPtr<SimpleFontData> getFontDataForSize(float size) 25 PassRefPtr<SimpleFontData> getFontDataForSize(float size)
25 { 26 {
26 FontDescription fontDescription; 27 FontDescription fontDescription;
27 fontDescription.setSizeAdjust(size); 28 fontDescription.setSizeAdjust(size);
28 fontDescription.setAdjustedSize(size); 29 fontDescription.setAdjustedSize(size);
29 return getFontData(fontDescription); 30 return getFontData(fontDescription);
(...skipping 14 matching lines...) Expand all
44 45
45 TEST(CSSFontFaceSourceTest, HashCollision) 46 TEST(CSSFontFaceSourceTest, HashCollision)
46 { 47 {
47 DummyFontFaceSource fontFaceSource; 48 DummyFontFaceSource fontFaceSource;
48 // Even if the hash value collide, fontface cache should return different va lue for different fonts. 49 // Even if the hash value collide, fontface cache should return different va lue for different fonts.
49 EXPECT_EQ(simulateHashCalculation(2821), simulateHashCalculation(3346)); 50 EXPECT_EQ(simulateHashCalculation(2821), simulateHashCalculation(3346));
50 EXPECT_NE(fontFaceSource.getFontDataForSize(2821), fontFaceSource.getFontDat aForSize(3346)); 51 EXPECT_NE(fontFaceSource.getFontDataForSize(2821), fontFaceSource.getFontDat aForSize(3346));
51 } 52 }
52 53
53 } // namespace blink 54 } // namespace blink
OLDNEW
« no previous file with comments | « skia/config/SkUserConfig.h ('k') | third_party/WebKit/Source/platform/fonts/WebFontDecoder.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698