termui/buffer_test.go

24 lines
551 B
Go
Raw Normal View History

2016-11-10 21:25:53 -07:00
// Copyright 2016 Zack Guo <zack.y.guo@gmail.com>. All rights reserved.
2016-01-26 18:45:18 -07:00
// Use of this source code is governed by a MIT license that can
// be found in the LICENSE file.
2015-10-10 09:20:44 -06:00
package termui
import (
"image"
"testing"
)
func TestBufferUnion(t *testing.T) {
b0 := NewBuffer()
b1 := NewBuffer()
b1.Area.Max.X = 100
b1.Area.Max.Y = 100
b0.Area.Max.X = 50
b0.Merge(b1)
if b0.Area.Max.X != 100 {
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)
}
}