oficina / equipo Public

Clone
git clone https://amadan.net/oficina/equipo

Plain git — no account needed to clone.

Download

Download this file

1import CoreGraphics
2import Testing
3@testable import EquipoKit
4
5@Suite struct KeyboardTests {
6 @Test func liftKeepsTheBottomDirectlyAboveTheKeyboard() {
7 // A 874-point screen, the content's bottom above a floating tab bar.
8 let bottom: CGFloat = 790
9 let keyboard = CGRect(x: 0, y: 538, width: 402, height: 336)
10 #expect(KeyboardOverlap.lift(keyboard: keyboard, bottom: bottom) == 252)
11 #expect(bottom - KeyboardOverlap.lift(keyboard: keyboard, bottom: bottom) == keyboard.minY)
12 }
13 @Test func aHiddenKeyboardLiftsNothing() {
14 #expect(KeyboardOverlap.lift(keyboard: .null, bottom: 790) == 0)
15 #expect(KeyboardOverlap.lift(keyboard: .zero, bottom: 790) == 0)
16 // Hiding: the end frame is below the screen.
17 #expect(KeyboardOverlap.lift(keyboard: CGRect(x: 0, y: 874, width: 402, height: 336), bottom: 790) == 0)
18 // A region that ends above the keyboard is not lifted.
19 #expect(KeyboardOverlap.lift(keyboard: CGRect(x: 0, y: 538, width: 402, height: 336), bottom: 500) == 0)
20 }
21}
22