|
|
|
@ -1110,26 +1110,33 @@ func TestSetSheetRow(t *testing.T) {
|
|
|
|
|
assert.NoError(t, f.SaveAs(filepath.Join("test", "TestSetSheetRow.xlsx")))
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func TestThemeColor(t *testing.T) {
|
|
|
|
|
t.Log(ThemeColor("000000", -0.1))
|
|
|
|
|
t.Log(ThemeColor("000000", 0))
|
|
|
|
|
t.Log(ThemeColor("000000", 1))
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func TestHSL(t *testing.T) {
|
|
|
|
|
var hsl HSL
|
|
|
|
|
t.Log(hsl.RGBA())
|
|
|
|
|
t.Log(hslModel(hsl))
|
|
|
|
|
t.Log(hslModel(color.Gray16{Y: uint16(1)}))
|
|
|
|
|
t.Log(HSLToRGB(0, 1, 0.4))
|
|
|
|
|
t.Log(HSLToRGB(0, 1, 0.6))
|
|
|
|
|
t.Log(hueToRGB(0, 0, -1))
|
|
|
|
|
t.Log(hueToRGB(0, 0, 2))
|
|
|
|
|
t.Log(hueToRGB(0, 0, 1.0/7))
|
|
|
|
|
t.Log(hueToRGB(0, 0, 0.4))
|
|
|
|
|
t.Log(hueToRGB(0, 0, 2.0/4))
|
|
|
|
|
r, g, b, a := hsl.RGBA()
|
|
|
|
|
assert.Equal(t, uint32(0), r)
|
|
|
|
|
assert.Equal(t, uint32(0), g)
|
|
|
|
|
assert.Equal(t, uint32(0), b)
|
|
|
|
|
assert.Equal(t, uint32(0xffff), a)
|
|
|
|
|
assert.Equal(t, HSL{0, 0, 0}, hslModel(hsl))
|
|
|
|
|
assert.Equal(t, HSL{0, 0, 0}, hslModel(color.Gray16{Y: uint16(1)}))
|
|
|
|
|
R, G, B := HSLToRGB(0, 1, 0.4)
|
|
|
|
|
assert.Equal(t, uint8(204), R)
|
|
|
|
|
assert.Equal(t, uint8(0), G)
|
|
|
|
|
assert.Equal(t, uint8(0), B)
|
|
|
|
|
R, G, B = HSLToRGB(0, 1, 0.6)
|
|
|
|
|
assert.Equal(t, uint8(255), R)
|
|
|
|
|
assert.Equal(t, uint8(51), G)
|
|
|
|
|
assert.Equal(t, uint8(51), B)
|
|
|
|
|
assert.Equal(t, 0.0, hueToRGB(0, 0, -1))
|
|
|
|
|
assert.Equal(t, 0.0, hueToRGB(0, 0, 2))
|
|
|
|
|
assert.Equal(t, 0.0, hueToRGB(0, 0, 1.0/7))
|
|
|
|
|
assert.Equal(t, 0.0, hueToRGB(0, 0, 0.4))
|
|
|
|
|
assert.Equal(t, 0.0, hueToRGB(0, 0, 2.0/4))
|
|
|
|
|
t.Log(RGBToHSL(255, 255, 0))
|
|
|
|
|
t.Log(RGBToHSL(0, 255, 255))
|
|
|
|
|
h, s, l := RGBToHSL(0, 255, 255)
|
|
|
|
|
assert.Equal(t, float64(0.5), h)
|
|
|
|
|
assert.Equal(t, float64(1), s)
|
|
|
|
|
assert.Equal(t, float64(0.5), l)
|
|
|
|
|
t.Log(RGBToHSL(250, 100, 50))
|
|
|
|
|
t.Log(RGBToHSL(50, 100, 250))
|
|
|
|
|
t.Log(RGBToHSL(250, 50, 100))
|
|
|
|
|