import CoreGraphics import Testing @testable import EquipoKit @Suite struct KeyboardTests { @Test func liftKeepsTheBottomDirectlyAboveTheKeyboard() { // A 874-point screen, the content's bottom above a floating tab bar. let bottom: CGFloat = 790 let keyboard = CGRect(x: 0, y: 538, width: 402, height: 336) #expect(KeyboardOverlap.lift(keyboard: keyboard, bottom: bottom) == 252) #expect(bottom - KeyboardOverlap.lift(keyboard: keyboard, bottom: bottom) == keyboard.minY) } @Test func aHiddenKeyboardLiftsNothing() { #expect(KeyboardOverlap.lift(keyboard: .null, bottom: 790) == 0) #expect(KeyboardOverlap.lift(keyboard: .zero, bottom: 790) == 0) // Hiding: the end frame is below the screen. #expect(KeyboardOverlap.lift(keyboard: CGRect(x: 0, y: 874, width: 402, height: 336), bottom: 790) == 0) // A region that ends above the keyboard is not lifted. #expect(KeyboardOverlap.lift(keyboard: CGRect(x: 0, y: 538, width: 402, height: 336), bottom: 500) == 0) } }