K. Moon | 832a694 | 2022-10-31 20:11:31 +0000 | [diff] [blame] | 1 | // Copyright 2020 The PDFium Authors |
Tom Sepez | 72f520c | 2020-08-24 23:43:46 +0000 | [diff] [blame] | 2 | // 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 Sepez | 3799960 | 2022-05-20 16:44:20 +0000 | [diff] [blame] | 8 | #include <string> |
| 9 | |
Tom Sepez | 72f520c | 2020-08-24 23:43:46 +0000 | [diff] [blame] | 10 | #include "public/fpdfview.h" |
| 11 | #include "testing/gtest/include/gtest/gtest.h" |
Tom Anderson | d4fe5f7 | 2021-12-03 20:52:52 +0000 | [diff] [blame] | 12 | #include "testing/test_fonts.h" |
Tom Sepez | 72f520c | 2020-08-24 23:43:46 +0000 | [diff] [blame] | 13 | |
| 14 | class 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 Anderson | d4fe5f7 | 2021-12-03 20:52:52 +0000 | [diff] [blame] | 26 | |
Tom Sepez | 3799960 | 2022-05-20 16:44:20 +0000 | [diff] [blame] | 27 | void AddFlags(int argc, char** argv); |
| 28 | |
| 29 | bool write_pngs() const { return write_pngs_; } |
| 30 | |
Tom Anderson | d4fe5f7 | 2021-12-03 20:52:52 +0000 | [diff] [blame] | 31 | private: |
Tom Sepez | 3799960 | 2022-05-20 16:44:20 +0000 | [diff] [blame] | 32 | void AddFlag(const std::string& flag); |
| 33 | |
Alan Screen | 7784e6a | 2022-09-22 16:15:36 +0000 | [diff] [blame] | 34 | FPDF_RENDERER_TYPE renderer_type_; |
Tom Sepez | 3799960 | 2022-05-20 16:44:20 +0000 | [diff] [blame] | 35 | bool write_pngs_ = false; |
Tom Anderson | d4fe5f7 | 2021-12-03 20:52:52 +0000 | [diff] [blame] | 36 | TestFonts test_fonts_; |
Tom Sepez | 72f520c | 2020-08-24 23:43:46 +0000 | [diff] [blame] | 37 | }; |
| 38 | |
| 39 | #endif // TESTING_EMBEDDER_TEST_ENVIRONMENT_H_ |