fix: window minimum, stock spacing layout, sidebar width floor
Part A stages 1-3 of the GUI layout cleanup plan: - Stage 1 (F1-F3): delete settingsControlWidth's redundant wrapper (the Border centre slot already stretches controls), truncate the config path label, and name the default window size so it can be asserted against. Settings no longer widens the window past what it asks for. - Stage 2 (F4-F5): drop compactVBoxLayout for the stock layout.NewCustomPaddedVBoxLayout and a single derived rowOverlap() spacing, replacing three hand-tuned spacing constants. - Stage 3 (F7): delete the inert 400px sidebar width floor; the Border left slot already renders it at content MinSize. See docs/PLAN-gui-layout.md.
This commit is contained in:
@@ -45,6 +45,30 @@ func newTestService(t *testing.T) *app.Service {
|
||||
return app.NewService(newTestStore(t), nil)
|
||||
}
|
||||
|
||||
// TestMainViewFitsTheDefaultWindowSize is the regression guard for F1: the
|
||||
// assembled content must fit within the window size the app asks for, so Fyne
|
||||
// never silently widens the window past it. The store's ConfigPath is
|
||||
// deliberately long so the test also covers F3 — the config path label must
|
||||
// not grow the Settings tab's minimum width with it.
|
||||
func TestMainViewFitsTheDefaultWindowSize(t *testing.T) {
|
||||
testApp := test.NewApp()
|
||||
defer testApp.Quit()
|
||||
|
||||
w := testApp.NewWindow("test")
|
||||
defer w.Close()
|
||||
|
||||
store := newTestStore(t)
|
||||
store.Paths.ConfigPath = filepath.Join(t.TempDir(), "a-deliberately-long-directory-name-to-stress-the-config-path-label", "gosentry.json")
|
||||
svc := app.NewService(store, nil)
|
||||
defer svc.Stop()
|
||||
|
||||
content, _ := newMainView(w, svc)
|
||||
min := content.MinSize()
|
||||
if min.Width > defaultWindowWidth || min.Height > defaultWindowHeight {
|
||||
t.Errorf("content.MinSize() = %v, want within %vx%v", min, defaultWindowWidth, defaultWindowHeight)
|
||||
}
|
||||
}
|
||||
|
||||
func TestMainViewBuilds(t *testing.T) {
|
||||
testApp := test.NewApp()
|
||||
defer testApp.Quit()
|
||||
|
||||
Reference in New Issue
Block a user