Skip to content

Commit

Permalink
Missed Resize test
Browse files Browse the repository at this point in the history
  • Loading branch information
andydotxyz committed Jan 27, 2021
1 parent f59f91c commit 21ca8bc
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions dialog/base_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,12 @@ import (
"image/color"
"testing"

"github.com/stretchr/testify/assert"

"fyne.io/fyne/v2"
"fyne.io/fyne/v2/canvas"
"fyne.io/fyne/v2/test"
"fyne.io/fyne/v2/theme"
"fyne.io/fyne/v2/widget"
)

Expand All @@ -28,3 +31,17 @@ func TestShowCustom_ApplyTheme(t *testing.T) {
test.ApplyTheme(t, test.NewTheme())
test.AssertImageMatches(t, "dialog-custom-ugly.png", w.Canvas().Capture())
}

func TestShowCustom_Resize(t *testing.T) {
w := test.NewWindow(canvas.NewRectangle(color.Transparent))
w.Resize(fyne.NewSize(300, 300))

label := widget.NewLabel("Content")
label.Alignment = fyne.TextAlignCenter
d := NewCustom("Title", "OK", label, w)

size := fyne.NewSize(200, 200)
d.Resize(size)
d.Show()
assert.Equal(t, size, d.(*dialog).win.Content.Size().Add(fyne.NewSize(theme.Padding()*2, theme.Padding()*2)))
}

0 comments on commit 21ca8bc

Please sign in to comment.