ee2c52bbc6
Add an optional renderContent field to canvas nodes across the go-zero API type, domain node, SQLC models/queries, PostgreSQL schema, and mappers so a lightweight transparent-WebP display texture persists alongside the original content. Prefer renderContent for project thumbnails and main-canvas previews, and treat both content and renderContent as protected/deletable asset URLs during canvas asset cleanup. Extend round-trip coverage. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
24 lines
707 B
Go
24 lines
707 B
Go
package logic
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"img_infinite_canvas/internal/domain/design"
|
|
)
|
|
|
|
func TestCanvasNodeSemanticContextRoundTrip(t *testing.T) {
|
|
nodes := []design.Node{{
|
|
ID: "cad-1",
|
|
Type: design.NodeTypeImage,
|
|
Title: "plan.svg",
|
|
LayerRole: "cad-vector",
|
|
SemanticContext: "CAD semantic context: layer ROOMS",
|
|
RenderContent: "https://assets.example/plan-preview.webp",
|
|
}}
|
|
|
|
roundTrip := toDomainNodes(toAPINodes(nodes))
|
|
if len(roundTrip) != 1 || roundTrip[0].SemanticContext != nodes[0].SemanticContext || roundTrip[0].RenderContent != nodes[0].RenderContent {
|
|
t.Fatalf("expected CAD context and render content round trip, got %#v", roundTrip)
|
|
}
|
|
}
|