Skip to content

Fix the Linux-only assumptions in the test suite and build on Windows - #481

Merged
kwart merged 7 commits into
masterfrom
test/windows-ci-480
Aug 17, 2026
Merged

Fix the Linux-only assumptions in the test suite and build on Windows#481
kwart merged 7 commits into
masterfrom
test/windows-ci-480

Conversation

@kwart

@kwart kwart commented Aug 17, 2026

Copy link
Copy Markdown
Member

Fixes #480.

The suite carried four Linux-only assumptions. Each fix uncovered the next, so all four are here.

  • JSignPdfSignatureDrawerTest: the logical AWT name Helvetica resolves to Symbol on Windows and DSS's TextFitter fails on the first Latin glyph. Loads the bundled DejaVuSans through DSSFileFont, the same font DssFontUtils embeds for real signatures.
  • NativeFileChooserTest: Path.toString() renders the platform separator, so the hardcoded /tmp/x expectations fail with \tmp\x. Compares Path to Path.
  • SignerOptionsFromCmdLineTest: -q sets the app and global logger levels to OFF for the whole process, and the test never restored them. Surefire reuses one JVM and orders classes by platform: on Linux this test runs after the signing tests, on Windows before, silencing every later log-capture assertion (3 failures in ExistingFieldSigningTest). Not a Windows bug — Linux passes on class ordering alone.
  • BufferingModeSigningTest.stagingHonoursTheConfiguredDirectory: the staging directory was sampled on Thread.sleep(1L), which the platform timer granularity rounds to ~15 ms on Windows, so a fast sign fits between two looks. Uses a WatchService.

BufferingModeSigningTest.tempFileIsRemovedAfterFailure asserts the Windows outcome that OpenPdfSigningEngine already documents: the abort between preClose() and close() leaves OpenPDF's own RandomAccessFile open, so the delete cannot succeed and the engine warns instead. Production is unchanged; closing that handle needs its own issue.

CI builds windows-2025 alongside ubuntu-24.04 so the next one is caught in the PR. fail-fast: false keeps both results visible; surefire reports upload on failure only.

Both legs green on the branch: https://github.com/intoolswetrust/jsignpdf/actions/runs/32064962283

kwart added 7 commits August 16, 2026 19:54
The logical AWT name "Helvetica" is not portable. On Windows it resolves
to Symbol, and DSS's TextFitter then fails measuring the first Latin glyph:
U+0053 ('S') is not available in the font Symbol.

Load the same DejaVuSans that DssFontUtils embeds for real signatures, so
the test measures text through the font production actually uses.
Path.toString() renders the platform separator, so the hardcoded "/tmp/x"
expectations fail on Windows with "\tmp\x". Comparing Path to Path keeps
the assertions platform-neutral.
SignerOptionsFromCmdLineTest exercises -q, which sets the app and global
logger levels to OFF for the whole process. Surefire reuses one JVM and
orders test classes by platform, so on Windows that test runs before the
signing tests and every later log-capture assertion sees nothing:
ExistingFieldSigningTest's three refusal/warning tests fail with an empty
capture. Restore both levels after the test.

Also assert the documented Windows outcome in tempFileIsRemovedAfterFailure:
the abort leaves OpenPDF's RandomAccessFile open, so the delete cannot
succeed there and the engine warns instead.
The sampler polled the staging directory every Thread.sleep(1L), which the
platform timer granularity rounds up to ~15 ms on Windows. A sign that
finishes in well under that fits between two looks and the staging file is
never seen, so the test fails intermittently there. A WatchService reports
the creation whenever it happens.
The suite carried four Linux-only assumptions that only a Windows runner
caught (see #480). Build both platforms so the next one is caught in the PR.

The test/windows-ci-** push trigger is temporary, to exercise the matrix
before it reaches master.
@kwart
kwart merged commit 75d46e7 into master Aug 17, 2026
2 checks passed
@kwart
kwart deleted the test/windows-ci-480 branch August 17, 2026 20:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

JSignPdfSignatureDrawerTest fails on Windows: 'Helvetica' resolves to Symbol

1 participant