package renderpage import ( "fmt" "testing" "amadan.net/oficina/equipo/internal/runner/render" "amadan.net/oficina/equipo/internal/wire" ) // TestCapturesFitTheWire: every capture a step can write has a name the // wire's capture id accepts, a size within its render_file bound and // pixels within the bounds the instance decodes, so a // Design step can name any of them in its options (protocol 38). func TestCapturesFitTheWire(t *testing.T) { if MaxCaptureBytes != wire.MaxCaptureBytes { t.Fatalf("capture bound %d, the wire's %d", MaxCaptureBytes, wire.MaxCaptureBytes) } // The instance decodes a capture only within the wire's pixel bounds // (task 19): every capture render_page writes fits them. if MaxWidth != wire.MaxCaptureWidth || MaxHeight != wire.MaxCaptureHeight { t.Fatalf("capture bounds %dx%d, the wire's %dx%d", MaxWidth, MaxHeight, wire.MaxCaptureWidth, wire.MaxCaptureHeight) } for call := 1; call <= MaxCalls; call++ { for _, tree := range []string{TreeBase, TreeWork, "diff"} { for n := 1; n <= render.MaxPages; n++ { if id := fmt.Sprintf("%d-%s-%d.png", call, tree, n); !wire.ValidCaptureID(id) { t.Fatalf("the wire refuses %s", id) } } } } }