diff options
| author | Sam Anthony <sam@samanthony.xyz> | 2026-02-10 09:30:42 -0500 |
|---|---|---|
| committer | Sam Anthony <sam@samanthony.xyz> | 2026-02-10 09:30:42 -0500 |
| commit | 3ce04a4d3dc8d174b520d85804e5c8dce8c5d08f (patch) | |
| tree | 8ae271f0f151e1870b25574a88218f2040841247 /layout/resize_test.go | |
| parent | fa47463d8fa0dbd1b12ef227c15fa573e45244cd (diff) | |
| download | gui-3ce04a4d3dc8d174b520d85804e5c8dce8c5d08f.zip | |
add layout resize functions
Diffstat (limited to 'layout/resize_test.go')
| -rw-r--r-- | layout/resize_test.go | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/layout/resize_test.go b/layout/resize_test.go new file mode 100644 index 0000000..5be7a41 --- /dev/null +++ b/layout/resize_test.go @@ -0,0 +1,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) + } +} |