Skip to content

Commit

Permalink
Add a benchmark for the form layout
Browse files Browse the repository at this point in the history
  • Loading branch information
Jacalz committed May 1, 2024
1 parent 78bd85c commit 43d28d4
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions layout/formlayout_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,30 @@ import (
"github.com/stretchr/testify/assert"
)

var minSize fyne.Size

func BenchmarkFormLayout(b *testing.B) {
b.StopTimer()

min := fyne.Size{}
form := layout.NewFormLayout()
label1 := canvas.NewRectangle(color.Black)
content1 := canvas.NewRectangle(color.Black)
label2 := canvas.NewRectangle(color.Black)
content2 := canvas.NewRectangle(color.Black)

objects := []fyne.CanvasObject{label1, content1, label2, content2}

b.StartTimer()

b.ReportAllocs()
for i := 0; i < b.N; i++ {
min = form.MinSize(objects)
}

minSize = min
}

func TestFormLayout(t *testing.T) {
gridSize := fyne.NewSize(125, 125)

Expand Down

0 comments on commit 43d28d4

Please sign in to comment.