From 070c9772ce7957762c227b083a06eb137d4d18c0 Mon Sep 17 00:00:00 2001 From: "James R. Barlow" Date: Tue, 23 May 2023 00:33:54 -0700 Subject: [PATCH] Add test to confirm we can find formx optimizable images --- tests/test_optimize.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tests/test_optimize.py b/tests/test_optimize.py index c9e76bf0..375bbadb 100644 --- a/tests/test_optimize.py +++ b/tests/test_optimize.py @@ -204,3 +204,11 @@ def test_group3(resources, outdir): assert ( opt.extract_image_filter(pdf, outdir, im, im.objgen[0]) is None ), "Group 3 should be disallowed" + + +def test_find_formx(resources, outdir): + with pikepdf.open(resources / 'formxobject.pdf') as pdf: + working, pagenos = opt._find_image_xrefs(pdf) + assert len(working) == 1 + xref = next(iter(working)) + assert pagenos[xref] == 0