buffer_test.go 551 B

123456789101112131415161718192021222324
  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. package termui
  5. import (
  6. "image"
  7. "testing"
  8. )
  9. func TestBufferUnion(t *testing.T) {
  10. b0 := NewBuffer()
  11. b1 := NewBuffer()
  12. b1.Area.Max.X = 100
  13. b1.Area.Max.Y = 100
  14. b0.Area.Max.X = 50
  15. b0.Merge(b1)
  16. if b0.Area.Max.X != 100 {
  17. t.Errorf("Buffer.Merge unions Area failed: should:%v, actual %v,%v", image.Rect(0, 0, 50, 0).Union(image.Rect(0, 0, 100, 100)), b1.Area, b0.Area)
  18. }
  19. }