Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Jacalz committed Jan 6, 2024
1 parent c2ab3af commit 88f799a
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions internal/widget/shadowing_renderer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ func TestShadowingRenderer_Objects(t *testing.T) {
}{
"with shadow": {
12,
[]fyne.CanvasObject{w.NewShadow(w.ShadowAround, 12)},
[]fyne.CanvasObject{},
},
"without shadow": {
0,
Expand All @@ -26,13 +26,18 @@ func TestShadowingRenderer_Objects(t *testing.T) {
}
for name, tt := range tests {
t.Run(name, func(t *testing.T) {
shadowIndex := 0
if tt.level > 0 {
shadowIndex = 1 // Shadow pointers are not the same. Avoid comparing.
}

objects := []fyne.CanvasObject{widget.NewLabel("A"), widget.NewLabel("B")}
r := w.NewShadowingRenderer(objects, tt.level)
assert.Equal(t, append(tt.wantPrependedObjects, objects...), r.Objects())
assert.Equal(t, append(tt.wantPrependedObjects, objects...), r.Objects()[shadowIndex:])

otherObjects := []fyne.CanvasObject{widget.NewLabel("X"), widget.NewLabel("Y")}
r.SetObjects(otherObjects)
assert.Equal(t, append(tt.wantPrependedObjects, otherObjects...), r.Objects())
assert.Equal(t, append(tt.wantPrependedObjects, otherObjects...), r.Objects()[shadowIndex:])
})
}
}

0 comments on commit 88f799a

Please sign in to comment.