diff --git a/container/testdata/doctabs/desktop/single_custom_theme.png b/container/testdata/doctabs/desktop/single_custom_theme.png index 46bb4f6f82..a020f40b42 100644 Binary files a/container/testdata/doctabs/desktop/single_custom_theme.png and b/container/testdata/doctabs/desktop/single_custom_theme.png differ diff --git a/container/testdata/doctabs/mobile/theme_ugly.png b/container/testdata/doctabs/mobile/theme_ugly.png index 46bb4f6f82..a020f40b42 100644 Binary files a/container/testdata/doctabs/mobile/theme_ugly.png and b/container/testdata/doctabs/mobile/theme_ugly.png differ diff --git a/test/theme.go b/test/theme.go index d0bb631c86..7cfb3f1cd6 100644 --- a/test/theme.go +++ b/test/theme.go @@ -39,13 +39,13 @@ func NewTheme() fyne.Theme { theme.ColorNameHeaderBackground: red(22), theme.ColorNameInputBackground: red(30), theme.ColorNameInputBorder: gray(10), - theme.ColorNameMenuBackground: red(30), + theme.ColorNameMenuBackground: red(50), theme.ColorNameOnPrimary: red(200), theme.ColorNameOverlayBackground: red(44), theme.ColorNamePlaceHolder: blue(200), theme.ColorNamePressed: blue(250), theme.ColorNamePrimary: green(255), - theme.ColorNameScrollBar: blue(200), + theme.ColorNameScrollBar: blue(220), theme.ColorNameSeparator: gray(30), theme.ColorNameSelection: red(55), theme.ColorNameShadow: blue(150), @@ -136,14 +136,6 @@ func Theme() fyne.Theme { } func newConfigurableTheme(name string, colors map[fyne.ThemeColorName]color.Color, fonts map[fyne.TextStyle]fyne.Resource, sizes map[fyne.ThemeSizeName]float32) fyne.Theme { - seen := map[color.Color]fyne.ThemeColorName{} - for cn, c := range colors { - if seen[c] != "" { - // This panic will never happen on released code because it will happen on CI runs prior release. - panic(fmt.Sprintf("duplicate color value %#v for color %s already used for color %s in theme %s", c, cn, seen[c], name)) - } - seen[c] = cn - } return &configurableTheme{ colors: colors, fonts: fonts, diff --git a/test/theme_test.go b/test/theme_test.go new file mode 100644 index 0000000000..ea9620a5c3 --- /dev/null +++ b/test/theme_test.go @@ -0,0 +1,32 @@ +package test + +import ( + "fmt" + "testing" + + "github.com/stretchr/testify/assert" + + "fyne.io/fyne/v2" +) + +func Test_NewTheme_checkForUniqueColors(t *testing.T) { + th := NewTheme().(*configurableTheme) + seen := map[string]fyne.ThemeColorName{} + for cn, c := range th.colors { + r, g, b, a := c.RGBA() + key := fmt.Sprintf("%d %d %d %d", r, g, b, a) + assert.True(t, seen[key] == "", "color value %#v for color %s already used for color %s in theme %s", c, cn, seen[key], th.name) + seen[key] = cn + } +} + +func Test_Theme_checkForUniqueColors(t *testing.T) { + th := Theme().(*configurableTheme) + seen := map[string]fyne.ThemeColorName{} + for cn, c := range th.colors { + r, g, b, a := c.RGBA() + key := fmt.Sprintf("%d %d %d %d", r, g, b, a) + assert.True(t, seen[key] == "", "color value %#v for color %s already used for color %s in theme %s", c, cn, seen[key], th.name) + seen[key] = cn + } +} diff --git a/widget/testdata/list/list_theme_changed.png b/widget/testdata/list/list_theme_changed.png index 461e397389..fc4cfc857d 100644 Binary files a/widget/testdata/list/list_theme_changed.png and b/widget/testdata/list/list_theme_changed.png differ diff --git a/widget/testdata/menu/desktop/layout_shortcuts_other_theme_changed.png b/widget/testdata/menu/desktop/layout_shortcuts_other_theme_changed.png index 73627052ba..34e573d37d 100644 Binary files a/widget/testdata/menu/desktop/layout_shortcuts_other_theme_changed.png and b/widget/testdata/menu/desktop/layout_shortcuts_other_theme_changed.png differ diff --git a/widget/testdata/menu/desktop/layout_theme_changed.png b/widget/testdata/menu/desktop/layout_theme_changed.png index 27ce38b650..905a4137b0 100644 Binary files a/widget/testdata/menu/desktop/layout_theme_changed.png and b/widget/testdata/menu/desktop/layout_theme_changed.png differ diff --git a/widget/testdata/menu/mobile/layout_theme_changed.png b/widget/testdata/menu/mobile/layout_theme_changed.png index ec024e54cd..046537172a 100644 Binary files a/widget/testdata/menu/mobile/layout_theme_changed.png and b/widget/testdata/menu/mobile/layout_theme_changed.png differ diff --git a/widget/testdata/select/desktop/theme_changed.png b/widget/testdata/select/desktop/theme_changed.png index b61372424f..489dace2f2 100644 Binary files a/widget/testdata/select/desktop/theme_changed.png and b/widget/testdata/select/desktop/theme_changed.png differ diff --git a/widget/testdata/select/mobile/theme_changed.png b/widget/testdata/select/mobile/theme_changed.png index b0f985d77b..af4d790edf 100644 Binary files a/widget/testdata/select/mobile/theme_changed.png and b/widget/testdata/select/mobile/theme_changed.png differ diff --git a/widget/testdata/table/theme_changed.png b/widget/testdata/table/theme_changed.png index c37d16dc10..51e108fdf5 100644 Binary files a/widget/testdata/table/theme_changed.png and b/widget/testdata/table/theme_changed.png differ diff --git a/widget/testdata/tree/theme_changed.png b/widget/testdata/tree/theme_changed.png index f56583f99b..e9547f52a3 100644 Binary files a/widget/testdata/tree/theme_changed.png and b/widget/testdata/tree/theme_changed.png differ