diff --git a/image/color/color_test.go b/image/color/color_test.go index f61fc02..98804fc 100644 --- a/image/color/color_test.go +++ b/image/color/color_test.go @@ -1,6 +1,23 @@ package ucolor import "testing" +import "image/color" + +func TestTransparent (test *testing.T) { + if Transparent(color.NRGBA { A: 255 }) { + test.Fatal("false positive") + } + if !Transparent(color.NRGBA { A: 0 }) { + test.Fatal("false negative") + } +} + +func TestToRGBA (test *testing.T) { + rgba := ToRGBA(color.NRGBA { R: 123, G: 100, B: 23, A: 230 }) + if rgba != (color.RGBA { R: 111, G: 90, B: 20, A: 230 }) { + test.Fatalf("wrong value: %v", rgba) + } +} func TestPremultiply (test *testing.T) { r, g, b, a := Premultiply(0xFFFF, 0xFFFF, 0xFFFF, 0x8888)