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.
tap animation should be created in widget's CreateRenderer method
- Loading branch information
Showing
6 changed files
with
88 additions
and
25 deletions.
There are no files selected for viewing
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
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,42 @@ | ||
package widget | ||
|
||
import ( | ||
"testing" | ||
|
||
"fyne.io/fyne/v2" | ||
"fyne.io/fyne/v2/internal/cache" | ||
"fyne.io/fyne/v2/test" | ||
"github.com/stretchr/testify/assert" | ||
) | ||
|
||
func TestSelectRenderer_TapAnimation(t *testing.T) { | ||
test.NewApp() | ||
defer test.NewApp() | ||
|
||
sel := NewSelect([]string{"one"}, func(s string) {}) | ||
w := test.NewWindow(sel) | ||
defer w.Close() | ||
w.Resize(sel.MinSize().Add(fyne.NewSize(10, 10))) | ||
sel.Resize(sel.MinSize()) | ||
|
||
test.ApplyTheme(t, test.NewTheme()) | ||
sel.Refresh() | ||
|
||
render1 := test.WidgetRenderer(sel).(*selectRenderer) | ||
test.Tap(sel) | ||
sel.popUp.Hide() | ||
sel.tapAnim.Tick(0.5) | ||
test.AssertImageMatches(t, "select/tap_animation.png", w.Canvas().Capture()) | ||
|
||
cache.DestroyRenderer(sel) | ||
sel.Refresh() | ||
|
||
render2 := test.WidgetRenderer(sel).(*selectRenderer) | ||
|
||
assert.NotEqual(t, render1, render2) | ||
|
||
test.Tap(sel) | ||
sel.popUp.Hide() | ||
sel.tapAnim.Tick(0.5) | ||
test.AssertImageMatches(t, "select/tap_animation.png", w.Canvas().Capture()) | ||
} |
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.