diff --git a/widget/button_internal_test.go b/widget/button_internal_test.go index 38d53f2a58..bc4298abce 100644 --- a/widget/button_internal_test.go +++ b/widget/button_internal_test.go @@ -92,7 +92,8 @@ func TestButton_DisabledIconChangeUsingSetIcon(t *testing.T) { // assert we are using the disabled original icon button.Disable() - assert.True(t, strings.HasPrefix(render.icon.Resource.Name(), "disabled_")) + cancelBaseName := strings.TrimPrefix(theme.CancelIcon().Name(), "foreground_") + assert.Equal(t, render.icon.Resource.Name(), fmt.Sprintf("disabled_%v", cancelBaseName)) // re-enable, then change the icon button.Enable() @@ -101,7 +102,9 @@ func TestButton_DisabledIconChangeUsingSetIcon(t *testing.T) { // assert we are using the disabled new icon button.Disable() - assert.True(t, strings.HasPrefix(render.icon.Resource.Name(), "disabled_")) + searchBaseName := strings.TrimPrefix(theme.SearchIcon().Name(), "foreground_") + assert.Equal(t, render.icon.Resource.Name(), fmt.Sprintf("disabled_%v", searchBaseName)) + } func TestButton_DisabledIconChangedDirectly(t *testing.T) { @@ -111,7 +114,8 @@ func TestButton_DisabledIconChangedDirectly(t *testing.T) { // assert we are using the disabled original icon button.Disable() - assert.Equal(t, render.icon.Resource.Name(), fmt.Sprintf("disabled_%v", theme.CancelIcon().Name())) + cancelBaseName := strings.TrimPrefix(theme.CancelIcon().Name(), "foreground_") + assert.Equal(t, render.icon.Resource.Name(), fmt.Sprintf("disabled_%v", cancelBaseName)) // re-enable, then change the icon button.Enable() @@ -121,7 +125,8 @@ func TestButton_DisabledIconChangedDirectly(t *testing.T) { // assert we are using the disabled new icon button.Disable() - assert.Equal(t, render.icon.Resource.Name(), fmt.Sprintf("disabled_%v", theme.SearchIcon().Name())) + searchBaseName := strings.TrimPrefix(theme.SearchIcon().Name(), "foreground_") + assert.Equal(t, render.icon.Resource.Name(), fmt.Sprintf("disabled_%v", searchBaseName)) }