test(pcbnew): assert collab add preserves each item's layer

Adds a layer-preservation check to the footprint/via/zone/text round-trip add tests,
documenting + verifying that an item's own serialized layer is applied by makeItem and
the peer editor's active layer is never consulted. 4 add tests pass.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Gergő Törcsvári 2026-06-08 16:38:37 +02:00
commit 1bfa562a61
No known key found for this signature in database
GPG key ID: 8E75F2CDE64E5322

View file

@ -249,6 +249,9 @@ test.describe("pcbnew collab bridge — single page", () => {
const snap = JSON.parse(window.Module.kicadCollabSnapshot());
return snap.added.find((it: { id: string }) => it.id === i);
}, id);
// The item's own layer travels in the delta and is applied explicitly by makeItem — it does
// NOT pick up the peer editor's active layer. (Footprint layer = which side it sits on.)
expect(after.layer, `${label} layer preserved`).toBe(payload.layer);
if (type === "PCB_TEXT") {
expect(after.text, "text string preserved").toBe(payload.text);
expect(after.hjust, "text horizontal justification preserved").toBe(payload.hjust);