Expand PPBR compatibility fixtures

This commit is contained in:
2026-06-16 00:08:04 +02:00
parent 80d8c078f6
commit 2ae7411ba6
3 changed files with 31 additions and 22 deletions

View File

@@ -292,11 +292,11 @@ agent or engineer to remove them without reconstructing context from chat.
children; toolbar settings, cloud browser, and other remaining retained children; toolbar settings, cloud browser, and other remaining retained
dialog families still stay open under the same debt until they move to the dialog families still stay open under the same debt until they move to the
same lifetime model. same lifetime model.
- 2026-06-15: `DEBT-0049` was narrowed again. `pp_assets_brush_package_tests` - 2026-06-16: `DEBT-0049` was narrowed again. `pp_assets_brush_package_tests`
now names the currently accepted legacy PPBR version matrix explicitly: now names the currently accepted legacy PPBR version matrix explicitly:
canonical `0.1`, tolerated `0.2`, tolerated `1.1`, and rejected `1.2`. The legacy major-zero cases, legacy minor-one cases, and rejected `1.2`. The
live parser still preserves the legacy tolerance until broader compatibility live parser still preserves the legacy tolerance until a stricter supported
fixtures prove strict canonical enforcement is safe. version matrix is proven safe.
- 2026-06-15: `DEBT-0063` was narrowed again. Sidebar stroke/color/layer/grid - 2026-06-15: `DEBT-0063` was narrowed again. Sidebar stroke/color/layer/grid
popups, file/about/layer menu popups in `src/app_layout.cpp`, quick popups, file/about/layer menu popups in `src/app_layout.cpp`, quick
brush/color popup+ticker overlays in `src/legacy_quick_ui_services.cpp`, brush/color popup+ticker overlays in `src/legacy_quick_ui_services.cpp`,

View File

@@ -1509,7 +1509,9 @@ legacy-owned.
The live PPBR import/export path consumes those helpers, while legacy The live PPBR import/export path consumes those helpers, while legacy
Serializer/Image payload reading, stroke preview generation, preset storage, Serializer/Image payload reading, stroke preview generation, preset storage,
and the historical permissive version check remain tracked under `DEBT-0047` and the historical permissive version check remain tracked under `DEBT-0047`
and `DEBT-0049`. and `DEBT-0049`. The compatibility test fixture now spells out the tolerated
legacy matrix more directly, but the parser still keeps the permissive rule
until a stricter supported-version policy is proven safe.
ABR and PPBR import image target planning for brush tips and patterns also now ABR and PPBR import image target planning for brush tips and patterns also now
uses `pp_assets::brush_package`, so the legacy preset panel no longer owns the uses `pp_assets::brush_package`, so the legacy preset panel no longer owns the
`data/brushes`, `data/brushes/thumbs`, `data/patterns`, and `data/brushes`, `data/brushes/thumbs`, `data/patterns`, and

View File

@@ -24,25 +24,32 @@ std::array<std::byte, pp::assets::ppbr_header_size> ppbr_header(std::uint16_t ma
void parses_ppbr_header_and_legacy_version_tolerance(pp::tests::Harness& harness) void parses_ppbr_header_and_legacy_version_tolerance(pp::tests::Harness& harness)
{ {
const auto canonical_bytes = ppbr_header(0, 1); struct Case {
const auto canonical = pp::assets::parse_ppbr_header(canonical_bytes); std::uint16_t major;
std::uint16_t minor;
bool accepted;
};
PP_EXPECT(harness, canonical); const std::array<Case, 6> cases {
PP_EXPECT(harness, canonical.value().major == 0U); Case { 0U, 0U, true },
PP_EXPECT(harness, canonical.value().minor == 1U); Case { 0U, 1U, true },
Case { 0U, 2U, true },
Case { 1U, 1U, true },
Case { 2U, 1U, true },
Case { 1U, 2U, false },
};
const auto tolerated_minor = pp::assets::parse_ppbr_header(ppbr_header(0, 2)); for (const auto& item : cases) {
const auto tolerated_major = pp::assets::parse_ppbr_header(ppbr_header(1, 1)); const auto result = pp::assets::parse_ppbr_header(ppbr_header(item.major, item.minor));
const auto rejected_both = pp::assets::parse_ppbr_header(ppbr_header(1, 2)); if (item.accepted) {
PP_EXPECT(harness, result);
PP_EXPECT(harness, tolerated_minor); PP_EXPECT(harness, result.value().major == item.major);
PP_EXPECT(harness, tolerated_minor.value().major == 0U); PP_EXPECT(harness, result.value().minor == item.minor);
PP_EXPECT(harness, tolerated_minor.value().minor == 2U); } else {
PP_EXPECT(harness, tolerated_major); PP_EXPECT(harness, !result);
PP_EXPECT(harness, tolerated_major.value().major == 1U); PP_EXPECT(harness, result.status().code == pp::foundation::StatusCode::invalid_argument);
PP_EXPECT(harness, tolerated_major.value().minor == 1U); }
PP_EXPECT(harness, !rejected_both); }
PP_EXPECT(harness, rejected_both.status().code == pp::foundation::StatusCode::invalid_argument);
} }
void rejects_truncated_and_bad_magic_headers(pp::tests::Harness& harness) void rejects_truncated_and_bad_magic_headers(pp::tests::Harness& harness)