diff options
Diffstat (limited to 'gui/internal/model/prefs_test.go')
| -rw-r--r-- | gui/internal/model/prefs_test.go | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/gui/internal/model/prefs_test.go b/gui/internal/model/prefs_test.go index 328ac31..69cc678 100644 --- a/gui/internal/model/prefs_test.go +++ b/gui/internal/model/prefs_test.go @@ -57,3 +57,30 @@ func TestPrefsWithoutAFile(t *testing.T) { t.Errorf("with damaged text: %+v, want the defaults", got) } } + +// TestWithDisplayKeepsTheDividers: the Settings window used to compose a +// whole Prefs from its own controls, which wrote the remembered pane +// positions back as zeros - so dragging the dividers and then ticking any +// checkbox in Settings threw the positions away and the next window opened +// at the defaults. +func TestWithDisplayKeepsTheDividers(t *testing.T) { + p := Prefs{ + PreviewWidth: 640, ListWidth: 800, ListHeight: 300, PreviewHeight: 281, + Sort: SortName, ShowSize: true, ShowAge: true, ShowRule: true, + Colours: true, Preview: true, SelectAll: true, Layout: LayoutSide, + } + d := p.DisplayOf() + d.ShowRule = false + d.Sort = SortSize + got := p.WithDisplay(d) + + if got.PreviewWidth != 640 || got.ListWidth != 800 || got.ListHeight != 300 { + t.Errorf("the dividers were disturbed: %+v", got) + } + if got.ShowRule || got.Sort != SortSize { + t.Errorf("the change did not take: %+v", got) + } + if !got.ShowSize || !got.ShowAge || !got.Colours || !got.Preview || !got.SelectAll { + t.Errorf("something else changed: %+v", got) + } +} |
