From 574d4408a5174bb410cf4ec3db24283671bcce79 Mon Sep 17 00:00:00 2001 From: Dan Sinclair Date: Mon, 28 Aug 2017 10:11:24 -0400 Subject: Add a global font loader in XFA tests This CL creates a global font loader for use in XFA tests. This is needed because the CFGAS_FontMangaer takes a linearly increasing amount of time to load fonts each time it's loaded. This can get excessively slow for test suites which run a lot of tests. Change-Id: Ie389844b56598ce414f4f761654fa4ed465955fd Reviewed-on: https://pdfium-review.googlesource.com/12090 Reviewed-by: Henrique Nakashima Reviewed-by: Ryan Harrison Commit-Queue: dsinclair --- xfa/fgas/layout/cfx_rtfbreak_unittest.cpp | 18 ++---------------- 1 file changed, 2 insertions(+), 16 deletions(-) (limited to 'xfa/fgas') diff --git a/xfa/fgas/layout/cfx_rtfbreak_unittest.cpp b/xfa/fgas/layout/cfx_rtfbreak_unittest.cpp index cef215fe2a..8997edc083 100644 --- a/xfa/fgas/layout/cfx_rtfbreak_unittest.cpp +++ b/xfa/fgas/layout/cfx_rtfbreak_unittest.cpp @@ -18,17 +18,8 @@ class CFX_RTFBreakTest : public testing::Test { public: void SetUp() override { - CFX_GEModule::Get()->GetFontMgr()->SetSystemFontInfo( - IFX_SystemFontInfo::CreateDefault(nullptr)); - -#if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ - font_mgr_ = CFGAS_FontMgr::Create(FX_GetDefFontEnumerator()); -#else - font_source_ = pdfium::MakeUnique(); - font_mgr_ = CFGAS_FontMgr::Create(font_source_.get()); -#endif - - font_ = CFGAS_GEFont::LoadFont(L"Arial Black", 0, 0, font_mgr_.get()); + font_ = + CFGAS_GEFont::LoadFont(L"Arial Black", 0, 0, GetGlobalFontManager()); ASSERT(font_.Get() != nullptr); } @@ -39,12 +30,7 @@ class CFX_RTFBreakTest : public testing::Test { } private: - std::unique_ptr font_mgr_; CFX_RetainPtr font_; - -#if _FXM_PLATFORM_ != _FXM_PLATFORM_WINDOWS_ - std::unique_ptr font_source_; -#endif }; // As soon as you get one of the control characters the break is complete -- cgit v1.2.3