diff options
| author | Lukasz Kasprzak <lukas@labunix.xyz> | 2026-09-17 14:16:19 +0200 |
|---|---|---|
| committer | Lukasz Kasprzak <lukas@labunix.xyz> | 2026-09-17 14:16:19 +0200 |
| commit | f74a02254ac15a84d38c9a254ead293ebaad2377 (patch) | |
| tree | a5e4139e91aa2afea5769dff856d887cda735a83 /gui/internal/model/prefs_test.go | |
| parent | 6d28cf285f9944eb26c7ed0efcce558521b51cb9 (diff) | |
| download | krino-f74a02254ac15a84d38c9a254ead293ebaad2377.tar.gz krino-f74a02254ac15a84d38c9a254ead293ebaad2377.zip | |
Settings changes take effect, and keep this copy respects the plan
Five of the Settings window's controls - the sort order, the three
column toggles and the preview height - were read when it built its new
preferences but never connected to anything, so changing them did
nothing until some other control happened to fire, and then they all
landed at once out of nowhere. Every control is connected now.
The same closure composed a whole Prefs from its own widgets, which
wrote the remembered divider positions back as zeros: dragging the
panes to taste and then ticking any checkbox threw them away. A
settings change is now applied over the preferences as they are, by
model.Prefs.WithDisplay - which is where it can be tested, and is.
"Keep this copy, replace the other" wrote a Displaces straight into the
chain. internal/plan refuses to build two steps that displace one path,
because the second destroys what the first put there; the window went
round that code, so choosing it for two duplicates of one file left
both rows saying "done" with the first file in the Trash. It now
refuses the second, naming the file that has the place.
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) + } +} |
