[Draft] Add two PoC testcases to libcupsfilters test suite (text→PDF and malformed PDF)#109
Conversation
…d PDF) and their corresponding input-files in cupsfilters/test_files
|
Note that we do not actually do application/pdf → application/pdf, but instead application/pdf → application/vnd.cups-pdf which resolves to a call of pdftopdf. pdftopdf, independent whether the old QPDF-based one ot the new PDFio-based one shhould error out. Both PDF manipulation libraries should error on invalid PDF. |
|
I had initially used application/pdf → application/pdf, which explains why the malformed test was just a pass-through. |
|
@shreyanshtiwari4 What is still missing in this PR? Why it is still "Draft"? |
I forgot to close this PR, it was raised 3 months back to show you my work, when I initially started my contribution. I will close this PR. |
|
This PR contained two test cases:-
So, let me know if you want me to add malformed pdf as a test case. I will raise a separate PR for it. |
OK, please make a new PR for that. |
Summary
This draft PR adds two small Proof-of-Concept testcases to
cupsfilters/test-filter-cases.txt, along with their corresponding input files incupsfilters/test_files/.The purpose of this PoC is to better understand how the libcupsfilters test harness (
testfilters) behaves for simple input→output scenarios, and to explore how we can later expand automated CI coverage using such testcases.This PR is not intended for merging yet — it is meant for discussion, feedback, and refinement of directions for future test additions.
Added Testcases
1.
text/plain → application/pdf(Positive Test)Entry added to
test-filter-cases.txt:Local Behavior (PoC-Only Test Run)
Ran:
From the log:
The output file "cupsfilters/test_files/output_files/output_text_simple.pdf" was created successfully (~1125 bytes) and appears as a valid PDF.
Conclusion:
This PoC correctly exercises the texttopdf filter and demonstrates that the test harness handles simple text→PDF transforms reliably.
2.
malformed PDF → application/pdf(Exploratory “Negative” Test)Entry added to
test-filter-cases.txt:malformed.pdf is a deliberately invalid “PDF” consisting of:
Local behavior (same PoC-only run as above)
From the log:
The output file "cupsfilters/test_files/output_files/output_malformed_should_fail.pdf" was created with size 26 bytes, i.e. essentially a direct copy of the malformed input.(although I was expecting a Ghostscript failure)
From observation I think the reason this happens:
Conclusion:
This PoC demonstrates the current behavior: malformed-PDF handling only triggers Ghostscript failures when the test requests a transformation such as PDF→PWG or PDF→PCLm.