@@ -25,55 +25,53 @@ class KeyboardAppearanceInfoTests: XCTestCase {
25
25
UIKeyboardAnimationCurveUserInfoKey: UIViewAnimationCurve . EaseOut. rawValue,
26
26
]
27
27
28
- var defaultParsingUserInfo : [ String : AnyObject ] = [
29
- UIKeyboardFrameBeginUserInfoKey: " bla " ,
30
- UIKeyboardFrameEndUserInfoKey: " bla " ,
31
- UIKeyboardAnimationDurationUserInfoKey: NSValue ( CGRect: CGRect ( x: 100 , y: 100 , width: 100 , height: 100 ) ) ,
32
- UIKeyboardAnimationCurveUserInfoKey: " bla " ,
33
- ]
34
-
35
28
if #available( iOS 9 . 0 , * ) {
36
29
testUserInfo [ UIKeyboardIsLocalUserInfoKey] = false
37
- defaultParsingUserInfo [ UIKeyboardIsLocalUserInfoKey] = " this shouldn't work "
38
30
} else {
39
31
print ( " UIKeyboardIsLocalUserInfoKey is not available before iOS9. " )
40
32
}
41
33
42
34
// Fake the notification
43
35
let note = NSNotification ( name: UIKeyboardWillShowNotification, object: nil , userInfo: testUserInfo)
44
36
apperanceInfo = KeyboardAppearanceInfo ( notification: note)
45
- defaultsAppearanceInfo = KeyboardAppearanceInfo ( notification: NSNotification ( name: UIKeyboardWillShowNotification, object: nil , userInfo: defaultParsingUserInfo) )
37
+ let defaultNote = NSNotification ( name: UIKeyboardWillShowNotification, object: nil , userInfo: nil )
38
+ defaultsAppearanceInfo = KeyboardAppearanceInfo ( notification: defaultNote)
46
39
}
47
40
48
41
func testBeginFrame( ) {
49
42
XCTAssertEqual ( apperanceInfo. beginFrame, CGRect ( x: 100 , y: 100 , width: 100 , height: 100 ) ,
50
43
" Parsing beginFrame from keyboard appearance info failed. " )
51
- XCTAssertEqual ( defaultsAppearanceInfo. beginFrame, CGRectZero)
44
+ XCTAssertEqual ( defaultsAppearanceInfo. beginFrame, CGRectZero,
45
+ " Parsing default beginFrame from keyboard appearance info failed. " )
52
46
}
53
47
54
48
func testEndFrame( ) {
55
49
XCTAssertEqual ( apperanceInfo. endFrame, CGRect ( x: 200 , y: 200 , width: 200 , height: 200 ) ,
56
50
" Parsing endFrame from keyboard appearance info failed. " )
57
- XCTAssertEqual ( defaultsAppearanceInfo. endFrame, CGRectZero)
51
+ XCTAssertEqual ( defaultsAppearanceInfo. endFrame, CGRectZero,
52
+ " Parsing default endFrame from keyboard appearance info failed. " )
58
53
}
59
54
60
55
@available ( iOS 9 . 0 , * )
61
56
func testBelongsToCurrentApp( ) {
62
57
XCTAssertEqual ( apperanceInfo. belongsToCurrentApp, false ,
63
58
" Parsing belongsToCurrentApp from keyboard appearance info failed. " )
64
- XCTAssertEqual ( defaultsAppearanceInfo. belongsToCurrentApp, true )
59
+ XCTAssertEqual ( defaultsAppearanceInfo. belongsToCurrentApp, true ,
60
+ " Parsing default belongsToCurrentApp from keyboard appearance info failed. " )
65
61
}
66
62
67
63
func testAnimationDuration( ) {
68
64
XCTAssertEqual ( apperanceInfo. animationDuration, Double ( 3 ) ,
69
65
" Parsing animationDuration from keyboard appearance info failed. " )
70
- XCTAssertEqual ( defaultsAppearanceInfo. animationDuration, 0.25 )
66
+ XCTAssertEqual ( defaultsAppearanceInfo. animationDuration, Double ( 0.25 ) ,
67
+ " Parsing default animationDuration from keyboard appearance info failed. " )
71
68
}
72
69
73
70
func testAnimationCurve( ) {
74
71
XCTAssertEqual ( apperanceInfo. animationCurve, UIViewAnimationCurve ( rawValue: 2 ) ,
75
72
" Parsing animationCurve from keyboard appearance info failed. " )
76
- XCTAssertEqual ( defaultsAppearanceInfo. animationCurve, UIViewAnimationCurve . EaseInOut)
73
+ XCTAssertEqual ( defaultsAppearanceInfo. animationCurve, UIViewAnimationCurve ( rawValue: defaultsAppearanceInfo. animationCurve. rawValue) ,
74
+ " Parsing default animationCurve from keyboard appearance info failed. " )
77
75
}
78
76
79
77
func testAnimateAlong( ) {
0 commit comments