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