22 lines
563 B
Go
22 lines
563 B
Go
package layout
|
|
|
|
import (
|
|
"github.com/stevec/fancywin/internal/config"
|
|
"testing"
|
|
)
|
|
|
|
func TestResolvePercentageAndGap(t *testing.T) {
|
|
got := Resolve(Rect{0, 0, 1920, 1040}, config.Zone{X: 50, Y: 0, Width: 50, Height: 100}, 8)
|
|
want := (Rect{968, 8, 1912, 1032})
|
|
if got != want {
|
|
t.Fatalf("got %+v, want %+v", got, want)
|
|
}
|
|
}
|
|
|
|
func TestZoneAt(t *testing.T) {
|
|
z := []config.Zone{{X: 0, Y: 0, Width: 50, Height: 100}, {X: 50, Y: 0, Width: 50, Height: 100}}
|
|
if got := ZoneAt(Rect{0, 0, 100, 100}, z, 0, Point{75, 20}); got != 1 {
|
|
t.Fatalf("got %d", got)
|
|
}
|
|
}
|