示例#1
0
func TestNewVertical_singleStop(t *testing.T) {
	c := color.NRGBA{0, 255, 255, 0}
	v := NewVertical(200, 400, []Stop{{0.0, c}}).At(100, 150)

	r0, g0, b0, a0 := v.RGBA()
	r1, g1, b1, a1 := c.RGBA()

	if r0 != r1 || g0 != g1 || b0 != b1 || a0 != a1 {
		t.Fatalf("v.At(%d, %d) = %+v, want %+v", 200, 400, v, c)
	}
}
示例#2
0
func TestNewVertical_noStops(t *testing.T) {
	v := NewVertical(200, 400, []Stop{}).At(100, 150)
	c := color.NRGBA{255, 0, 255, 255}

	r0, g0, b0, a0 := v.RGBA()
	r1, g1, b1, a1 := c.RGBA()

	if r0 != r1 || g0 != g1 || b0 != b1 || a0 != a1 {
		t.Fatalf("v.At(%d, %d) = %+v, want %+v", 200, 400, v, c)
	}
}