fix: 그룹 내 그림(Picture) 직렬화 구현 + 라운드트립 테스트#583
Conversation
그룹 도형 자식으로 포함된 Picture가 serialize_group_child()에서 TODO로 빈 분기로 남아 있어 저장 시 누락되던 문제 수정. 변경: - serialize_group_child()의 ShapeObject::Picture 분기에 SHAPE_COMPONENT + SHAPE_COMPONENT_PICTURE 레코드 생성 추가 - 라운드트립 테스트 추가: serialize→parse 후 Picture 자식의 bin_data_id, shape_attr 필드 보존 검증 이전 PR #428은 테스트 미포함으로 close됨. 이번에 Copilot 리뷰 피드백 반영하여 라운드트립 테스트 포함. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
This PR implements serialization for ShapeObject::Picture when it appears as a child inside a Group shape, fixing the issue where grouped pictures were dropped on save. It also adds a roundtrip test to ensure grouped picture metadata (e.g., bin_data_id, original dimensions) is preserved through serialize → parse.
Changes:
- Implement
serialize_group_child()handling forShapeObject::Pictureby emittingHWPTAG_SHAPE_COMPONENT+HWPTAG_SHAPE_COMPONENT_PICTURE. - Add a new roundtrip test
test_roundtrip_group_picture_childto verify grouped picture child survival and key fields preservation.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
src/serializer/control.rs |
Implements grouped Picture child serialization by emitting the appropriate SHAPE_COMPONENT + SHAPE_COMPONENT_PICTURE records at the expected nesting levels. |
src/serializer/control/tests.rs |
Adds a regression test ensuring Group → Picture child roundtrips and preserves bin_data_id and original dimensions. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
cherry-pick: - 21fe401 (8dc75f6): fix: 그룹 내 그림(Picture) 직렬화 구현 + 라운드트립 테스트 본질: - src/serializer/control.rs +13/-2 (serialize_group_child Picture 분기) - src/serializer/control/tests.rs +79 (라운드트립 테스트 신규) - 기존 단독 Picture 직렬화와 동일 패턴 적용 · HWPTAG_SHAPE_COMPONENT (comp_level) · HWPTAG_SHAPE_COMPONENT_PICTURE (type_level) - 다른 그룹 자식 (Line/Rectangle/Ellipse/Chart/OLE) 과 동일 구조 검증: - cargo test --lib 1125 passed (신규 test_roundtrip_group_picture_child GREEN) - 회귀 0 (issue_505/530/546/418/501/svg_snapshot) - cargo clippy --lib 0 건 직렬화 영역 (저장 시 누락 정정), 시각 영향 없음 — B 처리 (라운드트립 테스트로 결정적 검증). 작성자: @oksure (Hyunwoo Park) — 세 번째 PR (PR #581/#582 후속) PR #428 후속 — Copilot 리뷰 피드백 (라운드트립 테스트 부재) 반영. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…commit) 본 PR 은 외부 컨트리뷰터 @oksure (Hyunwoo Park) 의 세 번째 PR (PR #581/#582 후속). cherry-pick: - 21fe401 (8dc75f6): fix: 그룹 내 그림(Picture) 직렬화 구현 + 라운드트립 테스트 · src/serializer/control.rs +13/-2 · src/serializer/control/tests.rs +79 본질: serialize_group_child 의 ShapeObject::Picture TODO 빈 분기 → 단독 Picture 직렬화와 동일 패턴 적용 (HWPTAG_SHAPE_COMPONENT + HWPTAG_SHAPE_COMPONENT_PICTURE). PR #428 후속 (Copilot 리뷰 피드백 반영, 라운드트립 테스트 포함). 검증: - cargo test --lib 1125 passed (신규 GREEN +1) - test_roundtrip_group_picture_child 통과 - 회귀 0 (issue_505/530/546/418/501/svg_snapshot) - cargo clippy --lib 0 건 작업지시자 의견 정합 (HWP 직렬화 영역, PR #553 close 시 명시).
|
@oksure 님, 세 번째 PR 도 cherry-pick 머지로 devel 에 반영했습니다 (devel `146db57`). 머지된 commit
author 는 @oksure 으로 보존되었습니다. 검증 (B 처리 — 직렬화 영역, 라운드트립 테스트로 결정적 검증)
본 PR 은 직렬화 영역 (저장 시 누락 정정) 이라 SVG/web Canvas 시각 영향 없음 — 라운드트립 테스트로 결정적 검증 충분 (작업지시자 결정). 작업지시자 의견 정합작업지시자 의견 (PR #553 close 시):
→ 본 PR 은 HWP5 직렬화 영역의 누락 정정. 작업지시자의 직렬화 본질 강조와 정합한 영역. 정합한 영역 인정본 PR 의 정합한 영역 (PR #581/#582 에 이은 세 번째 모범 사례):
컨트리뷰터께 부탁드리는 사항 — devel 동기화세 번째 PR 도 PR #581/#582 와 같은 오래된 base (`30351cdf`) 로 분기되어 있어 PR diff stat 에 본 환경 최근 변경분이 "삭제" 로 표시되었지만 본 commit 의 실제 변경은 2 files 정합. 다음 PR 작업 전 본 환경 `devel` 동기화 부탁드립니다 — PR #581 close 댓글의 절차 참조: ```bash base 동기화하면 다음 PR 의 변경 stat 이 본질 commit 만 표시되어 검토가 더 정합합니다. 처리 보고서`mydocs/pr/archives/pr_583_report.md` 세 번 연속 매우 정합한 PR입니다. PR #428 의 Copilot 피드백을 정확히 반영하신 점도 매우 인상적이었습니다. |
- mydocs/pr/pr_583_report.md → archives/ Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
배경
이전 PR #428에서 동일 수정을 제출했으나, Copilot 리뷰에서 라운드트립
테스트 부재를 지적받아 close됨. 이번 PR은 해당 피드백을 반영.
문제
serialize_group_child()의ShapeObject::Picture분기가 TODO로 빈 상태:그룹 도형에 포함된 그림이 저장 시 누락됨.
해결
기존 단독 Picture 직렬화(
serialize_picture_control)와 동일한 패턴으로그룹 자식 경로에 레코드 2개 생성:
HWPTAG_SHAPE_COMPONENT(comp_level) —serialize_shape_component(SHAPE_PICTURE_ID, ...)HWPTAG_SHAPE_COMPONENT_PICTURE(type_level) —serialize_picture_data(pic)다른 그룹 자식(Line, Rectangle, Ellipse, Chart, OLE)과 동일한 구조.
검증
라운드트립 테스트
test_roundtrip_group_picture_child:Group{children: [Picture{bin_data_id=7, size=5000x3000}]} 구성
serialize_section→parse_body_text_sectionPicture 자식 존재,
bin_data_id,original_width/height보존 확인cargo test전체 통과cargo clippy -- -D warnings경고 0이전 PR: #428 (closed)