summaryrefslogtreecommitdiff
path: root/SmartDeviceLinkTests/RPCSpecs/StructSpecs/SDLScreenParamsSpec.m
blob: 421272ba4c34fbc4fcc0ef7541759fbde0f8c8cb (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
//
//  SDLScreenParamsSpec.m
//  SmartDeviceLink


#import <Foundation/Foundation.h>

#import <Quick/Quick.h>
#import <Nimble/Nimble.h>

#import "SDLImageResolution.h"
#import "SDLRPCParameterNames.h"
#import "SDLScreenParams.h"
#import "SDLTouchEventCapabilities.h"


QuickSpecBegin(SDLScreenParamsSpec)

SDLImageResolution* resolution = [[SDLImageResolution alloc] init];
SDLTouchEventCapabilities* capabilities = [[SDLTouchEventCapabilities alloc] init];

describe(@"Getter/Setter Tests", ^ {
    it(@"Should set and get correctly", ^ {
        SDLScreenParams* testStruct = [[SDLScreenParams alloc] init];
        
        testStruct.resolution = resolution;
        testStruct.touchEventAvailable = capabilities;
        
        expect(testStruct.resolution).to(equal(resolution));
        expect(testStruct.touchEventAvailable).to(equal(capabilities));
    });
    
    it(@"Should get correctly when initialized", ^ {
        NSMutableDictionary<NSString *, id> *dict = [@{SDLRPCParameterNameResolution:resolution,
                                                       SDLRPCParameterNameTouchEventAvailable:capabilities} mutableCopy];
        SDLScreenParams* testStruct = [[SDLScreenParams alloc] initWithDictionary:dict];
        
        expect(testStruct.resolution).to(equal(resolution));
        expect(testStruct.touchEventAvailable).to(equal(capabilities));
    });
    
    it(@"Should return nil if not set", ^ {
        SDLScreenParams* testStruct = [[SDLScreenParams alloc] init];
        
        expect(testStruct.resolution).to(beNil());
        expect(testStruct.touchEventAvailable).to(beNil());
    });
});

QuickSpecEnd