Debian Codegraph @

podofo/test/unit/main.cpp

raw
1 // SPDX-FileCopyrightText: 2007 Dominik Seichter <[email protected]>
2 // SPDX-FileCopyrightText: 2021 Francesco Pretto <[email protected]>
3 // SPDX-License-Identifier: MIT-0
4
5 #define CATCH_CONFIG_RUNNER
6 #include <catch.hpp>
7
8 #include <PdfTest.h>
9
10 using namespace std;
11 using namespace PoDoFo;
12
13 int main(int argc, char* argv[])
14 {
15 // Avoid performing test initialization on Catch2 query for tests,
16 // which it does with switches "--list-test-names-only" and "--list-reporters"
17 if (argc <= 1 || string_view(argv[1]).find("--list") == string_view::npos)
18 {
19 PdfCommon::SetMaxLoggingSeverity(PdfLogSeverity::Warning);
20
21 // Add a fonts directory for more consistents run
22 auto fontPath = TestUtils::GetTestInputPath() / "Fonts";
23 if (!fs::exists(fontPath))
24 {
25 throw runtime_error("Missing Fonts directory. Ensure you have correctly "
26 "fetched \"extern/resources\" git submodule");
27 }
28
29 PdfCommon::AddFontDirectory(fontPath.u8string());
30 PdfCommon::SetMaxLoggingSeverity(PdfLogSeverity::Warning);
31 }
32
33 return Catch::Session().run(argc, argv);
34 }