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

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

Issue 2940933003: DO NOT SUBMIT results of new clang-format (Closed)
Patch Set: Created 3 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
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"
(...skipping 20 matching lines...) Expand all
31 }; 31 };
32 32
33 namespace { 33 namespace {
34 34
35 unsigned SimulateHashCalculation(float size) { 35 unsigned SimulateHashCalculation(float size) {
36 FontDescription font_description; 36 FontDescription font_description;
37 font_description.SetSizeAdjust(size); 37 font_description.SetSizeAdjust(size);
38 font_description.SetAdjustedSize(size); 38 font_description.SetAdjustedSize(size);
39 return font_description.CacheKey(FontFaceCreationParams()).GetHash(); 39 return font_description.CacheKey(FontFaceCreationParams()).GetHash();
40 } 40 }
41 } 41 } // namespace
42 42
43 TEST(CSSFontFaceSourceTest, HashCollision) { 43 TEST(CSSFontFaceSourceTest, HashCollision) {
44 DummyFontFaceSource font_face_source; 44 DummyFontFaceSource font_face_source;
45 // Even if the hash value collide, fontface cache should return different 45 // Even if the hash value collide, fontface cache should return different
46 // value for different fonts. 46 // value for different fonts.
47 EXPECT_EQ(SimulateHashCalculation(8775), SimulateHashCalculation(418)); 47 EXPECT_EQ(SimulateHashCalculation(8775), SimulateHashCalculation(418));
48 EXPECT_NE(font_face_source.GetFontDataForSize(8775), 48 EXPECT_NE(font_face_source.GetFontDataForSize(8775),
49 font_face_source.GetFontDataForSize(418)); 49 font_face_source.GetFontDataForSize(418));
50 } 50 }
51 51
52 } // namespace blink 52 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698