MCPcopy
hub / github.com/gdamore/tcell / TestSgrColorRGB

Function TestSgrColorRGB

vt/tests/mock_test.go:746–770  ·  view source on GitHub ↗

TestSgrColorRGB tests simple ECMA 48 ANSI color (full 24-bit color.)

(t *testing.T)

Source from the content-addressed store, hash-verified

744
745// TestSgrColorRGB tests simple ECMA 48 ANSI color (full 24-bit color.)
746func TestSgrColorRGB(t *testing.T) {
747 term := vt.NewMockTerm(vt.MockOptSize{X: 80, Y: 24}, vt.MockOptColors(1<<24))
748 defer MustClose(t, term)
749 MustStart(t, term)
750
751 // foreground
752 WriteF(t, term, "\x1b[m\x1b[H\x1b[38:2:255:0:0mA")
753 CheckColors(t, term, 0, 0, color.NewRGBColor(255, 0, 0), color.Black)
754
755 WriteF(t, term, "\x1b[m\x1b[H\x1b[38;2;2;0;0mA")
756 CheckColors(t, term, 0, 0, color.NewRGBColor(2, 0, 0), color.Black)
757
758 // background
759 WriteF(t, term, "\x1b[m\x1b[H\x1b[48:2:1:2:3mA")
760 CheckColors(t, term, 0, 0, color.Silver, color.NewRGBColor(1, 2, 3))
761
762 WriteF(t, term, "\x1b[m\x1b[H\x1b[48;2;4;5;6mA")
763 CheckColors(t, term, 0, 0, color.Silver, color.NewRGBColor(4, 5, 6))
764
765 // full colors
766 WriteF(t, term, "\x1b[m\x1b[H\x1b[38;2;99;88;77;48;2;4;5;6;58;2;99;98;91;1mA")
767 CheckColors(t, term, 0, 0, color.NewRGBColor(99, 88, 77), color.NewRGBColor(4, 5, 6))
768 VerifyF(t, term.GetCell(Coord{X: 0, Y: 0}).S.Uc() == color.NewRGBColor(99, 98, 91), "underline color is wrong")
769 CheckAttrs(t, term, 0, 0, vt.Bold)
770}
771
772// TestTitles tests that we can set a window title.
773func TestTitles(t *testing.T) {

Callers

nothing calls this directly

Calls 11

GetCellMethod · 0.95
NewMockTermFunction · 0.92
MockOptColorsTypeAlias · 0.92
NewRGBColorFunction · 0.92
MustCloseFunction · 0.85
MustStartFunction · 0.85
WriteFFunction · 0.85
CheckColorsFunction · 0.85
VerifyFFunction · 0.85
CheckAttrsFunction · 0.85
UcMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…