package tasks import ( "errors" "testing" "jiggablend/pkg/types" ) func TestNewContext_NormalizesFrameEnd(t *testing.T) { ctx := NewContext(1, 2, "job", 10, 1, "render", "/tmp", "tok", nil, nil, nil, nil, nil, nil, nil, false, false, false, false, false, false, nil) if ctx.FrameEnd != 10 { t.Fatalf("expected FrameEnd to be normalized to Frame, got %d", ctx.FrameEnd) } } func TestContext_GetOutputFormat_Default(t *testing.T) { ctx := &Context{} if got := ctx.GetOutputFormat(); got != "PNG" { t.Fatalf("GetOutputFormat() = %q, want PNG", got) } } func TestContext_ShouldForceCPU(t *testing.T) { ctx := &Context{ForceCPURendering: true} if !ctx.ShouldForceCPU() { t.Fatal("expected force cpu when runner-level flag is set") } force := true ctx = &Context{Metadata: &types.BlendMetadata{RenderSettings: types.RenderSettings{EngineSettings: map[string]interface{}{"force_cpu": force}}}} if !ctx.ShouldForceCPU() { t.Fatal("expected force cpu when metadata requests it") } } func TestErrJobCancelled_IsSentinel(t *testing.T) { if !errors.Is(ErrJobCancelled, ErrJobCancelled) { t.Fatal("sentinel error should be self-identical") } }