forked from fyne-io/fyne
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding test to show that override renders a mobile app tabs on a desk…
…top computer
- Loading branch information
1 parent
3ba2b0a
commit f5a5fb2
Showing
1 changed file
with
35 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
//go:build !mobile | ||
|
||
package container_test | ||
|
||
import ( | ||
"testing" | ||
|
||
"fyne.io/fyne/v2/container" | ||
"fyne.io/fyne/v2/test" | ||
"fyne.io/fyne/v2/widget" | ||
) | ||
|
||
func TestAppTabs_OverrideMobile(t *testing.T) { | ||
test.NewTempApp(t) | ||
|
||
item1 := &container.TabItem{Text: "Test1", Content: widget.NewLabel("Text 1")} | ||
item2 := &container.TabItem{Text: "Test2", Content: widget.NewLabel("Text 2")} | ||
item3 := &container.TabItem{Text: "Test3", Content: widget.NewLabel("Text 3")} | ||
tabs := container.NewAppTabs(item1, item2, item3) | ||
w := test.NewWindow(tabs) | ||
defer w.Close() | ||
w.SetPadded(false) | ||
c := w.Canvas() | ||
|
||
min := tabs.MinSize() | ||
w.Resize(min) | ||
|
||
test.AssertRendersToMarkup(t, "apptabs/desktop/tab_location_top.xml", c) | ||
|
||
override := container.NewThemeOverride(tabs, test.Theme()) | ||
override.SetDeviceIsMobile(true) | ||
w.Resize(min.AddWidthHeight(-4, -0)) | ||
|
||
test.AssertRendersToMarkup(t, "apptabs/mobile/tab_location_top.xml", c) | ||
} |