-
Notifications
You must be signed in to change notification settings - Fork 520
Expand file tree
/
Copy pathSCLAlertViewTestHelpers.m
More file actions
73 lines (59 loc) · 1.42 KB
/
Copy pathSCLAlertViewTestHelpers.m
File metadata and controls
73 lines (59 loc) · 1.42 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
//
// SCLAlertViewTestHelpers.m
// SCLAlertViewTests
//
// Created by Diogo Autilio on 9/26/14.
// Copyright (c) 2014-2016 AnyKey Entertainment. All rights reserved.
//
#import "SCLAlertViewTestHelpers.h"
@implementation SCLAlertViewTestCase
{
BOOL _animationsWereEnabled;
}
- (void)setUp
{
[super setUp];
_animationsWereEnabled = UIView.areAnimationsEnabled;
[UIView setAnimationsEnabled:NO];
}
- (void)tearDown
{
[UIView setAnimationsEnabled:_animationsWereEnabled];
[super tearDown];
}
- (UIViewController *)presentingViewController
{
UIViewController *viewController = [[UIViewController alloc] init];
viewController.view.frame = CGRectMake(0.0f, 0.0f, 320.0f, 480.0f);
return viewController;
}
- (NSArray<SCLButton *> *)buttonsInView:(UIView *)view
{
NSMutableArray<SCLButton *> *buttons = [NSMutableArray array];
if ([view isKindOfClass:SCLButton.class]) {
[buttons addObject:(SCLButton *)view];
}
for (UIView *subview in view.subviews) {
[buttons addObjectsFromArray:[self buttonsInView:subview]];
}
return buttons;
}
@end
@implementation SCLAlertViewTestTarget
- (void)performAction
{
self.actionCount += 1;
}
@end
@implementation SCLAlertViewTrackingTextField
- (BOOL)becomeFirstResponder
{
self.becomeFirstResponderCount += 1;
return YES;
}
- (BOOL)resignFirstResponder
{
self.resignFirstResponderCount += 1;
return YES;
}
@end