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:
@@ -3,6 +3,9 @@ package ui
|
||||
import (
|
||||
"path/filepath"
|
||||
"testing"
|
||||
|
||||
"fyne.io/fyne/v2"
|
||||
"fyne.io/fyne/v2/widget"
|
||||
)
|
||||
|
||||
// TestSettingsFolderPath covers the path the "Open" button beside the logs
|
||||
@@ -33,3 +36,24 @@ func TestSettingsFolderPath(t *testing.T) {
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
// TestSettingsRowStretchesItsControl is the property that makes F2's removal
|
||||
// of settingsControlWidth invisible: settingsRow puts the value in a Border
|
||||
// centre slot, which already stretches it to the column width on its own, so
|
||||
// wrapping it in a fixed-width layout was redundant.
|
||||
func TestSettingsRowStretchesItsControl(t *testing.T) {
|
||||
entry := widget.NewEntry()
|
||||
row := settingsRow("Label", entry)
|
||||
|
||||
baseWidth := entry.Size().Width
|
||||
wide := fyne.NewSize(row.MinSize().Width+200, row.MinSize().Height)
|
||||
row.Resize(wide)
|
||||
|
||||
// Only the caption column and one inter-column padding come out of the
|
||||
// extra width; the rest must reach the control. Requiring most of the
|
||||
// 200px growth to show up on the entry is what a reinstated fixed-width
|
||||
// wrapper around it would break.
|
||||
if got := entry.Size().Width; got < baseWidth+150 {
|
||||
t.Errorf("control did not stretch to fill the row: entry width = %v, want at least %v", got, baseWidth+150)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user