Browse Source

Reduce logging severity in TextView tests

tablepad
Trevor Slocum 2 years ago
parent
commit
babfb2a5f1
  1. 1
      CHANGELOG
  2. 18
      textview_test.go

1
CHANGELOG

@ -1,6 +1,7 @@
v1.4.7 (WIP)
- Add Box.SetBackgroundTransparent
- Add List.SetSelectedAlwaysCentered
- Fix default background transparency of Flex and Grid
v1.4.6 (2020-05-18)
- Add Box.ShowFocus

18
textview_test.go

@ -201,13 +201,16 @@ func TestTextViewMaxLines(t *testing.T) {
// append 100 lines with no limit set:
for i := 0; i < 100; i++ {
tv.Write([]byte(fmt.Sprintf("L%d\n", i)))
_, err := tv.Write([]byte(fmt.Sprintf("L%d\n", i)))
if err != nil {
t.Errorf("failed to write to TextView: %s", err)
}
}
// retrieve the total text and see we have the 100 lines:
count := strings.Count(tv.GetText(true), "\n")
if count != 100 {
t.Fatalf("Expected 100 lines, got %d", count)
t.Errorf("expected 100 lines, got %d", count)
}
// now set the maximum lines to 20, this should clip the buffer:
@ -215,12 +218,15 @@ func TestTextViewMaxLines(t *testing.T) {
// verify buffer was clipped:
count = len(strings.Split(tv.GetText(true), "\n"))
if count != 20 {
t.Fatalf("Expected 20 lines, got %d", count)
t.Errorf("expected 20 lines, got %d", count)
}
// append 100 more lines:
for i := 100; i < 200; i++ {
tv.Write([]byte(fmt.Sprintf("L%d\n", i)))
_, err := tv.Write([]byte(fmt.Sprintf("L%d\n", i)))
if err != nil {
t.Errorf("failed to write to TextView: %s", err)
}
}
// Sice max lines is set to 20, we should still get 20 lines:
@ -228,12 +234,12 @@ func TestTextViewMaxLines(t *testing.T) {
lines := strings.Split(txt, "\n")
count = len(lines)
if count != 20 {
t.Fatalf("Expected 20 lines, got %d", count)
t.Errorf("expected 20 lines, got %d", count)
}
// and those 20 lines should be the last ones:
if lines[0] != "L181" {
t.Fatalf("Expected to get L181, got %s", lines[0])
t.Errorf("expected to get L181, got %s", lines[0])
}
}

Loading…
Cancel
Save