blob: e04c5ae4be054b4b95d3f4f8b02c6ef65dff50c0 [file] [log] [blame]
K. Moon832a6942022-10-31 20:11:31 +00001// Copyright 2020 The PDFium Authors
Tom Sepez72f520c2020-08-24 23:43:46 +00002// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#ifndef TESTING_EMBEDDER_TEST_ENVIRONMENT_H_
6#define TESTING_EMBEDDER_TEST_ENVIRONMENT_H_
7
Tom Sepez37999602022-05-20 16:44:20 +00008#include <string>
9
Tom Sepez72f520c2020-08-24 23:43:46 +000010#include "public/fpdfview.h"
11#include "testing/gtest/include/gtest/gtest.h"
Tom Andersond4fe5f72021-12-03 20:52:52 +000012#include "testing/test_fonts.h"
Tom Sepez72f520c2020-08-24 23:43:46 +000013
14class EmbedderTestEnvironment : public testing::Environment {
15 public:
16 EmbedderTestEnvironment();
17 ~EmbedderTestEnvironment() override;
18
19 // Note: GetInstance() does not create one if it does not exist,
20 // so the main program must explicitly add this enviroment.
21 static EmbedderTestEnvironment* GetInstance();
22
23 // testing::Environment:
24 void SetUp() override;
25 void TearDown() override;
Tom Andersond4fe5f72021-12-03 20:52:52 +000026
Tom Sepez37999602022-05-20 16:44:20 +000027 void AddFlags(int argc, char** argv);
28
29 bool write_pngs() const { return write_pngs_; }
30
Tom Andersond4fe5f72021-12-03 20:52:52 +000031 private:
Tom Sepez37999602022-05-20 16:44:20 +000032 void AddFlag(const std::string& flag);
33
Alan Screen7784e6a2022-09-22 16:15:36 +000034 FPDF_RENDERER_TYPE renderer_type_;
Tom Sepez37999602022-05-20 16:44:20 +000035 bool write_pngs_ = false;
Tom Andersond4fe5f72021-12-03 20:52:52 +000036 TestFonts test_fonts_;
Tom Sepez72f520c2020-08-24 23:43:46 +000037};
38
39#endif // TESTING_EMBEDDER_TEST_ENVIRONMENT_H_