Split app UI layout packages
This commit is contained in:
+19
-18
@@ -25,7 +25,8 @@ import (
|
||||
"git.julianfamily.org/keepassgo/internal/apiaudit"
|
||||
"git.julianfamily.org/keepassgo/internal/apitokens"
|
||||
"git.julianfamily.org/keepassgo/internal/appstate"
|
||||
appuilayout "git.julianfamily.org/keepassgo/internal/appui/layout"
|
||||
headerlayout "git.julianfamily.org/keepassgo/internal/appui/layout/header"
|
||||
listlayout "git.julianfamily.org/keepassgo/internal/appui/layout/list"
|
||||
"git.julianfamily.org/keepassgo/internal/clipboard"
|
||||
"git.julianfamily.org/keepassgo/internal/passwords"
|
||||
"git.julianfamily.org/keepassgo/internal/session"
|
||||
@@ -260,13 +261,13 @@ func TestUIListPanelTopSectionsMatchAcrossDesktopAndPhoneForEntries(t *testing.T
|
||||
phone := newUIWithModel("phone", vault.Model{})
|
||||
phone.state.Section = appstate.SectionEntries
|
||||
|
||||
want := []listPanelTopSection{
|
||||
listPanelTopSearch,
|
||||
listPanelTopNavigation,
|
||||
listPanelTopPath,
|
||||
listPanelTopGroup,
|
||||
listPanelTopGroupTools,
|
||||
listPanelTopPrimary,
|
||||
want := []listlayout.TopSection{
|
||||
listlayout.TopSearch,
|
||||
listlayout.TopNavigation,
|
||||
listlayout.TopPath,
|
||||
listlayout.TopGroup,
|
||||
listlayout.TopGroupTools,
|
||||
listlayout.TopPrimary,
|
||||
}
|
||||
if got := desktop.listPanelTopSections(); !slices.Equal(got, want) {
|
||||
t.Fatalf("desktop.listPanelTopSections() = %v, want %v", got, want)
|
||||
@@ -373,10 +374,10 @@ func TestUIHeaderMenusUseOverlayModelAcrossModes(t *testing.T) {
|
||||
func TestAnchoredMenuXAllowsWiderMenusToExtendLeft(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
if got := appuilayout.AnchoredMenuX(48, 160); got != -112 {
|
||||
if got := headerlayout.AnchoredMenuX(48, 160); got != -112 {
|
||||
t.Fatalf("anchoredMenuX(48, 160) = %d, want -112", got)
|
||||
}
|
||||
if got := appuilayout.AnchoredMenuX(160, 48); got != 112 {
|
||||
if got := headerlayout.AnchoredMenuX(160, 48); got != 112 {
|
||||
t.Fatalf("anchoredMenuX(160, 48) = %d, want 112", got)
|
||||
}
|
||||
}
|
||||
@@ -384,10 +385,10 @@ func TestAnchoredMenuXAllowsWiderMenusToExtendLeft(t *testing.T) {
|
||||
func TestAnchoredMenuOriginXClampsToVisibleContainer(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
if got := appuilayout.AnchoredMenuOriginX(360, 312, 360, 140); got != 220 {
|
||||
if got := headerlayout.AnchoredMenuOriginX(360, 312, 360, 140); got != 220 {
|
||||
t.Fatalf("anchoredMenuOriginX should keep a right-aligned menu visible, got %d want 220", got)
|
||||
}
|
||||
if got := appuilayout.AnchoredMenuOriginX(360, 0, 44, 160); got != 0 {
|
||||
if got := headerlayout.AnchoredMenuOriginX(360, 0, 44, 160); got != 0 {
|
||||
t.Fatalf("anchoredMenuOriginX should clamp oversized left overflow to zero, got %d want 0", got)
|
||||
}
|
||||
}
|
||||
@@ -395,7 +396,7 @@ func TestAnchoredMenuOriginXClampsToVisibleContainer(t *testing.T) {
|
||||
func TestHeaderActionMetricsComputeTriggerAnchors(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
metrics := appuilayout.HeaderActionMetrics{
|
||||
metrics := headerlayout.ActionMetrics{
|
||||
RowOriginX: 24,
|
||||
Spacing: 8,
|
||||
RowDims: layout.Dimensions{Size: image.Pt(180, 40)},
|
||||
@@ -404,10 +405,10 @@ func TestHeaderActionMetricsComputeTriggerAnchors(t *testing.T) {
|
||||
MainDims: layout.Dimensions{Size: image.Pt(36, 40)},
|
||||
}
|
||||
|
||||
if got := metrics.SyncAnchor(); got != (appuilayout.DropdownAnchor{TriggerRightX: 76, TriggerBottomY: 40}) {
|
||||
if got := metrics.SyncAnchor(); got != (headerlayout.DropdownAnchor{TriggerRightX: 76, TriggerBottomY: 40}) {
|
||||
t.Fatalf("metrics.syncAnchor() = %+v, want right=76 bottom=40", got)
|
||||
}
|
||||
if got := metrics.MainAnchor(); got != (appuilayout.DropdownAnchor{TriggerRightX: 172, TriggerBottomY: 40}) {
|
||||
if got := metrics.MainAnchor(); got != (headerlayout.DropdownAnchor{TriggerRightX: 172, TriggerBottomY: 40}) {
|
||||
t.Fatalf("metrics.mainAnchor() = %+v, want right=172 bottom=40", got)
|
||||
}
|
||||
}
|
||||
@@ -415,14 +416,14 @@ func TestHeaderActionMetricsComputeTriggerAnchors(t *testing.T) {
|
||||
func TestDropdownSurfaceOriginKeepsMenusWithinVisibleArea(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
surface := appuilayout.DropdownSurface{ContainerWidth: 320, LeftInset: 16, TopInset: 16}
|
||||
anchor := appuilayout.DropdownAnchor{TriggerRightX: 300, TriggerBottomY: 42}
|
||||
surface := headerlayout.DropdownSurface{ContainerWidth: 320, LeftInset: 16, TopInset: 16}
|
||||
anchor := headerlayout.DropdownAnchor{TriggerRightX: 300, TriggerBottomY: 42}
|
||||
|
||||
if got := surface.Origin(anchor, 140); got != image.Pt(176, 58) {
|
||||
t.Fatalf("surface.origin(anchor, 140) = %v, want (176,58)", got)
|
||||
}
|
||||
|
||||
leftAnchor := appuilayout.DropdownAnchor{TriggerRightX: 36, TriggerBottomY: 42}
|
||||
leftAnchor := headerlayout.DropdownAnchor{TriggerRightX: 36, TriggerBottomY: 42}
|
||||
if got := surface.Origin(leftAnchor, 120); got != image.Pt(16, 58) {
|
||||
t.Fatalf("surface.origin(leftAnchor, 120) = %v, want (16,58)", got)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user