Files
rk35xx-android14/external/pdfium/testing/xfa_test_environment.cpp
T
hmz007 36ed224bac Rockchip Anroid14_SDK 20240628-rkr5 (2556df1a)
Signed-off-by: hmz007 <hmz007@gmail.com>
Change-Id: Ib87fdbe7a0be7dc961af3500fe9ea4589a127f9f
2024-10-29 18:12:02 +08:00

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/fxge/cfx_fontmgr.h"
#include "core/fxge/cfx_gemodule.h"
#include "core/fxge/systemfontinfo_iface.h"
#include "third_party/base/check.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();
}