/
render_engine_test.go
43 lines (32 loc) · 1015 Bytes
/
render_engine_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
package latvis
import (
"github.com/mrjones/gt"
"testing"
)
func TestSquareBox(t *testing.T) {
box, err := NewBoundingBox(
Coordinate{Lat: 0, Lng: 0},
Coordinate{Lat: 10, Lng: 10})
gt.AssertNil(t, err)
w, h := imgSize(box, 500)
gt.AssertEqualM(t, 500, w, "Width should be maxed for a square box")
gt.AssertEqualM(t, 500, h, "Height should be maxed for a square box")
}
func TestWideBox(t *testing.T) {
box, err := NewBoundingBox(
Coordinate{Lat: 0, Lng: 0},
Coordinate{Lat: 10, Lng: 100})
gt.AssertNil(t, err)
w, h := imgSize(box, 500)
gt.AssertEqualM(t, 500, w, "Width should be maxed for a wide box")
gt.AssertEqualM(t, 50, h, "Height should be short for a wide box")
}
func TestTallBox(t *testing.T) {
box, err := NewBoundingBox(
Coordinate{Lat: 0, Lng: 0},
Coordinate{Lat: 10, Lng: 5})
gt.AssertNil(t, err)
w, h := imgSize(box, 500)
gt.AssertEqualM(t, 250, w, "Width should be narrow for a tall box")
gt.AssertEqualM(t, 500, h, "Height should be maxed for a tall box")
}