summaryrefslogtreecommitdiff
path: root/SmartDeviceLinkTests/RPCSpecs/RequestSpecs/SDLSetGlobalPropertiesSpec.m
blob: b5228cc0a522aa0ebf72a183a27346b880e01ecb (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
79
80
81
82
83
//
//  SDLSetGlobalPropertiesSpec.m
//  SmartDeviceLink


#import <Foundation/Foundation.h>

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

#import "SDLImage.h"
#import "SDLKeyboardProperties.h"
#import "SDLNames.h"
#import "SDLSetGlobalProperties.h"
#import "SDLTTSChunk.h"
#import "SDLVrHelpItem.h"


QuickSpecBegin(SDLSetGlobalPropertiesSpec)

SDLTTSChunk* chunk1 = [[SDLTTSChunk alloc] init];
SDLTTSChunk* chunk2 = [[SDLTTSChunk alloc] init];
SDLVRHelpItem* help = [[SDLVRHelpItem alloc] init];
SDLImage* image = [[SDLImage alloc] init];
SDLKeyboardProperties* keyboard = [[SDLKeyboardProperties alloc] init];

describe(@"Getter/Setter Tests", ^ {
    it(@"Should set and get correctly", ^ {
        SDLSetGlobalProperties* testRequest = [[SDLSetGlobalProperties alloc] init];
        
        testRequest.helpPrompt = [@[chunk1] mutableCopy];
        testRequest.timeoutPrompt = [@[chunk2] mutableCopy];
        testRequest.vrHelpTitle = @"vr";
        testRequest.vrHelp = [@[help] mutableCopy];
        testRequest.menuTitle = @"TheNewMenu";
        testRequest.menuIcon = image;
        testRequest.keyboardProperties = keyboard;
        
        expect(testRequest.helpPrompt).to(equal([@[chunk1] mutableCopy]));
        expect(testRequest.timeoutPrompt).to(equal([@[chunk2] mutableCopy]));
        expect(testRequest.vrHelpTitle).to(equal(@"vr"));
        expect(testRequest.vrHelp).to(equal([@[help] mutableCopy]));
        expect(testRequest.menuTitle).to(equal(@"TheNewMenu"));
        expect(testRequest.menuIcon).to(equal(image));
        expect(testRequest.keyboardProperties).to(equal(keyboard));
    });
    
    it(@"Should get correctly when initialized", ^ {
        NSMutableDictionary* dict = [@{SDLNameRequest:
                                           @{SDLNameParameters:
                                                 @{SDLNameHelpPrompt:[@[chunk1] mutableCopy],
                                                   SDLNameTimeoutPrompt:[@[chunk2] mutableCopy],
                                                   SDLNameVRHelpTitle:@"vr",
                                                   SDLNameVRHelp:[@[help] mutableCopy],
                                                   SDLNameMenuTitle:@"TheNewMenu",
                                                   SDLNameMenuIcon:image,
                                                   SDLNameKeyboardProperties:keyboard},
                                             SDLNameOperationName:SDLNameSetGlobalProperties}} mutableCopy];
        SDLSetGlobalProperties* testRequest = [[SDLSetGlobalProperties alloc] initWithDictionary:dict];
        
        expect(testRequest.helpPrompt).to(equal([@[chunk1] mutableCopy]));
        expect(testRequest.timeoutPrompt).to(equal([@[chunk2] mutableCopy]));
        expect(testRequest.vrHelpTitle).to(equal(@"vr"));
        expect(testRequest.vrHelp).to(equal([@[help] mutableCopy]));
        expect(testRequest.menuTitle).to(equal(@"TheNewMenu"));
        expect(testRequest.menuIcon).to(equal(image));
        expect(testRequest.keyboardProperties).to(equal(keyboard));
    });
    
    it(@"Should return nil if not set", ^ {
        SDLSetGlobalProperties* testRequest = [[SDLSetGlobalProperties alloc] init];
        
        expect(testRequest.helpPrompt).to(beNil());
        expect(testRequest.timeoutPrompt).to(beNil());
        expect(testRequest.vrHelpTitle).to(beNil());
        expect(testRequest.vrHelp).to(beNil());
        expect(testRequest.menuTitle).to(beNil());
        expect(testRequest.menuIcon).to(beNil());
        expect(testRequest.keyboardProperties).to(beNil());
    });
});

QuickSpecEnd