Skip to content

fix(bindings): update tests for JXL encoding support#13

Merged
clroot merged 3 commits intomainfrom
fix/update-jxl-encode-tests
Feb 19, 2026
Merged

fix(bindings): update tests for JXL encoding support#13
clroot merged 3 commits intomainfrom
fix/update-jxl-encode-tests

Conversation

@clroot
Copy link
Owner

@clroot clroot commented Feb 19, 2026

Summary

JXL 인코딩이 지원되면서 기존 "JXL은 인코딩 불가" 테스트들이 실패. 테스트를 업데이트.

  • Python test_format.py: can_encode is Falseis True
  • Python test_convert.py: test_jxl_encode_raisestest_to_jxl (정상 인코딩 확인)
  • Kotlin SlimgTest.kt: assertFalse(formatCanEncode(Format.JXL))assertTrue

Test plan

  • Python Bindings CI 통과
  • Kotlin Bindings CI 통과

- Python: test_jxl_cannot_encode → test_jxl_can_encode
- Python: test_jxl_encode_raises → test_to_jxl (verify encode works)
- Kotlin: formatCanEncode returns true for all formats including JXL
@gemini-code-assist
Copy link

Summary of Changes

Hello @clroot, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

이 PR은 JXL 인코딩 지원이 추가됨에 따라 기존에 JXL 인코딩이 불가능하다고 가정했던 테스트들을 업데이트합니다. Python 및 Kotlin 바인딩에서 JXL 포맷의 인코딩 가능 여부를 정확하게 반영하고, JXL로의 이미지 변환이 성공적으로 이루어지는지 확인하는 새로운 테스트 로직을 도입하여, 시스템의 기능 변경에 맞춰 테스트 스위트의 정합성을 보장합니다.

Highlights

  • Python 테스트 업데이트: bindings/python/tests/test_format.py 파일에서 JXL 포맷의 can_encode 속성이 False에서 True로 변경된 것을 확인하도록 테스트를 업데이트했습니다.
  • Python 변환 테스트 교체: bindings/python/tests/test_convert.py 파일에서 JXL 인코딩 실패를 확인하던 테스트를 JXL 인코딩 성공을 확인하는 테스트로 교체했습니다.
  • Kotlin 테스트 업데이트: bindings/kotlin/src/test/kotlin/io/clroot/slimg/SlimgTest.kt 파일에서 formatCanEncode(Format.JXL)false를 반환하는 것을 확인하던 테스트를 true를 반환하는 것을 확인하도록 변경했습니다.
Changelog
  • bindings/kotlin/src/test/kotlin/io/clroot/slimg/SlimgTest.kt
    • formatCanEncode returns false only for JXL 테스트의 이름을 formatCanEncode returns true for all formats로 변경했습니다.
    • JXL 포맷에 대한 formatCanEncode 호출 결과가 false 대신 true임을 단언하도록 수정했습니다.
  • bindings/python/tests/test_convert.py
    • JXL 인코딩 시 예외 발생을 확인하던 test_jxl_encode_raises 테스트를 제거했습니다.
    • JXL로의 성공적인 이미지 변환과 결과 데이터의 유효성을 확인하는 test_to_jxl 테스트를 추가했습니다.
  • bindings/python/tests/test_format.py
    • JXL 포맷의 can_encode 속성이 False임을 단언하던 test_jxl_cannot_encode 테스트를 제거했습니다.
    • JXL 포맷의 can_encode 속성이 True임을 단언하는 test_jxl_can_encode 테스트를 추가했습니다.
Activity
  • 현재까지 이 PR에 대한 인간 활동(댓글, 리뷰 등)은 없습니다.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

JXL 인코딩 지원에 따라 테스트 코드를 업데이트하는 PR이군요. 전반적으로 변경 사항은 올바르지만, 테스트 코드의 유지보수성을 높일 수 있는 몇 가지 개선점을 제안합니다. Kotlin 테스트에서는 모든 포맷을 순회하도록 하고, Python 테스트에서는 JXL 매직 바이트 검사를 추가하여 다른 테스트와 일관성을 맞추는 것이 좋겠습니다. 또한, 다른 Python 테스트 파일에서는 pytest의 파라미터화를 활용하여 중복을 줄이고 모든 포맷을 포괄하도록 개선할 수 있습니다.

