/
circle_test.go
52 lines (40 loc) · 1.13 KB
/
circle_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
44
45
46
47
48
49
50
51
52
package canvas_test
import (
"image/color"
"testing"
"fyne.io/fyne"
"fyne.io/fyne/canvas"
"github.com/stretchr/testify/assert"
)
func TestCircle_MinSize(t *testing.T) {
circle := canvas.NewCircle(color.Black)
min := circle.MinSize()
assert.True(t, min.Width > 0)
assert.True(t, min.Height > 0)
}
func TestCircle_FillColor(t *testing.T) {
c := color.White
circle := canvas.NewCircle(c)
assert.Equal(t, c, circle.FillColor)
}
func TestCircle_Resize(t *testing.T) {
targetWidth := float32(50)
targetHeight := float32(50)
circle := canvas.NewCircle(color.White)
start := circle.Size()
assert.True(t, start.Height == 0)
assert.True(t, start.Width == 0)
circle.Resize(fyne.NewSize(targetWidth, targetHeight))
target := circle.Size()
assert.True(t, target.Height == targetHeight)
assert.True(t, target.Width == targetWidth)
}
func TestCircle_Move(t *testing.T) {
circle := canvas.NewCircle(color.White)
circle.Resize(fyne.NewSize(50, 50))
start := fyne.Position{X: 0, Y: 0}
assert.True(t, circle.Position() == start)
target := fyne.Position{X: 10, Y: 75}
circle.Move(target)
assert.True(t, circle.Position() == target)
}