fix(bindings): update tests for JXL encoding support#13
Conversation
- 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
Summary of ChangesHello @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
Changelog
Activity
Using Gemini Code AssistThe 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
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 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
|
There was a problem hiding this comment.
Code Review
JXL 인코딩 지원에 따라 테스트 코드를 업데이트하는 PR이군요. 전반적으로 변경 사항은 올바르지만, 테스트 코드의 유지보수성을 높일 수 있는 몇 가지 개선점을 제안합니다. Kotlin 테스트에서는 모든 포맷을 순회하도록 하고, Python 테스트에서는 JXL 매직 바이트 검사를 추가하여 다른 테스트와 일관성을 맞추는 것이 좋겠습니다. 또한, 다른 Python 테스트 파일에서는 pytest의 파라미터화를 활용하여 중복을 줄이고 모든 포맷을 포괄하도록 개선할 수 있습니다.
| 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)) | ||
| } |
There was a problem hiding this comment.
| 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 |
There was a problem hiding this comment.
다른 포맷의 테스트와 일관성을 유지하고 테스트를 더 견고하게 만들기 위해 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"| def test_jxl_can_encode(self): | ||
| assert slimg.Format.JXL.can_encode is True |
There was a problem hiding this comment.
이 테스트 클래스는 현재 모든 포맷을 다루고 있지 않으며(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)
Summary
JXL 인코딩이 지원되면서 기존 "JXL은 인코딩 불가" 테스트들이 실패. 테스트를 업데이트.
test_format.py:can_encode is False→is Truetest_convert.py:test_jxl_encode_raises→test_to_jxl(정상 인코딩 확인)SlimgTest.kt:assertFalse(formatCanEncode(Format.JXL))→assertTrueTest plan