- python unit tests for basic "backend" functionality using
pytest(orunittest)- basic utils: History, Redaction, ... → see !112
- document redaction functionality: Page, Document
- test redaction with variety of example PDF files
- full-page redaction
- no redaction (only elemens outside of page borders must be redacted)
- test partial-page redaction?
- integration tests for basic "frontend", e.g.,
- window title depending on document modified state
- button visibility and sensibility, e.g., undo/redo depends on past/future history redaction?
- maybe test file contents after redaction with various independent tools, e.g.,
- pypdf
- extract text
- extract images
- manually check page content stream for painting/text operators to check for vector drawings (like in #114/files)
- pikepdf
- poppler
- pypdf
Test results on sample PDF files
| source | total | no open (safe) | fail redact (unsafe, warn) | redact too much (safe, warn) | fail redact (no warn) | broken saving |
|---|---|---|---|---|---|---|
| py-pdf | 33 | 3 | 2 (draw) | 0 | ||
| qpdf | 632 | 58 | 4 (draw) | 0 | ||
| pikepdf | 35 | 4 | 0 | 0 | ||
| Artifex | 128 | 5 | 10 (draw), 1 (txt), 4 (img #165) | 1 (img #155) | ||
| PyMuPDF | 164 | 1 | 7 (draw), 4 (img #165) | 0 | ||
| ghostpdl | 35 | 0 | 3 (draw) | 0 | ||
| poppler | 13 | 1 | 0 | 0 | ||
| openpreserve | 293 | 24 | 19 (draw), 9 (img) | 0 | 9 (#199) | 4 (#198) |
| total | 1,333 | 96 (7.2%) | 64 (4.8%) | 1 (0.1%) | 9 (0.7%) | 4 (0.3%) |
- [ ] python unit tests for basic "backend" functionality using `pytest` (or `unittest`)
- [x] basic utils: History, Redaction, ... → see !112
- [x] document redaction functionality: Page, Document
- [x] repeated saving to same path !92 → see !112
- [x] redaction of certain rectangles: test that underlying text, images and drawings are indeed removed → see !112
- [x] history, modified state → see !112
- [ ] test redaction with variety of example PDF files
- [x] full-page redaction
- [ ] no redaction (only elemens outside of page borders must be redacted)
- [ ] test partial-page redaction?
- [ ] integration tests for basic "frontend", e.g.,
- [ ] window title depending on document modified state
- [ ] button visibility and sensibility, e.g., undo/redo depends on past/future history redaction?
- [ ] maybe test file contents after redaction with various independent tools, e.g.,
- [ ] pypdf
- [ ] [extract text](https://pypdf.readthedocs.io/en/stable/user/extract-text.html)
- [ ] [extract images](https://pypdf.readthedocs.io/en/stable/user/extract-images.html)
- [ ] manually check page content stream for painting/text operators to check for vector drawings (like in https://codeberg.org/censor/Censor/pulls/114/files#diff-6dfd2fc9f7b3373d0ef617aef1810049cf1e9487)
- pikepdf
- poppler
### Test results on sample PDF files
- full page redaction with !150, !151, !156, !159, !160, !193 (v0.7.1):
source | total | no open (safe) | fail redact (unsafe, warn) | redact too much (safe, warn)|fail redact (no warn)|broken saving
--- | --- | --- | --- | --- | --- | ---
[py-pdf](https://github.com/py-pdf/sample-files) | 33 | 3 | 2 (draw) | 0
[qpdf](https://github.com/qpdf/qpdf/tree/main/qpdf/qtest) | 632 | 58 | 4 (draw) | 0
[pikepdf](https://github.com/pikepdf/pikepdf/tree/main/tests/resources) | 35 | 4 | 0 | 0
[Artifex](https://github.com/ArtifexSoftware/tests/tree/master/pdf) | 128 | 5 | 10 (draw), 1 (txt), 4 (img #165)| 1 (img #155)
[PyMuPDF](https://github.com/pymupdf/PyMuPDF/tree/main/tests/resources) | 164 | 1 | 7 (draw), 4 (img #165)| 0
[ghostpdl](https://github.com/ArtifexSoftware/ghostpdl/tree/master/examples) | 35 | 0 | 3 (draw) | 0
[poppler](https://gitlab.freedesktop.org/poppler/test/-/tree/master/tests) | 13 | 1 | 0 | 0
[openpreserve](https://github.com/openpreserve/format-corpus) | 293 | 24 | 19 (draw), 9 (img) | 0 | 9 (#199) | 4 (#198)
**total** |1,333 | 96 (7.2%) | **64 (4.8%)** | 1 (0.1%) | **9 (0.7%)** | **4 (0.3%)**