summaryrefslogtreecommitdiff
path: root/ui/buffers_test.go
diff options
context:
space:
mode:
authorHubert Hirtz <hubert@hirtz.pm>2021-05-26 12:44:35 +0200
committerHubert Hirtz <hubert@hirtz.pm>2021-05-26 17:43:29 +0200
commit287e40855e3bceb258af247317a288d179e55c57 (patch)
tree063ac47fada92281fc82a3e4b36a4d6a402c461d /ui/buffers_test.go
parentDo not go into infinite loops on TLS mismatch (diff)
Pick nick colors in terminal color scheme
So that the colors go well with the terminal background.
Diffstat (limited to 'ui/buffers_test.go')
-rw-r--r--ui/buffers_test.go20
1 files changed, 4 insertions, 16 deletions
diff --git a/ui/buffers_test.go b/ui/buffers_test.go
index b78f8e9..13a32de 100644
--- a/ui/buffers_test.go
+++ b/ui/buffers_test.go
@@ -6,7 +6,7 @@ import (
)
func assertSplitPoints(t *testing.T, body string, expected []point) {
- l := Line{Body: body}
+ l := Line{Body: PlainString(body)}
l.computeSplitPoints()
if len(l.splitPoints) != len(expected) {
@@ -71,7 +71,7 @@ func showSplit(s string, nls []int) string {
}
func assertNewLines(t *testing.T, body string, width int, expected int) {
- l := Line{Body: body}
+ l := Line{Body: PlainString(body)}
l.computeSplitPoints()
actual := l.NewLines(width)
@@ -141,6 +141,8 @@ func TestRenderedHeight(t *testing.T) {
assertNewLines(t, "have a good day!", 17, 1) // |have a good day! |
// LEN=15, WIDTH=11
+ // TODO find other zero- or two-width chars, since IRC color codes are
+ // now handled by app.go
assertNewLines(t, "\x0342barmand\x03: cc", 1, 10) // |b|a|r|m|a|n|d|:|c|c|
assertNewLines(t, "\x0342barmand\x03: cc", 2, 5) // |ba|rm|an|d:|cc|
assertNewLines(t, "\x0342barmand\x03: cc", 3, 4) // |bar|man|d: |cc |
@@ -160,17 +162,3 @@ func TestRenderedHeight(t *testing.T) {
assertNewLines(t, "cc en direct du word wrapping des familles le tests ça v a va va v a va", 46, 2)
}
-
-/*
-func assertTrimWidth(t *testing.T, s string, w int, expected string) {
- actual := trimWidth(s, w)
- if actual != expected {
- t.Errorf("%q (width=%d): expected to be trimmed as %q, got %q\n", s, w, expected, actual)
- }
-}
-
-func TestTrimWidth(t *testing.T) {
- assertTrimWidth(t, "ludovicchabant/fn", 16, "ludovicchabant/…")
- assertTrimWidth(t, "zzzzzzzzzzzzzz黒猫/sr", 16, "zzzzzzzzzzzzzz黒…")
-}
-// */