From 05a4ec89ea2b4de875e195b9223dfa423e183eec Mon Sep 17 00:00:00 2001 From: Zandor Smith Date: Mon, 14 Mar 2022 14:57:29 +0100 Subject: [PATCH] Fix testIsPhoneIsPadIsPod test. --- Tests/Tests.swift | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/Tests/Tests.swift b/Tests/Tests.swift index 1ab7203..6b50827 100644 --- a/Tests/Tests.swift +++ b/Tests/Tests.swift @@ -34,24 +34,38 @@ class DeviceKitTests: XCTestCase { XCTAssertTrue(device.isSimulator) } - func testIsPhoneIsPad() { + func testIsPhoneIsPadIsPod() { // Test for https://github.com/devicekit/DeviceKit/issues/165 to prevent it from happening in the future. if UIDevice.current.userInterfaceIdiom == .pad { XCTAssertTrue(device.isPad) XCTAssertFalse(device.isPhone) + XCTAssertFalse(device.isPod) } else if UIDevice.current.userInterfaceIdiom == .phone { XCTAssertFalse(device.isPad) - XCTAssertTrue(device.isPhone) // TODO: failed for iPod touch (7th generation) + if device.description.contains("iPod") { + XCTAssertFalse(device.isPhone) + XCTAssertTrue(device.isPod) + } else { + XCTAssertTrue(device.isPhone) + XCTAssertFalse(device.isPod) + } } for pad in Device.allPads { XCTAssertTrue(pad.isPad) XCTAssertFalse(pad.isPhone) + XCTAssertFalse(pad.isPod) } for phone in Device.allPhones { XCTAssertFalse(phone.isPad) XCTAssertTrue(phone.isPhone) + XCTAssertFalse(phone.isPod) + } + for pod in Device.allPods { + XCTAssertFalse(pod.isPad) + XCTAssertFalse(pod.isPhone) + XCTAssertTrue(pod.isPod) } }