blob: 7799bb16e3e9e5d0b7232e977e9e13347b4ff5e4 [file] [log] [blame]
// Copyright 2019 PDFium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "testing/xfa_test_environment.h"
#include "core/fxge/cfx_fontmgr.h"
#include "core/fxge/cfx_gemodule.h"
#include "core/fxge/systemfontinfo_iface.h"
#include "xfa/fgas/font/cfgas_gemodule.h"
namespace {
XFATestEnvironment* g_env = nullptr;
} // namespace
XFATestEnvironment::XFATestEnvironment() {
ASSERT(!g_env);
g_env = this;
}
XFATestEnvironment::~XFATestEnvironment() {
ASSERT(g_env);
g_env = nullptr;
}
void XFATestEnvironment::SetUp() {
CFX_GEModule::Get()->GetFontMgr()->SetSystemFontInfo(
CFX_GEModule::Get()->GetPlatform()->CreateDefaultSystemFontInfo());
// The font loading that takes place in CFGAS_GEModule::Create() is slow,
// but we do it only once per binary execution, not once per test.
CFGAS_GEModule::Create();
}
void XFATestEnvironment::TearDown() {
CFGAS_GEModule::Destroy();
}