Implemented discovery logic already exists in tests/forms_integration.rs: - discover_pdf_fixtures() uses walkdir for recursive PDF discovery - find_pdf_fixtures() uses std::fs for non-recursive discovery - All 6 tests pass, including test_discover_pdf_fixtures which prints discovered fixtures - Test is idempotent with no side effects Acceptance criteria: ✅ Discovers PDF files in tests/fixtures/forms/ ✅ Prints discovered fixtures for verification ✅ cargo test forms_integration passes (6/6 tests) ✅ Test runs identically on repeated execution Verification: notes/bf-14tjh.md
3.1 KiB
3.1 KiB
Verification Note: bf-4ozna - Create degraded 200 DPI PDF from source document
Task Completion Summary
Successfully created a degraded 200 DPI PDF from a public domain source document for use as an OCR test fixture.
Artifacts Created
-
Primary Output:
tests/fixtures/scanned/low-quality/degraded-200dpi.pdf(588KB)- Multi-page PDF with intentional degradation effects
-
Supporting Files:
tests/fixtures/scanned/low-quality/create_degraded_200dpi.py- Python script for generating the degraded PDFtests/fixtures/scanned/low-quality/source-document-abraham-lincoln-public-domain.txt- Source text (public domain)tests/fixtures/scanned/low-quality/degraded-200dpi-ground-truth.txt- Expected OCR output for validation
Degradation Applied
The PDF was created with the following intentional degradation effects (from the creation script):
- Resolution: Set to 200 DPI (lower than typical 300 DPI scans)
- Gaussian Blur: radius=0.3 (simulates poor focus)
- Random Noise: amount=12 (simulates scan artifacts)
- Contrast Reduction: factor=0.9 (simulates poor scan quality)
- Sharpness Reduction: factor=0.85
- JPEG Compression: quality=85 (introduces compression artifacts)
Source Document
- Content: Abraham Lincoln historical biography ("THE PEOPLE'S LEADER IN THE STRUGGLE FOR NATIONAL EXISTENCE")
- Author: George Haven Putnam, Litt. D.
- License: Public Domain (Project Gutenberg eBook #11728)
- URL: https://www.gutenberg.org/ebooks/11728
- Size: ~2.5KB excerpt used for single-page fixture
Verification
✅ Acceptance Criteria Met:
- ✓ degraded-200dpi.pdf exists in tests/fixtures/scanned/low-quality/
- ✓ PDF is visibly degraded (200 DPI with blur, noise, compression artifacts)
- ✓ PDF is readable enough for OCR but clearly poor quality
- ✓ File size is reasonable (588KB for multi-page fixture)
- ✓ PDF can be rendered by standard tools (verified with pdftoppm)
Testing Verification
# PDF exists and has correct size
$ ls -lh tests/fixtures/scanned/low-quality/degraded-200dpi.pdf
-rw-r--r-- 1 coding users 588K Jul 6 11:39 degraded-200dpi.pdf
# PDF can be rendered (produces 6.1MB PPM image)
$ pdftoppm -r 150 -f 1 -l 1 tests/fixtures/scanned/low-quality/degraded-200dpi.pdf /tmp/verify-degraded
$ ls -lh /tmp/verify-degraded-1.ppm
-rw-r--r-- 1 coding users 6.1M Jul 6 12:10 /tmp/verify-degraded-1.ppm
Re-creation
The degraded PDF can be re-created using the provided script:
cd tests/fixtures/scanned/low-quality/
python3 create_degraded_200dpi.py
Requires: pip3 install reportlab Pillow
Use Case
This fixture is designed for testing OCR quality and robustness with degraded input, simulating:
- Low-resolution scans
- Poor quality scanning equipment
- Compressed/recompressed PDFs
- Scanned documents with artifacts
Notes
- All artifacts are committed to the repository
- Source document is confirmed public domain
- Ground truth file enables OCR accuracy validation
- Infrastructure supports future degraded fixture generation