summaryrefslogtreecommitdiff
path: root/SmartDeviceLinkTests/RPCSpecs/StructSpecs/SDLKeyboardPropertiesSpec.m
blob: 4a8dc21bb1f5d5b3d83a2321a5955d0dd3686ff7 (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
//
//  SDLKeyboardPropertiesSpec.m
//  SmartDeviceLink


#import <Foundation/Foundation.h>

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

#import "SDLKeyboardLayout.h"
#import "SDLKeypressMode.h"
#import "SDLKeyboardProperties.h"
#import "SDLLanguage.h"
#import "SDLNames.h"


QuickSpecBegin(SDLKeyboardPropertiesSpec)

describe(@"Getter/Setter Tests", ^ {
    it(@"Should set and get correctly", ^ {
        SDLKeyboardProperties* testStruct = [[SDLKeyboardProperties alloc] init];
        
        testStruct.language = SDLLanguageDaDk;
        testStruct.keyboardLayout = SDLKeyboardLayoutQWERTZ;
        testStruct.keypressMode = SDLKeypressModeResendCurrentEntry;
        testStruct.limitedCharacterList = [@[@"s", @"r", @"f", @"q"] mutableCopy];
        testStruct.autoCompleteText = @"Auto Carrot";
        
        expect(testStruct.language).to(equal(SDLLanguageDaDk));
        expect(testStruct.keyboardLayout).to(equal(SDLKeyboardLayoutQWERTZ));
        expect(testStruct.keypressMode).to(equal(SDLKeypressModeResendCurrentEntry));
        expect(testStruct.limitedCharacterList).to(equal([@[@"s", @"r", @"f", @"q"] mutableCopy]));
        expect(testStruct.autoCompleteText).to(equal(@"Auto Carrot"));
    });
    
    it(@"Should get correctly when initialized", ^ {
        NSMutableDictionary* dict = [@{SDLNameLanguage:SDLLanguageDaDk,
                                       SDLNameKeyboardLayout:SDLKeyboardLayoutQWERTZ,
                                       SDLNameKeypressMode:SDLKeypressModeResendCurrentEntry,
                                       SDLNameLimitedCharacterList:[@[@"s", @"r", @"f", @"q"] mutableCopy],
                                       SDLNameAutoCompleteText:@"Auto Carrot"} mutableCopy];
        SDLKeyboardProperties* testStruct = [[SDLKeyboardProperties alloc] initWithDictionary:dict];
        
        expect(testStruct.language).to(equal(SDLLanguageDaDk));
        expect(testStruct.keyboardLayout).to(equal(SDLKeyboardLayoutQWERTZ));
        expect(testStruct.keypressMode).to(equal(SDLKeypressModeResendCurrentEntry));
        expect(testStruct.limitedCharacterList).to(equal([@[@"s", @"r", @"f", @"q"] mutableCopy]));
        expect(testStruct.autoCompleteText).to(equal(@"Auto Carrot"));
    });
    
    it(@"Should return nil if not set", ^ {
        SDLKeyboardProperties* testStruct = [[SDLKeyboardProperties alloc] init];
        
        expect(testStruct.language).to(beNil());
        expect(testStruct.keyboardLayout).to(beNil());
        expect(testStruct.keypressMode).to(beNil());
        expect(testStruct.limitedCharacterList).to(beNil());
        expect(testStruct.autoCompleteText).to(beNil());
    });
});

QuickSpecEnd