From 16f1fa7430b401083bea9f579481387640d36fdd Mon Sep 17 00:00:00 2001 From: Andy Williams Date: Tue, 19 Mar 2019 10:33:10 +0000 Subject: [PATCH] Fix color of tab underline when theme changes --- widget/tabcontainer.go | 2 +- widget/tabcontainer_test.go | 12 ++++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/widget/tabcontainer.go b/widget/tabcontainer.go index 4acf148424..54c02d74cf 100644 --- a/widget/tabcontainer.go +++ b/widget/tabcontainer.go @@ -172,7 +172,7 @@ func (t *tabContainerRenderer) Layout(size fyne.Size) { } func (t *tabContainerRenderer) ApplyTheme() { - t.line.StrokeColor = theme.ButtonColor() + t.line.FillColor = theme.ButtonColor() } func (t *tabContainerRenderer) BackgroundColor() color.Color { diff --git a/widget/tabcontainer_test.go b/widget/tabcontainer_test.go index 3fbd43edae..7e503ee98e 100644 --- a/widget/tabcontainer_test.go +++ b/widget/tabcontainer_test.go @@ -3,6 +3,8 @@ package widget import ( "testing" + "fyne.io/fyne" + "fyne.io/fyne/theme" "github.com/stretchr/testify/assert" ) @@ -44,3 +46,13 @@ func TestTabContainer_SelectTabIndex(t *testing.T) { tabs.SelectTabIndex(1) assert.Equal(t, 1, tabs.CurrentTabIndex()) } + +func TestTabContainer_ApplyTheme(t *testing.T) { + tabs := NewTabContainer(&TabItem{Text: "Test1", Content: NewLabel("Test1")}) + underline := Renderer(tabs).(*tabContainerRenderer).line + barColor := underline.FillColor + + fyne.CurrentApp().Settings().SetTheme(theme.LightTheme()) + Renderer(tabs).ApplyTheme() + assert.NotEqual(t, barColor, underline.FillColor) +}