mirror of
https://pdfium.googlesource.com/pdfium
synced 2026-07-31 22:26:36 +08:00
Bug: pdfium:2127 Change-Id: I6958fd117a550a8c46a43265ee46370bd1615f38 Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/116851 Reviewed-by: Tom Sepez <tsepez@chromium.org> Reviewed-by: Thomas Sepez <tsepez@google.com> Commit-Queue: Lei Zhang <thestig@chromium.org>
41 lines
1.0 KiB
C++
41 lines
1.0 KiB
C++
// Copyright 2019 The PDFium Authors
|
|
// 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/fxcrt/check.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() {
|
|
DCHECK(!g_env);
|
|
g_env = this;
|
|
}
|
|
|
|
XFATestEnvironment::~XFATestEnvironment() {
|
|
DCHECK(g_env);
|
|
g_env = nullptr;
|
|
}
|
|
|
|
void XFATestEnvironment::SetUp() {
|
|
CFX_GEModule::Get()->GetFontMgr()->GetBuiltinMapper()->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();
|
|
}
|