canvas_test.go 870 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. // Copyright 2017 Zack Guo <zack.y.guo@gmail.com>. All rights reserved.
  2. // Use of this source code is governed by a MIT license that can
  3. // be found in the LICENSE file.
  4. // +build ignore
  5. package termui
  6. import (
  7. "testing"
  8. "github.com/davecgh/go-spew/spew"
  9. )
  10. func TestCanvasSet(t *testing.T) {
  11. c := NewCanvas()
  12. c.Set(0, 0)
  13. c.Set(0, 1)
  14. c.Set(0, 2)
  15. c.Set(0, 3)
  16. c.Set(1, 3)
  17. c.Set(2, 3)
  18. c.Set(3, 3)
  19. c.Set(4, 3)
  20. c.Set(5, 3)
  21. spew.Dump(c)
  22. }
  23. func TestCanvasUnset(t *testing.T) {
  24. c := NewCanvas()
  25. c.Set(0, 0)
  26. c.Set(0, 1)
  27. c.Set(0, 2)
  28. c.Unset(0, 2)
  29. spew.Dump(c)
  30. c.Unset(0, 3)
  31. spew.Dump(c)
  32. }
  33. func TestCanvasBuffer(t *testing.T) {
  34. c := NewCanvas()
  35. c.Set(0, 0)
  36. c.Set(0, 1)
  37. c.Set(0, 2)
  38. c.Set(0, 3)
  39. c.Set(1, 3)
  40. c.Set(2, 3)
  41. c.Set(3, 3)
  42. c.Set(4, 3)
  43. c.Set(5, 3)
  44. c.Set(6, 3)
  45. c.Set(7, 2)
  46. c.Set(8, 1)
  47. c.Set(9, 0)
  48. bufs := c.Buffer()
  49. spew.Dump(bufs)
  50. }