roles
This commit is contained in:
parent
8c8cbfd7dd
commit
41d48bf60a
28 changed files with 434 additions and 7 deletions
29
utils/colors_test.go
Normal file
29
utils/colors_test.go
Normal file
|
@ -0,0 +1,29 @@
|
|||
package utils_test
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"git.sapphic.engineer/roleypoly/v4/utils"
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
func TestIntToRgb(t *testing.T) {
|
||||
r, g, b := utils.IntToRgb(0x123456)
|
||||
assert.Equal(t, uint8(0x12), r, "red")
|
||||
assert.Equal(t, uint8(0x34), g, "green")
|
||||
assert.Equal(t, uint8(0x56), b, "blue")
|
||||
}
|
||||
|
||||
func TestIsDarkColor(t *testing.T) {
|
||||
isDark := utils.IsDarkColor(0, 0, 0)
|
||||
assert.True(t, isDark)
|
||||
|
||||
isLight := utils.IsDarkColor(255, 255, 255)
|
||||
assert.False(t, isLight)
|
||||
|
||||
isQuestionable := utils.IsDarkColor(0x88, 0x88, 0x88)
|
||||
assert.False(t, isQuestionable)
|
||||
|
||||
isReallyQuestionable := utils.IsDarkColor(0x00, 0x88, 0x00)
|
||||
assert.True(t, isReallyQuestionable)
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue