#pragma once #include #include #include #include "parser/pdfium_document.hpp" #include "fonts/pdf_fonts/encoding/cjk_collection_db.hpp" #include #include #include #include #include #include #include #include "fonts/cache/glyph_cache.hpp" #include "fonts/pdf_fonts/font.hpp" #ifndef TEST_CORPUS_DIR #define TEST_CORPUS_DIR "../../corpus" #endif namespace { #define SKIP_IF_NO_PDFIUM() \ if (!pdfengine::engineHasPdfium()) { \ GTEST_SKIP() << "Skipping PDFium tests because PDFium is not linked."; \ } std::filesystem::path getCorpusPath(const std::string& subfolder, const std::string& filename) { return std::filesystem::path(TEST_CORPUS_DIR) / subfolder / filename; } std::vector readFile(const std::filesystem::path& path) { std::ifstream file(path, std::ios::binary | std::ios::ate); if (!file.is_open()) { return {}; } std::streamsize size = file.tellg(); file.seekg(0, std::ios::beg); std::vector buffer(size); if (file.read(reinterpret_cast(buffer.data()), size)) { return buffer; } return {}; } const std::vector corpus_basic = { "about_blank.pdf", "black.pdf", "clip_path.pdf", "dashed_lines.pdf", "hello_world.pdf", "hello_world_2_pages.pdf", "many_rectangles.pdf", "rectangles.pdf", "rectangles_multi_pages.pdf", "whitespace.pdf" }; const std::vector corpus_fonts = { "latin_extended.pdf", "rotated_text.pdf", "rotated_text_90.pdf", "text_font.pdf", "utf-8.pdf", "vertical_text.pdf", "hebrew_mirrored.pdf" }; const std::vector corpus_edge = { "annots.pdf", "bookmarks.pdf", "combobox_form.pdf", "embedded_attachments.pdf", "empty_xref.pdf", "encrypted.pdf", "linearized.pdf", "listbox_form.pdf", "no_page_count.pdf", "page_labels.pdf", "text_form.pdf", "unsupported_feature.pdf", "zero_length_stream.pdf" }; }