ebiten: Better test values for CompositeModeMultiply

This commit is contained in:
Hajime Hoshi 2020-07-18 21:57:02 +09:00
parent 6ccb614b08
commit d22026d366

View File

@ -2205,8 +2205,8 @@ func TestImageCompositeModeMultiply(t *testing.T) {
dst, _ := NewImage(w, h, FilterDefault)
src, _ := NewImage(w, h, FilterDefault)
dst.Fill(color.RGBA{0x01, 0x02, 0x03, 0x04})
src.Fill(color.RGBA{0x05, 0x06, 0x07, 0x08})
dst.Fill(color.RGBA{0x10, 0x20, 0x30, 0x40})
src.Fill(color.RGBA{0x50, 0x60, 0x70, 0x80})
op := &DrawImageOptions{}
op.CompositeMode = CompositeModeMultiply
@ -2216,10 +2216,10 @@ func TestImageCompositeModeMultiply(t *testing.T) {
for i := 0; i < w; i++ {
got := dst.At(i, j).(color.RGBA)
want := color.RGBA{
R: byte(math.Floor((0x01 / 255.0) * (0x05 / 255.0) * 255)),
G: byte(math.Floor((0x02 / 255.0) * (0x06 / 255.0) * 255)),
B: byte(math.Floor((0x03 / 255.0) * (0x07 / 255.0) * 255)),
A: byte(math.Floor((0x04 / 255.0) * (0x08 / 255.0) * 255)),
R: byte(math.Floor((0x10 / 255.0) * (0x50 / 255.0) * 255)),
G: byte(math.Floor((0x20 / 255.0) * (0x60 / 255.0) * 255)),
B: byte(math.Floor((0x30 / 255.0) * (0x70 / 255.0) * 255)),
A: byte(math.Floor((0x40 / 255.0) * (0x80 / 255.0) * 255)),
}
if got != want {
t.Errorf("dst.At(%d, %d): got: %v, want: %v", i, j, got, want)