Skip to content

A native macOS / windows / Linux database IDE built with Swift and AppKit. Connect to PostgreSQL, MySQL, SQLite, and Redis from a single app with a fast, keyboard-driven interface.

C++

test(tabs): cover selection hit area

Tobi485521571492
diff --git a/macos/Tests/GridexTests/TabNavigationTests.swift b/macos/Tests/GridexTests/TabNavigationTests.swift
index f848393..3e2702c 100644
--- a/macos/Tests/GridexTests/TabNavigationTests.swift
+++ b/macos/Tests/GridexTests/TabNavigationTests.swift
@@ -65,6 +65,17 @@ final class TabNavigationTests: XCTestCase {
XCTAssertEqual(state.activeTabId, only)
}
+ func test_tabHitAreas_routeVisiblePaddingToSelectionWithoutIncludingCloseControl() {
+ let hitAreas = TabItemView.hitAreas(
+ in: NSRect(x: 0, y: 0, width: 160, height: 38),
+ closeFrame: NSRect(x: 130, y: 0, width: 20, height: 38)
+ )
+
+ XCTAssertEqual(hitAreas.target(at: NSPoint(x: 4, y: 19)), .selection)
+ XCTAssertEqual(hitAreas.target(at: NSPoint(x: 124, y: 19)), .selection)
+ XCTAssertEqual(hitAreas.target(at: NSPoint(x: 140, y: 19)), .close)
+ }
+
private func makeTwoTabState() -> (AppState, UUID, UUID) {
let state = AppState()
state.openTable(name: "first", schema: nil)