diff options
author | leonid lokhmatov, Luxoft <zaqqqqqqqq@gmail.com> | 2021-02-09 09:05:11 +0200 |
---|---|---|
committer | leonid lokhmatov, Luxoft <zaqqqqqqqq@gmail.com> | 2021-02-09 09:42:32 +0200 |
commit | 392b96181f2cf3a3e161b92f2435ae26e311b296 (patch) | |
tree | a6f5dbd5ac16d7e793f32e108ab9f56d3602907f | |
parent | 6fe8d4f9a2b46239be30b48aaf51cf2d8af1b26f (diff) | |
download | sdl_ios-392b96181f2cf3a3e161b92f2435ae26e311b296.tar.gz |
SDL0238 'Keyboard Enhancements r2': implement unit tests
7 files changed, 249 insertions, 16 deletions
diff --git a/SmartDeviceLink-iOS.xcodeproj/project.pbxproj b/SmartDeviceLink-iOS.xcodeproj/project.pbxproj index 38507c961..a55f8b100 100644 --- a/SmartDeviceLink-iOS.xcodeproj/project.pbxproj +++ b/SmartDeviceLink-iOS.xcodeproj/project.pbxproj @@ -1693,6 +1693,9 @@ B3A9D9E825D2578F00CDFD21 /* SDLKeyboardLayoutCapability.h in Headers */ = {isa = PBXBuildFile; fileRef = B3A9D9E625D2578F00CDFD21 /* SDLKeyboardLayoutCapability.h */; settings = {ATTRIBUTES = (Public, ); }; }; B3A9D9ED25D2586C00CDFD21 /* SDLKeyboardInputMask.h in Headers */ = {isa = PBXBuildFile; fileRef = B3A9D9EB25D2586C00CDFD21 /* SDLKeyboardInputMask.h */; settings = {ATTRIBUTES = (Public, ); }; }; B3A9D9EE25D2586C00CDFD21 /* SDLKeyboardInputMask.m in Sources */ = {isa = PBXBuildFile; fileRef = B3A9D9EC25D2586C00CDFD21 /* SDLKeyboardInputMask.m */; }; + B3A9DA0425D26D8500CDFD21 /* SDLKeyboardInputMaskSpec.m in Sources */ = {isa = PBXBuildFile; fileRef = B3A9DA0325D26D8500CDFD21 /* SDLKeyboardInputMaskSpec.m */; }; + B3A9DA0A25D26E1800CDFD21 /* SDLKeyboardCapabilitiesSpec.m in Sources */ = {isa = PBXBuildFile; fileRef = B3A9DA0925D26E1800CDFD21 /* SDLKeyboardCapabilitiesSpec.m */; }; + B3A9DA1225D270EA00CDFD21 /* SDLKeyboardLayoutCapabilitySpec.m in Sources */ = {isa = PBXBuildFile; fileRef = B3A9DA1125D270E900CDFD21 /* SDLKeyboardLayoutCapabilitySpec.m */; }; B3EC9E6E2579AA010039F3AA /* SDLClimateDataSpec.m in Sources */ = {isa = PBXBuildFile; fileRef = B3EC9E6D2579AA010039F3AA /* SDLClimateDataSpec.m */; }; B3F7918324E062C200DB5CAF /* SDLGetVehicleDataSpec.m in Sources */ = {isa = PBXBuildFile; fileRef = 162E824C1A9BDE8A00906325 /* SDLGetVehicleDataSpec.m */; }; C975877F257AEFDB0066F271 /* SDLSeekIndicatorTypeSpec.m in Sources */ = {isa = PBXBuildFile; fileRef = C975877E257AEFDB0066F271 /* SDLSeekIndicatorTypeSpec.m */; }; @@ -3551,6 +3554,9 @@ B3A9D9E625D2578F00CDFD21 /* SDLKeyboardLayoutCapability.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDLKeyboardLayoutCapability.h; path = public/SDLKeyboardLayoutCapability.h; sourceTree = "<group>"; }; B3A9D9EB25D2586C00CDFD21 /* SDLKeyboardInputMask.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDLKeyboardInputMask.h; path = public/SDLKeyboardInputMask.h; sourceTree = "<group>"; }; B3A9D9EC25D2586C00CDFD21 /* SDLKeyboardInputMask.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SDLKeyboardInputMask.m; path = public/SDLKeyboardInputMask.m; sourceTree = "<group>"; }; + B3A9DA0325D26D8500CDFD21 /* SDLKeyboardInputMaskSpec.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SDLKeyboardInputMaskSpec.m; sourceTree = "<group>"; }; + B3A9DA0925D26E1800CDFD21 /* SDLKeyboardCapabilitiesSpec.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SDLKeyboardCapabilitiesSpec.m; sourceTree = "<group>"; }; + B3A9DA1125D270E900CDFD21 /* SDLKeyboardLayoutCapabilitySpec.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SDLKeyboardLayoutCapabilitySpec.m; sourceTree = "<group>"; }; B3EC9E6D2579AA010039F3AA /* SDLClimateDataSpec.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SDLClimateDataSpec.m; sourceTree = "<group>"; }; BB3C600D221AEF37007DD4CA /* NSMutableDictionary+StoreSpec.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; name = "NSMutableDictionary+StoreSpec.m"; path = "DevAPISpecs/NSMutableDictionary+StoreSpec.m"; sourceTree = "<group>"; }; C975877E257AEFDB0066F271 /* SDLSeekIndicatorTypeSpec.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SDLSeekIndicatorTypeSpec.m; sourceTree = "<group>"; }; @@ -3767,6 +3773,7 @@ 162E81FD1A9BDE8A00906325 /* SDLImageTypeSpec.m */, 162E81FE1A9BDE8A00906325 /* SDLInteractionModeSpec.m */, 162E81FF1A9BDE8A00906325 /* SDLKeyboardEventSpec.m */, + B3A9DA0325D26D8500CDFD21 /* SDLKeyboardInputMaskSpec.m */, 162E82001A9BDE8A00906325 /* SDLKeyboardLayoutSpec.m */, 162E82011A9BDE8A00906325 /* SDLKeypressModeSpec.m */, 162E82021A9BDE8A00906325 /* SDLLanguageSpec.m */, @@ -4063,6 +4070,8 @@ 162E829F1A9BDE8A00906325 /* SDLImageFieldSpec.m */, 5DB202261F5F2D030061D189 /* SDLImageResolutionSpec.m */, 162E82A01A9BDE8A00906325 /* SDLImageSpec.m */, + B3A9DA0925D26E1800CDFD21 /* SDLKeyboardCapabilitiesSpec.m */, + B3A9DA1125D270E900CDFD21 /* SDLKeyboardLayoutCapabilitySpec.m */, 162E82A11A9BDE8A00906325 /* SDLKeyboardPropertiesSpec.m */, 1EAA476B2036A52F000FE74B /* SDLLightCapabilitiesSpec.m */, 1EAA476920369ECC000FE74B /* SDLLightControlCapabilitiesSpec.m */, @@ -8434,6 +8443,7 @@ 162E837D1A9BDE8B00906325 /* SDLEmergencyEventSpec.m in Sources */, 162E82D31A9BDE8A00906325 /* SDLCarModeStatusSpec.m in Sources */, 8B7B31A91F2FB8BC00BDC38D /* SDLVideoStreamingProtocolSpec.m in Sources */, + B3A9DA0A25D26E1800CDFD21 /* SDLKeyboardCapabilitiesSpec.m in Sources */, 88EED83B1F33BECB00E6C42E /* SDLHapticRectSpec.m in Sources */, 162E82EA1A9BDE8B00906325 /* SDLLanguageSpec.m in Sources */, 5D76E3291D3D0A8800647CFA /* SDLFakeViewControllerPresenter.m in Sources */, @@ -8509,6 +8519,7 @@ 162E835B1A9BDE8B00906325 /* SDLPerformInteractionResponseSpec.m in Sources */, 880E35B82088F78E00181259 /* SDLSystemCapabilityManagerSpec.m in Sources */, 162E832D1A9BDE8B00906325 /* SDLEncodedSyncPDataSpec.m in Sources */, + B3A9DA0425D26D8500CDFD21 /* SDLKeyboardInputMaskSpec.m in Sources */, 1EE8C44C1F385C7100FDC2CF /* SDLRDSDataSpec.m in Sources */, 5DB92D241AC47B2C00C15BB0 /* SDLHexUtilitySpec.m in Sources */, 8815D0F022330765000F24E6 /* SDLRPCRequestNotificationSpec.m in Sources */, @@ -8812,6 +8823,7 @@ 162E830F1A9BDE8B00906325 /* SDLOnAppInterfaceUnregisteredSpec.m in Sources */, 162E83971A9BDE8B00906325 /* SDLVehicleTypeSpec.m in Sources */, 887BE4D422272B2200B397C2 /* SDLControlFramePayloadConstantsSpec.m in Sources */, + B3A9DA1225D270EA00CDFD21 /* SDLKeyboardLayoutCapabilitySpec.m in Sources */, 885468382225CBA400994D8D /* SDLCloudAppPropertiesSpec.m in Sources */, 88A795D5210678E000056542 /* SDLStaticIconNameSpec.m in Sources */, 1680B1131A9CD7AD00DBD79E /* SDLProtocolHeaderSpec.m in Sources */, diff --git a/SmartDeviceLink/public/SDLKeyboardLayoutCapability.h b/SmartDeviceLink/public/SDLKeyboardLayoutCapability.h index 2bcbe95ca..b78218663 100644 --- a/SmartDeviceLink/public/SDLKeyboardLayoutCapability.h +++ b/SmartDeviceLink/public/SDLKeyboardLayoutCapability.h @@ -59,4 +59,4 @@ NS_ASSUME_NONNULL_BEGIN @end -NS_ASSUME_NONNULL_END
\ No newline at end of file +NS_ASSUME_NONNULL_END diff --git a/SmartDeviceLink/public/SDLKeyboardLayoutCapability.m b/SmartDeviceLink/public/SDLKeyboardLayoutCapability.m index ec302a409..57cb9a81c 100644 --- a/SmartDeviceLink/public/SDLKeyboardLayoutCapability.m +++ b/SmartDeviceLink/public/SDLKeyboardLayoutCapability.m @@ -36,6 +36,7 @@ #import "SDLRPCParameterNames.h" NS_ASSUME_NONNULL_BEGIN + @implementation SDLKeyboardLayoutCapability - (instancetype)initWithKeyboardLayout:(SDLKeyboardLayout)keyboardLayout numConfigurableKeys:(UInt8)numConfigurableKeys { @@ -68,4 +69,4 @@ NS_ASSUME_NONNULL_BEGIN @end -NS_ASSUME_NONNULL_END
\ No newline at end of file +NS_ASSUME_NONNULL_END diff --git a/SmartDeviceLinkTests/RPCSpecs/EnumSpecs/SDLKeyboardInputMaskSpec.m b/SmartDeviceLinkTests/RPCSpecs/EnumSpecs/SDLKeyboardInputMaskSpec.m new file mode 100644 index 000000000..dd7bd708e --- /dev/null +++ b/SmartDeviceLinkTests/RPCSpecs/EnumSpecs/SDLKeyboardInputMaskSpec.m @@ -0,0 +1,23 @@ +// +// SDLAppHMITypeSpec.m +// SmartDeviceLink + + +#import <Foundation/Foundation.h> + +#import <Quick/Quick.h> +#import <Nimble/Nimble.h> + +#import "SDLKeyboardInputMask.h" + +QuickSpecBegin(SDLKeyboardInputMaskSpec) + +describe(@"individual enum value tests", ^{ + it(@"should match internal values", ^{ + expect(SDLKeyboardInputMaskEnableInputKeyMask).to(equal(@"ENABLE_INPUT_KEY_MASK")); + expect(SDLKeyboardInputMaskDisableInputKeyMask).to(equal(@"DISABLE_INPUT_KEY_MASK")); + expect(SDLKeyboardInputMaskUserChoiceInputKeyMask).to(equal(@"USER_CHOICE_INPUT_KEY_MASK")); + }); +}); + +QuickSpecEnd diff --git a/SmartDeviceLinkTests/RPCSpecs/StructSpecs/SDLKeyboardCapabilitiesSpec.m b/SmartDeviceLinkTests/RPCSpecs/StructSpecs/SDLKeyboardCapabilitiesSpec.m new file mode 100644 index 000000000..dc25aa921 --- /dev/null +++ b/SmartDeviceLinkTests/RPCSpecs/StructSpecs/SDLKeyboardCapabilitiesSpec.m @@ -0,0 +1,78 @@ +// +// SDLKeyboardCapabilitiesSpec.m +// SmartDeviceLink + + +#import <Foundation/Foundation.h> + +#import <Quick/Quick.h> +#import <Nimble/Nimble.h> + +#import "SDLKeyboardCapabilities.h" +#import "SDLRPCParameterNames.h" +#import "SDLKeyboardLayoutCapability.h" + +QuickSpecBegin(SDLKeyboardCapabilitiesSpec) + +NSNumber *maskInputCharactersSupported = @YES; +SDLKeyboardLayoutCapability *keyboardLayoutCapability = [[SDLKeyboardLayoutCapability alloc] init]; +NSArray<SDLKeyboardLayoutCapability *> *supportedKeyboards = @[keyboardLayoutCapability]; +__block SDLKeyboardCapabilities* testStruct = nil; + +describe(@"getter/setter tests", ^{ + afterEach(^{ + testStruct = nil; + }); + + context(@"init", ^{ + beforeEach(^{ + testStruct = [[SDLKeyboardCapabilities alloc] init]; + }); + + it(@"should return nil if not set", ^{ + expect(testStruct.maskInputCharactersSupported).to(beNil()); + expect(testStruct.supportedKeyboards).to(beNil()); + }); + }); + + context(@"init and assign", ^{ + beforeEach(^{ + testStruct = [[SDLKeyboardCapabilities alloc] init]; + testStruct.maskInputCharactersSupported = maskInputCharactersSupported; + testStruct.supportedKeyboards = supportedKeyboards; + }); + + it(@"expect all properties to be set properly", ^{ + expect(testStruct.maskInputCharactersSupported).to(equal(maskInputCharactersSupported)); + expect(testStruct.supportedKeyboards).to(equal(supportedKeyboards)); + }); + }); + + context(@"initWithDictionary:", ^{ + beforeEach(^{ + NSDictionary<NSString *, id> *dict = @{ + SDLRPCParameterNameMaskInputCharactersSupported: maskInputCharactersSupported, + SDLRPCParameterNameSupportedKeyboards: supportedKeyboards, + }; + testStruct = [[SDLKeyboardCapabilities alloc] initWithDictionary:dict]; + }); + + it(@"expect all properties to be set properly", ^{ + expect(testStruct.maskInputCharactersSupported).to(equal(maskInputCharactersSupported)); + expect(testStruct.supportedKeyboards).to(equal(supportedKeyboards)); + }); + }); + + context(@"initWithMaskInputCharactersSupported:supportedKeyboards:", ^{ + beforeEach(^{ + testStruct = [[SDLKeyboardCapabilities alloc] initWithMaskInputCharactersSupported:maskInputCharactersSupported supportedKeyboards:supportedKeyboards]; + }); + + it(@"expect all properties to be set properly", ^{ + expect(testStruct.maskInputCharactersSupported).to(equal(maskInputCharactersSupported)); + expect(testStruct.supportedKeyboards).to(equal(supportedKeyboards)); + }); + }); +}); + +QuickSpecEnd diff --git a/SmartDeviceLinkTests/RPCSpecs/StructSpecs/SDLKeyboardLayoutCapabilitySpec.m b/SmartDeviceLinkTests/RPCSpecs/StructSpecs/SDLKeyboardLayoutCapabilitySpec.m new file mode 100644 index 000000000..6457c6e97 --- /dev/null +++ b/SmartDeviceLinkTests/RPCSpecs/StructSpecs/SDLKeyboardLayoutCapabilitySpec.m @@ -0,0 +1,78 @@ +// +// SDLKeyboardLayoutCapabilitySpec.m +// SmartDeviceLink + + +#import <Foundation/Foundation.h> + +#import <Quick/Quick.h> +#import <Nimble/Nimble.h> + +#import "SDLKeyboardCapabilities.h" +#import "SDLKeyboardLayout.h" +#import "SDLRPCParameterNames.h" +#import "SDLKeyboardLayoutCapability.h" + +QuickSpecBegin(SDLKeyboardLayoutCapabilitySpec) + +SDLKeyboardLayout keyboardLayout = SDLKeyboardLayoutNumeric; +UInt8 numConfigurableKeys = 9; +__block SDLKeyboardLayoutCapability* testStruct = nil; + +describe(@"getter/setter tests", ^{ + afterEach(^{ + testStruct = nil; + }); + + context(@"init", ^{ + beforeEach(^{ + testStruct = [[SDLKeyboardLayoutCapability alloc] init]; + }); + + it(@"should return nil if not set", ^{ + expect(testStruct.keyboardLayout).to(beNil()); + expect(testStruct.numConfigurableKeys).to(beNil()); + }); + }); + + context(@"init and assign", ^{ + beforeEach(^{ + testStruct = [[SDLKeyboardLayoutCapability alloc] init]; + testStruct.numConfigurableKeys = @(numConfigurableKeys); + testStruct.keyboardLayout = keyboardLayout; + }); + + it(@"expect all properties to be set properly", ^{ + expect(testStruct.numConfigurableKeys).to(equal(@(numConfigurableKeys))); + expect(testStruct.keyboardLayout).to(equal(keyboardLayout)); + }); + }); + + context(@"initWithDictionary:", ^{ + beforeEach(^{ + NSDictionary<NSString *, id> *dict = @{ + SDLRPCParameterNameNumConfigurableKeys: @(numConfigurableKeys), + SDLRPCParameterNameKeyboardLayout: keyboardLayout, + }; + testStruct = [[SDLKeyboardLayoutCapability alloc] initWithDictionary:dict]; + }); + + it(@"expect all properties to be set properly", ^{ + expect(testStruct.numConfigurableKeys).to(equal(@(numConfigurableKeys))); + expect(testStruct.keyboardLayout).to(equal(keyboardLayout)); + }); + }); + + context(@"initWithKeyboardLayout:numConfigurableKeys:", ^{ + beforeEach(^{ + testStruct = [[SDLKeyboardLayoutCapability alloc] initWithKeyboardLayout:keyboardLayout numConfigurableKeys:numConfigurableKeys]; + }); + + it(@"expect all properties to be set properly", ^{ + expect(testStruct.numConfigurableKeys).to(equal(@(numConfigurableKeys))); + expect(testStruct.keyboardLayout).to(equal(keyboardLayout)); + }); + }); +}); + +QuickSpecEnd diff --git a/SmartDeviceLinkTests/RPCSpecs/StructSpecs/SDLKeyboardPropertiesSpec.m b/SmartDeviceLinkTests/RPCSpecs/StructSpecs/SDLKeyboardPropertiesSpec.m index b1f15a63f..1d3011dad 100644 --- a/SmartDeviceLinkTests/RPCSpecs/StructSpecs/SDLKeyboardPropertiesSpec.m +++ b/SmartDeviceLinkTests/RPCSpecs/StructSpecs/SDLKeyboardPropertiesSpec.m @@ -17,15 +17,17 @@ QuickSpecBegin(SDLKeyboardPropertiesSpec) -describe(@"Getter/Setter Tests", ^ { - __block SDLLanguage testLanguage = SDLLanguageDaDk; - __block SDLKeyboardLayout testLayout = SDLKeyboardLayoutAZERTY; - __block SDLKeypressMode testMode = SDLKeypressModeSingleKeypress; - __block NSArray<NSString *> *testLimitedCharacterList = @[@"s", @"r", @"f"]; - __block NSString *testAutoCompleteText = @"Auto Carrot"; - __block NSArray<NSString *> *testAutoCompleteList = @[@"Hello World", @"How are you"]; - - it(@"Should set and get correctly", ^ { +SDLLanguage testLanguage = SDLLanguageDaDk; +SDLKeyboardLayout testLayout = SDLKeyboardLayoutAZERTY; +SDLKeypressMode testMode = SDLKeypressModeSingleKeypress; +NSArray<NSString *> *testLimitedCharacterList = @[@"s", @"r", @"f"]; +NSString *testAutoCompleteText = @"Auto Carrot"; +NSArray<NSString *> *testAutoCompleteList = @[@"Hello World", @"How are you"]; +SDLKeyboardInputMask maskInputCharacters = SDLKeyboardInputMaskEnableInputKeyMask; +NSArray<NSString *> *customKeys = @[@"abc", @"DEF"]; + +describe(@"getter/setter tests", ^{ + it(@"should set and get correctly", ^{ SDLKeyboardProperties* testStruct = [[SDLKeyboardProperties alloc] init]; testStruct.language = testLanguage; @@ -33,6 +35,8 @@ describe(@"Getter/Setter Tests", ^ { testStruct.keypressMode = testMode; testStruct.limitedCharacterList = testLimitedCharacterList; testStruct.autoCompleteList = testAutoCompleteList; + testStruct.maskInputCharacters = maskInputCharacters; + testStruct.customKeys = customKeys; #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wdeprecated-declarations" testStruct.autoCompleteText = testAutoCompleteText; @@ -43,19 +47,23 @@ describe(@"Getter/Setter Tests", ^ { expect(testStruct.keypressMode).to(equal(testMode)); expect(testStruct.limitedCharacterList).to(equal(testLimitedCharacterList)); expect(testStruct.autoCompleteList).to(equal(testAutoCompleteList)); + expect(testStruct.maskInputCharacters).to(equal(maskInputCharacters)); + expect(testStruct.customKeys).to(equal(customKeys)); #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wdeprecated-declarations" expect(testStruct.autoCompleteText).to(equal(testAutoCompleteText)); #pragma clang diagnostic pop }); - it(@"Should get correctly when initialized with a dictionary", ^ { + it(@"should get correctly when initialized with a dictionary", ^{ NSDictionary* dict = @{SDLRPCParameterNameLanguage: testLanguage, SDLRPCParameterNameKeyboardLayout: testLayout, SDLRPCParameterNameKeypressMode: testMode, SDLRPCParameterNameLimitedCharacterList: testLimitedCharacterList, SDLRPCParameterNameAutoCompleteList: testAutoCompleteList, - SDLRPCParameterNameAutoCompleteText: testAutoCompleteText + SDLRPCParameterNameAutoCompleteText: testAutoCompleteText, + SDLRPCParameterNameMaskInputCharacters: maskInputCharacters, + SDLRPCParameterNameCustomKeys: customKeys, }; SDLKeyboardProperties* testStruct = [[SDLKeyboardProperties alloc] initWithDictionary:dict]; @@ -64,13 +72,15 @@ describe(@"Getter/Setter Tests", ^ { expect(testStruct.keypressMode).to(equal(testMode)); expect(testStruct.limitedCharacterList).to(equal(testLimitedCharacterList)); expect(testStruct.autoCompleteList).to(equal(testAutoCompleteList)); + expect(testStruct.maskInputCharacters).to(equal(maskInputCharacters)); + expect(testStruct.customKeys).to(equal(customKeys)); #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wdeprecated-declarations" expect(testStruct.autoCompleteText).to(equal(testAutoCompleteText)); #pragma clang diagnostic pop }); - it(@"Should get correctly when initialized with initWithLanguage:layout:keypressMode:limitedCharacterList:autoCompleteText:autoCompleteList:", ^ { + it(@"should get correctly when initialized with initWithLanguage:layout:keypressMode:limitedCharacterList:autoCompleteText:autoCompleteList:", ^{ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wdeprecated-declarations" SDLKeyboardProperties *testStruct = [[SDLKeyboardProperties alloc] initWithLanguage:testLanguage layout:testLayout keypressMode:testMode limitedCharacterList:testLimitedCharacterList autoCompleteText:testAutoCompleteText autoCompleteList:testAutoCompleteList]; @@ -79,6 +89,8 @@ describe(@"Getter/Setter Tests", ^ { expect(testStruct.keyboardLayout).to(equal(testLayout)); expect(testStruct.keypressMode).to(equal(testMode)); expect(testStruct.limitedCharacterList).to(equal(testLimitedCharacterList)); + expect(testStruct.maskInputCharacters).to(beNil()); + expect(testStruct.customKeys).to(beNil()); #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wdeprecated-declarations" expect(testStruct.autoCompleteText).to(equal(testAutoCompleteText)); @@ -86,20 +98,25 @@ describe(@"Getter/Setter Tests", ^ { expect(testStruct.autoCompleteList).to(equal(testAutoCompleteList)); }); - it(@"Should get correctly when initialized with initWithLanguage:keyboardLayout:keypressMode:limitedCharacterList:autoCompleteList:", ^ { + it(@"should get correctly when initialized with initWithLanguage:keyboardLayout:keypressMode:limitedCharacterList:autoCompleteList:", ^{ +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated-declarations" SDLKeyboardProperties *testStruct = [[SDLKeyboardProperties alloc] initWithLanguage:testLanguage keyboardLayout:testLayout keypressMode:testMode limitedCharacterList:testLimitedCharacterList autoCompleteList:testAutoCompleteList]; +#pragma clang diagnostic pop expect(testStruct.language).to(equal(testLanguage)); expect(testStruct.keyboardLayout).to(equal(testLayout)); expect(testStruct.keypressMode).to(equal(testMode)); expect(testStruct.limitedCharacterList).to(equal(testLimitedCharacterList)); expect(testStruct.autoCompleteList).to(equal(testAutoCompleteList)); + expect(testStruct.maskInputCharacters).to(beNil()); + expect(testStruct.customKeys).to(beNil()); #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wdeprecated-declarations" expect(testStruct.autoCompleteText).to(beNil()); #pragma clang diagnostic pop }); - it(@"Should return nil if not set", ^ { + it(@"should return nil if not set", ^{ SDLKeyboardProperties* testStruct = [[SDLKeyboardProperties alloc] init]; expect(testStruct.language).to(beNil()); @@ -107,11 +124,35 @@ describe(@"Getter/Setter Tests", ^ { expect(testStruct.keypressMode).to(beNil()); expect(testStruct.limitedCharacterList).to(beNil()); expect(testStruct.autoCompleteList).to(beNil()); + expect(testStruct.maskInputCharacters).to(beNil()); + expect(testStruct.customKeys).to(beNil()); #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wdeprecated-declarations" expect(testStruct.autoCompleteText).to(beNil()); #pragma clang diagnostic pop }); + + context(@"initWithLanguage:keyboardLayout:keypressMode:limitedCharacterList:autoCompleteList:maskInputCharacters:customKeys:", ^{ + __block SDLKeyboardProperties *testStruct = nil; + + beforeEach(^{ + testStruct = [[SDLKeyboardProperties alloc] initWithLanguage:testLanguage keyboardLayout:testLayout keypressMode:testMode limitedCharacterList:testLimitedCharacterList autoCompleteList:testAutoCompleteList maskInputCharacters:maskInputCharacters customKeys:customKeys]; + }); + + it(@"all properties must be set properly", ^{ + expect(testStruct.language).to(equal(testLanguage)); + expect(testStruct.keyboardLayout).to(equal(testLayout)); + expect(testStruct.keypressMode).to(equal(testMode)); + expect(testStruct.limitedCharacterList).to(equal(testLimitedCharacterList)); + expect(testStruct.autoCompleteList).to(equal(testAutoCompleteList)); + expect(testStruct.maskInputCharacters).to(equal(maskInputCharacters)); + expect(testStruct.customKeys).to(equal(customKeys)); +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated-declarations" + expect(testStruct.autoCompleteText).to(beNil()); +#pragma clang diagnostic pop + }); + }); }); QuickSpecEnd |