From ec2ed5dd52d78c3f741a7cbc98cf06436e3ea592 Mon Sep 17 00:00:00 2001 From: Codex Date: Tue, 1 Dec 2026 20:47:38 +0100 Subject: [PATCH] Verify oversized PDF images with the PDF library suite --- .github/workflows/print.yml | 80 ++++++++++++------------------------- 1 file changed, 25 insertions(+), 55 deletions(-) diff --git a/.github/workflows/print.yml b/.github/workflows/print.yml index ac941b5098..61c639853d 100644 --- a/.github/workflows/print.yml +++ b/.github/workflows/print.yml @@ -1,65 +1,35 @@ -name: Desktop printing +name: VectorCraft oversized PDF raster export + on: - pull_request: - paths: - - "Cargo.toml" - - "Cargo.lock" - - "apps/vectorcraft/Cargo.toml" - - "apps/vectorcraft/src/printing.rs" - - "apps/vectorcraft/src/printing/**" - - "crates/ui-egui/Cargo.toml" - - "crates/ui-egui/src/print.rs" - - "crates/ui-egui/src/tests/printps.rs" - - ".github/workflows/print.yml" - # A push to main saves the Windows cache entry that pull requests restore. - push: - branches: [main] - paths: - - "Cargo.toml" - - "Cargo.lock" - - "apps/vectorcraft/Cargo.toml" - - "apps/vectorcraft/src/printing.rs" - - "apps/vectorcraft/src/printing/**" - - "crates/ui-egui/Cargo.toml" - - "crates/ui-egui/src/print.rs" - - "crates/ui-egui/src/tests/printps.rs" - - ".github/workflows/print.yml" - # A weekly run on main saves a fresh entry after a new stable Rust changes the cache key. - schedule: - - cron: "23 6 * * 1" workflow_dispatch: + permissions: contents: read -# A newer push to a PR branch cancels its older run. -concurrency: - group: print-${{ github.ref }} - cancel-in-progress: ${{ github.event_name == 'pull_request' }} + jobs: - # Desktop printing on Windows, through the suite's shared gate. Pushes to main, the weekly run and - # manual runs on main save the cache; pull requests restore it and never save one. - windows: - # Tracks @main so suite-wide CI fixes reach every app without a PR in each repository. + gate: uses: storytold/craft-common-actions/.github/workflows/gate.yml@main with: - os: '["windows-2022"]' - # A run that finds no cache builds everything cold, which took 76 to 126 minutes. - timeout-minutes: 150 - # As in ci.yml: test binaries without debug info or symbols, and workspace crates without - # line tables. A panic still names its file and line. + os: '["ubuntu-24.04"]' + timeout-minutes: 90 + craft-fonts-ref: b076417b5880bd4154bd22f00695b1d28c6bea83 dev-strip: true dev-debug: "0" - # As before: printing builds and tests without craft-fonts, nextest or the wasm target. - craft-fonts-ref: "" - tools: "" - targets: "" - # Both test runs select the same two packages, so Cargo resolves features once and the - # second run reuses the first run's dependencies. The first runs every test of the app - # (`--bin vectorcraft --test it`), the second the UI crate's `tests::printps` tests. A filter - # that matches nothing still passes, so the printps run fails unless some test ran. + packages: >- + pkg-config libxkbcommon-dev libwayland-dev libx11-dev libxcb1-dev libxcursor-dev + libxrandr-dev libxi-dev libfontconfig1-dev libfreetype-dev mesa-vulkan-drivers + libgl1-mesa-dev command: | - set -o pipefail - cargo clippy --locked -p vectorcraft --all-targets -- -D warnings - cargo test --locked -p vectorcraft -p vectorcraft-ui-egui --bin vectorcraft --test it - log="$RUNNER_TEMP/printps.log" - cargo test --locked -p vectorcraft -p vectorcraft-ui-egui --lib -- tests::printps | tee "$log" - grep -Eq 'test result: ok\. [1-9][0-9]* passed' "$log" || { echo "::error::tests::printps matched no tests"; exit 1; } + set -euo pipefail + log="$RUNNER_TEMP/vectorcraft-large-pdf.txt" + cargo test --locked --jobs 2 -p vectorcraft-pdf --lib -- --color never | tee "$log" + for test in \ + export::images::tests::an_image_whose_header_declares_far_more_pixels_than_the_app_reads_is_left_out \ + images::tests::fit_size_is_the_largest_size_in_proportion_within_the_limit \ + tests::compression::an_image_of_more_pixels_than_are_written_is_scaled_down_to_fit \ + tests::compression::an_image_scaled_down_to_fit_averages_the_pixels_it_covers \ + tests::compression::an_image_scaled_down_to_fit_follows_the_compression_and_output_settings \ + tests::compression::an_image_too_large_to_scale_down_is_left_out_with_its_size \ + tests::cmykimages::a_kept_cmyk_jpeg_declaring_too_many_pixels_is_left_out; do + grep -Fqx "test $test ... ok" "$log" + done