mirror of
https://git.sr.ht/~eliasnaur/gio
synced 2026-07-01 23:55:39 +00:00
headless: clear background to transparent, not white
The clear background is the most useful, and the old behaviour can be achieved by filling the entire viewport with a white paint.ColorOp. Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
@@ -18,10 +18,10 @@ func TestPaintOffset(t *testing.T) {
|
||||
op.Offset(f32.Pt(10, 20)).Add(o)
|
||||
paint.FillShape(o, red, clip.Rect(image.Rect(0, 0, 50, 50)).Op())
|
||||
}, func(r result) {
|
||||
r.expect(0, 0, colornames.White)
|
||||
r.expect(0, 0, transparent)
|
||||
r.expect(59, 30, colornames.Red)
|
||||
r.expect(60, 30, colornames.White)
|
||||
r.expect(10, 70, colornames.White)
|
||||
r.expect(60, 30, transparent)
|
||||
r.expect(10, 70, transparent)
|
||||
})
|
||||
}
|
||||
|
||||
@@ -33,8 +33,8 @@ func TestPaintRotate(t *testing.T) {
|
||||
}, func(r result) {
|
||||
r.expect(40, 40, colornames.Red)
|
||||
r.expect(50, 19, colornames.Red)
|
||||
r.expect(59, 19, colornames.White)
|
||||
r.expect(21, 21, colornames.White)
|
||||
r.expect(59, 19, transparent)
|
||||
r.expect(21, 21, transparent)
|
||||
})
|
||||
}
|
||||
|
||||
@@ -44,7 +44,7 @@ func TestPaintShear(t *testing.T) {
|
||||
op.Affine(a).Add(o)
|
||||
paint.FillShape(o, red, clip.Rect(image.Rect(0, 0, 40, 40)).Op())
|
||||
}, func(r result) {
|
||||
r.expect(10, 30, colornames.White)
|
||||
r.expect(10, 30, transparent)
|
||||
})
|
||||
}
|
||||
|
||||
@@ -54,10 +54,10 @@ func TestClipPaintOffset(t *testing.T) {
|
||||
op.Offset(f32.Pt(20, 20)).Add(o)
|
||||
paint.FillShape(o, red, clip.Rect(image.Rect(0, 0, 100, 100)).Op())
|
||||
}, func(r result) {
|
||||
r.expect(0, 0, colornames.White)
|
||||
r.expect(19, 19, colornames.White)
|
||||
r.expect(0, 0, transparent)
|
||||
r.expect(19, 19, transparent)
|
||||
r.expect(20, 20, colornames.Red)
|
||||
r.expect(30, 30, colornames.White)
|
||||
r.expect(30, 30, transparent)
|
||||
})
|
||||
}
|
||||
|
||||
@@ -67,11 +67,11 @@ func TestClipOffset(t *testing.T) {
|
||||
clip.RRect{Rect: f32.Rect(10, 10, 30, 30)}.Add(o)
|
||||
paint.FillShape(o, red, clip.Rect(image.Rect(0, 0, 100, 100)).Op())
|
||||
}, func(r result) {
|
||||
r.expect(0, 0, colornames.White)
|
||||
r.expect(29, 29, colornames.White)
|
||||
r.expect(0, 0, transparent)
|
||||
r.expect(29, 29, transparent)
|
||||
r.expect(30, 30, colornames.Red)
|
||||
r.expect(49, 49, colornames.Red)
|
||||
r.expect(50, 50, colornames.White)
|
||||
r.expect(50, 50, transparent)
|
||||
})
|
||||
}
|
||||
|
||||
@@ -82,10 +82,10 @@ func TestClipScale(t *testing.T) {
|
||||
clip.RRect{Rect: f32.Rect(10, 10, 20, 20)}.Add(o)
|
||||
paint.FillShape(o, red, clip.Rect(image.Rect(0, 0, 1000, 1000)).Op())
|
||||
}, func(r result) {
|
||||
r.expect(19+10, 19+10, colornames.White)
|
||||
r.expect(19+10, 19+10, transparent)
|
||||
r.expect(20+10, 20+10, colornames.Red)
|
||||
r.expect(39+10, 39+10, colornames.Red)
|
||||
r.expect(40+10, 40+10, colornames.White)
|
||||
r.expect(40+10, 40+10, transparent)
|
||||
})
|
||||
}
|
||||
|
||||
@@ -95,9 +95,9 @@ func TestClipRotate(t *testing.T) {
|
||||
clip.RRect{Rect: f32.Rect(30, 30, 50, 50)}.Add(o)
|
||||
paint.FillShape(o, red, clip.Rect(image.Rect(0, 40, 100, 100)).Op())
|
||||
}, func(r result) {
|
||||
r.expect(39, 39, colornames.White)
|
||||
r.expect(39, 39, transparent)
|
||||
r.expect(41, 41, colornames.Red)
|
||||
r.expect(50, 50, colornames.White)
|
||||
r.expect(50, 50, transparent)
|
||||
})
|
||||
}
|
||||
|
||||
@@ -108,8 +108,8 @@ func TestOffsetTexture(t *testing.T) {
|
||||
scale(50.0/512, 50.0/512).Add(o)
|
||||
paint.PaintOp{}.Add(o)
|
||||
}, func(r result) {
|
||||
r.expect(14, 20, colornames.White)
|
||||
r.expect(66, 20, colornames.White)
|
||||
r.expect(14, 20, transparent)
|
||||
r.expect(66, 20, transparent)
|
||||
r.expect(16, 64, colornames.Green)
|
||||
r.expect(64, 16, colornames.Green)
|
||||
})
|
||||
@@ -124,7 +124,7 @@ func TestOffsetScaleTexture(t *testing.T) {
|
||||
paint.PaintOp{}.Add(o)
|
||||
}, func(r result) {
|
||||
r.expect(114, 64, colornames.Blue)
|
||||
r.expect(116, 64, colornames.White)
|
||||
r.expect(116, 64, transparent)
|
||||
})
|
||||
}
|
||||
|
||||
@@ -152,7 +152,7 @@ func TestRotateClipTexture(t *testing.T) {
|
||||
scale(60.0/512, 60.0/512).Add(o)
|
||||
paint.PaintOp{}.Add(o)
|
||||
}, func(r result) {
|
||||
r.expect(0, 0, colornames.White)
|
||||
r.expect(0, 0, transparent)
|
||||
r.expect(37, 39, colornames.Green)
|
||||
r.expect(36, 39, colornames.Green)
|
||||
r.expect(35, 39, colornames.Green)
|
||||
@@ -174,7 +174,7 @@ func TestComplicatedTransform(t *testing.T) {
|
||||
scale(50.0/512, 50.0/512).Add(o)
|
||||
paint.PaintOp{}.Add(o)
|
||||
}, func(r result) {
|
||||
r.expect(20, 5, colornames.White)
|
||||
r.expect(20, 5, transparent)
|
||||
})
|
||||
}
|
||||
|
||||
@@ -192,9 +192,9 @@ func TestTransformOrder(t *testing.T) {
|
||||
paint.FillShape(o, red, clip.Rect(image.Rect(0, 0, 20, 20)).Op())
|
||||
}, func(r result) {
|
||||
// centered and with radius 40
|
||||
r.expect(64-41, 64, colornames.White)
|
||||
r.expect(64-41, 64, transparent)
|
||||
r.expect(64-39, 64, colornames.Red)
|
||||
r.expect(64+39, 64, colornames.Red)
|
||||
r.expect(64+41, 64, colornames.White)
|
||||
r.expect(64+41, 64, transparent)
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user