summaryrefslogtreecommitdiff
path: root/excelize_test.go
diff options
context:
space:
mode:
authorxuri <xuri.me@gmail.com>2020-10-23 00:01:52 +0800
committerxuri <xuri.me@gmail.com>2020-10-23 00:01:52 +0800
commit9d470bb38f992d9f0da2168b7a576f9e212b7a88 (patch)
treeb9b3163b9ea9cdd20a82e759b27f7c20635ff336 /excelize_test.go
parentb812e9a1a8ebe9ab22c51553eb46b1f1cff1f7c1 (diff)
Update conversion between integer types and unit tests
Diffstat (limited to 'excelize_test.go')
-rw-r--r--excelize_test.go41
1 files changed, 24 insertions, 17 deletions
diff --git a/excelize_test.go b/excelize_test.go
index 9c1b1e6..b0483c7 100644
--- a/excelize_test.go
+++ b/excelize_test.go
@@ -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))