-
Notifications
You must be signed in to change notification settings - Fork 2.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[#49081] PDF-Export: Add tests for pdf content #13238
Conversation
…sts, do not hardcode column names
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Left 2 remarks inside, otherwise this is fine
content = export_pdf.content | ||
# File.binwrite('WorkPackageToPdf-test-preview.pdf', content) | ||
{ strings: PDF::Inspector::Text.analyze(content).strings, | ||
images: PDF::Inspector::XObject.analyze(content).page_xobjects.flat_map do |o| | ||
o.values.select { |v| v.hash[:Subtype] == :Image } | ||
end } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
❓ In the other test we are writing the PDF to disk, here we are checking the content directly. Can't we use the same procedure in the other file as well?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The (other) query based export does have a feature to batch exporting thousands of work packages (with images) to different pdfs and concats them in the end with an external tool. Granted, the batching is currently not triggered in the spec, but this change wouldn't have much benefits.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
def column_title(column_name) | ||
label_title(column_name).upcase | ||
end | ||
|
||
def label_title(column_name) | ||
WorkPackage.human_attribute_name(column_name) | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's only 2 methods, but they are the same here and in the other test. We could put them in a module in spec/support/
and include that module in both tests
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, done!
…or-pdf-content' into implementation/49081-add-tests-for-pdf-content
This PR adds:
https://community.openproject.org/work_packages/49081