| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2015 Google Inc. All rights reserved. | 2 * Copyright (C) 2015 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 | 32 |
| 33 #include "platform/fonts/TypesettingFeatures.h" | 33 #include "platform/fonts/TypesettingFeatures.h" |
| 34 #include "platform/testing/FontTestHelpers.h" | 34 #include "platform/testing/FontTestHelpers.h" |
| 35 #include "platform/testing/UnitTestHelpers.h" | 35 #include "platform/testing/UnitTestHelpers.h" |
| 36 #include "testing/gtest/include/gtest/gtest.h" | 36 #include "testing/gtest/include/gtest/gtest.h" |
| 37 | 37 |
| 38 using blink::testing::createTestFont; | 38 using blink::testing::createTestFont; |
| 39 | 39 |
| 40 namespace blink { | 40 namespace blink { |
| 41 | 41 |
| 42 static inline String fontPath(String relativePath) { | |
| 43 return testing::blinkRootDir() + "/Source/platform/testing/data/" + | |
| 44 relativePath; | |
| 45 } | |
| 46 | |
| 47 TEST(FontPlatformDataTest, AhemHasNoSpaceInLigaturesOrKerning) { | 42 TEST(FontPlatformDataTest, AhemHasNoSpaceInLigaturesOrKerning) { |
| 48 Font font = createTestFont("Ahem", fontPath("Ahem.woff"), 16); | 43 Font font = |
| 44 createTestFont("Ahem", testing::platformTestDataPath("Ahem.woff"), 16); |
| 49 const FontPlatformData& platformData = font.primaryFont()->platformData(); | 45 const FontPlatformData& platformData = font.primaryFont()->platformData(); |
| 50 TypesettingFeatures features = Kerning | Ligatures; | 46 TypesettingFeatures features = Kerning | Ligatures; |
| 51 | 47 |
| 52 EXPECT_FALSE(platformData.hasSpaceInLigaturesOrKerning(features)); | 48 EXPECT_FALSE(platformData.hasSpaceInLigaturesOrKerning(features)); |
| 53 } | 49 } |
| 54 | 50 |
| 55 TEST(FontPlatformDataTest, AhemSpaceLigatureHasSpaceInLigaturesOrKerning) { | 51 TEST(FontPlatformDataTest, AhemSpaceLigatureHasSpaceInLigaturesOrKerning) { |
| 56 Font font = createTestFont("AhemSpaceLigature", | 52 Font font = createTestFont( |
| 57 fontPath("AhemSpaceLigature.woff"), 16); | 53 "AhemSpaceLigature", |
| 54 testing::platformTestDataPath("AhemSpaceLigature.woff"), 16); |
| 58 const FontPlatformData& platformData = font.primaryFont()->platformData(); | 55 const FontPlatformData& platformData = font.primaryFont()->platformData(); |
| 59 TypesettingFeatures features = Kerning | Ligatures; | 56 TypesettingFeatures features = Kerning | Ligatures; |
| 60 | 57 |
| 61 EXPECT_TRUE(platformData.hasSpaceInLigaturesOrKerning(features)); | 58 EXPECT_TRUE(platformData.hasSpaceInLigaturesOrKerning(features)); |
| 62 } | 59 } |
| 63 | 60 |
| 64 TEST(FontPlatformDataTest, AhemSpaceLigatureHasNoSpaceWithoutFontFeatures) { | 61 TEST(FontPlatformDataTest, AhemSpaceLigatureHasNoSpaceWithoutFontFeatures) { |
| 65 Font font = createTestFont("AhemSpaceLigature", | 62 Font font = createTestFont( |
| 66 fontPath("AhemSpaceLigature.woff"), 16); | 63 "AhemSpaceLigature", |
| 64 testing::platformTestDataPath("AhemSpaceLigature.woff"), 16); |
| 67 const FontPlatformData& platformData = font.primaryFont()->platformData(); | 65 const FontPlatformData& platformData = font.primaryFont()->platformData(); |
| 68 TypesettingFeatures features = 0; | 66 TypesettingFeatures features = 0; |
| 69 | 67 |
| 70 EXPECT_FALSE(platformData.hasSpaceInLigaturesOrKerning(features)); | 68 EXPECT_FALSE(platformData.hasSpaceInLigaturesOrKerning(features)); |
| 71 } | 69 } |
| 72 | 70 |
| 73 } // namespace blink | 71 } // namespace blink |
| OLD | NEW |