summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/html_formatter.cc19
-rw-r--r--src/html_formatter.h2
-rw-r--r--src/pdf_formatter.cc7
-rw-r--r--src/pdf_formatter.h2
-rw-r--r--src/text_formatter.cc8
-rw-r--r--src/text_formatter.h2
-rw-r--r--test/verify_test.cc45
7 files changed, 53 insertions, 32 deletions
diff --git a/src/html_formatter.cc b/src/html_formatter.cc
index 0e796cc3..6b5930d2 100644
--- a/src/html_formatter.cc
+++ b/src/html_formatter.cc
@@ -23,7 +23,9 @@
#include <boost/filesystem.hpp>
+using std::string;
using std::unique_ptr;
+using std::vector;
using namespace dcp;
@@ -95,13 +97,24 @@ HTMLFormatter::unordered_list()
void
-HTMLFormatter::list_item(std::string const& text, boost::optional<std::string> type)
+HTMLFormatter::list_item(std::string const& text, boost::optional<std::string> type, vector<string> const& details)
{
if (type) {
- _file.puts(dcp::String::compose("<li class=\"%1\">%2</li>\n", *type, text).c_str());
+ _file.puts(dcp::String::compose("<li class=\"%1\">%2", *type, text).c_str());
} else {
- _file.puts(dcp::String::compose("<li>%1</li>\n", text).c_str());
+ _file.puts(dcp::String::compose("<li>%1", text).c_str());
}
+
+ if (!details.empty())
+ {
+ _file.puts("<ol>\n");
+ for (auto const& detail: details) {
+ _file.puts(fmt::format("<li>{}", detail).c_str());
+ }
+ _file.puts("</ol>\n");
+ }
+
+ _file.puts("</li>\n");
}
diff --git a/src/html_formatter.h b/src/html_formatter.h
index 2f87a758..2261bfb1 100644
--- a/src/html_formatter.h
+++ b/src/html_formatter.h
@@ -36,7 +36,7 @@ public:
std::unique_ptr<Formatter::Wrap> document() override;
std::unique_ptr<Formatter::Wrap> body() override;
std::unique_ptr<Formatter::Wrap> unordered_list() override;
- void list_item(std::string const& text, boost::optional<std::string> type = {}) override;
+ void list_item(std::string const& text, boost::optional<std::string> type = {}, std::vector<std::string> const& details = {}) override;
std::function<std::string (std::string)> process_string() override;
std::function<std::string (std::string)> fixed_width() override;
diff --git a/src/pdf_formatter.cc b/src/pdf_formatter.cc
index 0ec77c4b..3e4e5c09 100644
--- a/src/pdf_formatter.cc
+++ b/src/pdf_formatter.cc
@@ -24,7 +24,9 @@
#include <fmt/format.h>
+using std::string;
using std::unique_ptr;
+using std::vector;
using namespace dcp;
@@ -234,7 +236,7 @@ PDFFormatter::wrapped_text(float x, float first_line_indent, float font_size, dc
void
-PDFFormatter::list_item(std::string const& text, boost::optional<std::string> type)
+PDFFormatter::list_item(std::string const& text, boost::optional<std::string> type, vector<string> const& details)
{
float const indent = 16 * _indent;
float constexpr dot_radius = 1.5;
@@ -253,6 +255,9 @@ PDFFormatter::list_item(std::string const& text, boost::optional<std::string> ty
}
wrapped_text(indent, dot_radius * 6, font_size, colour, text, (page_width - horizontal_margin * 2) * dpi, font_size * 1.2);
+ for (auto const& detail: details) {
+ wrapped_text(indent + 16, dot_radius * 6, font_size, colour, text, (page_width - horizontal_margin * 2) * dpi, font_size * 1.2);
+ }
}
diff --git a/src/pdf_formatter.h b/src/pdf_formatter.h
index b7d0213d..d20e4ded 100644
--- a/src/pdf_formatter.h
+++ b/src/pdf_formatter.h
@@ -53,7 +53,7 @@ public:
void heading(std::string const& text) override;
void subheading(std::string const& text) override;
std::unique_ptr<Formatter::Wrap> unordered_list() override;
- void list_item(std::string const& text, boost::optional<std::string> type = {}) override;
+ void list_item(std::string const& text, boost::optional<std::string> type = {}, std::vector<std::string> const& details = {}) override;
std::function<std::string (std::string)> process_string() override;
std::function<std::string (std::string)> fixed_width() override;
void finish() override;
diff --git a/src/text_formatter.cc b/src/text_formatter.cc
index a147ea83..55f2e84d 100644
--- a/src/text_formatter.cc
+++ b/src/text_formatter.cc
@@ -22,7 +22,9 @@
#include "text_formatter.h"
+using std::string;
using std::unique_ptr;
+using std::vector;
using namespace dcp;
@@ -57,7 +59,7 @@ TextFormatter::unordered_list()
void
-TextFormatter::list_item(std::string const& text, boost::optional<std::string> type)
+TextFormatter::list_item(std::string const& text, boost::optional<std::string> type, vector<string> const& details)
{
LIBDCP_UNUSED(type);
for (int i = 0; i < _indent * 2; ++i) {
@@ -65,6 +67,10 @@ TextFormatter::list_item(std::string const& text, boost::optional<std::string> t
}
_file.puts("* ");
print(text);
+ for (auto const& detail: details) {
+ _file.puts(" - ");
+ print(detail);
+ }
}
diff --git a/src/text_formatter.h b/src/text_formatter.h
index 8fdb0d89..d0442959 100644
--- a/src/text_formatter.h
+++ b/src/text_formatter.h
@@ -34,7 +34,7 @@ public:
void heading(std::string const& text) override;
void subheading(std::string const& text) override;
std::unique_ptr<Formatter::Wrap> unordered_list() override;
- void list_item(std::string const& text, boost::optional<std::string> type = {}) override;
+ void list_item(std::string const& text, boost::optional<std::string> type = {}, std::vector<std::string> const& details = {}) override;
std::function<std::string (std::string)> process_string() override;
std::function<std::string (std::string)> fixed_width() override;
diff --git a/test/verify_test.cc b/test/verify_test.cc
index 96e77a6a..02b2fd03 100644
--- a/test/verify_test.cc
+++ b/test/verify_test.cc
@@ -6224,31 +6224,28 @@ BOOST_AUTO_TEST_CASE(verify_dcp_with_two_cpls)
prepare_directory(combined);
dcp::combine({ prefix + "_0", prefix+ "_1" }, combined);
+ using VN = dcp::VerificationNote;
+ using VC = VN::Code;
+
check_verify_result_with_duplicates({combined}, {}, {
- ok(dcp::VerificationNote::Code::MATCHING_CPL_HASHES, cpls[0]),
- ok(dcp::VerificationNote::Code::MATCHING_CPL_HASHES, cpls[1]),
- ok(dcp::VerificationNote::Code::MATCHING_PKL_ANNOTATION_TEXT_WITH_CPL, cpls[0]),
- ok(dcp::VerificationNote::Code::MATCHING_PKL_ANNOTATION_TEXT_WITH_CPL, cpls[1]),
- ok(dcp::VerificationNote::Code::VALID_CONTENT_KIND, string{"trailer"}, cpls[0]),
- ok(dcp::VerificationNote::Code::VALID_CONTENT_KIND, string{"trailer"}, cpls[1]),
- ok(dcp::VerificationNote::Code::NONE_ENCRYPTED, cpls[0]),
- ok(dcp::VerificationNote::Code::NONE_ENCRYPTED, cpls[1]),
- ok(dcp::VerificationNote::Code::VALID_CPL_ANNOTATION_TEXT, string{"hello"}, cpls[0]),
- ok(dcp::VerificationNote::Code::VALID_CPL_ANNOTATION_TEXT, string{"hello"}, cpls[1]),
- ok(dcp::VerificationNote::Code::VALID_CONTENT_VERSION_LABEL_TEXT, cpls[0]->content_version()->label_text, cpls[0]),
- ok(dcp::VerificationNote::Code::VALID_CONTENT_VERSION_LABEL_TEXT, cpls[1]->content_version()->label_text, cpls[1]),
- ok(dcp::VerificationNote::Code::VALID_PICTURE_FRAME_SIZES_IN_BYTES, canonical(combined / "videofoo.mxf"), cpls[0]),
- ok(dcp::VerificationNote::Code::VALID_PICTURE_FRAME_SIZES_IN_BYTES, canonical(combined / "videofoo0.mxf"), cpls[1]),
- ok(dcp::VerificationNote::Code::CORRECT_PICTURE_HASH, canonical(combined / "videofoo.mxf"), cpls[0]),
- ok(dcp::VerificationNote::Code::CORRECT_PICTURE_HASH, canonical(combined / "videofoo0.mxf"), cpls[1]),
- dcp::VerificationNote(
- dcp::VerificationNote::Type::BV21_ERROR,
- dcp::VerificationNote::Code::MISSING_CPL_METADATA,
- canonical(combined / cpls[0]->file()->filename())).set_cpl_id(cpls[0]->id()),
- dcp::VerificationNote(
- dcp::VerificationNote::Type::BV21_ERROR,
- dcp::VerificationNote::Code::MISSING_CPL_METADATA,
- canonical(combined / cpls[1]->file()->filename())).set_cpl_id(cpls[1]->id())
+ note(VC::MATCHING_CPL_HASHES, cpls[0]),
+ note(VC::MATCHING_CPL_HASHES, cpls[1]),
+ note(VC::MATCHING_PKL_ANNOTATION_TEXT_WITH_CPL, cpls[0]),
+ note(VC::MATCHING_PKL_ANNOTATION_TEXT_WITH_CPL, cpls[1]),
+ note(VC::VALID_CONTENT_KIND, string{"trailer"}, cpls[0]),
+ note(VC::VALID_CONTENT_KIND, string{"trailer"}, cpls[1]),
+ note(VC::NONE_ENCRYPTED, cpls[0]),
+ note(VC::NONE_ENCRYPTED, cpls[1]),
+ note(VC::VALID_CPL_ANNOTATION_TEXT, string{"hello"}, cpls[0]),
+ note(VC::VALID_CPL_ANNOTATION_TEXT, string{"hello"}, cpls[1]),
+ note(VC::VALID_CONTENT_VERSION_LABEL_TEXT, cpls[0]->content_version()->label_text, cpls[0]),
+ note(VC::VALID_CONTENT_VERSION_LABEL_TEXT, cpls[1]->content_version()->label_text, cpls[1]),
+ note(VC::VALID_PICTURE_FRAME_SIZES_IN_BYTES, canonical(combined / "videofoo.mxf"), cpls[0]),
+ note(VC::VALID_PICTURE_FRAME_SIZES_IN_BYTES, canonical(combined / "videofoo0.mxf"), cpls[1]),
+ note(VC::CORRECT_PICTURE_HASH, canonical(combined / "videofoo.mxf"), cpls[0]),
+ note(VC::CORRECT_PICTURE_HASH, canonical(combined / "videofoo0.mxf"), cpls[1]),
+ note(VC::MISSING_CPL_METADATA, canonical(combined / cpls[0]->file()->filename()), cpls[0]),
+ note(VC::MISSING_CPL_METADATA, canonical(combined / cpls[1]->file()->filename()), cpls[1])
});
}