OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 #import "platform/fonts/mac/FontFamilyMatcherMac.h" | 5 #import "platform/fonts/mac/FontFamilyMatcherMac.h" |
6 | 6 |
| 7 #include "platform/FontFamilyNames.h" |
| 8 |
7 #include <AppKit/AppKit.h> | 9 #include <AppKit/AppKit.h> |
8 #include <gtest/gtest.h> | 10 #include <gtest/gtest.h> |
9 | 11 |
10 #import "platform/mac/VersionUtilMac.h" | 12 #import "platform/mac/VersionUtilMac.h" |
11 | 13 |
12 @interface NSString (YosemiteAdditions) | 14 @interface NSString (YosemiteAdditions) |
13 - (BOOL)containsString:(NSString*)string; | 15 - (BOOL)containsString:(NSString*)string; |
14 @end | 16 @end |
15 | 17 |
16 namespace blink { | 18 namespace blink { |
17 | 19 |
18 void TestSystemFontContainsString(FontWeight desiredWeight, | 20 void TestSystemFontContainsString(FontWeight desiredWeight, |
19 NSString* substring) { | 21 NSString* substring) { |
20 NSFont* font = MatchNSFontFamily(@"BlinkMacSystemFont", 0, desiredWeight, 11); | 22 NSFont* font = |
| 23 MatchNSFontFamily(FontFamilyNames::system_ui, 0, desiredWeight, 11); |
21 EXPECT_TRUE([font.description containsString:substring]); | 24 EXPECT_TRUE([font.description containsString:substring]); |
22 } | 25 } |
23 | 26 |
24 TEST(FontFamilyMatcherMacTest, YosemiteFontWeights) { | 27 TEST(FontFamilyMatcherMacTest, YosemiteFontWeights) { |
25 if (!IsOS10_10()) | 28 if (!IsOS10_10()) |
26 return; | 29 return; |
27 | 30 |
28 TestSystemFontContainsString(FontWeight100, @"-UltraLight"); | 31 TestSystemFontContainsString(FontWeight100, @"-UltraLight"); |
29 TestSystemFontContainsString(FontWeight200, @"-Thin"); | 32 TestSystemFontContainsString(FontWeight200, @"-Thin"); |
30 TestSystemFontContainsString(FontWeight300, @"-Light"); | 33 TestSystemFontContainsString(FontWeight300, @"-Light"); |
31 TestSystemFontContainsString(FontWeight400, @"-Regular"); | 34 TestSystemFontContainsString(FontWeight400, @"-Regular"); |
32 TestSystemFontContainsString(FontWeight500, @"-Medium"); | 35 TestSystemFontContainsString(FontWeight500, @"-Medium"); |
33 TestSystemFontContainsString(FontWeight600, @"-Bold"); | 36 TestSystemFontContainsString(FontWeight600, @"-Bold"); |
34 TestSystemFontContainsString(FontWeight700, @"-Bold"); | 37 TestSystemFontContainsString(FontWeight700, @"-Bold"); |
35 TestSystemFontContainsString(FontWeight800, @"-Heavy"); | 38 TestSystemFontContainsString(FontWeight800, @"-Heavy"); |
36 TestSystemFontContainsString(FontWeight900, @"-Heavy"); | 39 TestSystemFontContainsString(FontWeight900, @"-Heavy"); |
37 } | 40 } |
38 | 41 |
39 } // namespace blink | 42 } // namespace blink |
OLD | NEW |