termui/buffer_test.go

24 lines
551 B
Go
Raw Normal View History

2017-01-14 06:07:43 +00:00
// Copyright 2017 Zack Guo <zack.y.guo@gmail.com>. All rights reserved.
2016-01-27 01:45:18 +00:00
// Use of this source code is governed by a MIT license that can
// be found in the LICENSE file.
2015-10-10 15:20:44 +00: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)
}
}