2024-04-23 14:15:28 -06:00
|
|
|
package ncurses
|
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
|
|
|
)
|
|
|
|
|
|
|
|
func StartTest(t *testing.T) Window {
|
2024-04-23 22:10:40 -06:00
|
|
|
window := InitScr()
|
2024-04-23 14:15:28 -06:00
|
|
|
return window
|
|
|
|
}
|
|
|
|
|
|
|
|
func EndTest(t *testing.T) {
|
2024-04-23 22:10:40 -06:00
|
|
|
ret := EndWin()
|
2024-04-23 14:15:28 -06:00
|
|
|
if ret != 0 {
|
2024-04-23 22:10:40 -06:00
|
|
|
t.Fatalf("EndWin result - 0x%02x", ret)
|
2024-04-23 14:15:28 -06:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func TestInitScr(t *testing.T) {
|
2024-04-23 22:10:40 -06:00
|
|
|
StartTest(t)
|
2024-04-23 14:15:28 -06:00
|
|
|
EndTest(t)
|
|
|
|
}
|
|
|
|
|
|
|
|
func TestNewWin(t *testing.T) {
|
|
|
|
StartTest(t)
|
|
|
|
|
2024-04-23 22:10:40 -06:00
|
|
|
window := NewWin(10, 10, 0, 0)
|
2024-04-23 14:15:28 -06:00
|
|
|
t.Logf("NewWin result - 0x%x", window)
|
|
|
|
|
2024-04-23 22:10:40 -06:00
|
|
|
ret := DelWin(window)
|
2024-04-23 14:15:28 -06:00
|
|
|
if ret != 0 {
|
2024-04-23 22:10:40 -06:00
|
|
|
t.Fatalf("DelWin result - 0x%02x", ret)
|
2024-04-23 14:15:28 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
EndTest(t)
|
|
|
|
}
|
|
|
|
|
2024-04-23 22:10:40 -06:00
|
|
|
func TestColors(t *testing.T) {
|
|
|
|
StartTest(t)
|
|
|
|
|
|
|
|
ret := StartColor()
|
|
|
|
if ret != 0 {
|
|
|
|
t.Fatalf("StartColor result - 0x%02x", ret)
|
|
|
|
}
|
|
|
|
|
|
|
|
ret = InitColor(0, 1000, 0, 0)
|
|
|
|
if ret != 0 {
|
|
|
|
t.Fatalf("InitColor result - 0x%02x", ret)
|
|
|
|
}
|
|
|
|
|
|
|
|
ret = InitColor(1, 0, 1000, 0)
|
|
|
|
if ret != 0 {
|
|
|
|
t.Fatalf("InitColor result - 0x%02x", ret)
|
|
|
|
}
|
|
|
|
|
|
|
|
ret = InitPair(1, 0, 1)
|
|
|
|
if ret != 0 {
|
|
|
|
t.Fatalf("InitPair result - 0x%02x", ret)
|
|
|
|
}
|
|
|
|
|
|
|
|
EndTest(t)
|
|
|
|
}
|