Skip to content

Commit 2f873e4

Browse files
authored
Merge pull request #76 from jminutaglio/patch-3
Fixes for iPad Air 5 hardware strings & add tests
2 parents b422d3a + 192860d commit 2f873e4

File tree

4 files changed

+28
-5
lines changed

4 files changed

+28
-5
lines changed

Sources/DeviceModel.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ extension DeviceModel {
161161
case (5, 3), (5, 4): return .iPadAir2
162162
case (11, 3), (11, 4): return .iPadAir3
163163
case (13, 1), (13, 2): return .iPadAir4
164-
case (13, 17), (13, 18): return .iPadAir5
164+
case (13, 16), (13, 17): return .iPadAir5
165165
case (2, 5), (2, 6), (2, 7): return .iPadMini
166166
case (4, 4), (4, 5), (4, 6): return .iPadMini2
167167
case (4, 7), (4, 8), (4, 9): return .iPadMini3

Sources/Identifier.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ extension Identifier: CustomStringConvertible {
167167
case (14, 5):
168168
return "iPhone 13"
169169
case (14, 6):
170-
return "iPhone SE (3nd Gen)"
170+
return "iPhone SE (3rd Gen)"
171171

172172
default:
173173
return "unknown"
@@ -315,10 +315,10 @@ extension Identifier: CustomStringConvertible {
315315
return "3rd Gen iPad Air (Wi-Fi+LTE)"
316316
case (13, 1):
317317
return "4th Gen iPad Air (Wi-Fi)"
318-
case (13, 17):
318+
case (13, 16):
319319
return "5th Gen iPad Air (Wi-Fi)"
320-
case (13, 18):
321-
return "5th Gen iPad Air (Wi-Fi+LTE)"
320+
case (13, 17):
321+
return "5th Gen iPad Air (Wi-Fi+5G)"
322322
case (13, 2):
323323
return "4th Gen iPad Air (Wi-Fi+LTE)"
324324
case (11, 6):

Tests/DeviceModelTests.swift

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,11 @@ class DeviceModelTests: XCTestCase {
192192
}
193193

194194
func testDeviceModelIPhone13ProMax() {
195+
let deviceModel = DeviceModel(identifier: Identifier("iPhone14,6"))
196+
XCTAssert(deviceModel == .iPhoneSE3 , "DeviceModel - .iPhoneSE3 is failing")
197+
}
198+
199+
func testDeviceModelIPhoneSE3() {
195200
let deviceModel = DeviceModel(identifier: Identifier("iPhone14,3"))
196201
XCTAssert(deviceModel == .iPhone13ProMax , "DeviceModel - .iPhone13ProMax is failing")
197202
}
@@ -392,6 +397,12 @@ class DeviceModelTests: XCTestCase {
392397
XCTAssert(deviceModel1 == .iPadAir3 && deviceModel2 == .iPadAir3 , "DeviceModel - .iPadAir3 is failing")
393398
}
394399

400+
func testDeviceModelIPadAir5() {
401+
let deviceModel1 = DeviceModel(identifier: Identifier("iPad13,16"))
402+
let deviceModel2 = DeviceModel(identifier: Identifier("iPad13,17"))
403+
XCTAssert(deviceModel1 == .iPadAir5 && deviceModel2 == .iPadAir5 , "DeviceModel - .iPadAir5 is failing")
404+
}
405+
395406
// MARK: - iPod Device Model tests
396407

397408
func testDeviceModelIPodTouchFirstGen() {

Tests/IdentifierTests.swift

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,10 @@ class IdentifierTests: XCTestCase {
6666

6767
// MARK: - iPhone String Description tests
6868

69+
func testDisplayStringiPhone14v6() {
70+
XCTAssert(Identifier("iPhone14,6").description == "iPhone SE (3rd Gen)", "iPhone14,6 is failing to produce a common device model string")
71+
}
72+
6973
func testDisplayStringiPhone14v5() {
7074
XCTAssert(Identifier("iPhone14,5").description == "iPhone 13", "iPhone14,5 is failing to produce a common device model string")
7175
}
@@ -286,6 +290,14 @@ class IdentifierTests: XCTestCase {
286290
func testDisplayStringiPad14v1() {
287291
XCTAssert(Identifier("iPad14,1").description == "6th Gen iPad mini (8.3 inch, Wi-Fi)", "iPad14,1 is failing to produce a common device model string")
288292
}
293+
294+
func testDisplayStringiPad13v16() {
295+
XCTAssert(Identifier("iPad13,16").description == "5th Gen iPad Air (Wi-Fi)", "iPad13,16 is failing to produce a common device model string")
296+
}
297+
func testDisplayStringiPad13v17() {
298+
XCTAssert(Identifier("iPad13,17").description == "5th Gen iPad Air (Wi-Fi+5G)", "iPad13,17 is failing to produce a common device model string")
299+
}
300+
289301
func testDisplayStringiPad13v11() {
290302
XCTAssert(Identifier("iPad13,11").description == "5th Gen iPad Pro (12.9 inch, Wi-Fi+5G, 16GB RAM)", "iPad13,11 is failing to produce a common device model string")
291303
}

0 commit comments

Comments
 (0)