blob: 59c3974df59f0f61d777cd6df1cd5eba4d2a0302 (
plain)
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
74
75
76
77
78
|
#import <Quick/Quick.h>
#import <Nimble/Nimble.h>
#import "SDLLockScreenConfiguration.h"
QuickSpecBegin(SDLLockScreenConfigurationSpec)
describe(@"a lock screen configuration", ^{
__block SDLLockScreenConfiguration *testConfig = nil;
context(@"in the disabled configuration", ^{
beforeEach(^{
testConfig = [SDLLockScreenConfiguration disabledConfiguration];
});
it(@"should properly set properties", ^{
expect(@(testConfig.enableAutomaticLockScreen)).to(beFalsy());
expect(@(testConfig.showInOptionalState)).to(beFalsy());
expect(testConfig.backgroundColor).to(equal([UIColor colorWithRed:(57.0/255.0) green:(78.0/255.0) blue:(96.0/255.0) alpha:1.0]));
expect(testConfig.appIcon).to(beNil());
expect(testConfig.customViewController).to(beNil());
});
});
context(@"in the base enabled configuration", ^{
beforeEach(^{
testConfig = [SDLLockScreenConfiguration enabledConfiguration];
});
it(@"should properly set properties", ^{
expect(@(testConfig.enableAutomaticLockScreen)).to(beTruthy());
expect(@(testConfig.showInOptionalState)).to(beFalsy());
expect(testConfig.backgroundColor).to(equal([UIColor colorWithRed:(57.0/255.0) green:(78.0/255.0) blue:(96.0/255.0) alpha:1.0]));
expect(testConfig.appIcon).to(beNil());
expect(testConfig.customViewController).to(beNil());
});
});
context(@"in the background customizable enabled configuration", ^{
__block UIColor *testBackgroundColor = nil;
__block UIImage *testImage = nil;
beforeEach(^{
testBackgroundColor = [UIColor blueColor];
testImage = [UIImage imageNamed:@"testImagePNG" inBundle:[NSBundle bundleForClass:[self class]] compatibleWithTraitCollection:nil];
testConfig = [SDLLockScreenConfiguration enabledConfigurationWithAppIcon:testImage backgroundColor:testBackgroundColor];
});
it(@"should properly set properties", ^{
expect(@(testConfig.enableAutomaticLockScreen)).to(beTruthy());
expect(@(testConfig.showInOptionalState)).to(beFalsy());
expect(testConfig.backgroundColor).to(equal([UIColor blueColor]));
expect(testConfig.appIcon).to(equal(testImage));
expect(testConfig.customViewController).to(beNil());
});
});
context(@"in the view controller customizable enabled configuration", ^{
__block UIViewController *testVC = nil;
beforeEach(^{
testVC = [[UIViewController alloc] init];
testConfig = [SDLLockScreenConfiguration enabledConfigurationWithViewController:testVC];
});
it(@"should properly set properties", ^{
expect(@(testConfig.enableAutomaticLockScreen)).to(beTruthy());
expect(@(testConfig.showInOptionalState)).to(beFalsy());
expect(testConfig.backgroundColor).to(equal([UIColor colorWithRed:(57.0/255.0) green:(78.0/255.0) blue:(96.0/255.0) alpha:1.0]));
expect(testConfig.appIcon).to(beNil());
expect(testConfig.customViewController).to(equal(testVC));
});
});
});
QuickSpecEnd
|