Comment on lines +51 to 58
fun `formatCanEncode returns true for all formats`() {
assertTrue(formatCanEncode(Format.JPEG))
assertTrue(formatCanEncode(Format.PNG))
assertTrue(formatCanEncode(Format.WEB_P))
assertTrue(formatCanEncode(Format.AVIF))
assertFalse(formatCanEncode(Format.JXL))
assertTrue(formatCanEncode(Format.JXL))
assertTrue(formatCanEncode(Format.QOI))
}

Choose a reason for hiding this comment

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

medium

이 테스트는 모든 Format 열거형 멤버를 순회하도록 리팩터링하여 향후 새로운 포맷이 추가될 때 테스트가 자동으로 확장되도록 할 수 있습니다. 이렇게 하면 유지보수성이 향상됩니다.

    fun `formatCanEncode returns true for all formats`() {
        for (format in Format.values()) {
            assertTrue(formatCanEncode(format), "Encoding should be supported for $format")
        }
    }

Comment on lines +50 to +53
def test_to_jxl(self, sample_image):
result = slimg.convert(sample_image, format="jxl", quality=80)
assert result.format == slimg.Format.JXL
assert len(result.data) > 0

Choose a reason for hiding this comment

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

medium

다른 포맷의 테스트와 일관성을 유지하고 테스트를 더 견고하게 만들기 위해 JXL 매직 바이트를 확인하는 단언문(assertion)을 추가하는 것이 좋습니다. JXL은 두 가지 시그니처(bare codestream 또는 container)를 가질 수 있습니다.

    def test_to_jxl(self, sample_image):
        result = slimg.convert(sample_image, format="jxl", quality=80)
        assert result.format == slimg.Format.JXL
        assert len(result.data) > 0
        # JXL can have a bare codestream (FF 0A) or be in a container (JXL ).
        is_bare = result.data[:2] == b'\xff\x0a'
        is_container = len(result.data) >= 8 and result.data[:4] == b'\x00\x00\x00\x0c' and result.data[4:8] == b'JXL '
        assert is_bare or is_container, "JXL magic bytes not found"

Comment on lines +35 to +36
def test_jxl_can_encode(self):
assert slimg.Format.JXL.can_encode is True

Choose a reason for hiding this comment

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

medium

이 테스트 클래스는 현재 모든 포맷을 다루고 있지 않으며(AVIF, QOI 누락), 각 포맷에 대한 테스트가 중복됩니다. pytest.mark.parametrize를 사용하여 모든 포맷을 한 번에 테스트하도록 리팩터링하면 더 간결하고 유지보수하기 좋은 코드가 될 것입니다. 예를 들어, 다음과 같이 작성할 수 있습니다:

import pytest
import slimg

@pytest.mark.parametrize("format_enum", list(slimg.Format))
def test_all_formats_can_encode(format_enum):
    assert format_enum.can_encode is True

이렇게 하면 TestFormatCanEncode 클래스 전체를 대체할 수 있습니다.

Vendored cmake build inherits Rust's profile by default. On Windows
debug builds, this causes _CrtDbgReport unresolved symbol errors
because libjxl's assert macros reference debug CRT functions that
Rust doesn't link.
- cli (slimg): 0.4.0 → 0.5.0
- slimg-core: 0.4.0 → 0.5.0
- slimg-ffi: 0.4.0 → 0.5.0
- Python (slimg): 0.4.0 → 0.5.0
- Kotlin (slimg): 0.4.0 → 0.5.0
- slimg-libjxl-sys: 0.1.0 (unchanged, separate versioning)
@clroot clroot merged commit d7a8a74 into main Feb 19, 2026
15 checks passed
@clroot clroot deleted the fix/update-jxl-encode-tests branch February 19, 2026 09:48
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.

1 participant