TestSgrColorRGB tests simple ECMA 48 ANSI color (full 24-bit color.)
(t *testing.T)
| 744 | |
| 745 | // TestSgrColorRGB tests simple ECMA 48 ANSI color (full 24-bit color.) |
| 746 | func 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. |
| 773 | func TestTitles(t *testing.T) { |
nothing calls this directly
no test coverage detected
searching dependent graphs…