blob: df938b7dcce9c3ec65156bb370463db095b75d93 (
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
|
//
// SDLSoftButtonSpec.m
// SmartDeviceLink
#import <Foundation/Foundation.h>
#import <Quick/Quick.h>
#import <Nimble/Nimble.h>
#import "SDLImage.h"
#import "SDLNames.h"
#import "SDLSoftButton.h"
#import "SDLSoftButtonType.h"
#import "SDLSystemAction.h"
QuickSpecBegin(SDLSoftButtonSpec)
SDLImage* image = [[SDLImage alloc] init];
describe(@"Getter/Setter Tests", ^ {
it(@"Should set and get correctly", ^ {
SDLSoftButton* testStruct = [[SDLSoftButton alloc] init];
testStruct.type = SDLSoftButtonTypeImage;
testStruct.text = @"Button";
testStruct.image = image;
testStruct.isHighlighted = @YES;
testStruct.softButtonID = @5423;
testStruct.systemAction = SDLSystemActionKeepContext;
expect(testStruct.type).to(equal(SDLSoftButtonTypeImage));
expect(testStruct.text).to(equal(@"Button"));
expect(testStruct.image).to(equal(image));
expect(testStruct.isHighlighted).to(equal(@YES));
expect(testStruct.softButtonID).to(equal(@5423));
expect(testStruct.systemAction).to(equal(SDLSystemActionKeepContext));
});
it(@"Should get correctly when initialized", ^ {
NSMutableDictionary* dict = [@{SDLNameType:SDLSoftButtonTypeImage,
SDLNameText:@"Button",
SDLNameImage:image,
SDLNameIsHighlighted:@YES,
SDLNameSoftButtonId:@5423,
SDLNameSystemAction:SDLSystemActionKeepContext} mutableCopy];
SDLSoftButton* testStruct = [[SDLSoftButton alloc] initWithDictionary:dict];
expect(testStruct.type).to(equal(SDLSoftButtonTypeImage));
expect(testStruct.text).to(equal(@"Button"));
expect(testStruct.image).to(equal(image));
expect(testStruct.isHighlighted).to(equal(@YES));
expect(testStruct.softButtonID).to(equal(@5423));
expect(testStruct.systemAction).to(equal(SDLSystemActionKeepContext));
});
it(@"Should return nil if not set", ^ {
SDLSoftButton* testStruct = [[SDLSoftButton alloc] init];
expect(testStruct.type).to(beNil());
expect(testStruct.text).to(beNil());
expect(testStruct.image).to(beNil());
expect(testStruct.isHighlighted).to(beNil());
expect(testStruct.softButtonID).to(beNil());
expect(testStruct.systemAction).to(beNil());
});
});
QuickSpecEnd
|