* test: add background-prime visibility regression * fix: hide background-primed workspaces from portals
79 lines
2.3 KiB
Swift
79 lines
2.3 KiB
Swift
import XCTest
|
|
|
|
#if canImport(cmux_DEV)
|
|
@testable import cmux_DEV
|
|
#elseif canImport(cmux)
|
|
@testable import cmux
|
|
#endif
|
|
|
|
final class WorkspaceContentViewVisibilityTests: XCTestCase {
|
|
func testBackgroundPrimedWorkspaceStaysMountedButNotPanelVisible() {
|
|
XCTAssertEqual(
|
|
MountedWorkspacePresentationPolicy.resolve(
|
|
isSelectedWorkspace: false,
|
|
isRetiringWorkspace: false,
|
|
shouldPrimeInBackground: true
|
|
),
|
|
MountedWorkspacePresentation(
|
|
isRenderedVisible: false,
|
|
isPanelVisible: false,
|
|
renderOpacity: 0.001
|
|
)
|
|
)
|
|
}
|
|
|
|
func testRetiringWorkspaceStaysPanelVisibleDuringHandoff() {
|
|
XCTAssertEqual(
|
|
MountedWorkspacePresentationPolicy.resolve(
|
|
isSelectedWorkspace: false,
|
|
isRetiringWorkspace: true,
|
|
shouldPrimeInBackground: false
|
|
),
|
|
MountedWorkspacePresentation(
|
|
isRenderedVisible: true,
|
|
isPanelVisible: true,
|
|
renderOpacity: 1
|
|
)
|
|
)
|
|
}
|
|
|
|
func testPanelVisibleInUIReturnsFalseWhenWorkspaceHidden() {
|
|
XCTAssertFalse(
|
|
WorkspaceContentView.panelVisibleInUI(
|
|
isWorkspaceVisible: false,
|
|
isSelectedInPane: true,
|
|
isFocused: true
|
|
)
|
|
)
|
|
}
|
|
|
|
func testPanelVisibleInUIReturnsTrueForSelectedPanel() {
|
|
XCTAssertTrue(
|
|
WorkspaceContentView.panelVisibleInUI(
|
|
isWorkspaceVisible: true,
|
|
isSelectedInPane: true,
|
|
isFocused: false
|
|
)
|
|
)
|
|
}
|
|
|
|
func testPanelVisibleInUIReturnsTrueForFocusedPanelDuringTransientSelectionGap() {
|
|
XCTAssertTrue(
|
|
WorkspaceContentView.panelVisibleInUI(
|
|
isWorkspaceVisible: true,
|
|
isSelectedInPane: false,
|
|
isFocused: true
|
|
)
|
|
)
|
|
}
|
|
|
|
func testPanelVisibleInUIReturnsFalseWhenNeitherSelectedNorFocused() {
|
|
XCTAssertFalse(
|
|
WorkspaceContentView.panelVisibleInUI(
|
|
isWorkspaceVisible: true,
|
|
isSelectedInPane: false,
|
|
isFocused: false
|
|
)
|
|
)
|
|
}
|
|
}
|