adds nice git interface
This commit is contained in:
@@ -4,7 +4,7 @@ import Testing
|
||||
@Suite struct ColumnLayoutTests {
|
||||
@Test func roomyWindowUsesTheDesignRatios() {
|
||||
let w = ColumnLayout.fluid(windowWidth: 1760, focus: .terminal)
|
||||
#expect(w == ColumnWidths(sourceControl: 236, explorer: 289, agent: 480))
|
||||
#expect(w == ColumnWidths(explorer: 289, agent: 480))
|
||||
}
|
||||
|
||||
@Test func tightWindowFollowsFocus() {
|
||||
@@ -13,52 +13,45 @@ import Testing
|
||||
}
|
||||
|
||||
@Test func fittingKeepsTheEditorMinimum() {
|
||||
let fitted = ColumnLayout.fitted(ColumnWidths(sourceControl: 400, explorer: 400, agent: 400), windowWidth: 1000, visible: .all)
|
||||
#expect(fitted.sourceControl + fitted.explorer + fitted.agent <= 1000 - 3 - ColumnLayout.minEditorWidth)
|
||||
}
|
||||
|
||||
@Test func aHiddenColumnIsNeitherCountedNorScaled() {
|
||||
let widths = ColumnWidths(sourceControl: 400, explorer: 400, agent: 400)
|
||||
let visible = ColumnVisibility(sourceControl: false)
|
||||
let fitted = ColumnLayout.fitted(widths, windowWidth: 1000, visible: visible)
|
||||
#expect(fitted.sourceControl == 400)
|
||||
let fitted = ColumnLayout.fitted(ColumnWidths(explorer: 400, agent: 600), windowWidth: 1000, visible: .all)
|
||||
#expect(fitted.explorer + fitted.agent <= 1000 - 2 - ColumnLayout.minEditorWidth)
|
||||
}
|
||||
|
||||
@Test func withTheEditorHiddenTheAgentIsTheFlexColumn() {
|
||||
let widths = ColumnWidths(sourceControl: 400, explorer: 400, agent: 900)
|
||||
let fitted = ColumnLayout.fitted(widths, windowWidth: 1000, visible: ColumnVisibility(editor: false))
|
||||
#expect(fitted.agent == 900)
|
||||
#expect(fitted.sourceControl + fitted.explorer <= 1000 - 2 - ColumnLayout.minEditorWidth)
|
||||
}
|
||||
|
||||
@Test func withoutAFlexColumnTheFixedOnesOnlyHaveToFitTheWindow() {
|
||||
let widths = ColumnWidths(sourceControl: 300, explorer: 300, agent: 480)
|
||||
let visible = ColumnVisibility(editor: false, agent: false)
|
||||
#expect(ColumnLayout.fitted(widths, windowWidth: 1000, visible: visible) == widths)
|
||||
let narrow = ColumnLayout.fitted(widths, windowWidth: 501, visible: visible)
|
||||
#expect(narrow.sourceControl + narrow.explorer <= 500)
|
||||
#expect(narrow.agent == 480)
|
||||
}
|
||||
|
||||
@Test func fittingWithOnlyTheAgentBesideTheEditor() {
|
||||
let widths = ColumnWidths(sourceControl: 300, explorer: 300, agent: 900)
|
||||
let fitted = ColumnLayout.fitted(widths, windowWidth: 1000, visible: ColumnVisibility(sourceControl: false, explorer: false))
|
||||
#expect(fitted.sourceControl == 300)
|
||||
@Test func aHiddenColumnIsNeitherCountedNorScaled() {
|
||||
let widths = ColumnWidths(explorer: 400, agent: 900)
|
||||
let visible = ColumnVisibility(explorer: false)
|
||||
let fitted = ColumnLayout.fitted(widths, windowWidth: 1000, visible: visible)
|
||||
#expect(fitted.explorer == 400)
|
||||
#expect(fitted.agent <= 1000 - 1 - ColumnLayout.minEditorWidth)
|
||||
#expect(fitted.agent >= 1000 - 2 - ColumnLayout.minEditorWidth)
|
||||
}
|
||||
|
||||
@Test func withTheEditorHiddenTheAgentIsTheFlexColumn() {
|
||||
let widths = ColumnWidths(explorer: 900, agent: 900)
|
||||
let fitted = ColumnLayout.fitted(widths, windowWidth: 1000, visible: ColumnVisibility(editor: false))
|
||||
#expect(fitted.agent == 900)
|
||||
#expect(fitted.explorer <= 1000 - 1 - ColumnLayout.minEditorWidth)
|
||||
}
|
||||
|
||||
@Test func withoutAFlexColumnTheFixedOnesOnlyHaveToFitTheWindow() {
|
||||
let widths = ColumnWidths(explorer: 400, agent: 480)
|
||||
let visible = ColumnVisibility(editor: false, agent: false)
|
||||
#expect(ColumnLayout.fitted(widths, windowWidth: 1000, visible: visible) == widths)
|
||||
let narrow = ColumnLayout.fitted(widths, windowWidth: 300, visible: visible)
|
||||
#expect(narrow.explorer <= 300)
|
||||
#expect(narrow.agent == 480)
|
||||
}
|
||||
|
||||
@Test func splittersSitOnlyBetweenVisibleColumns() {
|
||||
#expect(ColumnVisibility.all.splitterCount == 3)
|
||||
#expect(ColumnVisibility(sourceControl: false, editor: false).splitterCount == 1)
|
||||
#expect(ColumnVisibility(sourceControl: false, explorer: false, editor: false, agent: false).splitterCount == 0)
|
||||
#expect(ColumnVisibility.all.splitterCount == 2)
|
||||
#expect(ColumnVisibility(editor: false).splitterCount == 1)
|
||||
#expect(ColumnVisibility(explorer: false, editor: false, agent: false).splitterCount == 0)
|
||||
}
|
||||
|
||||
@Test func theAgentLimitCountsOnlyVisibleColumns() {
|
||||
let widths = ColumnWidths(sourceControl: 300, explorer: 300, agent: 480)
|
||||
#expect(ColumnLayout.maxAgentWidth(windowWidth: 1600, widths: widths, visible: .all) == 1600 - 3 - 600 - ColumnLayout.minEditorWidth)
|
||||
let widths = ColumnWidths(explorer: 300, agent: 480)
|
||||
#expect(ColumnLayout.maxAgentWidth(windowWidth: 1600, widths: widths, visible: .all) == 1600 - 2 - 300 - ColumnLayout.minEditorWidth)
|
||||
#expect(ColumnLayout.maxAgentWidth(windowWidth: 1600, widths: widths, visible: ColumnVisibility(explorer: false))
|
||||
== 1600 - 2 - 300 - ColumnLayout.minEditorWidth)
|
||||
== 1600 - 1 - ColumnLayout.minEditorWidth)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user