aboutsummaryrefslogtreecommitdiffstats
path: root/layout/resize_test.go
blob: 5be7a416edb58d65234f0dd1098424df94f1eb8d (plain) (blame)
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
package layout_test

import (
	"image"
	"testing"

	"github.com/faiface/gui/layout"
)

func TestResizeAll(t *testing.T) {
	t.Parallel()
	parent := image.Rect(111, 222, 333, 444)
	child := layout.ResizeAll(parent)
	want := parent
	if child != want {
		t.Errorf("got %v; want %v", child, want)
	}
}

func TestResizeQuad1(t *testing.T) {
	t.Parallel()
	parent := image.Rect(111, 222, 333, 444)
	child := layout.ResizeQuad1(parent)
	want := image.Rect(222, 222, 333, 333)
	if child != want {
		t.Errorf("got %v; want %v", child, want)
	}
}

func TestResizeQuad2(t *testing.T) {
	t.Parallel()
	parent := image.Rect(111, 222, 333, 444)
	child := layout.ResizeQuad2(parent)
	want := image.Rect(111, 222, 222, 333)
	if child != want {
		t.Errorf("got %v; want %v", child, want)
	}
}

func TestResizeQuad3(t *testing.T) {
	t.Parallel()
	parent := image.Rect(111, 222, 333, 444)
	child := layout.ResizeQuad3(parent)
	want := image.Rect(111, 333, 222, 444)
	if child != want {
		t.Errorf("got %v; want %v", child, want)
	}
}

func TestResizeQuad4(t *testing.T) {
	t.Parallel()
	parent := image.Rect(111, 222, 333, 444)
	child := layout.ResizeQuad4(parent)
	want := image.Rect(222, 333, 333, 444)
	if child != want {
		t.Errorf("got %v; want %v", child, want)
	}
}