1
1
mirror of https://github.com/walles/moar.git synced 2024-11-27 01:05:23 +03:00
moar/twin/palette256_test.go
Johan Walles b103f0c10b Drop redundant dependency
Chroma already provides enough color handling for our needs.
2023-12-20 18:28:07 +01:00

48 lines
956 B
Go

package twin
import (
"testing"
"gotest.tools/v3/assert"
)
func TestColorRgbFirst16(t *testing.T) {
r, g, b := color256ToRGB(5)
assert.Equal(t, r, uint8(0x80))
assert.Equal(t, g, uint8(0x00))
assert.Equal(t, b, uint8(0x80))
}
func TestColorToRgbInTheGrey(t *testing.T) {
r, g, b := color256ToRGB(252)
assert.Equal(t, r, uint8(0xd0))
assert.Equal(t, g, uint8(0xd0))
assert.Equal(t, b, uint8(0xd0))
}
func TestColorToRgbInThe6x6Cube(t *testing.T) {
r, g, b := color256ToRGB(101)
assert.Equal(t, r, uint8(0x87))
assert.Equal(t, g, uint8(0x87))
assert.Equal(t, b, uint8(0x5f))
}
func TestColorToRgbStart6x6Cube(t *testing.T) {
r, g, b := color256ToRGB(16)
assert.Equal(t, r, uint8(0x00))
assert.Equal(t, g, uint8(0x00))
assert.Equal(t, b, uint8(0x00))
}
func TestColorRgbEnd6x6Cube(t *testing.T) {
r, g, b := color256ToRGB(231)
assert.Equal(t, r, uint8(0xff))
assert.Equal(t, g, uint8(0xff))
assert.Equal(t, b, uint8(0xff))
}