Skip to content

Commit

Permalink
Adding test to show that override renders a mobile app tabs on a desk…
Browse files Browse the repository at this point in the history
…top computer
  • Loading branch information
andydotxyz committed Nov 6, 2024
1 parent 3ba2b0a commit f5a5fb2
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions container/apptabs_override_test.go
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)
}

0 comments on commit f5a5fb2

Please sign in to comment.