2020-10-01 13:14:36 +02:00
|
|
|
package buf2d
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
2020-10-01 13:37:58 +02:00
|
|
|
"strings"
|
2020-10-01 13:14:36 +02:00
|
|
|
"testing"
|
|
|
|
)
|
|
|
|
|
|
|
|
func TestSub(t *testing.T) {
|
2022-03-31 12:37:35 +02:00
|
|
|
b := NewBuffer(10, 10, ' ')
|
2020-10-01 13:14:36 +02:00
|
|
|
s := b.Sub(1, 1, b.Width()-1, b.Height()-1)
|
2022-03-31 12:37:35 +02:00
|
|
|
b.Set(5, 1, 'a')
|
|
|
|
s.Set(5, 5, 'b')
|
|
|
|
WriteString(b, "Hello world", 1, 2)
|
2020-10-01 13:14:36 +02:00
|
|
|
|
|
|
|
fmt.Println(b)
|
2022-03-31 12:37:35 +02:00
|
|
|
fmt.Println(strings.Repeat("-", 10))
|
2020-10-01 13:14:36 +02:00
|
|
|
fmt.Println(s)
|
|
|
|
}
|
2022-05-04 09:49:22 +02:00
|
|
|
|
|
|
|
func TestSet(t *testing.T) {
|
2022-05-04 09:52:46 +02:00
|
|
|
b := NewBuffer(0, 0, ' ')
|
|
|
|
b.Set(0, 0, 'a')
|
2022-05-04 09:49:22 +02:00
|
|
|
}
|
2022-05-04 18:02:42 +02:00
|
|
|
|
|
|
|
func TestOffset(t *testing.T) {
|
|
|
|
b := NewBuffer(10, 10, ' ')
|
|
|
|
b = b.Sub(3, 3, 3, 3)
|
|
|
|
fmt.Println(b.OffsetX(), b.OffsetY())
|
|
|
|
}
|