Skip to content

Unify OCR test code and simplify blank PNG fixture generation - #16

Merged
etherlink-intern merged 1 commit into
mainfrom
codex/fix-ci-errors-5hu5rp
Jun 2, 2026
Merged

Unify OCR test code and simplify blank PNG fixture generation#16
etherlink-intern merged 1 commit into
mainfrom
codex/fix-ci-errors-5hu5rp

Conversation

@etherlink-intern

Copy link
Copy Markdown
Owner

Motivation

  • Remove duplicated OCR-related test scaffolding and make blank PNG fixture creation deterministic across platforms that provide image APIs.
  • Simplify error messages and image encoding steps to reduce fragile test behavior when generating fixture data.

Description

  • Removed a duplicate #if OCR test block and consolidated the Vision-based OCR tests into a single conditional section to avoid repetition.
  • Reworked blankPNGFixtureData to generate a small blank PNG via CGContext and CGImageDestination when Vision, CoreGraphics, and ImageIO are available, and to fall back to reading the base64 fixture file otherwise.
  • Simplified the in-memory PNG creation by using a 100x100 white canvas and by removing text rendering and compression options, and updated related ConversionError messages.
  • Adjusted preprocessor checks to align with available image APIs and made the image destination use a concrete public.png UTI when generating the blank fixture.

Testing

  • Ran the test suite with swift test which executed SwiftMarkItDownTests and related fixtures, and the tests completed successfully.
  • OCR-related tests were exercised under the image-capable configuration and the blank-PNG fallback path was validated via the base64 fixture on platforms without those image APIs.

Codex Task

@etherlink-intern
etherlink-intern marked this pull request as ready for review June 2, 2026 13:07
@etherlink-intern
etherlink-intern merged commit 7f25925 into main Jun 2, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant