-
-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #93 from fyne-io/feature/moduleconfig
Feature/moduleconfig
- Loading branch information
Showing
13 changed files
with
244 additions
and
104 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
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,72 @@ | ||
package ui | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/stretchr/testify/assert" | ||
|
||
"fyne.io/fynedesk" | ||
) | ||
|
||
func TestDeskSettings_IsModuleEnabled(t *testing.T) { | ||
s := &testSettings{moduleNames: []string{"Yes", "maybe"}} | ||
|
||
assert.True(t, isModuleEnabled("Yes", s)) | ||
assert.True(t, isModuleEnabled("maybe", s)) | ||
assert.False(t, isModuleEnabled("Maybe", s)) | ||
assert.False(t, isModuleEnabled("No", s)) | ||
} | ||
|
||
type testSettings struct { | ||
background string | ||
iconTheme string | ||
launcherIcons []string | ||
launcherIconSize int | ||
launcherZoomScale float64 | ||
launcherDisableZoom bool | ||
launcherDisableTaskbar bool | ||
|
||
moduleNames []string | ||
} | ||
|
||
func (ts *testSettings) IconTheme() string { | ||
return ts.iconTheme | ||
} | ||
|
||
func (ts *testSettings) Background() string { | ||
return ts.background | ||
} | ||
|
||
func (ts *testSettings) LauncherIcons() []string { | ||
return ts.launcherIcons | ||
} | ||
|
||
func (ts *testSettings) LauncherIconSize() int { | ||
if ts.launcherIconSize == 0 { | ||
return 32 | ||
} | ||
return ts.launcherIconSize | ||
} | ||
|
||
func (ts *testSettings) LauncherDisableTaskbar() bool { | ||
return ts.launcherDisableTaskbar | ||
} | ||
|
||
func (ts *testSettings) LauncherDisableZoom() bool { | ||
return ts.launcherDisableZoom | ||
} | ||
|
||
func (ts *testSettings) LauncherZoomScale() float64 { | ||
if ts.launcherZoomScale == 0 { | ||
return 1.0 | ||
} | ||
return ts.launcherZoomScale | ||
} | ||
|
||
func (ts *testSettings) ModuleNames() []string { | ||
return ts.moduleNames | ||
} | ||
|
||
func (*testSettings) AddChangeListener(listener chan fynedesk.DeskSettings) { | ||
return | ||
} |
Oops, something went wrong.