Skip to content

feat: add comprehensive async tests and remove orientation variable i…#51

Merged
CaiJingLong merged 1 commit intomainfrom
fix-async-jpeg
Aug 6, 2025
Merged

feat: add comprehensive async tests and remove orientation variable i…#51
CaiJingLong merged 1 commit intomainfrom
fix-async-jpeg

Conversation

@CaiJingLong
Copy link
Member

@CaiJingLong CaiJingLong commented Aug 6, 2025

This pull request adds comprehensive async tests for the ImageSizeGetter library and refines the JPEG decoder logic to improve robustness and correctness. The main focus is on ensuring that asynchronous image size detection works reliably across a variety of formats and edge cases, while also improving the decoder's handling of JPEG files.

Testing improvements

  • Added a new group of async tests in image_size_getter_test.dart to cover getSizeAsync and getSizeResultAsync for multiple image formats (GIF, JPEG, PNG, WebP, BMP), including extended and lossless WebP formats. These tests verify correct size detection and decoder identification.
  • Added tests for error handling, including cases for non-existent files and unsupported formats, ensuring that the async methods throw appropriate exceptions.
  • Added tests for async size detection using memory input, confirming that in-memory images are processed correctly.

JPEG decoder improvements

  • Improved the JPEG decoder by explicitly checking for the App1 block, which is often used for EXIF metadata and orientation, increasing robustness for non-standard JPEGs.
  • Removed incorrect orientation extraction from the JPEG decoder, ensuring that orientation is handled properly and not set from an invalid byte position.

…n JPEG decoder

Signed-off-by: Caijinglong <cjl_spy@163.com>
Copilot AI review requested due to automatic review settings August 6, 2025 06:15
@CaiJingLong CaiJingLong linked an issue Aug 6, 2025 that may be closed by this pull request
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds comprehensive async testing for the image_size_getter package and removes an unused orientation variable assignment in the JPEG decoder implementation.

  • Adds extensive async test coverage for all supported image formats (GIF, JPEG, PNG, WebP, BMP)
  • Includes error handling tests for non-existent files and unsupported formats
  • Removes unused orientation variable assignment in JPEG decoder

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
packages/image_size_getter/test/image_size_getter_test.dart Adds comprehensive async test suite covering all image formats and error scenarios
packages/image_size_getter/lib/src/decoder/impl/jpeg_decoder.dart Removes unused orientation variable assignment and adds explanatory comment

@CaiJingLong CaiJingLong merged commit fd9fc7f into main Aug 6, 2025
2 checks passed
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.

JpegDecoder::getSizeAsync Incorrect Orientation

1 participant