| Index: Source/platform/fonts/FontPlatformDataTest.cpp
|
| diff --git a/Source/web/tests/WebSelectorTest.cpp b/Source/platform/fonts/FontPlatformDataTest.cpp
|
| similarity index 52%
|
| copy from Source/web/tests/WebSelectorTest.cpp
|
| copy to Source/platform/fonts/FontPlatformDataTest.cpp
|
| index 28b8f7adf51b08af3d251c9d027bde83a596e818..ecc0c37fe10b4e923761b28b783fda6bb30bedff 100644
|
| --- a/Source/web/tests/WebSelectorTest.cpp
|
| +++ b/Source/platform/fonts/FontPlatformDataTest.cpp
|
| @@ -1,5 +1,5 @@
|
| /*
|
| - * Copyright (C) 2013 Google Inc. All rights reserved.
|
| + * Copyright (C) 2015 Google Inc. All rights reserved.
|
| *
|
| * Redistribution and use in source and binary forms, with or without
|
| * modification, are permitted provided that the following conditions are
|
| @@ -29,30 +29,50 @@
|
| */
|
|
|
| #include "config.h"
|
| -#include "public/web/WebSelector.h"
|
| +#include "platform/fonts/Font.h"
|
|
|
| -#include "public/platform/WebString.h"
|
| +#include "platform/fonts/TestFontSelector.h"
|
| +#include "platform/fonts/TypesettingFeatures.h"
|
| #include "public/platform/WebUnitTestSupport.h"
|
| +
|
| #include <gtest/gtest.h>
|
|
|
| namespace blink {
|
|
|
| -TEST(WebSelectorTest, Canonicalizes)
|
| +static inline String fontPath(String relativePath)
|
| {
|
| - EXPECT_EQ("h1, h2[style=\"foobar\"] span", canonicalizeSelector("h1,h2[style='foobar'] span").utf8());
|
| - EXPECT_EQ("h1, h2[style=\"foobar\"] span", canonicalizeSelector("h1, h2[style=\"foobar\"] span").utf8());
|
| + return Platform::current()->unitTestSupport()->webKitRootDir()
|
| + + String("/LayoutTests/")
|
| + + relativePath;
|
| }
|
|
|
| -TEST(WebSelectorTest, Checks)
|
| +TEST(FontPlatformDataTest, AhemHasNoSpaceInLigaturesOrKerning)
|
| {
|
| - EXPECT_EQ("", canonicalizeSelector("h1..h2").utf8());
|
| - EXPECT_EQ("", canonicalizeSelector("h1..h2", WebSelectorTypeCompound).utf8());
|
| + Font font = createTestFont("Ahem", fontPath("resources/Ahem.woff"));
|
| + const FontPlatformData& platformData = font.primaryFont()->platformData();
|
| + TypesettingFeatures features = Kerning | Ligatures;
|
| +
|
| + EXPECT_FALSE(platformData.hasSpaceInLigaturesOrKerning(features));
|
| }
|
|
|
| -TEST(WebSelectorTest, Restricts)
|
| +TEST(FontPlatformDataTest, AhemSpaceLigatureHasSpaceInLigaturesOrKerning)
|
| {
|
| - EXPECT_EQ("", canonicalizeSelector("h1 span,h2", WebSelectorTypeCompound).utf8());
|
| - EXPECT_EQ("h1, h2[style=\"foobar\"].cls", canonicalizeSelector("h1,h2[style=\"foobar\"].cls", WebSelectorTypeCompound).utf8());
|
| + Font font = createTestFont("AhemSpaceLigature",
|
| + fontPath("third_party/AhemSpaceLigature/AhemSpaceLigature.woff"));
|
| + const FontPlatformData& platformData = font.primaryFont()->platformData();
|
| + TypesettingFeatures features = Kerning | Ligatures;
|
| +
|
| + EXPECT_TRUE(platformData.hasSpaceInLigaturesOrKerning(features));
|
| +}
|
| +
|
| +TEST(FontPlatformDataTest, AhemSpaceLigatureHasNoSpaceWithoutFontFeatures)
|
| +{
|
| + Font font = createTestFont("AhemSpaceLigature",
|
| + fontPath("third_party/AhemSpaceLigature/AhemSpaceLigature.woff"));
|
| + const FontPlatformData& platformData = font.primaryFont()->platformData();
|
| + TypesettingFeatures features = 0;
|
| +
|
| + EXPECT_FALSE(platformData.hasSpaceInLigaturesOrKerning(features));
|
| }
|
|
|
| } // namespace blink
|
|
|