@@ -56,7 +56,7 @@ TEST_P(HtmlOutputTests, html_meta) {
5656 GTEST_SKIP ();
5757 }
5858
59- // TODO fix
59+ // TODO fix pdf implementation
6060 if ((engine == DecoderEngine::odr) &&
6161 (test_file.type == FileType::portable_document_format) &&
6262 (test_repo != " odr-public" )) {
@@ -71,6 +71,18 @@ TEST_P(HtmlOutputTests, html_meta) {
7171
7272 FileMeta file_meta = file.file_meta ();
7373
74+ fs::create_directories (output_path);
75+
76+ {
77+ const std::string meta_output = output_path + " /meta.json" ;
78+ const nlohmann::json json =
79+ odr::internal::util::meta::meta_to_json (file_meta);
80+ std::ofstream o (meta_output);
81+ o << std::setw (4 ) << json << std::endl;
82+ EXPECT_TRUE (fs::is_regular_file (meta_output));
83+ EXPECT_LT (0 , fs::file_size (meta_output));
84+ }
85+
7486 // encrypted ooxml type cannot be inspected
7587 if ((file.file_type () != FileType::office_open_xml_encrypted)) {
7688 EXPECT_EQ (test_file.type , file.file_type ());
@@ -94,6 +106,19 @@ TEST_P(HtmlOutputTests, html_meta) {
94106
95107 if (test_file.password .has_value ()) {
96108 file = file.decrypt (test_file.password .value ());
109+
110+ // After decryption, the file meta may change
111+ file_meta = file.file_meta ();
112+
113+ {
114+ const std::string meta_output = output_path + " /meta-decrypted.json" ;
115+ const nlohmann::json json =
116+ odr::internal::util::meta::meta_to_json (file_meta);
117+ std::ofstream o (meta_output);
118+ o << std::setw (4 ) << json << std::endl;
119+ EXPECT_TRUE (fs::is_regular_file (meta_output));
120+ EXPECT_LT (0 , fs::file_size (meta_output));
121+ }
97122 }
98123
99124 if (file.is_document_file ()) {
@@ -102,19 +127,6 @@ TEST_P(HtmlOutputTests, html_meta) {
102127 EXPECT_EQ (test_file.type , document_file.file_type ());
103128 }
104129
105- fs::create_directories (output_path);
106- file_meta = file.file_meta ();
107-
108- {
109- const std::string meta_output = output_path + " /meta.json" ;
110- const nlohmann::json json =
111- odr::internal::util::meta::meta_to_json (file_meta);
112- std::ofstream o (meta_output);
113- o << std::setw (4 ) << json << std::endl;
114- EXPECT_TRUE (fs::is_regular_file (meta_output));
115- EXPECT_LT (0 , fs::file_size (meta_output));
116- }
117-
118130 const std::string resource_path = common::Path (output_path_prefix)
119131 .parent ()
120132 .join (Path (" resources" ))
0 commit comments