chromium/third_party/blink/renderer/platform/fonts/web_font_typeface_factory_test.cc

// Copyright 2023 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "third_party/blink/renderer/platform/fonts/web_font_typeface_factory.h"

#include "build/build_config.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/blink/renderer/platform/fonts/opentype/font_format_check.h"
#include "third_party/blink/renderer/platform/testing/runtime_enabled_features_test_helpers.h"

#if BUILDFLAG(IS_WIN)
#include "third_party/blink/renderer/platform/fonts/win/dwrite_font_format_support.h"
#endif

namespace blink {

AtLeast;
Return;

class MockFontFormatCheck : public FontFormatCheck {};

sk_sp<SkTypeface> expect_called(sk_sp<SkData>) {}

sk_sp<SkTypeface> expect_not_called(sk_sp<SkData>) {}

#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_APPLE)
WebFontTypefaceFactory::FontInstantiator g_expectSystem{
    expect_called, expect_not_called, expect_not_called};
WebFontTypefaceFactory::FontInstantiator g_expectFontations{
    expect_not_called, expect_called, expect_not_called};
WebFontTypefaceFactory::FontInstantiator g_expectFallback{
    expect_not_called, expect_not_called, expect_called};
#else
WebFontTypefaceFactory::FontInstantiator g_expectSystem{};
WebFontTypefaceFactory::FontInstantiator g_expectFontations{};
#endif

TEST(WebFontTypefaceFactoryTest, DefaultAlwaysSystem) {}

TEST(WebFontTypefaceFactoryTest, ColrV1AlwaysFallback) {}

TEST(WebFontTypefaceFactoryTest, FontationsSelectedAlwaysColrV1) {}

TEST(WebFontTypefaceFactoryTest, Cff2AlwaysFallback) {}

TEST(WebFontTypefaceFactoryTest, FontationsSelectedAlwaysCFF2) {}

TEST(WebFontTypefaceFactoryTest, CbdtCblcAlwaysFallback) {}

TEST(WebFontTypefaceFactoryTest, FontationsSelectedAlwaysCbdtCblc) {}

TEST(WebFontTypefaceFactoryTest, ColrV0FallbackApple) {}

TEST(WebFontTypefaceFactoryTest, VariableColrV0FallbackWindowsApple) {}

TEST(WebFontTypefaceFactoryTest, FontationsSelectedVariableSystem) {}

TEST(WebFontTypefaceFactoryTest, FontationsSelectedStaticSystem) {}

TEST(WebFontTypefaceFactoryTest, FontationsSelectedVariableColrV0) {}

#if BUILDFLAG(IS_IOS)
// TODO(crbug.com/1499557): Currently fails on the platform.
#define MAYBE_SbixFallbackWindows
#else
#define MAYBE_SbixFallbackWindows
#endif
TEST(WebFontTypefaceFactoryTest, MAYBE_SbixFallbackWindows) {}

TEST(WebFontTypefaceFactoryTest, FontationsSelectedSbixNonApple) {}

#if BUILDFLAG(IS_IOS)
// TODO(crbug.com/1499557): Currently fails on the platform.
#define MAYBE_VariationsWinFallbackIfNeeded
#else
#define MAYBE_VariationsWinFallbackIfNeeded
#endif
TEST(WebFontTypefaceFactoryTest, MAYBE_VariationsWinFallbackIfNeeded) {}

}  // namespace blink