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