Skip to content

Commit

Permalink
Merge pull request fyne-io#4850 from Jacalz/temp-test-app
Browse files Browse the repository at this point in the history
  • Loading branch information
Jacalz authored Jun 17, 2024
2 parents 237167e + 39089be commit 759df6f
Show file tree
Hide file tree
Showing 51 changed files with 184 additions and 343 deletions.
6 changes: 2 additions & 4 deletions canvas/text_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,7 @@ func TestText_MinSize_NoMultiLine(t *testing.T) {
}

func TestText_Layout(t *testing.T) {
test.NewApp()
defer test.NewApp()
test.NewTempApp(t)

for name, tt := range map[string]struct {
text string
Expand Down Expand Up @@ -132,8 +131,7 @@ func TestText_Layout(t *testing.T) {
}

func TestText_CarriageReturn(t *testing.T) {
test.NewApp()
defer test.NewApp()
test.NewTempApp(t)

for name, tt := range map[string]struct {
text string
Expand Down
6 changes: 2 additions & 4 deletions container/apptabs_desktop_flakey_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@ import (
)

func TestAppTabs_ApplyTheme(t *testing.T) {
test.NewApp()
defer test.NewApp()
test.NewTempApp(t)

w := test.NewWindow(
container.NewAppTabs(&container.TabItem{Text: "Test", Content: widget.NewLabel("Text")}),
Expand All @@ -30,8 +29,7 @@ func TestAppTabs_ApplyTheme(t *testing.T) {
}

func TestAppTabs_ChangeItemContent(t *testing.T) {
test.NewApp()
defer test.NewApp()
test.NewTempApp(t)

item1 := &container.TabItem{Text: "Test1", Content: widget.NewLabel("Text1")}
item2 := &container.TabItem{Text: "Test2", Content: widget.NewLabel("Text2")}
Expand Down
21 changes: 7 additions & 14 deletions container/apptabs_desktop_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@ import (
)

func TestAppTabs_ChangeItemIcon(t *testing.T) {
test.NewApp()
defer test.NewApp()
test.NewTempApp(t)

item1 := &container.TabItem{Icon: theme.CancelIcon(), Content: widget.NewLabel("Text1")}
item2 := &container.TabItem{Icon: theme.ConfirmIcon(), Content: widget.NewLabel("Text2")}
Expand All @@ -41,8 +40,7 @@ func TestAppTabs_ChangeItemIcon(t *testing.T) {
}

func TestAppTabs_ChangeItemText(t *testing.T) {
test.NewApp()
defer test.NewApp()
test.NewTempApp(t)

item1 := &container.TabItem{Text: "Test1", Content: widget.NewLabel("Text1")}
item2 := &container.TabItem{Text: "Test2", Content: widget.NewLabel("Text2")}
Expand All @@ -65,8 +63,7 @@ func TestAppTabs_ChangeItemText(t *testing.T) {
}

func TestAppTabs_DynamicTabs(t *testing.T) {
test.NewApp()
defer test.NewApp()
test.NewTempApp(t)

item1 := &container.TabItem{Text: "Test1", Content: widget.NewLabel("Text 1")}
tabs := container.NewAppTabs(item1)
Expand Down Expand Up @@ -117,8 +114,7 @@ func TestAppTabs_DynamicTabs(t *testing.T) {
}

func TestAppTabs_HoverButtons(t *testing.T) {
test.NewApp()
defer test.NewApp()
test.NewTempApp(t)

item1 := &container.TabItem{Text: "Test1", Content: widget.NewLabel("Text1")}
item2 := &container.TabItem{Text: "Test2", Content: widget.NewLabel("Text2")}
Expand Down Expand Up @@ -148,8 +144,7 @@ func TestAppTabs_HoverButtons(t *testing.T) {
}

func TestAppTabs_Layout(t *testing.T) {
test.NewApp()
defer test.NewApp()
test.NewTempApp(t)

w := test.NewWindow(nil)
defer w.Close()
Expand Down Expand Up @@ -248,8 +243,7 @@ func TestAppTabs_Layout(t *testing.T) {
}

func TestAppTabs_SetTabLocation(t *testing.T) {
test.NewApp()
defer test.NewApp()
test.NewTempApp(t)

item1 := &container.TabItem{Text: "Test1", Content: widget.NewLabel("Text 1")}
item2 := &container.TabItem{Text: "Test2", Content: widget.NewLabel("Text 2")}
Expand Down Expand Up @@ -281,8 +275,7 @@ func TestAppTabs_SetTabLocation(t *testing.T) {
}

func TestAppTabs_Tapped(t *testing.T) {
test.NewApp()
defer test.NewApp()
test.NewTempApp(t)

item1 := &container.TabItem{Text: "Test1", Content: widget.NewLabel("Text 1")}
item2 := &container.TabItem{Text: "Test2", Content: widget.NewLabel("Text 2")}
Expand Down
6 changes: 2 additions & 4 deletions container/apptabs_mobile_flakey_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@ import (
)

func TestAppTabs_ApplyTheme(t *testing.T) {
test.NewApp()
defer test.NewApp()
test.NewTempApp(t)

w := test.NewWindow(
container.NewAppTabs(&container.TabItem{Text: "Test", Content: widget.NewLabel("Text")}),
Expand All @@ -30,8 +29,7 @@ func TestAppTabs_ApplyTheme(t *testing.T) {
}

func TestAppTabs_ChangeItemContent(t *testing.T) {
test.NewApp()
defer test.NewApp()
test.NewTempApp(t)

item1 := &container.TabItem{Text: "Test1", Content: widget.NewLabel("Text1")}
item2 := &container.TabItem{Text: "Test2", Content: widget.NewLabel("Text2")}
Expand Down
21 changes: 7 additions & 14 deletions container/apptabs_mobile_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@ import (
)

func TestAppTabs_ChangeItemIcon(t *testing.T) {
test.NewApp()
defer test.NewApp()
test.NewTempApp(t)

item1 := &container.TabItem{Icon: theme.CancelIcon(), Content: widget.NewLabel("Text1")}
item2 := &container.TabItem{Icon: theme.ConfirmIcon(), Content: widget.NewLabel("Text2")}
Expand All @@ -42,8 +41,7 @@ func TestAppTabs_ChangeItemIcon(t *testing.T) {
}

func TestAppTabs_ChangeItemText(t *testing.T) {
test.NewApp()
defer test.NewApp()
test.NewTempApp(t)

item1 := &container.TabItem{Text: "Test1", Content: widget.NewLabel("Text1")}
item2 := &container.TabItem{Text: "Test2", Content: widget.NewLabel("Text2")}
Expand All @@ -66,8 +64,7 @@ func TestAppTabs_ChangeItemText(t *testing.T) {
}

func TestAppTabs_DynamicTabs(t *testing.T) {
test.NewApp()
defer test.NewApp()
test.NewTempApp(t)

item1 := &container.TabItem{Text: "Test1", Content: widget.NewLabel("Text 1")}
tabs := container.NewAppTabs(item1)
Expand Down Expand Up @@ -118,8 +115,7 @@ func TestAppTabs_DynamicTabs(t *testing.T) {
}

func TestAppTabs_HoverButtons(t *testing.T) {
test.NewApp()
defer test.NewApp()
test.NewTempApp(t)
test.ApplyTheme(t, internalTest.LightTheme(theme.DefaultTheme()))

item1 := &container.TabItem{Text: "Test1", Content: widget.NewLabel("Text1")}
Expand All @@ -144,8 +140,7 @@ func TestAppTabs_HoverButtons(t *testing.T) {
}

func TestAppTabs_Layout(t *testing.T) {
test.NewApp()
defer test.NewApp()
test.NewTempApp(t)

w := test.NewWindow(nil)
defer w.Close()
Expand Down Expand Up @@ -244,8 +239,7 @@ func TestAppTabs_Layout(t *testing.T) {
}

func TestAppTabs_SetTabLocation(t *testing.T) {
test.NewApp()
defer test.NewApp()
test.NewTempApp(t)

item1 := &container.TabItem{Text: "Test1", Content: widget.NewLabel("Text 1")}
item2 := &container.TabItem{Text: "Test2", Content: widget.NewLabel("Text 2")}
Expand Down Expand Up @@ -277,8 +271,7 @@ func TestAppTabs_SetTabLocation(t *testing.T) {
}

func TestAppTabs_Tapped(t *testing.T) {
test.NewApp()
defer test.NewApp()
test.NewTempApp(t)

item1 := &container.TabItem{Text: "Test1", Content: widget.NewLabel("Text 1")}
item2 := &container.TabItem{Text: "Test2", Content: widget.NewLabel("Text 2")}
Expand Down
27 changes: 9 additions & 18 deletions container/doctabs_desktop_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@ import (
)

func TestDocTabs_ApplyTheme(t *testing.T) {
test.NewApp()
defer test.NewApp()
test.NewTempApp(t)

w := test.NewWindow(
container.NewDocTabs(&container.TabItem{Text: "Test", Content: widget.NewLabel("Text")}),
Expand All @@ -35,8 +34,7 @@ func TestDocTabs_ApplyTheme(t *testing.T) {
}

func TestDocTabs_ChangeItemContent(t *testing.T) {
test.NewApp()
defer test.NewApp()
test.NewTempApp(t)

item1 := &container.TabItem{Text: "Test1", Content: widget.NewLabel("Text1")}
item2 := &container.TabItem{Text: "Test2", Content: widget.NewLabel("Text2")}
Expand All @@ -59,8 +57,7 @@ func TestDocTabs_ChangeItemContent(t *testing.T) {
}

func TestDocTabs_ChangeItemIcon(t *testing.T) {
test.NewApp()
defer test.NewApp()
test.NewTempApp(t)

item1 := &container.TabItem{Icon: theme.CancelIcon(), Content: widget.NewLabel("Text1")}
item2 := &container.TabItem{Icon: theme.ConfirmIcon(), Content: widget.NewLabel("Text2")}
Expand All @@ -83,8 +80,7 @@ func TestDocTabs_ChangeItemIcon(t *testing.T) {
}

func TestDocTabs_ChangeItemText(t *testing.T) {
test.NewApp()
defer test.NewApp()
test.NewTempApp(t)

item1 := &container.TabItem{Text: "Test1", Content: widget.NewLabel("Text1")}
item2 := &container.TabItem{Text: "Test2", Content: widget.NewLabel("Text2")}
Expand Down Expand Up @@ -113,8 +109,7 @@ func TestDocTabs_ChangeItemText(t *testing.T) {
}

func TestDocTabs_DynamicTabs(t *testing.T) {
test.NewApp()
defer test.NewApp()
test.NewTempApp(t)

item1 := &container.TabItem{Text: "Test1", Content: widget.NewLabel("Text 1")}
tabs := container.NewDocTabs(item1)
Expand Down Expand Up @@ -165,8 +160,7 @@ func TestDocTabs_DynamicTabs(t *testing.T) {
}

func TestDocTabs_HoverButtons(t *testing.T) {
test.NewApp()
defer test.NewApp()
test.NewTempApp(t)

item1 := &container.TabItem{Text: "Test1", Content: widget.NewLabel("Text1")}
item2 := &container.TabItem{Text: "Test2", Content: widget.NewLabel("Text2")}
Expand Down Expand Up @@ -202,8 +196,7 @@ func TestDocTabs_HoverButtons(t *testing.T) {
}

func TestDocTabs_Layout(t *testing.T) {
test.NewApp()
defer test.NewApp()
test.NewTempApp(t)

w := test.NewWindow(nil)
defer w.Close()
Expand Down Expand Up @@ -302,8 +295,7 @@ func TestDocTabs_Layout(t *testing.T) {
}

func TestDocTabs_SetTabLocation(t *testing.T) {
test.NewApp()
defer test.NewApp()
test.NewTempApp(t)

item1 := &container.TabItem{Text: "Test1", Content: widget.NewLabel("Text 1")}
item2 := &container.TabItem{Text: "Test2", Content: widget.NewLabel("Text 2")}
Expand Down Expand Up @@ -335,8 +327,7 @@ func TestDocTabs_SetTabLocation(t *testing.T) {
}

func TestDocTabs_Tapped(t *testing.T) {
test.NewApp()
defer test.NewApp()
test.NewTempApp(t)

item1 := &container.TabItem{Text: "Test1", Content: widget.NewLabel("Text 1")}
item2 := &container.TabItem{Text: "Test2", Content: widget.NewLabel("Text 2")}
Expand Down
27 changes: 9 additions & 18 deletions container/doctabs_mobile_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@ import (
)

func TestDocTabs_ApplyTheme(t *testing.T) {
test.NewApp()
defer test.NewApp()
test.NewTempApp(t)

w := test.NewWindow(
container.NewDocTabs(&container.TabItem{Text: "Test", Content: widget.NewLabel("Text")}),
Expand All @@ -36,8 +35,7 @@ func TestDocTabs_ApplyTheme(t *testing.T) {
}

func TestDocTabs_ChangeItemContent(t *testing.T) {
test.NewApp()
defer test.NewApp()
test.NewTempApp(t)

item1 := &container.TabItem{Text: "Test1", Content: widget.NewLabel("Text1")}
item2 := &container.TabItem{Text: "Test2", Content: widget.NewLabel("Text2")}
Expand All @@ -60,8 +58,7 @@ func TestDocTabs_ChangeItemContent(t *testing.T) {
}

func TestDocTabs_ChangeItemIcon(t *testing.T) {
test.NewApp()
defer test.NewApp()
test.NewTempApp(t)

item1 := &container.TabItem{Icon: theme.CancelIcon(), Content: widget.NewLabel("Text1")}
item2 := &container.TabItem{Icon: theme.ConfirmIcon(), Content: widget.NewLabel("Text2")}
Expand All @@ -84,8 +81,7 @@ func TestDocTabs_ChangeItemIcon(t *testing.T) {
}

func TestDocTabs_ChangeItemText(t *testing.T) {
test.NewApp()
defer test.NewApp()
test.NewTempApp(t)

item1 := &container.TabItem{Text: "Test1", Content: widget.NewLabel("Text1")}
item2 := &container.TabItem{Text: "Test2", Content: widget.NewLabel("Text2")}
Expand All @@ -108,8 +104,7 @@ func TestDocTabs_ChangeItemText(t *testing.T) {
}

func TestDocTabs_DynamicTabs(t *testing.T) {
test.NewApp()
defer test.NewApp()
test.NewTempApp(t)

item1 := &container.TabItem{Text: "Test1", Content: widget.NewLabel("Text 1")}
tabs := container.NewDocTabs(item1)
Expand Down Expand Up @@ -160,8 +155,7 @@ func TestDocTabs_DynamicTabs(t *testing.T) {
}

func TestDocTabs_HoverButtons(t *testing.T) {
test.NewApp()
defer test.NewApp()
test.NewTempApp(t)
test.ApplyTheme(t, internalTest.LightTheme(theme.DefaultTheme()))

item1 := &container.TabItem{Text: "Test1", Content: widget.NewLabel("Text1")}
Expand Down Expand Up @@ -195,8 +189,7 @@ func TestDocTabs_HoverButtons(t *testing.T) {
}

func TestDocTabs_Layout(t *testing.T) {
test.NewApp()
defer test.NewApp()
test.NewTempApp(t)

w := test.NewWindow(nil)
defer w.Close()
Expand Down Expand Up @@ -296,8 +289,7 @@ func TestDocTabs_Layout(t *testing.T) {
}

func TestDocTabs_SetTabLocation(t *testing.T) {
test.NewApp()
defer test.NewApp()
test.NewTempApp(t)

item1 := &container.TabItem{Text: "Test1", Content: widget.NewLabel("Text 1")}
item2 := &container.TabItem{Text: "Test2", Content: widget.NewLabel("Text 2")}
Expand Down Expand Up @@ -329,8 +321,7 @@ func TestDocTabs_SetTabLocation(t *testing.T) {
}

func TestDocTabs_Tapped(t *testing.T) {
test.NewApp()
defer test.NewApp()
test.NewTempApp(t)

item1 := &container.TabItem{Text: "Test1", Content: widget.NewLabel("Text 1")}
item2 := &container.TabItem{Text: "Test2", Content: widget.NewLabel("Text 2")}
Expand Down
3 changes: 1 addition & 2 deletions container/tabs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,7 @@ func TestTabButton_Icon_Change(t *testing.T) {
}

func TestTab_ThemeChange(t *testing.T) {
a := test.NewApp()
defer test.NewApp()
a := test.NewTempApp(t)
a.Settings().SetTheme(internalTest.LightTheme(theme.DefaultTheme()))

tabs := NewAppTabs(
Expand Down
3 changes: 1 addition & 2 deletions dialog/color_button_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@ import (
)

func Test_colorButton_Layout(t *testing.T) {
test.NewApp()
defer test.NewApp()
test.NewTempApp(t)

for name, tt := range map[string]struct {
color color.Color
Expand Down
Loading

0 comments on commit 759df6f

Please sign in to comment.