forked from fyne-io/fyne
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[test] check unique colors for themes via test
This avoids the check to be run on every instantiation. It also revealed that the old check did not work properly and revealed two duplicates in the ugly theme.
- Loading branch information
Showing
12 changed files
with
34 additions
and
10 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
} | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+16 Bytes
(100%)
widget/testdata/menu/desktop/layout_shortcuts_other_theme_changed.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.