mirror of
https://github.com/yattee/yattee.git
synced 2026-10-31 08:57:17 +00:00
Default the built-in presets to the corner layout
The built-in presets now use the corner layout, which still falls back to stacked where it doesn't fit (iPhone, iPad portrait, narrow windows). In the corner layout the landscape panels open visible unless the preset says otherwise, on devices that can show it: iPad, macOS, and foldable iPhones, whose hinge is now remembered once reported. Custom presets and presets saved without panel settings keep the stacked layout.
This commit is contained in:
@@ -323,4 +323,27 @@ struct PanelSettingsTests {
|
||||
#expect(settings.belowVideoContent == .nothing)
|
||||
#expect(settings.effectiveRegion(for: .comments) == .primary)
|
||||
}
|
||||
|
||||
@Test("Built-in presets default to the corner layout; legacy presets keep stacked")
|
||||
func builtInPresetsUseCornerLayout() {
|
||||
#expect(PanelSettings.builtInDefault.effectiveLayoutMode == .corner)
|
||||
#expect(PanelSettings.builtInDefault.pages == PanelSettings.default.pages)
|
||||
#expect(PanelSettings.default.effectiveLayoutMode == .stacked)
|
||||
for preset in LayoutPreset.allBuiltIn() {
|
||||
#expect(preset.layout.effectivePanelSettings.effectiveLayoutMode == .corner)
|
||||
}
|
||||
}
|
||||
|
||||
@Test("Landscape opens visible only in the corner layout on corner-capable devices")
|
||||
func cornerLandscapeDefaultVisibility() {
|
||||
let corner = PanelSettings.builtInDefault
|
||||
let expected: PanelDefaultVisibility = PanelSettings.canHostCornerLayout ? .visible : .hidden
|
||||
#expect(corner.effectiveDefaultVisibility(for: .landscape) == expected)
|
||||
#expect(corner.effectiveDefaultVisibility(for: .portrait) == .visible)
|
||||
#expect(PanelSettings.default.effectiveDefaultVisibility(for: .landscape) == .hidden)
|
||||
|
||||
var explicit = corner
|
||||
explicit.landscapeDefaultVisibility = .hidden
|
||||
#expect(explicit.effectiveDefaultVisibility(for: .landscape) == .hidden)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user