Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion test/data/reference-output/odr-private
40 changes: 26 additions & 14 deletions test/src/html_output_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ TEST_P(HtmlOutputTests, html_meta) {
GTEST_SKIP();
}

// TODO fix
// TODO fix pdf implementation
if ((engine == DecoderEngine::odr) &&
(test_file.type == FileType::portable_document_format) &&
(test_repo != "odr-public")) {
Expand All @@ -71,6 +71,18 @@ TEST_P(HtmlOutputTests, html_meta) {

FileMeta file_meta = file.file_meta();

fs::create_directories(output_path);

{
const std::string meta_output = output_path + "/meta.json";
const nlohmann::json json =
odr::internal::util::meta::meta_to_json(file_meta);
std::ofstream o(meta_output);
o << std::setw(4) << json << std::endl;
EXPECT_TRUE(fs::is_regular_file(meta_output));
EXPECT_LT(0, fs::file_size(meta_output));
}

// encrypted ooxml type cannot be inspected
if ((file.file_type() != FileType::office_open_xml_encrypted)) {
EXPECT_EQ(test_file.type, file.file_type());
Expand All @@ -94,6 +106,19 @@ TEST_P(HtmlOutputTests, html_meta) {

if (test_file.password.has_value()) {
file = file.decrypt(test_file.password.value());

// After decryption, the file meta may change
file_meta = file.file_meta();

{
const std::string meta_output = output_path + "/meta-decrypted.json";
const nlohmann::json json =
odr::internal::util::meta::meta_to_json(file_meta);
std::ofstream o(meta_output);
o << std::setw(4) << json << std::endl;
EXPECT_TRUE(fs::is_regular_file(meta_output));
EXPECT_LT(0, fs::file_size(meta_output));
}
}

if (file.is_document_file()) {
Expand All @@ -102,19 +127,6 @@ TEST_P(HtmlOutputTests, html_meta) {
EXPECT_EQ(test_file.type, document_file.file_type());
}

fs::create_directories(output_path);
file_meta = file.file_meta();

{
const std::string meta_output = output_path + "/meta.json";
const nlohmann::json json =
odr::internal::util::meta::meta_to_json(file_meta);
std::ofstream o(meta_output);
o << std::setw(4) << json << std::endl;
EXPECT_TRUE(fs::is_regular_file(meta_output));
EXPECT_LT(0, fs::file_size(meta_output));
}

const std::string resource_path = common::Path(output_path_prefix)
.parent()
.join(Path("resources"))
Expand Down