diff options
Diffstat (limited to 'SmartDeviceLinkTests')
63 files changed, 3216 insertions, 277 deletions
diff --git a/SmartDeviceLinkTests/DevAPISpecs/SDLMenuCellSpec.m b/SmartDeviceLinkTests/DevAPISpecs/SDLMenuCellSpec.m index b6b52f0a0..ff2ae7931 100644 --- a/SmartDeviceLinkTests/DevAPISpecs/SDLMenuCellSpec.m +++ b/SmartDeviceLinkTests/DevAPISpecs/SDLMenuCellSpec.m @@ -41,6 +41,15 @@ describe(@"a menu cell", ^{ expect(testCell.voiceCommands).to(beNil()); expect(testCell.subCells).to(equal(someSubcells)); }); + + it(@"should initialize properly as a submenu item with icon", ^{ + testCell = [[SDLMenuCell alloc] initWithTitle:someTitle icon:someArtwork subCells:someSubcells]; + + expect(testCell.title).to(equal(someTitle)); + expect(testCell.icon).to(equal(someArtwork)); + expect(testCell.voiceCommands).to(beNil()); + expect(testCell.subCells).to(equal(someSubcells)); + }); }); }); diff --git a/SmartDeviceLinkTests/DevAPISpecs/SDLMenuManagerSpec.m b/SmartDeviceLinkTests/DevAPISpecs/SDLMenuManagerSpec.m index cc6443407..f960f05ba 100644 --- a/SmartDeviceLinkTests/DevAPISpecs/SDLMenuManagerSpec.m +++ b/SmartDeviceLinkTests/DevAPISpecs/SDLMenuManagerSpec.m @@ -52,13 +52,23 @@ describe(@"menu manager", ^{ __block TestConnectionManager *mockConnectionManager = nil; __block SDLFileManager *mockFileManager = nil; - __block SDLArtwork *testArtwork = [[SDLArtwork alloc] initWithData:[@"Test data" dataUsingEncoding:NSUTF8StringEncoding] name:@"some artwork name" fileExtension:@"png" persistent:NO]; + __block SDLArtwork *testArtwork = nil; + __block SDLArtwork *testArtwork2 = nil; - __block SDLMenuCell *textOnlyCell = [[SDLMenuCell alloc] initWithTitle:@"Test 1" icon:nil voiceCommands:nil handler:^(SDLTriggerSource _Nonnull triggerSource) {}]; - __block SDLMenuCell *textAndImageCell = [[SDLMenuCell alloc] initWithTitle:@"Test 2" icon:testArtwork voiceCommands:nil handler:^(SDLTriggerSource _Nonnull triggerSource) {}]; - __block SDLMenuCell *submenuCell = [[SDLMenuCell alloc] initWithTitle:@"Test 3" subCells:@[textOnlyCell, textAndImageCell]]; + __block SDLMenuCell *textOnlyCell = nil; + __block SDLMenuCell *textAndImageCell = nil; + __block SDLMenuCell *submenuCell = nil; + __block SDLMenuCell *submenuImageCell = nil; beforeEach(^{ + testArtwork = [[SDLArtwork alloc] initWithData:[@"Test data" dataUsingEncoding:NSUTF8StringEncoding] name:@"some artwork name" fileExtension:@"png" persistent:NO]; + testArtwork2 = [[SDLArtwork alloc] initWithData:[@"Test data 2" dataUsingEncoding:NSUTF8StringEncoding] name:@"some artwork name 2" fileExtension:@"png" persistent:NO]; + + textOnlyCell = [[SDLMenuCell alloc] initWithTitle:@"Test 1" icon:nil voiceCommands:nil handler:^(SDLTriggerSource _Nonnull triggerSource) {}]; + textAndImageCell = [[SDLMenuCell alloc] initWithTitle:@"Test 2" icon:testArtwork voiceCommands:nil handler:^(SDLTriggerSource _Nonnull triggerSource) {}]; + submenuCell = [[SDLMenuCell alloc] initWithTitle:@"Test 3" subCells:@[textOnlyCell, textAndImageCell]]; + submenuImageCell = [[SDLMenuCell alloc] initWithTitle:@"Test 4" icon:testArtwork2 subCells:@[textOnlyCell]]; + mockConnectionManager = [[TestConnectionManager alloc] init]; mockFileManager = OCMClassMock([SDLFileManager class]); testManager = [[SDLMenuManager alloc] initWithConnectionManager:mockConnectionManager fileManager:mockFileManager]; @@ -195,14 +205,20 @@ describe(@"menu manager", ^{ }); it(@"should properly update an image cell", ^{ - testManager.menuCells = @[textAndImageCell]; + testManager.menuCells = @[textAndImageCell, submenuImageCell]; NSPredicate *addCommandPredicate = [NSPredicate predicateWithFormat:@"self isMemberOfClass: %@", [SDLAddCommand class]]; NSArray *add = [[mockConnectionManager.receivedRequests copy] filteredArrayUsingPredicate:addCommandPredicate]; SDLAddCommand *sentCommand = add.firstObject; + NSPredicate *addSubmenuPredicate = [NSPredicate predicateWithFormat:@"self isMemberOfClass: %@", [SDLAddSubMenu class]]; + NSArray *submenu = [[mockConnectionManager.receivedRequests copy] filteredArrayUsingPredicate:addSubmenuPredicate]; + SDLAddSubMenu *sentSubmenu = submenu.firstObject; + expect(add).to(haveCount(1)); + expect(submenu).to(haveCount(1)); expect(sentCommand.cmdIcon.value).to(equal(testArtwork.name)); + expect(sentSubmenu.menuIcon.value).to(equal(testArtwork2.name)); }); }); @@ -212,14 +228,20 @@ describe(@"menu manager", ^{ }); it(@"should immediately attempt to update without the image", ^{ - testManager.menuCells = @[textAndImageCell]; + testManager.menuCells = @[textAndImageCell, submenuImageCell]; NSPredicate *addCommandPredicate = [NSPredicate predicateWithFormat:@"self isMemberOfClass: %@", [SDLAddCommand class]]; NSArray *add = [[mockConnectionManager.receivedRequests copy] filteredArrayUsingPredicate:addCommandPredicate]; SDLAddCommand *sentCommand = add.firstObject; + NSPredicate *addSubmenuPredicate = [NSPredicate predicateWithFormat:@"self isMemberOfClass: %@", [SDLAddSubMenu class]]; + NSArray *submenu = [[mockConnectionManager.receivedRequests copy] filteredArrayUsingPredicate:addSubmenuPredicate]; + SDLAddSubMenu *sentSubmenu = submenu.firstObject; + expect(add).to(haveCount(1)); + expect(submenu).to(haveCount(1)); expect(sentCommand.cmdIcon.value).to(beNil()); + expect(sentSubmenu.menuIcon.value).to(beNil()); }); }); }); diff --git a/SmartDeviceLinkTests/DevAPISpecs/SDLNotificationDispatcherSpec.m b/SmartDeviceLinkTests/DevAPISpecs/SDLNotificationDispatcherSpec.m index fa53d0de8..47fc3ec74 100644 --- a/SmartDeviceLinkTests/DevAPISpecs/SDLNotificationDispatcherSpec.m +++ b/SmartDeviceLinkTests/DevAPISpecs/SDLNotificationDispatcherSpec.m @@ -53,6 +53,7 @@ describe(@"a notification dispatcher", ^{ expect(@([testDispatcher respondsToSelector:@selector(onOnLanguageChange:)])).to(beTruthy()); expect(@([testDispatcher respondsToSelector:@selector(onOnLockScreenNotification:)])).to(beTruthy()); expect(@([testDispatcher respondsToSelector:@selector(onOnSyncPData:)])).to(beTruthy()); + expect(@([testDispatcher respondsToSelector:@selector(onOnRCStatus:)])).to(beTruthy()); expect(@([testDispatcher respondsToSelector:@selector(onOnSystemRequest:)])).to(beTruthy()); expect(@([testDispatcher respondsToSelector:@selector(onOnTBTClientState:)])).to(beTruthy()); expect(@([testDispatcher respondsToSelector:@selector(onOnTouchEvent:)])).to(beTruthy()); diff --git a/SmartDeviceLinkTests/DevAPISpecs/SDLSoftButtonManagerSpec.m b/SmartDeviceLinkTests/DevAPISpecs/SDLSoftButtonManagerSpec.m index 7eaad7142..17be53b19 100644 --- a/SmartDeviceLinkTests/DevAPISpecs/SDLSoftButtonManagerSpec.m +++ b/SmartDeviceLinkTests/DevAPISpecs/SDLSoftButtonManagerSpec.m @@ -24,23 +24,23 @@ @interface SDLSoftButtonManager() +@property (strong, nonatomic) NSArray<SDLSoftButton *> *currentSoftButtons; + @property (weak, nonatomic) id<SDLConnectionManagerType> connectionManager; @property (weak, nonatomic) SDLFileManager *fileManager; -@property (strong, nonatomic) NSArray<SDLSoftButton *> *currentSoftButtons; - @property (strong, nonatomic, nullable) SDLShow *inProgressUpdate; @property (copy, nonatomic, nullable) SDLSoftButtonUpdateCompletionHandler inProgressHandler; -@property (strong, nonatomic, nullable) SDLShow *queuedImageUpdate; @property (assign, nonatomic) BOOL hasQueuedUpdate; @property (copy, nonatomic, nullable) SDLSoftButtonUpdateCompletionHandler queuedUpdateHandler; -@property (strong, nonatomic, nullable) SDLHMILevel currentLevel; -@property (assign, nonatomic) BOOL waitingOnHMILevelUpdateToSetButtons; +@property (copy, nonatomic, nullable) SDLHMILevel currentLevel; @property (strong, nonatomic, nullable) SDLDisplayCapabilities *displayCapabilities; @property (strong, nonatomic, nullable) SDLSoftButtonCapabilities *softButtonCapabilities; +@property (assign, nonatomic) BOOL waitingOnHMILevelUpdateToUpdate; + @end QuickSpecBegin(SDLSoftButtonManagerSpec) @@ -91,22 +91,22 @@ describe(@"a soft button manager", ^{ expect(testManager.hasQueuedUpdate).to(beFalse()); expect(testManager.displayCapabilities).to(beNil()); expect(testManager.softButtonCapabilities).to(beNil()); - expect(testManager.waitingOnHMILevelUpdateToSetButtons).to(beFalse()); + expect(testManager.waitingOnHMILevelUpdateToUpdate).to(beFalse()); }); context(@"when in HMI NONE", ^{ beforeEach(^{ testManager.currentLevel = SDLHMILevelNone; - NSString *sameName = @"Same name"; - testObject1 = [[SDLSoftButtonObject alloc] initWithName:sameName states:@[object1State1, object1State2] initialStateName:object1State1Name handler:nil]; - testObject2 = [[SDLSoftButtonObject alloc] initWithName:sameName state:object2State1 handler:nil]; + testObject1 = [[SDLSoftButtonObject alloc] initWithName:@"name1" states:@[object1State1, object1State2] initialStateName:object1State1Name handler:nil]; + testObject2 = [[SDLSoftButtonObject alloc] initWithName:@"name2" state:object2State1 handler:nil]; testManager.softButtonObjects = @[testObject1, testObject2]; }); - it(@"should not set the soft buttons", ^{ - expect(testManager.waitingOnHMILevelUpdateToSetButtons).to(beTrue()); + it(@"should set the soft buttons, but not update", ^{ + expect(testManager.softButtonObjects).toNot(beEmpty()); + expect(testManager.waitingOnHMILevelUpdateToUpdate).to(beTrue()); expect(testManager.inProgressUpdate).to(beNil()); }); }); @@ -115,15 +115,15 @@ describe(@"a soft button manager", ^{ beforeEach(^{ testManager.currentLevel = nil; - NSString *sameName = @"Same name"; - testObject1 = [[SDLSoftButtonObject alloc] initWithName:sameName states:@[object1State1, object1State2] initialStateName:object1State1Name handler:nil]; - testObject2 = [[SDLSoftButtonObject alloc] initWithName:sameName state:object2State1 handler:nil]; + testObject1 = [[SDLSoftButtonObject alloc] initWithName:@"name1" states:@[object1State1, object1State2] initialStateName:object1State1Name handler:nil]; + testObject2 = [[SDLSoftButtonObject alloc] initWithName:@"name2" state:object2State1 handler:nil]; testManager.softButtonObjects = @[testObject1, testObject2]; }); - it(@"should not set the soft buttons", ^{ - expect(testManager.waitingOnHMILevelUpdateToSetButtons).to(beTrue()); + it(@"should set the soft buttons, but not update", ^{ + expect(testManager.softButtonObjects).toNot(beEmpty()); + expect(testManager.waitingOnHMILevelUpdateToUpdate).to(beTrue()); expect(testManager.inProgressUpdate).to(beNil()); }); }); @@ -359,7 +359,7 @@ describe(@"a soft button manager", ^{ expect(testManager.currentLevel).to(beNil()); expect(testManager.displayCapabilities).to(beNil()); expect(testManager.softButtonCapabilities).to(beNil()); - expect(testManager.waitingOnHMILevelUpdateToSetButtons).to(beFalse()); + expect(testManager.waitingOnHMILevelUpdateToUpdate).to(beFalse()); }); }); }); diff --git a/SmartDeviceLinkTests/DevAPISpecs/SDLStreamingAudioLifecycleManagerSpec.m b/SmartDeviceLinkTests/DevAPISpecs/SDLStreamingAudioLifecycleManagerSpec.m new file mode 100644 index 000000000..af2317ca9 --- /dev/null +++ b/SmartDeviceLinkTests/DevAPISpecs/SDLStreamingAudioLifecycleManagerSpec.m @@ -0,0 +1,401 @@ +#import <Quick/Quick.h> +#import <Nimble/Nimble.h> +#import <OCMock/OCMock.h> + +#import "SDLControlFramePayloadAudioStartServiceAck.h" +#import "SDLDisplayCapabilities.h" +#import "SDLGlobals.h" +#import "SDLImageResolution.h" +#import "SDLOnHMIStatus.h" +#import "SDLProtocol.h" +#import "SDLRegisterAppInterfaceResponse.h" +#import "SDLRPCNotificationNotification.h" +#import "SDLRPCResponseNotification.h" +#import "SDLScreenParams.h" +#import "SDLStateMachine.h" +#import "SDLStreamingAudioLifecycleManager.h" +#import "SDLStreamingMediaConfiguration.h" +#import "SDLV2ProtocolHeader.h" +#import "SDLV2ProtocolMessage.h" +#import "TestConnectionManager.h" + +QuickSpecBegin(SDLStreamingAudioLifecycleManagerSpec) + +describe(@"the streaming audio manager", ^{ + __block SDLStreamingAudioLifecycleManager *streamingLifecycleManager = nil; + __block SDLStreamingMediaConfiguration *testConfiguration = [SDLStreamingMediaConfiguration insecureConfiguration]; + __block TestConnectionManager *testConnectionManager = nil; + + __block void (^sendNotificationForHMILevel)(SDLHMILevel hmiLevel) = ^(SDLHMILevel hmiLevel) { + SDLOnHMIStatus *hmiStatus = [[SDLOnHMIStatus alloc] init]; + hmiStatus.hmiLevel = hmiLevel; + SDLRPCNotificationNotification *notification = [[SDLRPCNotificationNotification alloc] initWithName:SDLDidChangeHMIStatusNotification object:self rpcNotification:hmiStatus]; + [[NSNotificationCenter defaultCenter] postNotification:notification]; + + [NSThread sleepForTimeInterval:0.3]; + }; + + beforeEach(^{ + testConnectionManager = [[TestConnectionManager alloc] init]; + streamingLifecycleManager = [[SDLStreamingAudioLifecycleManager alloc] initWithConnectionManager:testConnectionManager configuration:testConfiguration]; + }); + + it(@"should initialize properties", ^{ + expect(streamingLifecycleManager.audioManager).toNot(beNil()); + expect(@(streamingLifecycleManager.isStreamingSupported)).to(equal(@NO)); + expect(@(streamingLifecycleManager.isAudioConnected)).to(equal(@NO)); + expect(@(streamingLifecycleManager.isAudioEncrypted)).to(equal(@NO)); + expect(@(streamingLifecycleManager.requestedEncryptionType)).to(equal(@(SDLStreamingEncryptionFlagNone))); + expect(streamingLifecycleManager.currentAppState).to(equal(SDLAppStateActive)); + expect(streamingLifecycleManager.currentAudioStreamState).to(equal(SDLAudioStreamManagerStateStopped)); + }); + + describe(@"when started", ^{ + __block BOOL readyHandlerSuccess = NO; + __block NSError *readyHandlerError = nil; + + __block SDLProtocol *protocolMock = OCMClassMock([SDLProtocol class]); + + beforeEach(^{ + readyHandlerSuccess = NO; + readyHandlerError = nil; + + [streamingLifecycleManager startWithProtocol:protocolMock]; + }); + + it(@"should be ready to stream", ^{ + expect(@(streamingLifecycleManager.isStreamingSupported)).to(equal(@NO)); + expect(@(streamingLifecycleManager.isAudioConnected)).to(equal(@NO)); + expect(@(streamingLifecycleManager.isAudioEncrypted)).to(equal(@NO)); + expect(streamingLifecycleManager.currentAppState).to(equal(SDLAppStateActive)); + expect(streamingLifecycleManager.currentAudioStreamState).to(match(SDLAudioStreamManagerStateStopped)); + }); + + describe(@"after receiving a register app interface notification", ^{ + __block SDLRegisterAppInterfaceResponse *someRegisterAppInterfaceResponse = nil; + __block SDLDisplayCapabilities *someDisplayCapabilities = nil; + __block SDLScreenParams *someScreenParams = nil; + __block SDLImageResolution *someImageResolution = nil; + + beforeEach(^{ + someImageResolution = [[SDLImageResolution alloc] init]; + someImageResolution.resolutionWidth = @(600); + someImageResolution.resolutionHeight = @(100); + + someScreenParams = [[SDLScreenParams alloc] init]; + someScreenParams.resolution = someImageResolution; + }); + + context(@"that does not support graphics", ^{ + beforeEach(^{ + someDisplayCapabilities = [[SDLDisplayCapabilities alloc] init]; + someDisplayCapabilities.graphicSupported = @NO; + + someDisplayCapabilities.screenParams = someScreenParams; + + someRegisterAppInterfaceResponse = [[SDLRegisterAppInterfaceResponse alloc] init]; + someRegisterAppInterfaceResponse.displayCapabilities = someDisplayCapabilities; + SDLRPCResponseNotification *notification = [[SDLRPCResponseNotification alloc] initWithName:SDLDidReceiveRegisterAppInterfaceResponse object:self rpcResponse:someRegisterAppInterfaceResponse]; + + [[NSNotificationCenter defaultCenter] postNotification:notification]; + [NSThread sleepForTimeInterval:0.1]; + }); + + it(@"should not support streaming", ^{ + expect(@(streamingLifecycleManager.isStreamingSupported)).to(equal(@NO)); + }); + }); + + context(@"that supports graphics", ^{ + beforeEach(^{ + someDisplayCapabilities = [[SDLDisplayCapabilities alloc] init]; + someDisplayCapabilities.graphicSupported = @YES; + + someDisplayCapabilities.screenParams = someScreenParams; + + someRegisterAppInterfaceResponse = [[SDLRegisterAppInterfaceResponse alloc] init]; + someRegisterAppInterfaceResponse.displayCapabilities = someDisplayCapabilities; + SDLRPCResponseNotification *notification = [[SDLRPCResponseNotification alloc] initWithName:SDLDidReceiveRegisterAppInterfaceResponse object:self rpcResponse:someRegisterAppInterfaceResponse]; + + [[NSNotificationCenter defaultCenter] postNotification:notification]; + [NSThread sleepForTimeInterval:0.1]; + }); + + it(@"should support streaming", ^{ + expect(@(streamingLifecycleManager.isStreamingSupported)).to(equal(@YES)); + }); + }); + }); + + describe(@"if the app state is active", ^{ + __block id streamStub = nil; + + beforeEach(^{ + streamStub = OCMPartialMock(streamingLifecycleManager); + + OCMStub([streamStub isStreamingSupported]).andReturn(YES); + + [streamingLifecycleManager.appStateMachine setToState:SDLAppStateActive fromOldState:nil callEnterTransition:NO]; + }); + + describe(@"and the streams are open", ^{ + beforeEach(^{ + [streamingLifecycleManager.audioStreamStateMachine setToState:SDLAudioStreamManagerStateReady fromOldState:nil callEnterTransition:NO]; + }); + + describe(@"and the hmi state is limited", ^{ + beforeEach(^{ + streamingLifecycleManager.hmiLevel = SDLHMILevelLimited; + }); + + describe(@"and the hmi state changes to", ^{ + context(@"none", ^{ + beforeEach(^{ + sendNotificationForHMILevel(SDLHMILevelNone); + }); + + it(@"should close the streams", ^{ + expect(streamingLifecycleManager.currentAudioStreamState).to(equal(SDLAudioStreamManagerStateShuttingDown)); + }); + }); + + context(@"background", ^{ + beforeEach(^{ + sendNotificationForHMILevel(SDLHMILevelBackground); + }); + + it(@"should close the stream", ^{ + expect(streamingLifecycleManager.currentAudioStreamState).to(equal(SDLAudioStreamManagerStateShuttingDown)); + }); + }); + + context(@"limited", ^{ + beforeEach(^{ + sendNotificationForHMILevel(SDLHMILevelLimited); + }); + + it(@"should not close the stream", ^{ + expect(streamingLifecycleManager.currentAudioStreamState).to(equal(SDLAudioStreamManagerStateReady)); + }); + }); + + context(@"full", ^{ + beforeEach(^{ + sendNotificationForHMILevel(SDLHMILevelFull); + }); + + it(@"should not close the stream", ^{ + expect(streamingLifecycleManager.currentAudioStreamState).to(equal(SDLAudioStreamManagerStateReady)); + }); + }); + }); + + describe(@"and the app state changes to", ^{ + context(@"inactive", ^{ + beforeEach(^{ + [streamingLifecycleManager.appStateMachine setToState:SDLAppStateInactive fromOldState:nil callEnterTransition:YES]; + }); + + it(@"should suspend the video stream", ^{ + expect(streamingLifecycleManager.currentAudioStreamState).to(equal(SDLAudioStreamManagerStateShuttingDown)); + }); + }); + }); + }); + + describe(@"and the hmi state is full", ^{ + beforeEach(^{ + streamingLifecycleManager.hmiLevel = SDLHMILevelFull; + }); + + context(@"and hmi state changes to none", ^{ + beforeEach(^{ + sendNotificationForHMILevel(SDLHMILevelNone); + }); + + it(@"should close the streams", ^{ + expect(streamingLifecycleManager.currentAudioStreamState).to(equal(SDLAudioStreamManagerStateShuttingDown)); + }); + }); + + context(@"and hmi state changes to background", ^{ + beforeEach(^{ + sendNotificationForHMILevel(SDLHMILevelBackground); + }); + + it(@"should close the stream", ^{ + expect(streamingLifecycleManager.currentAudioStreamState).to(equal(SDLAudioStreamManagerStateShuttingDown)); + }); + }); + + context(@"and hmi state changes to limited", ^{ + beforeEach(^{ + sendNotificationForHMILevel(SDLHMILevelLimited); + }); + + it(@"should not close the stream", ^{ + expect(streamingLifecycleManager.currentAudioStreamState).to(equal(SDLAudioStreamManagerStateReady)); + }); + }); + + context(@"and hmi state changes to full", ^{ + beforeEach(^{ + sendNotificationForHMILevel(SDLHMILevelFull); + }); + + it(@"should not close the stream", ^{ + expect(streamingLifecycleManager.currentAudioStreamState).to(equal(SDLAudioStreamManagerStateReady)); + }); + }); + }); + }); + + describe(@"and the streams are closed", ^{ + beforeEach(^{ + [streamingLifecycleManager.audioStreamStateMachine setToState:SDLAudioStreamManagerStateStopped fromOldState:nil callEnterTransition:NO]; + }); + + describe(@"and the hmi state is none", ^{ + beforeEach(^{ + streamingLifecycleManager.hmiLevel = SDLHMILevelNone; + }); + + context(@"and hmi state changes to none", ^{ + beforeEach(^{ + sendNotificationForHMILevel(SDLHMILevelNone); + }); + + it(@"should not start the stream", ^{ + expect(streamingLifecycleManager.currentAudioStreamState).to(equal(SDLAudioStreamManagerStateStopped)); + }); + }); + + context(@"and hmi state changes to background", ^{ + beforeEach(^{ + sendNotificationForHMILevel(SDLHMILevelBackground); + }); + + it(@"should not start the stream", ^{ + expect(streamingLifecycleManager.currentAudioStreamState).to(equal(SDLAudioStreamManagerStateStopped)); + }); + }); + + context(@"and hmi state changes to limited", ^{ + beforeEach(^{ + sendNotificationForHMILevel(SDLHMILevelLimited); + }); + + it(@"should start the streams", ^{ + expect(streamingLifecycleManager.currentAudioStreamState).to(equal(SDLAudioStreamManagerStateStarting)); + }); + }); + + context(@"and hmi state changes to full", ^{ + beforeEach(^{ + sendNotificationForHMILevel(SDLHMILevelFull); + }); + + it(@"should start the streams", ^{ + expect(streamingLifecycleManager.currentAudioStreamState).to(equal(SDLAudioStreamManagerStateStarting)); + }); + }); + }); + }); + }); + + describe(@"after receiving an Audio Start ACK", ^{ + __block SDLProtocolHeader *testAudioHeader = nil; + __block SDLProtocolMessage *testAudioMessage = nil; + __block SDLControlFramePayloadAudioStartServiceAck *testAudioStartServicePayload = nil; + __block int64_t testMTU = 786579; + + beforeEach(^{ + [streamingLifecycleManager.audioStreamStateMachine setToState:SDLAudioStreamManagerStateStarting fromOldState:nil callEnterTransition:NO]; + + testAudioHeader = [[SDLV2ProtocolHeader alloc] initWithVersion:5]; + testAudioHeader.frameType = SDLFrameTypeSingle; + testAudioHeader.frameData = SDLFrameInfoStartServiceACK; + testAudioHeader.encrypted = YES; + testAudioHeader.serviceType = SDLServiceTypeAudio; + + testAudioStartServicePayload = [[SDLControlFramePayloadAudioStartServiceAck alloc] initWithMTU:testMTU]; + testAudioMessage = [[SDLV2ProtocolMessage alloc] initWithHeader:testAudioHeader andPayload:testAudioStartServicePayload.data]; + [streamingLifecycleManager handleProtocolStartServiceACKMessage:testAudioMessage]; + }); + + it(@"should have set all the right properties", ^{ + expect([[SDLGlobals sharedGlobals] mtuSizeForServiceType:SDLServiceTypeAudio]).to(equal(testMTU)); + expect(streamingLifecycleManager.audioEncrypted).to(equal(YES)); + expect(streamingLifecycleManager.currentAudioStreamState).to(equal(SDLAudioStreamManagerStateReady)); + }); + }); + + describe(@"after receiving an Audio Start NAK", ^{ + __block SDLProtocolHeader *testAudioHeader = nil; + __block SDLProtocolMessage *testAudioMessage = nil; + + beforeEach(^{ + [streamingLifecycleManager.audioStreamStateMachine setToState:SDLAudioStreamManagerStateStarting fromOldState:nil callEnterTransition:NO]; + + testAudioHeader = [[SDLV2ProtocolHeader alloc] initWithVersion:5]; + testAudioHeader.frameType = SDLFrameTypeSingle; + testAudioHeader.frameData = SDLFrameInfoStartServiceNACK; + testAudioHeader.encrypted = NO; + testAudioHeader.serviceType = SDLServiceTypeAudio; + + testAudioMessage = [[SDLV2ProtocolMessage alloc] initWithHeader:testAudioHeader andPayload:nil]; + [streamingLifecycleManager handleProtocolEndServiceACKMessage:testAudioMessage]; + }); + + it(@"should have set all the right properties", ^{ + expect(streamingLifecycleManager.currentAudioStreamState).to(equal(SDLAudioStreamManagerStateStopped)); + }); + }); + + describe(@"after receiving a audio end ACK", ^{ + __block SDLProtocolHeader *testAudioHeader = nil; + __block SDLProtocolMessage *testAudioMessage = nil; + + beforeEach(^{ + [streamingLifecycleManager.audioStreamStateMachine setToState:SDLAudioStreamManagerStateStarting fromOldState:nil callEnterTransition:NO]; + + testAudioHeader = [[SDLV2ProtocolHeader alloc] initWithVersion:5]; + testAudioHeader.frameType = SDLFrameTypeSingle; + testAudioHeader.frameData = SDLFrameInfoEndServiceACK; + testAudioHeader.encrypted = NO; + testAudioHeader.serviceType = SDLServiceTypeAudio; + + testAudioMessage = [[SDLV2ProtocolMessage alloc] initWithHeader:testAudioHeader andPayload:nil]; + [streamingLifecycleManager handleProtocolEndServiceACKMessage:testAudioMessage]; + }); + + it(@"should have set all the right properties", ^{ + expect(streamingLifecycleManager.currentAudioStreamState).to(equal(SDLAudioStreamManagerStateStopped)); + }); + }); + + describe(@"after receiving a audio end NAK", ^{ + __block SDLProtocolHeader *testAudioHeader = nil; + __block SDLProtocolMessage *testAudioMessage = nil; + + beforeEach(^{ + [streamingLifecycleManager.audioStreamStateMachine setToState:SDLAudioStreamManagerStateStarting fromOldState:nil callEnterTransition:NO]; + + testAudioHeader = [[SDLV2ProtocolHeader alloc] initWithVersion:5]; + testAudioHeader.frameType = SDLFrameTypeSingle; + testAudioHeader.frameData = SDLFrameInfoEndServiceNACK; + testAudioHeader.encrypted = NO; + testAudioHeader.serviceType = SDLServiceTypeAudio; + + testAudioMessage = [[SDLV2ProtocolMessage alloc] initWithHeader:testAudioHeader andPayload:nil]; + [streamingLifecycleManager handleProtocolEndServiceNAKMessage:testAudioMessage]; + }); + + it(@"should have set all the right properties", ^{ + expect(streamingLifecycleManager.currentAudioStreamState).to(equal(SDLAudioStreamManagerStateStopped)); + }); + }); + }); +}); + +QuickSpecEnd diff --git a/SmartDeviceLinkTests/SDLStreamingVideoLifecycleManagerSpec.m b/SmartDeviceLinkTests/DevAPISpecs/SDLStreamingVideoLifecycleManagerSpec.m index 81c9d97ad..33062b9db 100644 --- a/SmartDeviceLinkTests/SDLStreamingVideoLifecycleManagerSpec.m +++ b/SmartDeviceLinkTests/DevAPISpecs/SDLStreamingVideoLifecycleManagerSpec.m @@ -1,49 +1,40 @@ -// -// SDLStreamingVideoLifecycleManagerSpec.m -// SmartDeviceLink-iOS -// - #import <Quick/Quick.h> #import <Nimble/Nimble.h> #import <OCMock/OCMock.h> #import "SDLCarWindowViewController.h" -#import "SDLConnectionManagerType.h" #import "SDLControlFramePayloadConstants.h" #import "SDLControlFramePayloadNak.h" +#import "SDLControlFramePayloadVideoStartService.h" #import "SDLControlFramePayloadVideoStartServiceAck.h" #import "SDLDisplayCapabilities.h" -#import "SDLGenericResponse.h" +#import "SDLFakeStreamingManagerDataSource.h" +#import "SDLFocusableItemLocator.h" #import "SDLGetSystemCapability.h" #import "SDLGetSystemCapabilityResponse.h" +#import "SDLGenericResponse.h" #import "SDLGlobals.h" -#import "SDLFocusableItemLocatorType.h" -#import "SDLFocusableItemLocator.h" #import "SDLHMILevel.h" #import "SDLImageResolution.h" -#import "SDLNotificationConstants.h" #import "SDLOnHMIStatus.h" #import "SDLProtocol.h" -#import "SDLRPCNotificationNotification.h" #import "SDLRegisterAppInterfaceResponse.h" +#import "SDLRPCNotificationNotification.h" #import "SDLRPCResponseNotification.h" #import "SDLScreenParams.h" #import "SDLStateMachine.h" #import "SDLStreamingMediaConfiguration.h" #import "SDLStreamingVideoLifecycleManager.h" -#import "SDLFakeStreamingManagerDataSource.h" #import "SDLSystemCapability.h" #import "SDLV2ProtocolHeader.h" #import "SDLV2ProtocolMessage.h" #import "SDLVideoStreamingCapability.h" -#import "SDLVideoStreamingCodec.h" -#import "SDLVideoStreamingFormat.h" -#import "SDLVideoStreamingProtocol.h" +#import "SDLVideoStreamingState.h" #import "TestConnectionManager.h" QuickSpecBegin(SDLStreamingVideoLifecycleManagerSpec) -describe(@"the streaming media manager", ^{ +describe(@"the streaming video manager", ^{ __block SDLStreamingVideoLifecycleManager *streamingLifecycleManager = nil; __block SDLStreamingMediaConfiguration *testConfiguration = [SDLStreamingMediaConfiguration insecureConfiguration]; __block SDLCarWindowViewController *testViewController = [[SDLCarWindowViewController alloc] init]; @@ -51,9 +42,10 @@ describe(@"the streaming media manager", ^{ __block NSString *someBackgroundTitleString = nil; __block TestConnectionManager *testConnectionManager = nil; - __block void (^sendNotificationForHMILevel)(SDLHMILevel hmiLevel) = ^(SDLHMILevel hmiLevel) { + __block void (^sendNotificationForHMILevel)(SDLHMILevel hmiLevel, SDLVideoStreamingState streamState) = ^(SDLHMILevel hmiLevel, SDLVideoStreamingState streamState) { SDLOnHMIStatus *hmiStatus = [[SDLOnHMIStatus alloc] init]; hmiStatus.hmiLevel = hmiLevel; + hmiStatus.videoStreamingState = streamState; SDLRPCNotificationNotification *notification = [[SDLRPCNotificationNotification alloc] initWithName:SDLDidChangeHMIStatusNotification object:self rpcNotification:hmiStatus]; [[NSNotificationCenter defaultCenter] postNotification:notification]; @@ -82,7 +74,7 @@ describe(@"the streaming media manager", ^{ expect(@(streamingLifecycleManager.pixelBufferPool == NULL)).to(equal(@YES)); expect(@(streamingLifecycleManager.requestedEncryptionType)).to(equal(@(SDLStreamingEncryptionFlagNone))); expect(streamingLifecycleManager.currentAppState).to(equal(SDLAppStateActive)); - expect(streamingLifecycleManager.currentVideoStreamState).to(equal(SDLVideoStreamStateStopped)); + expect(streamingLifecycleManager.currentVideoStreamState).to(equal(SDLVideoStreamManagerStateStopped)); expect(streamingLifecycleManager.videoFormat).to(beNil()); expect(streamingLifecycleManager.dataSource).to(equal(testDataSource)); expect(streamingLifecycleManager.supportedFormats).to(haveCount(2)); @@ -96,7 +88,7 @@ describe(@"the streaming media manager", ^{ __block BOOL readyHandlerSuccess = NO; __block NSError *readyHandlerError = nil; - __block id protocolMock = OCMClassMock([SDLProtocol class]); + __block SDLProtocol *protocolMock = OCMClassMock([SDLProtocol class]); beforeEach(^{ readyHandlerSuccess = NO; @@ -113,7 +105,7 @@ describe(@"the streaming media manager", ^{ expect(@(CGSizeEqualToSize(streamingLifecycleManager.screenSize, CGSizeZero))).to(equal(@YES)); expect(@(streamingLifecycleManager.pixelBufferPool == NULL)).to(equal(@YES)); expect(streamingLifecycleManager.currentAppState).to(equal(SDLAppStateActive)); - expect(streamingLifecycleManager.currentVideoStreamState).to(match(SDLVideoStreamStateStopped)); + expect(streamingLifecycleManager.currentVideoStreamState).to(match(SDLVideoStreamManagerStateStopped)); }); describe(@"after receiving a register app interface notification", ^{ @@ -174,22 +166,21 @@ describe(@"the streaming media manager", ^{ }); describe(@"if the app state is active", ^{ - __block id streamStub = nil; + __block SDLStreamingVideoLifecycleManager *streamStub = nil; beforeEach(^{ streamStub = OCMPartialMock(streamingLifecycleManager); - OCMStub([streamStub isStreamingSupported]).andReturn(YES); [streamingLifecycleManager.appStateMachine setToState:SDLAppStateActive fromOldState:nil callEnterTransition:NO]; }); - describe(@"and video stream is open", ^{ + context(@"and the stream is open", ^{ beforeEach(^{ - [streamingLifecycleManager.videoStreamStateMachine setToState:SDLVideoStreamStateReady fromOldState:nil callEnterTransition:NO]; + [streamingLifecycleManager.videoStreamStateMachine setToState:SDLVideoStreamManagerStateReady fromOldState:nil callEnterTransition:NO]; }); - describe(@"and the hmi state is limited", ^{ + context(@"and the hmi state is limited", ^{ beforeEach(^{ streamingLifecycleManager.hmiLevel = SDLHMILevelLimited; }); @@ -197,41 +188,51 @@ describe(@"the streaming media manager", ^{ describe(@"and the hmi state changes to", ^{ context(@"none", ^{ beforeEach(^{ - sendNotificationForHMILevel(SDLHMILevelNone); + sendNotificationForHMILevel(SDLHMILevelNone, SDLVideoStreamingStateStreamable); }); - it(@"should close video stream", ^{ - expect(streamingLifecycleManager.currentVideoStreamState).to(equal(SDLVideoStreamStateShuttingDown)); + it(@"should close the stream", ^{ + expect(streamingLifecycleManager.currentVideoStreamState).to(equal(SDLVideoStreamManagerStateShuttingDown)); }); }); context(@"background", ^{ beforeEach(^{ - sendNotificationForHMILevel(SDLHMILevelBackground); + sendNotificationForHMILevel(SDLHMILevelBackground, SDLVideoStreamingStateStreamable); }); - it(@"should close video stream", ^{ - expect(streamingLifecycleManager.currentVideoStreamState).to(equal(SDLVideoStreamStateShuttingDown)); + it(@"should close the stream", ^{ + expect(streamingLifecycleManager.currentVideoStreamState).to(equal(SDLVideoStreamManagerStateShuttingDown)); }); }); context(@"limited", ^{ beforeEach(^{ - sendNotificationForHMILevel(SDLHMILevelLimited); + sendNotificationForHMILevel(SDLHMILevelLimited, SDLVideoStreamingStateStreamable); }); - it(@"should not close video stream", ^{ - expect(streamingLifecycleManager.currentVideoStreamState).to(equal(SDLVideoStreamStateReady)); + it(@"should not close the stream", ^{ + expect(streamingLifecycleManager.currentVideoStreamState).to(equal(SDLVideoStreamManagerStateReady)); }); }); context(@"full", ^{ beforeEach(^{ - sendNotificationForHMILevel(SDLHMILevelFull); + sendNotificationForHMILevel(SDLHMILevelFull, SDLVideoStreamingStateStreamable); }); - it(@"should not close video stream", ^{ - expect(streamingLifecycleManager.currentVideoStreamState).to(equal(SDLVideoStreamStateReady)); + it(@"should not close the stream", ^{ + expect(streamingLifecycleManager.currentVideoStreamState).to(equal(SDLVideoStreamManagerStateReady)); + }); + }); + + context(@"full but not streamable", ^{ + beforeEach(^{ + sendNotificationForHMILevel(SDLHMILevelFull, SDLVideoStreamingStateNotStreamable); + }); + + it(@"should close the stream", ^{ + expect(streamingLifecycleManager.currentVideoStreamState).to(equal(SDLVideoStreamManagerStateShuttingDown)); }); }); }); @@ -243,107 +244,126 @@ describe(@"the streaming media manager", ^{ }); it(@"should suspend the video stream", ^{ - expect(streamingLifecycleManager.currentVideoStreamState).to(equal(SDLVideoStreamStateSuspended)); - + expect(streamingLifecycleManager.currentVideoStreamState).to(equal(SDLVideoStreamManagerStateSuspended)); }); }); }); }); - describe(@"and the hmi state is full", ^{ + context(@"and the hmi state is full", ^{ beforeEach(^{ streamingLifecycleManager.hmiLevel = SDLHMILevelFull; }); context(@"and hmi state changes to none", ^{ beforeEach(^{ - sendNotificationForHMILevel(SDLHMILevelNone); + sendNotificationForHMILevel(SDLHMILevelNone, SDLVideoStreamingStateStreamable); }); - it(@"should close video stream", ^{ - expect(streamingLifecycleManager.currentVideoStreamState).to(equal(SDLVideoStreamStateShuttingDown)); + it(@"should close the streams", ^{ + expect(streamingLifecycleManager.currentVideoStreamState).to(equal(SDLVideoStreamManagerStateShuttingDown)); }); }); context(@"and hmi state changes to background", ^{ beforeEach(^{ - sendNotificationForHMILevel(SDLHMILevelBackground); + sendNotificationForHMILevel(SDLHMILevelBackground, SDLVideoStreamingStateStreamable); }); - it(@"should close video stream", ^{ - expect(streamingLifecycleManager.currentVideoStreamState).to(equal(SDLVideoStreamStateShuttingDown)); + it(@"should close the stream", ^{ + expect(streamingLifecycleManager.currentVideoStreamState).to(equal(SDLVideoStreamManagerStateShuttingDown)); }); }); context(@"and hmi state changes to limited", ^{ beforeEach(^{ - sendNotificationForHMILevel(SDLHMILevelLimited); + sendNotificationForHMILevel(SDLHMILevelLimited, SDLVideoStreamingStateStreamable); }); - it(@"should not close video stream", ^{ - expect(streamingLifecycleManager.currentVideoStreamState).to(equal(SDLVideoStreamStateReady)); + it(@"should not close the stream", ^{ + expect(streamingLifecycleManager.currentVideoStreamState).to(equal(SDLVideoStreamManagerStateReady)); }); }); context(@"and hmi state changes to full", ^{ beforeEach(^{ - sendNotificationForHMILevel(SDLHMILevelFull); + sendNotificationForHMILevel(SDLHMILevelFull, SDLVideoStreamingStateStreamable); + }); + + it(@"should not close the stream", ^{ + expect(streamingLifecycleManager.currentVideoStreamState).to(equal(SDLVideoStreamManagerStateReady)); + }); + }); + + context(@"full but not streamable", ^{ + beforeEach(^{ + sendNotificationForHMILevel(SDLHMILevelFull, SDLVideoStreamingStateNotStreamable); }); - it(@"should not close video stream", ^{ - expect(streamingLifecycleManager.currentVideoStreamState).to(equal(SDLVideoStreamStateReady)); + it(@"should close the stream", ^{ + expect(streamingLifecycleManager.currentVideoStreamState).to(equal(SDLVideoStreamManagerStateShuttingDown)); }); }); }); }); - describe(@"and video stream is closed", ^{ + context(@"and both streams are closed", ^{ beforeEach(^{ - [streamingLifecycleManager.videoStreamStateMachine setToState:SDLVideoStreamStateStopped fromOldState:nil callEnterTransition:NO]; + [streamingLifecycleManager.videoStreamStateMachine setToState:SDLVideoStreamManagerStateStopped fromOldState:nil callEnterTransition:NO]; }); - describe(@"and the hmi state is none", ^{ + context(@"and the hmi state is none", ^{ beforeEach(^{ streamingLifecycleManager.hmiLevel = SDLHMILevelNone; }); context(@"and hmi state changes to none", ^{ beforeEach(^{ - sendNotificationForHMILevel(SDLHMILevelNone); + sendNotificationForHMILevel(SDLHMILevelNone, SDLVideoStreamingStateStreamable); }); - it(@"should not start video stream", ^{ - expect(streamingLifecycleManager.currentVideoStreamState).to(equal(SDLVideoStreamStateStopped)); + it(@"should not start the stream", ^{ + expect(streamingLifecycleManager.currentVideoStreamState).to(equal(SDLVideoStreamManagerStateStopped)); }); }); context(@"and hmi state changes to background", ^{ beforeEach(^{ - sendNotificationForHMILevel(SDLHMILevelBackground); + sendNotificationForHMILevel(SDLHMILevelBackground, SDLVideoStreamingStateStreamable); }); - it(@"should not start video stream", ^{ - expect(streamingLifecycleManager.currentVideoStreamState).to(equal(SDLVideoStreamStateStopped)); + it(@"should not start the stream", ^{ + expect(streamingLifecycleManager.currentVideoStreamState).to(equal(SDLVideoStreamManagerStateStopped)); }); }); context(@"and hmi state changes to limited", ^{ beforeEach(^{ - sendNotificationForHMILevel(SDLHMILevelLimited); + sendNotificationForHMILevel(SDLHMILevelLimited, SDLVideoStreamingStateStreamable); }); - it(@"should start video stream", ^{ - expect(streamingLifecycleManager.currentVideoStreamState).to(equal(SDLVideoStreamStateStarting)); + it(@"should start the streams", ^{ + expect(streamingLifecycleManager.currentVideoStreamState).to(equal(SDLVideoStreamManagerStateStarting)); }); }); context(@"and hmi state changes to full", ^{ beforeEach(^{ - sendNotificationForHMILevel(SDLHMILevelFull); + sendNotificationForHMILevel(SDLHMILevelFull, SDLVideoStreamingStateStreamable); + }); + + it(@"should start the streams", ^{ + expect(streamingLifecycleManager.currentVideoStreamState).to(equal(SDLVideoStreamManagerStateStarting)); + }); + }); + + context(@"full but not streamable", ^{ + beforeEach(^{ + sendNotificationForHMILevel(SDLHMILevelFull, SDLVideoStreamingStateNotStreamable); }); - it(@"should start video stream", ^{ - expect(streamingLifecycleManager.currentVideoStreamState).to(equal(SDLVideoStreamStateStarting)); + it(@"should not start the stream", ^{ + expect(streamingLifecycleManager.currentVideoStreamState).to(equal(SDLVideoStreamManagerStateStopped)); }); }); }); @@ -352,7 +372,7 @@ describe(@"the streaming media manager", ^{ describe(@"sending a video capabilities request", ^{ beforeEach(^{ - [streamingLifecycleManager.videoStreamStateMachine setToState:SDLVideoStreamStateStarting fromOldState:nil callEnterTransition:YES]; + [streamingLifecycleManager.videoStreamStateMachine setToState:SDLVideoStreamManagerStateStarting fromOldState:nil callEnterTransition:YES]; }); it(@"should send out a video capabilities request", ^{ @@ -381,50 +401,50 @@ describe(@"the streaming media manager", ^{ expect(streamingLifecycleManager.preferredResolutions.firstObject.resolutionWidth).to(equal(0)); expect(streamingLifecycleManager.preferredResolutions.firstObject.resolutionHeight).to(equal(0)); }); - }); - context(@"and receiving a response", ^{ - __block SDLImageResolution *resolution = nil; - __block int32_t maxBitrate = 0; - __block NSArray<SDLVideoStreamingFormat *> *testFormats = nil; - __block BOOL testHapticsSupported = NO; + context(@"and receiving a response", ^{ + __block SDLImageResolution *resolution = nil; + __block int32_t maxBitrate = 0; + __block NSArray<SDLVideoStreamingFormat *> *testFormats = nil; + __block BOOL testHapticsSupported = NO; - beforeEach(^{ - SDLGetSystemCapabilityResponse *response = [[SDLGetSystemCapabilityResponse alloc] init]; - response.success = @YES; - response.systemCapability = [[SDLSystemCapability alloc] init]; - response.systemCapability.systemCapabilityType = SDLSystemCapabilityTypeVideoStreaming; - - resolution = [[SDLImageResolution alloc] initWithWidth:42 height:69]; - maxBitrate = 12345; - testFormats = @[[[SDLVideoStreamingFormat alloc] initWithCodec:SDLVideoStreamingCodecH265 protocol:SDLVideoStreamingProtocolRTMP], [[SDLVideoStreamingFormat alloc] initWithCodec:SDLVideoStreamingCodecH264 protocol:SDLVideoStreamingProtocolRTP]]; - testHapticsSupported = YES; - response.systemCapability.videoStreamingCapability = [[SDLVideoStreamingCapability alloc] initWithPreferredResolution:resolution maxBitrate:maxBitrate supportedFormats:testFormats hapticDataSupported:testHapticsSupported]; - [testConnectionManager respondToLastRequestWithResponse:response]; - }); + beforeEach(^{ + SDLGetSystemCapabilityResponse *response = [[SDLGetSystemCapabilityResponse alloc] init]; + response.success = @YES; + response.systemCapability = [[SDLSystemCapability alloc] init]; + response.systemCapability.systemCapabilityType = SDLSystemCapabilityTypeVideoStreaming; + + resolution = [[SDLImageResolution alloc] initWithWidth:42 height:69]; + maxBitrate = 12345; + testFormats = @[[[SDLVideoStreamingFormat alloc] initWithCodec:SDLVideoStreamingCodecH265 protocol:SDLVideoStreamingProtocolRTMP], [[SDLVideoStreamingFormat alloc] initWithCodec:SDLVideoStreamingCodecH264 protocol:SDLVideoStreamingProtocolRTP]]; + testHapticsSupported = YES; + response.systemCapability.videoStreamingCapability = [[SDLVideoStreamingCapability alloc] initWithPreferredResolution:resolution maxBitrate:maxBitrate supportedFormats:testFormats hapticDataSupported:testHapticsSupported]; + [testConnectionManager respondToLastRequestWithResponse:response]; + }); - it(@"should have correct data from the data source", ^{ - // Correct formats should be retrieved from the data source - expect(streamingLifecycleManager.preferredResolutions).to(haveCount(1)); - expect(streamingLifecycleManager.preferredResolutions.firstObject.resolutionWidth).to(equal(resolution.resolutionWidth)); - expect(streamingLifecycleManager.preferredResolutions.firstObject.resolutionHeight).to(equal(resolution.resolutionHeight)); + it(@"should have correct data from the data source", ^{ + // Correct formats should be retrieved from the data source + expect(streamingLifecycleManager.preferredResolutions).to(haveCount(1)); + expect(streamingLifecycleManager.preferredResolutions.firstObject.resolutionWidth).to(equal(resolution.resolutionWidth)); + expect(streamingLifecycleManager.preferredResolutions.firstObject.resolutionHeight).to(equal(resolution.resolutionHeight)); - expect(streamingLifecycleManager.preferredFormats).to(haveCount(streamingLifecycleManager.supportedFormats.count + 1)); - expect(streamingLifecycleManager.preferredFormats.firstObject.codec).to(equal(testDataSource.extraFormat.codec)); - expect(streamingLifecycleManager.preferredFormats.firstObject.protocol).to(equal(testDataSource.extraFormat.protocol)); + expect(streamingLifecycleManager.preferredFormats).to(haveCount(streamingLifecycleManager.supportedFormats.count + 1)); + expect(streamingLifecycleManager.preferredFormats.firstObject.codec).to(equal(testDataSource.extraFormat.codec)); + expect(streamingLifecycleManager.preferredFormats.firstObject.protocol).to(equal(testDataSource.extraFormat.protocol)); - // The haptic manager should be enabled - expect(streamingLifecycleManager.focusableItemManager.enableHapticDataRequests).to(equal(YES)); - }); + // The haptic manager should be enabled + expect(streamingLifecycleManager.focusableItemManager.enableHapticDataRequests).to(equal(YES)); + }); - it(@"should have decided upon the correct preferred format and resolution", ^{ - SDLVideoStreamingFormat *preferredFormat = streamingLifecycleManager.preferredFormats[streamingLifecycleManager.preferredFormatIndex]; - expect(preferredFormat.codec).to(equal(SDLVideoStreamingCodecH264)); - expect(preferredFormat.protocol).to(equal(SDLVideoStreamingProtocolRTP)); + it(@"should have decided upon the correct preferred format and resolution", ^{ + SDLVideoStreamingFormat *preferredFormat = streamingLifecycleManager.preferredFormats[streamingLifecycleManager.preferredFormatIndex]; + expect(preferredFormat.codec).to(equal(SDLVideoStreamingCodecH264)); + expect(preferredFormat.protocol).to(equal(SDLVideoStreamingProtocolRTP)); - SDLImageResolution *preferredResolution = streamingLifecycleManager.preferredResolutions[streamingLifecycleManager.preferredResolutionIndex]; - expect(preferredResolution.resolutionHeight).to(equal(@69)); - expect(preferredResolution.resolutionWidth).to(equal(@42)); + SDLImageResolution *preferredResolution = streamingLifecycleManager.preferredResolutions[streamingLifecycleManager.preferredResolutionIndex]; + expect(preferredResolution.resolutionHeight).to(equal(@69)); + expect(preferredResolution.resolutionWidth).to(equal(@42)); + }); }); }); }); @@ -440,7 +460,7 @@ describe(@"the streaming media manager", ^{ __block SDLVideoStreamingProtocol testVideoProtocol = SDLVideoStreamingProtocolRTP; beforeEach(^{ - [streamingLifecycleManager.videoStreamStateMachine setToState:SDLVideoStreamStateStarting fromOldState:nil callEnterTransition:NO]; + [streamingLifecycleManager.videoStreamStateMachine setToState:SDLVideoStreamManagerStateStarting fromOldState:nil callEnterTransition:NO]; testVideoHeader = [[SDLV2ProtocolHeader alloc] initWithVersion:5]; testVideoHeader.frameType = SDLFrameTypeSingle; @@ -461,7 +481,7 @@ describe(@"the streaming media manager", ^{ expect(CGSizeEqualToSize(streamingLifecycleManager.screenSize, CGSizeMake(testVideoWidth, testVideoHeight))).to(equal(YES)); expect(streamingLifecycleManager.videoEncrypted).to(equal(YES)); expect(streamingLifecycleManager.videoFormat).to(equal([[SDLVideoStreamingFormat alloc] initWithCodec:testVideoCodec protocol:testVideoProtocol])); - expect(streamingLifecycleManager.currentVideoStreamState).to(equal(SDLVideoStreamStateReady)); + expect(streamingLifecycleManager.currentVideoStreamState).to(equal(SDLVideoStreamManagerStateReady)); }); }); @@ -475,7 +495,7 @@ describe(@"the streaming media manager", ^{ it(@"should fall back correctly", ^{ expect(CGSizeEqualToSize(streamingLifecycleManager.screenSize, CGSizeMake(testVideoWidth, testVideoHeight))).to(equal(YES)); expect(streamingLifecycleManager.videoFormat).to(equal([[SDLVideoStreamingFormat alloc] initWithCodec:SDLVideoStreamingCodecH264 protocol:SDLVideoStreamingProtocolRAW])); - expect(streamingLifecycleManager.currentVideoStreamState).to(equal(SDLVideoStreamStateReady)); + expect(streamingLifecycleManager.currentVideoStreamState).to(equal(SDLVideoStreamManagerStateReady)); }); }); @@ -528,7 +548,7 @@ describe(@"the streaming media manager", ^{ __block SDLControlFramePayloadNak *testVideoStartNakPayload = nil; beforeEach(^{ - [streamingLifecycleManager.videoStreamStateMachine setToState:SDLVideoStreamStateStarting fromOldState:nil callEnterTransition:NO]; + [streamingLifecycleManager.videoStreamStateMachine setToState:SDLVideoStreamManagerStateStarting fromOldState:nil callEnterTransition:NO]; testVideoHeader = [[SDLV2ProtocolHeader alloc] initWithVersion:5]; testVideoHeader.frameType = SDLFrameTypeSingle; @@ -558,7 +578,7 @@ describe(@"the streaming media manager", ^{ }); it(@"should end the service", ^{ - expect(streamingLifecycleManager.currentVideoStreamState).to(equal(SDLVideoStreamStateStopped)); + expect(streamingLifecycleManager.currentVideoStreamState).to(equal(SDLVideoStreamManagerStateStopped)); }); }); }); @@ -568,7 +588,7 @@ describe(@"the streaming media manager", ^{ __block SDLProtocolMessage *testVideoMessage = nil; beforeEach(^{ - [streamingLifecycleManager.videoStreamStateMachine setToState:SDLVideoStreamStateStarting fromOldState:nil callEnterTransition:NO]; + [streamingLifecycleManager.videoStreamStateMachine setToState:SDLVideoStreamManagerStateStarting fromOldState:nil callEnterTransition:NO]; testVideoHeader = [[SDLV2ProtocolHeader alloc] initWithVersion:5]; testVideoHeader.frameType = SDLFrameTypeSingle; @@ -581,7 +601,7 @@ describe(@"the streaming media manager", ^{ }); it(@"should have set all the right properties", ^{ - expect(streamingLifecycleManager.currentVideoStreamState).to(equal(SDLVideoStreamStateStopped)); + expect(streamingLifecycleManager.currentVideoStreamState).to(equal(SDLVideoStreamManagerStateStopped)); }); }); @@ -590,7 +610,7 @@ describe(@"the streaming media manager", ^{ __block SDLProtocolMessage *testVideoMessage = nil; beforeEach(^{ - [streamingLifecycleManager.videoStreamStateMachine setToState:SDLVideoStreamStateStarting fromOldState:nil callEnterTransition:NO]; + [streamingLifecycleManager.videoStreamStateMachine setToState:SDLVideoStreamManagerStateStarting fromOldState:nil callEnterTransition:NO]; testVideoHeader = [[SDLV2ProtocolHeader alloc] initWithVersion:5]; testVideoHeader.frameType = SDLFrameTypeSingle; @@ -603,7 +623,7 @@ describe(@"the streaming media manager", ^{ }); it(@"should have set all the right properties", ^{ - expect(streamingLifecycleManager.currentVideoStreamState).to(equal(SDLVideoStreamStateStopped)); + expect(streamingLifecycleManager.currentVideoStreamState).to(equal(SDLVideoStreamManagerStateStopped)); }); }); }); diff --git a/SmartDeviceLinkTests/DevAPISpecs/SDLTextAndGraphicManagerSpec.m b/SmartDeviceLinkTests/DevAPISpecs/SDLTextAndGraphicManagerSpec.m index 5005483d0..ef5b18623 100644 --- a/SmartDeviceLinkTests/DevAPISpecs/SDLTextAndGraphicManagerSpec.m +++ b/SmartDeviceLinkTests/DevAPISpecs/SDLTextAndGraphicManagerSpec.m @@ -94,7 +94,7 @@ describe(@"text and graphic manager", ^{ expect(testManager.textField1).to(equal(testString)); expect(testManager.inProgressUpdate).to(beNil()); - expect(testManager.isDirty).to(beFalse()); + expect(testManager.isDirty).to(beTrue()); }); }); @@ -108,7 +108,7 @@ describe(@"text and graphic manager", ^{ expect(testManager.textField1).to(equal(testString)); expect(testManager.inProgressUpdate).to(beNil()); - expect(testManager.isDirty).to(beFalse()); + expect(testManager.isDirty).to(beTrue()); }); }); diff --git a/SmartDeviceLinkTests/ProtocolSpecs/SDLFunctionIDSpec.m b/SmartDeviceLinkTests/ProtocolSpecs/SDLFunctionIDSpec.m index 51145a6f6..8c87737e0 100644 --- a/SmartDeviceLinkTests/ProtocolSpecs/SDLFunctionIDSpec.m +++ b/SmartDeviceLinkTests/ProtocolSpecs/SDLFunctionIDSpec.m @@ -78,7 +78,8 @@ describe(@"GetFunctionName Tests", ^ { expect([functionID functionNameForId:32781]).to(equal(SDLNameOnSystemRequest)); expect([functionID functionNameForId:32782]).to(equal(SDLNameOnHashChange)); expect([functionID functionNameForId:32784]).to(equal(SDLNameOnWayPointChange)); - + expect([functionID functionNameForId:32785]).to(equal(SDLNameOnRCStatus)); + //Not listed in Spec expect([functionID functionNameForId:65536]).to(equal(SDLNameEncodedSyncPData)); expect([functionID functionNameForId:65537]).to(equal(SDLNameSyncPData)); @@ -151,6 +152,7 @@ describe(@"GetFunctionID Tests", ^ { expect([functionID functionIdForName:SDLNameOnSystemRequest]).to(equal(@32781)); expect([functionID functionIdForName:SDLNameOnHashChange]).to(equal(@32782)); expect([functionID functionIdForName:SDLNameOnWayPointChange]).to(equal(@32784)); + expect([functionID functionIdForName:SDLNameOnRCStatus]).to(equal(@32785)); //Not listed in Spec expect([functionID functionIdForName:SDLNameEncodedSyncPData]).to(equal(@65536)); @@ -158,6 +160,7 @@ describe(@"GetFunctionID Tests", ^ { expect([functionID functionIdForName:SDLNameOnEncodedSyncPData]).to(equal(@98304)); expect([functionID functionIdForName:SDLNameOnSyncPData]).to(equal(@98305)); + }); }); diff --git a/SmartDeviceLinkTests/RPCSpecs/EnumSpecs/SDLAudioStreamingIndicatorSpec.m b/SmartDeviceLinkTests/RPCSpecs/EnumSpecs/SDLAudioStreamingIndicatorSpec.m new file mode 100644 index 000000000..17dc3ef67 --- /dev/null +++ b/SmartDeviceLinkTests/RPCSpecs/EnumSpecs/SDLAudioStreamingIndicatorSpec.m @@ -0,0 +1,24 @@ +// +// SDLAudioStreamingIndicatorSpec.m +// SmartDeviceLink + + +#import <Foundation/Foundation.h> + +#import <Quick/Quick.h> +#import <Nimble/Nimble.h> + +#import "SDLAudioStreamingIndicator.h" + +QuickSpecBegin(SDLAudioStreamingIndicatorStatusSpec) + +describe(@"Individual Enum Value Tests", ^ { + it(@"Should match internal values", ^ { + expect(SDLAudioStreamingIndicatorPlayPause).to(equal(@"PLAY_PAUSE")); + expect(SDLAudioStreamingIndicatorPlay).to(equal(@"PLAY")); + expect(SDLAudioStreamingIndicatorPause).to(equal(@"PAUSE")); + expect(SDLAudioStreamingIndicatorStop).to(equal(@"STOP")); + }); +}); + +QuickSpecEnd diff --git a/SmartDeviceLinkTests/RPCSpecs/EnumSpecs/SDLDisplayModeSpec.m b/SmartDeviceLinkTests/RPCSpecs/EnumSpecs/SDLDisplayModeSpec.m new file mode 100644 index 000000000..a4533820e --- /dev/null +++ b/SmartDeviceLinkTests/RPCSpecs/EnumSpecs/SDLDisplayModeSpec.m @@ -0,0 +1,23 @@ +// +// SDLDisplayModeSpec.m +// SmartDeviceLinkTests +// + +#import <Foundation/Foundation.h> + +#import <Quick/Quick.h> +#import <Nimble/Nimble.h> + +#import "SDLDisplayMode.h" + +QuickSpecBegin(SDLDisplayModeSpec) + +describe(@"Individual Enum Value Tests", ^ { + it(@"Should match internal values", ^ { + expect(SDLDisplayModeDay).to(equal(@"DAY")); + expect(SDLDisplayModeNight).to(equal(@"NIGHT")); + expect(SDLDisplayModeAuto).to(equal(@"AUTO")); + }); +}); + +QuickSpecEnd diff --git a/SmartDeviceLinkTests/RPCSpecs/EnumSpecs/SDLDistanceUnitSpec.m b/SmartDeviceLinkTests/RPCSpecs/EnumSpecs/SDLDistanceUnitSpec.m new file mode 100644 index 000000000..87706d91d --- /dev/null +++ b/SmartDeviceLinkTests/RPCSpecs/EnumSpecs/SDLDistanceUnitSpec.m @@ -0,0 +1,22 @@ +// +// SDLDistanceUnitSpec.m +// SmartDeviceLinkTests +// + +#import <Foundation/Foundation.h> + +#import <Quick/Quick.h> +#import <Nimble/Nimble.h> + +#import "SDLDistanceUnit.h" + +QuickSpecBegin(SDLDistanceUnitSpec) + +describe(@"Individual Enum Value Tests", ^ { + it(@"Should match internal values", ^ { + expect(SDLDistanceUnitMiles).to(equal(@"MILES")); + expect(SDLDistanceUnitKilometers).to(equal(@"KILOMETERS")); + }); +}); + +QuickSpecEnd diff --git a/SmartDeviceLinkTests/RPCSpecs/EnumSpecs/SDLElectronicParkBrakeStatusSpec.m b/SmartDeviceLinkTests/RPCSpecs/EnumSpecs/SDLElectronicParkBrakeStatusSpec.m new file mode 100644 index 000000000..4dde85088 --- /dev/null +++ b/SmartDeviceLinkTests/RPCSpecs/EnumSpecs/SDLElectronicParkBrakeStatusSpec.m @@ -0,0 +1,18 @@ +#import <Quick/Quick.h> +#import <Nimble/Nimble.h> + +#import "SDLElectronicParkBrakeStatus.h" + +QuickSpecBegin(SDLElectronicParkBrakeStatusSpec) + +describe(@"Individual Enum Value Tests", ^ { + it(@"Should match internal values", ^ { + expect(SDLElectronicParkBrakeStatusClosed).to(equal(@"CLOSED")); + expect(SDLElectronicParkBrakeStatusTransition).to(equal(@"TRANSITION")); + expect(SDLElectronicParkBrakeStatusOpen).to(equal(@"OPEN")); + expect(SDLElectronicParkBrakeStatusDriveActive).to(equal(@"DRIVE_ACTIVE")); + expect(SDLElectronicParkBrakeStatusFault).to(equal(@"FAULT")); + }); +}); + +QuickSpecEnd diff --git a/SmartDeviceLinkTests/RPCSpecs/EnumSpecs/SDLLightNameSpec.m b/SmartDeviceLinkTests/RPCSpecs/EnumSpecs/SDLLightNameSpec.m new file mode 100644 index 000000000..e711273da --- /dev/null +++ b/SmartDeviceLinkTests/RPCSpecs/EnumSpecs/SDLLightNameSpec.m @@ -0,0 +1,62 @@ +// +// SDLLightNameSpec.m +// SmartDeviceLinkTests +// + +#import <Foundation/Foundation.h> + +#import <Foundation/Foundation.h> + +#import <Quick/Quick.h> +#import <Nimble/Nimble.h> + +#import "SDLLightName.h" + +QuickSpecBegin(SDLLightNameSpec) + +describe(@"Individual Enum Value Tests", ^ { + it(@"Should match internal values", ^ { + expect(SDLLightNameFrontLeftHighBeam).to(equal(@"FRONT_LEFT_HIGH_BEAM")); + expect(SDLLightNameFrontRightHighBeam).to(equal(@"FRONT_RIGHT_HIGH_BEAM")); + expect(SDLLightNameFrontLeftLowBeam).to(equal(@"FRONT_LEFT_LOW_BEAM")); + expect(SDLLightNameFrontRightLowBeam).to(equal(@"FRONT_RIGHT_LOW_BEAM")); + expect(SDLLightNameFrontLeftParkingLight).to(equal(@"FRONT_LEFT_PARKING_LIGHT")); + expect(SDLLightNameFrontRightParkingLight).to(equal(@"FRONT_RIGHT_PARKING_LIGHT")); + expect(SDLLightNameFrontLeftDaytimeRunningLight).to(equal(@"FRONT_LEFT_DAYTIME_RUNNING_LIGHT")); + expect(SDLLightNameFrontRightDaytimeRunningLight).to(equal(@"FRONT_RIGHT_DAYTIME_RUNNING_LIGHT")); + expect(SDLLightNameFrontLeftTurnLight).to(equal(@"FRONT_LEFT_TURN_LIGHT")); + expect(SDLLightNameFrontRightTurnLight).to(equal(@"FRONT_RIGHT_TURN_LIGHT")); + expect(SDLLightNameRearLeftFogLight).to(equal(@"REAR_LEFT_FOG_LIGHT")); + expect(SDLLightNameRearRightFogLight).to(equal(@"REAR_RIGHT_FOG_LIGHT")); + expect(SDLLightNameRearLeftTailLight).to(equal(@"REAR_LEFT_TAIL_LIGHT")); + expect(SDLLightNameRearRightTailLight).to(equal(@"REAR_RIGHT_TAIL_LIGHT")); + expect(SDLLightNameRearLeftBreakLight).to(equal(@"REAR_LEFT_BREAK_LIGHT")); + expect(SDLLightNameRearRightBreakLight).to(equal(@"REAR_RIGHT_BREAK_LIGHT")); + expect(SDLLightNameRearLeftTurnLight).to(equal(@"REAR_LEFT_TURN_LIGHT")); + expect(SDLLightNameRearRightTurnLight).to(equal(@"REAR_RIGHT_TURN_LIGHT")); + expect(SDLLightNameRearRegistrationPlateLight).to(equal(@"REAR_REGISTRATION_PLATE_LIGHT")); + expect(SDLLightNameHighBeams).to(equal(@"HIGH_BEAMS")); + expect(SDLLightNameLowBeams).to(equal(@"LOW_BEAMS")); + expect(SDLLightNameFogLights).to(equal(@"FOG_LIGHTS")); + expect(SDLLightNameRunningLights).to(equal(@"RUNNING_LIGHTS")); + expect(SDLLightNameParkingLights).to(equal(@"PARKING_LIGHTS")); + expect(SDLLightNameBrakeLights).to(equal(@"BRAKE_LIGHTS")); + expect(SDLLightNameRearReversingLights).to(equal(@"REAR_REVERSING_LIGHTS")); + expect(SDLLightNameSideMarkerLights).to(equal(@"SIDE_MARKER_LIGHTS")); + expect(SDLLightNameLeftTurnLights).to(equal(@"LEFT_TURN_LIGHTS")); + expect(SDLLightNameRightTurnLights).to(equal(@"RIGHT_TURN_LIGHTS")); + expect(SDLLightNameHazardLights).to(equal(@"HAZARD_LIGHTS")); + expect(SDLLightNameAmbientLights).to(equal(@"AMBIENT_LIGHTS")); + expect(SDLLightNameOverHeadLights).to(equal(@"OVERHEAD_LIGHTS")); + expect(SDLLightNameReadingLights).to(equal(@"READING_LIGHTS")); + expect(SDLLightNameTrunkLights).to(equal(@"TRUNK_LIGHTS")); + expect(SDLLightNameExteriorFrontLights).to(equal(@"EXTERIOR_FRONT_LIGHTS")); + expect(SDLLightNameExteriorRearLights).to(equal(@"EXTERIOR_REAR_LIGHTS")); + expect(SDLLightNameExteriorLeftLights).to(equal(@"EXTERIOR_LEFT_LIGHTS")); + expect(SDLLightNameExteriorRightLights).to(equal(@"EXTERIOR_RIGHT_LIGHTS")); + + }); +}); + +QuickSpecEnd + diff --git a/SmartDeviceLinkTests/RPCSpecs/EnumSpecs/SDLLightStatusSpec.m b/SmartDeviceLinkTests/RPCSpecs/EnumSpecs/SDLLightStatusSpec.m new file mode 100644 index 000000000..0f66a0d30 --- /dev/null +++ b/SmartDeviceLinkTests/RPCSpecs/EnumSpecs/SDLLightStatusSpec.m @@ -0,0 +1,23 @@ +// +// SDLLightStatusSpec.m +// SmartDeviceLinkTests +// + +#import <Foundation/Foundation.h> + +#import <Quick/Quick.h> +#import <Nimble/Nimble.h> + +#import "SDLLightStatus.h" + +QuickSpecBegin(SDLLightStatusSpec) + +describe(@"Individual Enum Value Tests", ^ { + it(@"Should match internal values", ^ { + expect(SDLLightStatusOn).to(equal(@"ON")); + expect(SDLLightStatusOFF).to(equal(@"OFF")); + + }); +}); + +QuickSpecEnd diff --git a/SmartDeviceLinkTests/RPCSpecs/EnumSpecs/SDLMassageCushionSpec.m b/SmartDeviceLinkTests/RPCSpecs/EnumSpecs/SDLMassageCushionSpec.m new file mode 100644 index 000000000..da8d21526 --- /dev/null +++ b/SmartDeviceLinkTests/RPCSpecs/EnumSpecs/SDLMassageCushionSpec.m @@ -0,0 +1,25 @@ +// +// SDLMassageCushionSpec.m +// SmartDeviceLinkTests +// + +#import <Foundation/Foundation.h> + +#import <Quick/Quick.h> +#import <Nimble/Nimble.h> + +#import "SDLMassageCushion.h" + +QuickSpecBegin(SDLMassageCushionSpec) + +describe(@"Individual Enum Value Tests", ^ { + it(@"Should match internal values", ^ { + expect(SDLMassageCushionTopLumbar).to(equal(@"TOP_LUMBAR")); + expect(SDLMassageCushionMiddleLumbar).to(equal(@"MIDDLE_LUMBAR")); + expect(SDLMassageCushionBottomLumbar).to(equal(@"BOTTOM_LUMBAR")); + expect(SDLMassageCushionBackBolsters).to(equal(@"BACK_BOLSTERS")); + expect(SDLMassageCushionSeatBolsters).to(equal(@"SEAT_BOLSTERS")); + }); +}); + +QuickSpecEnd diff --git a/SmartDeviceLinkTests/RPCSpecs/EnumSpecs/SDLMassageModeSpec.m b/SmartDeviceLinkTests/RPCSpecs/EnumSpecs/SDLMassageModeSpec.m new file mode 100644 index 000000000..b4cc8dcc8 --- /dev/null +++ b/SmartDeviceLinkTests/RPCSpecs/EnumSpecs/SDLMassageModeSpec.m @@ -0,0 +1,23 @@ +// +// SDLMassageModeSpec.m +// SmartDeviceLinkTests +// + +#import <Foundation/Foundation.h> + +#import <Quick/Quick.h> +#import <Nimble/Nimble.h> + +#import "SDLMassageMode.h" + +QuickSpecBegin(SDLMassageModeSpec) + +describe(@"Individual Enum Value Tests", ^ { + it(@"Should match internal values", ^ { + expect(SDLMassageModeOff).to(equal(@"OFF")); + expect(SDLMassageModeLow).to(equal(@"LOW")); + expect(SDLMassageModeHigh).to(equal(@"HIGH")); + }); +}); + +QuickSpecEnd diff --git a/SmartDeviceLinkTests/RPCSpecs/EnumSpecs/SDLMassageZoneSpec.m b/SmartDeviceLinkTests/RPCSpecs/EnumSpecs/SDLMassageZoneSpec.m new file mode 100644 index 000000000..71c05424b --- /dev/null +++ b/SmartDeviceLinkTests/RPCSpecs/EnumSpecs/SDLMassageZoneSpec.m @@ -0,0 +1,22 @@ +// +// SDLMassageZoneSpec.m +// SmartDeviceLinkTests +// + +#import <Foundation/Foundation.h> + +#import <Quick/Quick.h> +#import <Nimble/Nimble.h> + +#import "SDLMassageZone.h" + +QuickSpecBegin(SDLMassageZoneSpec) + +describe(@"Individual Enum Value Tests", ^ { + it(@"Should match internal values", ^ { + expect(SDLMassageZoneLumbar).to(equal(@"LUMBAR")); + expect(SDLMassageZoneSeatCushion).to(equal(@"SEAT_CUSHION")); + }); +}); + +QuickSpecEnd diff --git a/SmartDeviceLinkTests/RPCSpecs/EnumSpecs/SDLModuleTypeSpec.m b/SmartDeviceLinkTests/RPCSpecs/EnumSpecs/SDLModuleTypeSpec.m new file mode 100644 index 000000000..09fdd5006 --- /dev/null +++ b/SmartDeviceLinkTests/RPCSpecs/EnumSpecs/SDLModuleTypeSpec.m @@ -0,0 +1,23 @@ +// +// SDLModuleTypeSpec.m +// SmartDeviceLinkTests +// + +#import <Foundation/Foundation.h> + +#import <Quick/Quick.h> +#import <Nimble/Nimble.h> + +#import "SDLModuleType.h" + +QuickSpecBegin(SDLModuleTypeSpec) + +describe(@"Individual Enum Value Tests", ^ { + it(@"Should match internal values", ^ { + expect(SDLModuleTypeRadio).to(equal(@"RADIO")); + expect(SDLModuleTypeClimate).to(equal(@"CLIMATE")); + expect(SDLModuleTypeSeat).to(equal(@"SEAT")); + }); +}); + +QuickSpecEnd diff --git a/SmartDeviceLinkTests/RPCSpecs/EnumSpecs/SDLPrimaryAudioSource.m b/SmartDeviceLinkTests/RPCSpecs/EnumSpecs/SDLPrimaryAudioSource.m index 712dfd8d1..ecc55a85b 100644 --- a/SmartDeviceLinkTests/RPCSpecs/EnumSpecs/SDLPrimaryAudioSource.m +++ b/SmartDeviceLinkTests/RPCSpecs/EnumSpecs/SDLPrimaryAudioSource.m @@ -21,6 +21,11 @@ describe(@"Individual Enum Value Tests", ^ { expect(SDLPrimaryAudioSourceLineIn).to(equal(@"LINE_IN")); expect(SDLPrimaryAudioSourceIpod).to(equal(@"IPOD")); expect(SDLPrimaryAudioSourceMobileApp).to(equal(@"MOBILE_APP")); + expect(SDLPrimaryAudioSourceCD).to(equal(@"CD")); + expect(SDLPrimaryAudioSourceAM).to(equal(@"AM")); + expect(SDLPrimaryAudioSourceFM).to(equal(@"FM")); + expect(SDLPrimaryAudioSourceXM).to(equal(@"XM")); + expect(SDLPrimaryAudioSourceDAB).to(equal(@"DAB")); }); }); diff --git a/SmartDeviceLinkTests/RPCSpecs/EnumSpecs/SDLSpeechCapabilitiesSpec.m b/SmartDeviceLinkTests/RPCSpecs/EnumSpecs/SDLSpeechCapabilitiesSpec.m index b21c5b578..19c0f1182 100644 --- a/SmartDeviceLinkTests/RPCSpecs/EnumSpecs/SDLSpeechCapabilitiesSpec.m +++ b/SmartDeviceLinkTests/RPCSpecs/EnumSpecs/SDLSpeechCapabilitiesSpec.m @@ -19,6 +19,7 @@ describe(@"Individual Enum Value Tests", ^ { expect(SDLSpeechCapabilitiesLHPlusPhonemes).to(equal(@"LHPLUS_PHONEMES")); expect(SDLSpeechCapabilitiesPrerecorded).to(equal(@"PRE_RECORDED")); expect(SDLSpeechCapabilitiesSilence).to(equal(@"SILENCE")); + expect(SDLSpeechCapabilitiesFile).to(equal(@"FILE")); }); }); diff --git a/SmartDeviceLinkTests/RPCSpecs/EnumSpecs/SDLStaticIconNameSpec.m b/SmartDeviceLinkTests/RPCSpecs/EnumSpecs/SDLStaticIconNameSpec.m new file mode 100644 index 000000000..786ecc7c6 --- /dev/null +++ b/SmartDeviceLinkTests/RPCSpecs/EnumSpecs/SDLStaticIconNameSpec.m @@ -0,0 +1,200 @@ +// +// SDLStaticIconNameSpec.m +// SmartDeviceLinkTests +// +// Created by Nicole on 7/23/18. +// Copyright © 2018 smartdevicelink. All rights reserved. +// + +#import <Foundation/Foundation.h> + +#import <Quick/Quick.h> +#import <Nimble/Nimble.h> + +#import "SDLStaticIconName.h" + +QuickSpecBegin(SDLStaticIconNameSpec) + +describe(@"Individual Enum Value Tests", ^{ + it(@"Should match internal values", ^{ + expect(SDLStaticIconNameAcceptCall).to(equal(@"0x29")); + expect(SDLStaticIconNameAddWaypoint).to(equal(@"0x1B")); + expect(SDLStaticIconNameAlbum).to(equal(@"0x21")); + expect(SDLStaticIconNameAmbientLighting).to(equal(@"0x3d")); + expect(SDLStaticIconNameArrowNorth).to(equal(@"0x40")); + expect(SDLStaticIconNameAudioMute).to(equal(@"0x12")); + expect(SDLStaticIconNameAudiobookEpisode).to(equal(@"0x83")); + expect(SDLStaticIconNameAudiobookNarrator).to(equal(@"0x82")); + expect(SDLStaticIconNameAuxillaryAudio).to(equal(@"0x45")); + expect(SDLStaticIconNameBack).to(equal(@"0x86")); + expect(SDLStaticIconNameBatteryCapacity0Of5).to(equal(@"0xF7")); + expect(SDLStaticIconNameBatteryCapacity1Of5).to(equal(@"0xF8")); + expect(SDLStaticIconNameBatteryCapacity2Of5).to(equal(@"0xF9")); + expect(SDLStaticIconNameBatteryCapacity3Of5).to(equal(@"0xFA")); + expect(SDLStaticIconNameBatteryCapacity4Of5).to(equal(@"0xf6")); + expect(SDLStaticIconNameBatteryCapacity5Of5).to(equal(@"0xFB")); + expect(SDLStaticIconNameBluetoothAudioSource).to(equal(@"0x09")); + expect(SDLStaticIconNameBluetooth1).to(equal(@"0xcc")); + expect(SDLStaticIconNameBluetooth2).to(equal(@"0xCD")); + expect(SDLStaticIconNameBrowse).to(equal(@"0x77")); + expect(SDLStaticIconNameCellPhoneInRoamingMode).to(equal(@"0x66")); + expect(SDLStaticIconNameCellServiceSignalStrength0Of5Bars).to(equal(@"0x67")); + expect(SDLStaticIconNameCellServiceSignalStrength1Of5Bars).to(equal(@"0x68")); + expect(SDLStaticIconNameCellServiceSignalStrength2Of5Bars).to(equal(@"0x69")); + expect(SDLStaticIconNameCellServiceSignalStrength3Of5Bars).to(equal(@"0x6A")); + expect(SDLStaticIconNameCellServiceSignalStrength4Of5Bars).to(equal(@"0x6B")); + expect(SDLStaticIconNameCellServiceSignalStrength5Of5Bars).to(equal(@"0xd3")); + expect(SDLStaticIconNameChangeLaneLeft).to(equal(@"0xc3")); + expect(SDLStaticIconNameChangeLaneRight).to(equal(@"0xc1")); + expect(SDLStaticIconNameCheckBoxChecked).to(equal(@"0x27")); + expect(SDLStaticIconNameCheckBoxUnchecked).to(equal(@"0x28")); + expect(SDLStaticIconNameClimate).to(equal(@"0xd1")); + expect(SDLStaticIconNameClock).to(equal(@"0xfc")); + expect(SDLStaticIconNameCompose).to(equal(@"0x1A")); + expect(SDLStaticIconNameContact).to(equal(@"0x5C")); + expect(SDLStaticIconNameContinue).to(equal(@"0x42")); + expect(SDLStaticIconNameDash).to(equal(@"0x7F")); + expect(SDLStaticIconNameDate).to(equal(@"0x87")); + expect(SDLStaticIconNameDelete).to(equal(@"0x0F")); + expect(SDLStaticIconNameDestination).to(equal(@"0x94")); + expect(SDLStaticIconNameDestinationFerryAhead).to(equal(@"0x4D")); + expect(SDLStaticIconNameEbookmark).to(equal(@"0x2B")); + expect(SDLStaticIconNameEmpty).to(equal(@"0x01")); + expect(SDLStaticIconNameEndCall).to(equal(@"0x2C")); + expect(SDLStaticIconNameFail).to(equal(@"0xD6")); + expect(SDLStaticIconNameFastForward30Secs).to(equal(@"0x08")); + expect(SDLStaticIconNameFavoriteHeart).to(equal(@"0x0E")); + expect(SDLStaticIconNameFavoriteStar).to(equal(@"0x95")); + expect(SDLStaticIconNameFaxNumber).to(equal(@"0x80")); + expect(SDLStaticIconNameFilename).to(equal(@"0x50")); + expect(SDLStaticIconNameFilter).to(equal(@"0x79")); + expect(SDLStaticIconNameFolder).to(equal(@"0x1C")); + expect(SDLStaticIconNameFuelPrices).to(equal(@"0xe9")); + expect(SDLStaticIconNameFullMap).to(equal(@"0x0c")); + expect(SDLStaticIconNameGenericPhoneNumber).to(equal(@"0x53")); + expect(SDLStaticIconNameGenre).to(equal(@"0x4E")); + expect(SDLStaticIconNameGlobalKeyboard).to(equal(@"0xea")); + expect(SDLStaticIconNameHighwayExitInformation).to(equal(@"0xf4")); + expect(SDLStaticIconNameHomePhoneNumber).to(equal(@"0x55")); + expect(SDLStaticIconNameHyperlink).to(equal(@"0x78")); + expect(SDLStaticIconNameID3TagUnknown).to(equal(@"0x51")); + expect(SDLStaticIconNameIncomingCalls).to(equal(@"0x57")); + expect(SDLStaticIconNameInformation).to(equal(@"0x5d")); + expect(SDLStaticIconNameIPodMediaSource).to(equal(@"0x0D")); + expect(SDLStaticIconNameJoinCalls).to(equal(@"0x02")); + expect(SDLStaticIconNameKeepLeft).to(equal(@"0x46")); + expect(SDLStaticIconNameKeepRight).to(equal(@"0x48")); + expect(SDLStaticIconNameKey).to(equal(@"0x7D")); + expect(SDLStaticIconNameLeft).to(equal(@"0x9f")); + expect(SDLStaticIconNameLeftArrow).to(equal(@"0x4B")); + expect(SDLStaticIconNameLeftExit).to(equal(@"0xaf")); + expect(SDLStaticIconNameLineInAudioSource).to(equal(@"0x06")); + expect(SDLStaticIconNameLocked).to(equal(@"0x22")); + expect(SDLStaticIconNameMediaControlLeftArrow).to(equal(@"0x17")); + expect(SDLStaticIconNameMediaControlRecording).to(equal(@"0x20")); + expect(SDLStaticIconNameMediaControlRightArrow).to(equal(@"0x15")); + expect(SDLStaticIconNameMediaControlStop).to(equal(@"0x16")); + expect(SDLStaticIconNameMicrophone).to(equal(@"0xe8")); + expect(SDLStaticIconNameMissedCalls).to(equal(@"0x58")); + expect(SDLStaticIconNameMobilePhoneNumber).to(equal(@"0x54")); + expect(SDLStaticIconNameMoveDown).to(equal(@"0xE5")); + expect(SDLStaticIconNameMoveUp).to(equal(@"0xe4")); + expect(SDLStaticIconNameMP3TagArtist).to(equal(@"0x24")); + expect(SDLStaticIconNameNavigation).to(equal(@"0x8e")); + expect(SDLStaticIconNameNavigationCurrentDirection).to(equal(@"0x0a")); + expect(SDLStaticIconNameNegativeRatingThumbsDown).to(equal(@"0x14")); + expect(SDLStaticIconNameNew).to(equal(@"0x5E")); + expect(SDLStaticIconNameOfficePhoneNumber).to(equal(@"0x56")); + expect(SDLStaticIconNameOpened).to(equal(@"0x5F")); + expect(SDLStaticIconNameOrigin).to(equal(@"0x96")); + expect(SDLStaticIconNameOutgoingCalls).to(equal(@"0x59")); + expect(SDLStaticIconNamePause).to(equal(@"0xCF")); + expect(SDLStaticIconNamePhoneCall1).to(equal(@"0x1D")); + expect(SDLStaticIconNamePhoneCall2).to(equal(@"0x1E")); + expect(SDLStaticIconNamePhoneDevice).to(equal(@"0x03")); + expect(SDLStaticIconNamePhonebook).to(equal(@"0x81")); + expect(SDLStaticIconNamePhoto).to(equal(@"0x88")); + expect(SDLStaticIconNamePlay).to(equal(@"0xD0")); + expect(SDLStaticIconNamePlaylist).to(equal(@"0x4F")); + expect(SDLStaticIconNamePopUp).to(equal(@"0x76")); + expect(SDLStaticIconNamePositiveRatingThumbsUp).to(equal(@"0x13")); + expect(SDLStaticIconNamePower).to(equal(@"0x5b")); + expect(SDLStaticIconNamePrimaryPhone).to(equal(@"0x1F")); + expect(SDLStaticIconNameRadioButtonChecked).to(equal(@"0x25")); + expect(SDLStaticIconNameRadioButtonUnchecked).to(equal(@"0x26")); + expect(SDLStaticIconNameRecentCalls).to(equal(@"0xe7")); + expect(SDLStaticIconNameRecentDestinations).to(equal(@"0xf2")); + expect(SDLStaticIconNameRedo).to(equal(@"0x19")); + expect(SDLStaticIconNameRefresh).to(equal(@"0x97")); + expect(SDLStaticIconNameRemoteDiagnosticsCheckEngine).to(equal(@"0x7E")); + expect(SDLStaticIconNameRendered911Assist).to(equal(@"0xac")); + expect(SDLStaticIconNameRepeat).to(equal(@"0xe6")); + expect(SDLStaticIconNameRepeatPlay).to(equal(@"0x73")); + expect(SDLStaticIconNameReply).to(equal(@"0x04")); + expect(SDLStaticIconNameRewind30Secs).to(equal(@"0x07")); + expect(SDLStaticIconNameRight).to(equal(@"0xa3")); + expect(SDLStaticIconNameRightExit).to(equal(@"0xb1")); + expect(SDLStaticIconNameRingtones).to(equal(@"0x5A")); + expect(SDLStaticIconNameRoundaboutLeftHand1).to(equal(@"0xee")); + expect(SDLStaticIconNameRoundaboutLeftHand2).to(equal(@"0x8c")); + expect(SDLStaticIconNameRoundaboutLeftHand3).to(equal(@"0x84")); + expect(SDLStaticIconNameRoundaboutLeftHand4).to(equal(@"0x72")); + expect(SDLStaticIconNameRoundaboutLeftHand5).to(equal(@"0x6e")); + expect(SDLStaticIconNameRoundaboutLeftHand6).to(equal(@"0x64")); + expect(SDLStaticIconNameRoundaboutLeftHand7).to(equal(@"0x60")); + expect(SDLStaticIconNameRoundaboutRightHand1).to(equal(@"0x62")); + expect(SDLStaticIconNameRoundaboutRightHand2).to(equal(@"0x6c")); + expect(SDLStaticIconNameRoundaboutRightHand3).to(equal(@"0x70")); + expect(SDLStaticIconNameRoundaboutRightHand4).to(equal(@"0x7a")); + expect(SDLStaticIconNameRoundaboutRightHand5).to(equal(@"0x8a")); + expect(SDLStaticIconNameRoundaboutRightHand6).to(equal(@"0xec")); + expect(SDLStaticIconNameRoundaboutRightHand7).to(equal(@"0xf0")); + expect(SDLStaticIconNameRSS).to(equal(@"0x89")); + expect(SDLStaticIconNameSettings).to(equal(@"0x49")); + expect(SDLStaticIconNameSharpLeft).to(equal(@"0xa5")); + expect(SDLStaticIconNameSharpRight).to(equal(@"0xa7")); + expect(SDLStaticIconNameShow).to(equal(@"0xe1")); + expect(SDLStaticIconNameShufflePlay).to(equal(@"0x74")); + expect(SDLStaticIconNameSkiPlaces).to(equal(@"0xab")); + expect(SDLStaticIconNameSlightLeft).to(equal(@"0x9d")); + expect(SDLStaticIconNameSlightRight).to(equal(@"0xa1")); + expect(SDLStaticIconNameSmartphone).to(equal(@"0x05")); + expect(SDLStaticIconNameSortList).to(equal(@"0x7B")); + expect(SDLStaticIconNameSpeedDialNumbersNumber0).to(equal(@"0xE0")); + expect(SDLStaticIconNameSpeedDialNumbersNumber1).to(equal(@"0xD7")); + expect(SDLStaticIconNameSpeedDialNumbersNumber2).to(equal(@"0xD8")); + expect(SDLStaticIconNameSpeedDialNumbersNumber3).to(equal(@"0xD9")); + expect(SDLStaticIconNameSpeedDialNumbersNumber4).to(equal(@"0xDA")); + expect(SDLStaticIconNameSpeedDialNumbersNumber5).to(equal(@"0xDB")); + expect(SDLStaticIconNameSpeedDialNumbersNumber6).to(equal(@"0xDC")); + expect(SDLStaticIconNameSpeedDialNumbersNumber7).to(equal(@"0xDD")); + expect(SDLStaticIconNameSpeedDialNumbersNumber8).to(equal(@"0xDE")); + expect(SDLStaticIconNameSpeedDialNumbersNumber9).to(equal(@"0xDF")); + expect(SDLStaticIconNameSuccess).to(equal(@"0xD5")); + expect(SDLStaticIconNameTrackTitle).to(equal(@"0x4C")); + expect(SDLStaticIconNameTrafficReport).to(equal(@"0x2A")); + expect(SDLStaticIconNameTurnList).to(equal(@"0x10")); + expect(SDLStaticIconNameUTurnLeftTraffic).to(equal(@"0xad")); + expect(SDLStaticIconNameUTurnRightTraffic).to(equal(@"0xa9")); + expect(SDLStaticIconNameUndo).to(equal(@"0x18")); + expect(SDLStaticIconNameUnlocked).to(equal(@"0x23")); + expect(SDLStaticIconNameUSBMediaAudioSource).to(equal(@"0x0B")); + expect(SDLStaticIconNameVoiceControlScrollbarListItemNo1).to(equal(@"0xC7")); + expect(SDLStaticIconNameVoiceControlScrollbarListItemNo2).to(equal(@"0xC8")); + expect(SDLStaticIconNameVoiceControlScrollbarListItemNo3).to(equal(@"0xC9")); + expect(SDLStaticIconNameVoiceControlScrollbarListItemNo4).to(equal(@"0xCA")); + expect(SDLStaticIconNameVoiceRecognitionFailed).to(equal(@"0x90")); + expect(SDLStaticIconNameVoiceRecognitionPause).to(equal(@"0x92")); + expect(SDLStaticIconNameVoiceRecognitionSuccessful).to(equal(@"0x8F")); + expect(SDLStaticIconNameVoiceRecognitionSystemActive).to(equal(@"0x11")); + expect(SDLStaticIconNameVoiceRecognitionSystemListening).to(equal(@"0x91")); + expect(SDLStaticIconNameVoiceRecognitionTryAgain).to(equal(@"0x93")); + expect(SDLStaticIconNameWarning).to(equal(@"0xfe")); + expect(SDLStaticIconNameWeather).to(equal(@"0xeb")); + expect(SDLStaticIconNameWifiFull).to(equal(@"0x43")); + expect(SDLStaticIconNameZoomIn).to(equal(@"0x98")); + expect(SDLStaticIconNameZoomOut).to(equal(@"0x9a")); + }); +}); + +QuickSpecEnd diff --git a/SmartDeviceLinkTests/RPCSpecs/EnumSpecs/SDLSupportedSeatSpec.m b/SmartDeviceLinkTests/RPCSpecs/EnumSpecs/SDLSupportedSeatSpec.m new file mode 100644 index 000000000..d01bda43f --- /dev/null +++ b/SmartDeviceLinkTests/RPCSpecs/EnumSpecs/SDLSupportedSeatSpec.m @@ -0,0 +1,22 @@ +// +// SDLSupportedSeatSpec.m +// SmartDeviceLinkTests +// + +#import <Foundation/Foundation.h> + +#import <Quick/Quick.h> +#import <Nimble/Nimble.h> + +#import "SDLSupportedSeat.h" + +QuickSpecBegin(SDLSupportedSeatSpec) + +describe(@"Individual Enum Value Tests", ^ { + it(@"Should match internal values", ^ { + expect(SDLSupportedSeatDriver).to(equal(@"DRIVER")); + expect(SDLSupportedSeatFrontPassenger).to(equal(@"FRONT_PASSENGER")); + }); +}); + +QuickSpecEnd diff --git a/SmartDeviceLinkTests/RPCSpecs/EnumSpecs/SDLTurnSignalSpec.m b/SmartDeviceLinkTests/RPCSpecs/EnumSpecs/SDLTurnSignalSpec.m new file mode 100644 index 000000000..6be1c9439 --- /dev/null +++ b/SmartDeviceLinkTests/RPCSpecs/EnumSpecs/SDLTurnSignalSpec.m @@ -0,0 +1,27 @@ +// +// SDLTurnSignalSpec.m +// SmartDeviceLinkTests +// +// Created by Nicole on 7/19/18. +// Copyright © 2018 smartdevicelink. All rights reserved. +// + +#import <Foundation/Foundation.h> + +#import <Quick/Quick.h> +#import <Nimble/Nimble.h> + +#import "SDLTurnSignal.h" + +QuickSpecBegin(SDLTurnSignalSpec) + +describe(@"Individual Enum Value Tests", ^ { + it(@"Should match internal values", ^ { + expect(SDLTurnSignalOff).to(equal(@"OFF")); + expect(SDLTurnSignalLeft).to(equal(@"LEFT")); + expect(SDLTurnSignalRight).to(equal(@"RIGHT")); + expect(SDLTurnSignalBoth).to(equal(@"BOTH")); + }); +}); + +QuickSpecEnd diff --git a/SmartDeviceLinkTests/RPCSpecs/EnumSpecs/SDLVehicleDataTypeSpec.m b/SmartDeviceLinkTests/RPCSpecs/EnumSpecs/SDLVehicleDataTypeSpec.m index ee79864fa..2d9812475 100644 --- a/SmartDeviceLinkTests/RPCSpecs/EnumSpecs/SDLVehicleDataTypeSpec.m +++ b/SmartDeviceLinkTests/RPCSpecs/EnumSpecs/SDLVehicleDataTypeSpec.m @@ -42,6 +42,8 @@ describe(@"Individual Enum Value Tests", ^ { expect(SDLVehicleDataTypeEngineTorque).to(equal(@"VEHICLEDATA_ENGINETORQUE")); expect(SDLVehicleDataTypeAccelerationPedal).to(equal(@"VEHICLEDATA_ACCPEDAL")); expect(SDLVehicleDataTypeSteeringWheel).to(equal(@"VEHICLEDATA_STEERINGWHEEL")); + expect(SDLVehicleDataTypeElectronicParkBrakeStatus).to(equal(@"VEHICLEDATA_ELECTRONICPARKBRAKESTATUS")); + expect(SDLVehicleDataTypeTurnSignal).to(equal(@"VEHICLEDATA_TURNSIGNAL")); }); }); diff --git a/SmartDeviceLinkTests/RPCSpecs/EnumSpecs/SDLVideoStreamingStateSpec.m b/SmartDeviceLinkTests/RPCSpecs/EnumSpecs/SDLVideoStreamingStateSpec.m new file mode 100644 index 000000000..9bb2b6900 --- /dev/null +++ b/SmartDeviceLinkTests/RPCSpecs/EnumSpecs/SDLVideoStreamingStateSpec.m @@ -0,0 +1,15 @@ +#import <Quick/Quick.h> +#import <Nimble/Nimble.h> + +#import "SDLVideoStreamingState.h" + +QuickSpecBegin(SDLVideoStreamingStateSpec) + +describe(@"Individual Enum Value Tests", ^ { + it(@"Should match internal values", ^ { + expect(SDLVideoStreamingStateStreamable).to(equal(@"STREAMABLE")); + expect(SDLVideoStreamingStateNotStreamable).to(equal(@"NOT_STREAMABLE")); + }); +}); + +QuickSpecEnd diff --git a/SmartDeviceLinkTests/RPCSpecs/NotificationSpecs/SDLOnHMIStatusSpec.m b/SmartDeviceLinkTests/RPCSpecs/NotificationSpecs/SDLOnHMIStatusSpec.m index 5f442276e..649e7aa74 100644 --- a/SmartDeviceLinkTests/RPCSpecs/NotificationSpecs/SDLOnHMIStatusSpec.m +++ b/SmartDeviceLinkTests/RPCSpecs/NotificationSpecs/SDLOnHMIStatusSpec.m @@ -24,24 +24,28 @@ describe(@"Getter/Setter Tests", ^ { testNotification.hmiLevel = SDLHMILevelLimited; testNotification.audioStreamingState = SDLAudioStreamingStateAttenuated; testNotification.systemContext = SDLSystemContextHMIObscured; + testNotification.videoStreamingState = SDLVideoStreamingStateStreamable; expect(testNotification.hmiLevel).to(equal(SDLHMILevelLimited)); expect(testNotification.audioStreamingState).to(equal(SDLAudioStreamingStateAttenuated)); expect(testNotification.systemContext).to(equal(SDLSystemContextHMIObscured)); + expect(testNotification.videoStreamingState).to(equal(SDLVideoStreamingStateStreamable)); }); it(@"Should get correctly when initialized", ^ { NSMutableDictionary* dict = [@{SDLNameNotification: @{SDLNameParameters: - @{SDLNameHMILevel:SDLHMILevelLimited, - SDLNameAudioStreamingState:SDLAudioStreamingStateAttenuated, - SDLNameSystemContext:SDLSystemContextHMIObscured}, + @{SDLNameHMILevel: SDLHMILevelLimited, + SDLNameAudioStreamingState: SDLAudioStreamingStateAttenuated, + SDLNameSystemContext: SDLSystemContextHMIObscured, + SDLNameVideoStreamingState: SDLVideoStreamingStateStreamable}, SDLNameOperationName:SDLNameOnHMIStatus}} mutableCopy]; SDLOnHMIStatus* testNotification = [[SDLOnHMIStatus alloc] initWithDictionary:dict]; expect(testNotification.hmiLevel).to(equal(SDLHMILevelLimited)); expect(testNotification.audioStreamingState).to(equal(SDLAudioStreamingStateAttenuated)); expect(testNotification.systemContext).to(equal(SDLSystemContextHMIObscured)); + expect(testNotification.videoStreamingState).to(equal(SDLVideoStreamingStateStreamable)); }); it(@"Should return nil if not set", ^ { @@ -50,6 +54,7 @@ describe(@"Getter/Setter Tests", ^ { expect(testNotification.hmiLevel).to(beNil()); expect(testNotification.audioStreamingState).to(beNil()); expect(testNotification.systemContext).to(beNil()); + expect(testNotification.videoStreamingState).to(beNil()); }); }); diff --git a/SmartDeviceLinkTests/RPCSpecs/NotificationSpecs/SDLOnRCStatusSpec.m b/SmartDeviceLinkTests/RPCSpecs/NotificationSpecs/SDLOnRCStatusSpec.m new file mode 100644 index 000000000..4f733d7a8 --- /dev/null +++ b/SmartDeviceLinkTests/RPCSpecs/NotificationSpecs/SDLOnRCStatusSpec.m @@ -0,0 +1,54 @@ +// SDLOnRCStatusSpec.m +// + +#import <Foundation/Foundation.h> + +#import <Quick/Quick.h> +#import <Nimble/Nimble.h> + +#import "SDLOnRCStatus.h" +#import "SDLModuleData.h" +#import "SDLNames.h" + +QuickSpecBegin(SDLOnRCStatusSpec) +SDLModuleData * allocatedModule = [[SDLModuleData alloc] init]; +SDLModuleData * freeModule = [[SDLModuleData alloc] init]; + +describe(@"Getter/Setter Tests", ^ { + it(@"Should set and get correctly", ^ { + SDLOnRCStatus* testNotification = [[SDLOnRCStatus alloc] init]; + testNotification.allowed = @YES; + testNotification.allocatedModules = [@[allocatedModule] copy]; + testNotification.freeModules = [@[freeModule] copy]; + + expect(testNotification.allowed).to(equal(@YES)); + expect(testNotification.allocatedModules).to(equal([@[allocatedModule] copy])); + expect(testNotification.freeModules).to(equal([@[freeModule] copy])); + + }); + + it(@"Should get correctly when initialized", ^ { + NSMutableDictionary<NSString *, id> *dict = [@{SDLNameNotification: + @{SDLNameParameters: + @{SDLNameAllocatedModules:[@[allocatedModule] copy], + SDLNameFreeModules:[@[freeModule] copy], + SDLNameAllowed:@YES + }, + SDLNameOperationName:SDLNameOnRCStatus}} mutableCopy]; + SDLOnRCStatus* testNotification = [[SDLOnRCStatus alloc] initWithDictionary:dict]; + + expect(testNotification.allowed).to(equal(@YES)); + expect(testNotification.allocatedModules).to(equal([@[allocatedModule] copy])); + expect(testNotification.freeModules).to(equal([@[freeModule] copy])); + }); + + it(@"Should return nil if not set", ^ { + SDLOnRCStatus* testNotification = [[SDLOnRCStatus alloc] init]; + + expect(testNotification.allowed).to(beNil()); + expect(testNotification.allocatedModules).to(beNil()); + expect(testNotification.freeModules).to(beNil()); + }); +}); + +QuickSpecEnd diff --git a/SmartDeviceLinkTests/RPCSpecs/NotificationSpecs/SDLOnVehicleDataSpec.m b/SmartDeviceLinkTests/RPCSpecs/NotificationSpecs/SDLOnVehicleDataSpec.m index bb7a040f2..aba995df9 100644 --- a/SmartDeviceLinkTests/RPCSpecs/NotificationSpecs/SDLOnVehicleDataSpec.m +++ b/SmartDeviceLinkTests/RPCSpecs/NotificationSpecs/SDLOnVehicleDataSpec.m @@ -39,6 +39,7 @@ describe(@"Getter/Setter Tests", ^ { testNotification.deviceStatus = device; testNotification.driverBraking = SDLVehicleDataEventStatusYes; testNotification.eCallInfo = eCall; + testNotification.electronicParkBrakeStatus = SDLElectronicParkBrakeStatusDriveActive; testNotification.emergencyEvent = event; testNotification.engineOilLife = @34.45; testNotification.engineTorque = @-200.124; @@ -56,6 +57,7 @@ describe(@"Getter/Setter Tests", ^ { testNotification.speed = @70.1; testNotification.steeringWheelAngle = @0.000000001; testNotification.tirePressure = tires; + testNotification.turnSignal = SDLTurnSignalRight; testNotification.vin = @"222222222722"; testNotification.wiperStatus = SDLWiperStatusStalled; @@ -67,6 +69,7 @@ describe(@"Getter/Setter Tests", ^ { expect(testNotification.deviceStatus).to(equal(device)); expect(testNotification.driverBraking).to(equal(SDLVehicleDataEventStatusYes)); expect(testNotification.eCallInfo).to(equal(eCall)); + expect(testNotification.electronicParkBrakeStatus).to(equal(SDLElectronicParkBrakeStatusDriveActive)); expect(testNotification.emergencyEvent).to(equal(event)); expect(testNotification.engineOilLife).to(equal(@34.45)); expect(testNotification.engineTorque).to(equal(@-200.124)); @@ -84,41 +87,44 @@ describe(@"Getter/Setter Tests", ^ { expect(testNotification.speed).to(equal(@70.1)); expect(testNotification.steeringWheelAngle).to(equal(@0.000000001)); expect(testNotification.tirePressure).to(equal(tires)); + expect(testNotification.turnSignal).to(equal(SDLTurnSignalRight)); expect(testNotification.vin).to(equal(@"222222222722")); expect(testNotification.wiperStatus).to(equal(SDLWiperStatusStalled)); }); it(@"Should get correctly when initialized", ^ { NSDictionary* dict = @{SDLNameNotification: - @{SDLNameParameters: - @{SDLNameAccelerationPedalPosition:@99.99999999, - SDLNameAirbagStatus:airbag, - SDLNameBeltStatus:belt, - SDLNameBodyInformation:body, - SDLNameClusterModeStatus:clusterMode, - SDLNameDeviceStatus:device, - SDLNameDriverBraking:SDLVehicleDataEventStatusYes, - SDLNameECallInfo:eCall, - SDLNameEmergencyEvent:event, - SDLNameEngineOilLife:@45.1, - SDLNameEngineTorque:@-200.124, - SDLNameExternalTemperature:@-10, - SDLNameFuelLevel:@10.3, - SDLNameFuelLevelState:SDLComponentVolumeStatusAlert, - SDLNameFuelRange:@[fuelRange], - SDLNameGPS:gps, - SDLNameHeadLampStatus:headLamp, - SDLNameInstantFuelConsumption:@4000.63, - SDLNameMyKey:myKey, - SDLNameOdometer:@100050, - SDLNamePRNDL:SDLPRNDLDrive, - SDLNameRPM:@4242, - SDLNameSpeed:@70.1, - SDLNameSteeringWheelAngle:@0.000000001, - SDLNameTirePressure:tires, - SDLNameVIN:@"222222222722", - SDLNameWiperStatus:SDLWiperStatusStalled}, - SDLNameOperationName:SDLNameOnVehicleData}}; + @{SDLNameParameters: + @{SDLNameAccelerationPedalPosition:@99.99999999, + SDLNameAirbagStatus:airbag, + SDLNameBeltStatus:belt, + SDLNameBodyInformation:body, + SDLNameClusterModeStatus:clusterMode, + SDLNameDeviceStatus:device, + SDLNameDriverBraking:SDLVehicleDataEventStatusYes, + SDLNameECallInfo:eCall, + SDLNameElectronicParkBrakeStatus:SDLElectronicParkBrakeStatusDriveActive, + SDLNameEmergencyEvent:event, + SDLNameEngineOilLife:@45.1, + SDLNameEngineTorque:@-200.124, + SDLNameExternalTemperature:@-10, + SDLNameFuelLevel:@10.3, + SDLNameFuelLevelState:SDLComponentVolumeStatusAlert, + SDLNameFuelRange:@[fuelRange], + SDLNameGPS:gps, + SDLNameHeadLampStatus:headLamp, + SDLNameInstantFuelConsumption:@4000.63, + SDLNameMyKey:myKey, + SDLNameOdometer:@100050, + SDLNamePRNDL:SDLPRNDLDrive, + SDLNameRPM:@4242, + SDLNameSpeed:@70.1, + SDLNameSteeringWheelAngle:@0.000000001, + SDLNameTirePressure:tires, + SDLNameTurnSignal:SDLTurnSignalOff, + SDLNameVIN:@"222222222722", + SDLNameWiperStatus:SDLWiperStatusStalled}, + SDLNameOperationName:SDLNameOnVehicleData}}; SDLOnVehicleData* testNotification = [[SDLOnVehicleData alloc] initWithDictionary:dict]; expect(testNotification.accPedalPosition).to(equal(@99.99999999)); @@ -129,6 +135,7 @@ describe(@"Getter/Setter Tests", ^ { expect(testNotification.deviceStatus).to(equal(device)); expect(testNotification.driverBraking).to(equal(SDLVehicleDataEventStatusYes)); expect(testNotification.eCallInfo).to(equal(eCall)); + expect(testNotification.electronicParkBrakeStatus).to(equal(SDLElectronicParkBrakeStatusDriveActive)); expect(testNotification.emergencyEvent).to(equal(event)); expect(testNotification.engineOilLife).to(equal(@45.1)); expect(testNotification.engineTorque).to(equal(@-200.124)); @@ -146,6 +153,7 @@ describe(@"Getter/Setter Tests", ^ { expect(testNotification.speed).to(equal(@70.1)); expect(testNotification.steeringWheelAngle).to(equal(@0.000000001)); expect(testNotification.tirePressure).to(equal(tires)); + expect(testNotification.turnSignal).to(equal(SDLTurnSignalOff)); expect(testNotification.vin).to(equal(@"222222222722")); expect(testNotification.wiperStatus).to(equal(SDLWiperStatusStalled)); }); @@ -161,6 +169,7 @@ describe(@"Getter/Setter Tests", ^ { expect(testNotification.deviceStatus).to(beNil()); expect(testNotification.driverBraking).to(beNil()); expect(testNotification.eCallInfo).to(beNil()); + expect(testNotification.electronicParkBrakeStatus).to(beNil()); expect(testNotification.emergencyEvent).to(beNil()); expect(testNotification.engineOilLife).to(beNil()); expect(testNotification.engineTorque).to(beNil()); @@ -178,6 +187,7 @@ describe(@"Getter/Setter Tests", ^ { expect(testNotification.speed).to(beNil()); expect(testNotification.steeringWheelAngle).to(beNil()); expect(testNotification.tirePressure).to(beNil()); + expect(testNotification.turnSignal).to(beNil()); expect(testNotification.vin).to(beNil()); expect(testNotification.wiperStatus).to(beNil()); }); diff --git a/SmartDeviceLinkTests/RPCSpecs/RequestSpecs/SDLAddSubMenuSpec.m b/SmartDeviceLinkTests/RPCSpecs/RequestSpecs/SDLAddSubMenuSpec.m index 8dd5742cb..f082671b5 100644 --- a/SmartDeviceLinkTests/RPCSpecs/RequestSpecs/SDLAddSubMenuSpec.m +++ b/SmartDeviceLinkTests/RPCSpecs/RequestSpecs/SDLAddSubMenuSpec.m @@ -9,21 +9,60 @@ #import <Nimble/Nimble.h> #import "SDLAddSubMenu.h" +#import "SDLImage.h" #import "SDLNames.h" QuickSpecBegin(SDLAddSubMenuSpec) describe(@"Getter/Setter Tests", ^ { + __block UInt32 menuId = 4345645; + __block UInt8 position = 27; + __block NSString *menuName = @"Welcome to the menu"; + __block SDLImage *image = nil; + + beforeEach(^{ + image = [[SDLImage alloc] initWithName:@"Test"]; + }); + + it(@"should correctly initialize with initWithId:menuName:", ^{ + SDLAddSubMenu *testRequest = [[SDLAddSubMenu alloc] initWithId:menuId menuName:menuName]; + + expect(testRequest.menuID).to(equal(@(menuId))); + expect(testRequest.position).to(beNil()); + expect(testRequest.menuName).to(equal(menuName)); + expect(testRequest.menuIcon).to(beNil()); + }); + + it(@"should correctly initialize with initWithId:menuName:position:", ^{ + SDLAddSubMenu *testRequest = [[SDLAddSubMenu alloc] initWithId:menuId menuName:menuName position:position]; + + expect(testRequest.menuID).to(equal(@(menuId))); + expect(testRequest.position).to(equal(@(position))); + expect(testRequest.menuName).to(equal(menuName)); + expect(testRequest.menuIcon).to(beNil()); + }); + + it(@"should correctly initialize with initWithId:menuName:menuIcon:position:", ^{ + SDLAddSubMenu *testRequest = [[SDLAddSubMenu alloc] initWithId:menuId menuName:menuName menuIcon:image position:position]; + + expect(testRequest.menuID).to(equal(@(menuId))); + expect(testRequest.position).to(equal(@(position))); + expect(testRequest.menuName).to(equal(menuName)); + expect(testRequest.menuIcon).to(equal(image)); + }); + it(@"Should set and get correctly", ^ { SDLAddSubMenu* testRequest = [[SDLAddSubMenu alloc] init]; testRequest.menuID = @4345645; testRequest.position = @27; testRequest.menuName = @"Welcome to the menu"; + testRequest.menuIcon = image; - expect(testRequest.menuID).to(equal(@4345645)); - expect(testRequest.position).to(equal(@27)); - expect(testRequest.menuName).to(equal(@"Welcome to the menu")); + expect(testRequest.menuID).to(equal(@(menuId))); + expect(testRequest.position).to(equal(@(position))); + expect(testRequest.menuName).to(equal(menuName)); + expect(testRequest.menuIcon).to(equal(image)); }); it(@"Should get correctly when initialized", ^ { @@ -31,13 +70,18 @@ describe(@"Getter/Setter Tests", ^ { @{SDLNameParameters: @{SDLNameMenuId:@4345645, SDLNamePosition:@27, - SDLNameMenuName:@"Welcome to the menu"}, + SDLNameMenuName:@"Welcome to the menu", + SDLNameMenuIcon: @{ + SDLNameValue: @"Test" + } + }, SDLNameOperationName:SDLNameAddSubMenu}} mutableCopy]; SDLAddSubMenu* testRequest = [[SDLAddSubMenu alloc] initWithDictionary:dict]; - expect(testRequest.menuID).to(equal(@4345645)); - expect(testRequest.position).to(equal(@27)); - expect(testRequest.menuName).to(equal(@"Welcome to the menu")); + expect(testRequest.menuID).to(equal(@(menuId))); + expect(testRequest.position).to(equal(@(position))); + expect(testRequest.menuName).to(equal(menuName)); + expect(testRequest.menuIcon.value).to(equal(@"Test")); }); it(@"Should return nil if not set", ^ { @@ -46,6 +90,7 @@ describe(@"Getter/Setter Tests", ^ { expect(testRequest.menuID).to(beNil()); expect(testRequest.position).to(beNil()); expect(testRequest.menuName).to(beNil()); + expect(testRequest.menuIcon).to(beNil()); }); }); diff --git a/SmartDeviceLinkTests/RPCSpecs/RequestSpecs/SDLGetVehicleDataSpec.m b/SmartDeviceLinkTests/RPCSpecs/RequestSpecs/SDLGetVehicleDataSpec.m index c1df0f946..d5575fe7b 100644 --- a/SmartDeviceLinkTests/RPCSpecs/RequestSpecs/SDLGetVehicleDataSpec.m +++ b/SmartDeviceLinkTests/RPCSpecs/RequestSpecs/SDLGetVehicleDataSpec.m @@ -25,6 +25,7 @@ describe(@"Getter/Setter Tests", ^ { testRequest.deviceStatus = @NO; testRequest.driverBraking = @YES; testRequest.eCallInfo = @YES; + testRequest.electronicParkBrakeStatus = @YES; testRequest.emergencyEvent = @YES; testRequest.engineOilLife = @YES; testRequest.engineTorque = @NO; @@ -42,6 +43,7 @@ describe(@"Getter/Setter Tests", ^ { testRequest.speed = @NO; testRequest.steeringWheelAngle = @NO; testRequest.tirePressure = @NO; + testRequest.turnSignal = @YES; testRequest.wiperStatus = @NO; expect(testRequest.accPedalPosition).to(equal(@YES)); @@ -52,6 +54,7 @@ describe(@"Getter/Setter Tests", ^ { expect(testRequest.deviceStatus).to(equal(@NO)); expect(testRequest.driverBraking).to(equal(@YES)); expect(testRequest.eCallInfo).to(equal(@YES)); + expect(testRequest.electronicParkBrakeStatus).to(equal(@YES)); expect(testRequest.emergencyEvent).to(equal(@YES)); expect(testRequest.engineOilLife).to(equal(@YES)); expect(testRequest.engineTorque).to(equal(@NO)); @@ -69,6 +72,7 @@ describe(@"Getter/Setter Tests", ^ { expect(testRequest.speed).to(equal(@NO)); expect(testRequest.steeringWheelAngle).to(equal(@NO)); expect(testRequest.tirePressure).to(equal(@NO)); + expect(testRequest.turnSignal).to(equal(@YES)); expect(testRequest.wiperStatus).to(equal(@NO)); }); @@ -83,6 +87,7 @@ describe(@"Getter/Setter Tests", ^ { SDLNameDeviceStatus:@YES, SDLNameDriverBraking:@YES, SDLNameECallInfo:@YES, + SDLNameElectronicParkBrakeStatus:@YES, SDLNameEmergencyEvent:@NO, SDLNameEngineOilLife:@YES, SDLNameEngineTorque:@YES, @@ -100,6 +105,7 @@ describe(@"Getter/Setter Tests", ^ { SDLNameSpeed:@YES, SDLNameSteeringWheelAngle:@NO, SDLNameTirePressure:@YES, + SDLNameTurnSignal:@NO, SDLNameWiperStatus:@YES}, SDLNameOperationName:SDLNameGetVehicleData}}; SDLGetVehicleData* testRequest = [[SDLGetVehicleData alloc] initWithDictionary:dict]; @@ -112,6 +118,7 @@ describe(@"Getter/Setter Tests", ^ { expect(testRequest.deviceStatus).to(equal(@YES)); expect(testRequest.driverBraking).to(equal(@YES)); expect(testRequest.eCallInfo).to(equal(@YES)); + expect(testRequest.electronicParkBrakeStatus).to(equal(@YES)); expect(testRequest.emergencyEvent).to(equal(@NO)); expect(testRequest.engineOilLife).to(equal(@YES)); expect(testRequest.engineTorque).to(equal(@YES)); @@ -129,6 +136,7 @@ describe(@"Getter/Setter Tests", ^ { expect(testRequest.speed).to(equal(@YES)); expect(testRequest.steeringWheelAngle).to(equal(@NO)); expect(testRequest.tirePressure).to(equal(@YES)); + expect(testRequest.turnSignal).to(equal(@NO)); expect(testRequest.wiperStatus).to(equal(@YES)); }); }); @@ -145,6 +153,7 @@ describe(@"initializers", ^{ expect(testRequest.deviceStatus).to(beNil()); expect(testRequest.driverBraking).to(beNil()); expect(testRequest.eCallInfo).to(beNil()); + expect(testRequest.electronicParkBrakeStatus).to(beNil()); expect(testRequest.emergencyEvent).to(beNil()); expect(testRequest.engineOilLife).to(beNil()); expect(testRequest.engineTorque).to(beNil()); @@ -162,6 +171,7 @@ describe(@"initializers", ^{ expect(testRequest.speed).to(beNil()); expect(testRequest.steeringWheelAngle).to(beNil()); expect(testRequest.tirePressure).to(beNil()); + expect(testRequest.turnSignal).to(beNil()); expect(testRequest.wiperStatus).to(beNil()); }); @@ -176,6 +186,7 @@ describe(@"initializers", ^{ expect(testRequest.deviceStatus).to(equal(@YES)); expect(testRequest.driverBraking).to(equal(@YES)); expect(testRequest.eCallInfo).to(equal(@YES)); + expect(testRequest.electronicParkBrakeStatus).to(equal(@NO)); expect(testRequest.emergencyEvent).to(equal(@YES)); expect(testRequest.engineOilLife).to(equal(@NO)); expect(testRequest.engineTorque).to(equal(@YES)); @@ -193,11 +204,12 @@ describe(@"initializers", ^{ expect(testRequest.speed).to(equal(@YES)); expect(testRequest.steeringWheelAngle).to(equal(@YES)); expect(testRequest.tirePressure).to(equal(@YES)); + expect(testRequest.turnSignal).to(equal(@NO)); expect(testRequest.wiperStatus).to(equal(@YES)); }); context(@"initWithAccelerationPedalPosition:airbagStatus:beltStatus:bodyInformation:clusterModeStatus:deviceStatus:driverBraking:eCallInfo:emergencyEvent:engineOilLife:engineTorque:externalTemperature:fuelLevel:fuelLevelState:gps:headLampStatus:instantFuelConsumption:myKey:odometer:prndl:rpm:speed:steeringWheelAngle:tirePressure:wiperStatus:", ^{ - SDLGetVehicleData *testRequest = [[SDLGetVehicleData alloc] initWithAccelerationPedalPosition:YES airbagStatus:YES beltStatus:YES bodyInformation:YES clusterModeStatus:YES deviceStatus:YES driverBraking:YES eCallInfo:YES emergencyEvent:YES engineOilLife:YES engineTorque:YES externalTemperature:YES fuelLevel:YES fuelLevelState:YES fuelRange:YES gps:YES headLampStatus:YES instantFuelConsumption:YES myKey:YES odometer:YES prndl:YES rpm:YES speed:YES steeringWheelAngle:YES tirePressure:YES vin:YES wiperStatus:YES]; + SDLGetVehicleData *testRequest = [[SDLGetVehicleData alloc] initWithAccelerationPedalPosition:YES airbagStatus:YES beltStatus:YES bodyInformation:YES clusterModeStatus:YES deviceStatus:YES driverBraking:YES eCallInfo:YES electronicParkBrakeStatus:YES emergencyEvent:YES engineOilLife:YES engineTorque:YES externalTemperature:YES fuelLevel:YES fuelLevelState:YES fuelRange:YES gps:YES headLampStatus:YES instantFuelConsumption:YES myKey:YES odometer:YES prndl:YES rpm:YES speed:YES steeringWheelAngle:YES tirePressure:YES turnSignal:YES vin:YES wiperStatus:YES]; expect(testRequest.accPedalPosition).to(equal(@YES)); expect(testRequest.airbagStatus).to(equal(@YES)); @@ -207,6 +219,7 @@ describe(@"initializers", ^{ expect(testRequest.deviceStatus).to(equal(@YES)); expect(testRequest.driverBraking).to(equal(@YES)); expect(testRequest.eCallInfo).to(equal(@YES)); + expect(testRequest.electronicParkBrakeStatus).to(equal(@YES)); expect(testRequest.emergencyEvent).to(equal(@YES)); expect(testRequest.engineOilLife).to(equal(@YES)); expect(testRequest.engineTorque).to(equal(@YES)); @@ -224,6 +237,7 @@ describe(@"initializers", ^{ expect(testRequest.speed).to(equal(@YES)); expect(testRequest.steeringWheelAngle).to(equal(@YES)); expect(testRequest.tirePressure).to(equal(@YES)); + expect(testRequest.turnSignal).to(equal(@YES)); expect(testRequest.wiperStatus).to(equal(@YES)); }); }); diff --git a/SmartDeviceLinkTests/RPCSpecs/RequestSpecs/SDLSetMediaClockTimerSpec.m b/SmartDeviceLinkTests/RPCSpecs/RequestSpecs/SDLSetMediaClockTimerSpec.m index bf8243ab8..351a6e558 100644 --- a/SmartDeviceLinkTests/RPCSpecs/RequestSpecs/SDLSetMediaClockTimerSpec.m +++ b/SmartDeviceLinkTests/RPCSpecs/RequestSpecs/SDLSetMediaClockTimerSpec.m @@ -26,10 +26,12 @@ describe(@"Getter/Setter Tests", ^ { testRequest.startTime = time1; testRequest.endTime = time2; testRequest.updateMode = SDLUpdateModeCountUp; + testRequest.audioStreamingIndicator = SDLAudioStreamingIndicatorPlayPause; expect(testRequest.startTime).to(equal(time1)); expect(testRequest.endTime).to(equal(time2)); expect(testRequest.updateMode).to(equal(SDLUpdateModeCountUp)); + expect(testRequest.audioStreamingIndicator).to(equal(SDLAudioStreamingIndicatorPlayPause)); }); it(@"Should get correctly when initialized", ^ { @@ -37,13 +39,16 @@ describe(@"Getter/Setter Tests", ^ { @{SDLNameParameters: @{SDLNameStartTime:time1, SDLNameEndTime:time2, - SDLNameUpdateMode:SDLUpdateModeCountUp}, + SDLNameUpdateMode:SDLUpdateModeCountUp, + SDLNameAudioStreamingIndicator:SDLAudioStreamingIndicatorPlayPause + }, SDLNameOperationName:SDLNameSetMediaClockTimer}} mutableCopy]; SDLSetMediaClockTimer* testRequest = [[SDLSetMediaClockTimer alloc] initWithDictionary:dict]; expect(testRequest.startTime).to(equal(time1)); expect(testRequest.endTime).to(equal(time2)); expect(testRequest.updateMode).to(equal(SDLUpdateModeCountUp)); + expect(testRequest.audioStreamingIndicator).to(equal(SDLAudioStreamingIndicatorPlayPause)); }); it(@"Should return nil if not set", ^ { @@ -52,6 +57,7 @@ describe(@"Getter/Setter Tests", ^ { expect(testRequest.startTime).to(beNil()); expect(testRequest.endTime).to(beNil()); expect(testRequest.updateMode).to(beNil()); + expect(testRequest.audioStreamingIndicator).to(beNil()); }); }); diff --git a/SmartDeviceLinkTests/RPCSpecs/RequestSpecs/SDLSubscribeVehicleDataSpec.m b/SmartDeviceLinkTests/RPCSpecs/RequestSpecs/SDLSubscribeVehicleDataSpec.m index 79575e019..3ec8a0adb 100644 --- a/SmartDeviceLinkTests/RPCSpecs/RequestSpecs/SDLSubscribeVehicleDataSpec.m +++ b/SmartDeviceLinkTests/RPCSpecs/RequestSpecs/SDLSubscribeVehicleDataSpec.m @@ -25,6 +25,7 @@ describe(@"Getter/Setter Tests", ^ { testRequest.deviceStatus = @NO; testRequest.driverBraking = @YES; testRequest.eCallInfo = @YES; + testRequest.electronicParkBrakeStatus = @YES; testRequest.emergencyEvent = @YES; testRequest.engineOilLife = @YES; testRequest.engineTorque = @NO; @@ -42,6 +43,7 @@ describe(@"Getter/Setter Tests", ^ { testRequest.speed = @NO; testRequest.steeringWheelAngle = @NO; testRequest.tirePressure = @NO; + testRequest.turnSignal = @YES; testRequest.wiperStatus = @NO; expect(testRequest.accPedalPosition).to(equal(@YES)); @@ -52,6 +54,7 @@ describe(@"Getter/Setter Tests", ^ { expect(testRequest.deviceStatus).to(equal(@NO)); expect(testRequest.driverBraking).to(equal(@YES)); expect(testRequest.eCallInfo).to(equal(@YES)); + expect(testRequest.electronicParkBrakeStatus).to(equal(@YES)); expect(testRequest.emergencyEvent).to(equal(@YES)); expect(testRequest.engineOilLife).to(equal(@YES)); expect(testRequest.engineTorque).to(equal(@NO)); @@ -69,39 +72,42 @@ describe(@"Getter/Setter Tests", ^ { expect(testRequest.speed).to(equal(@NO)); expect(testRequest.steeringWheelAngle).to(equal(@NO)); expect(testRequest.tirePressure).to(equal(@NO)); + expect(testRequest.turnSignal).to(equal(@YES)); expect(testRequest.wiperStatus).to(equal(@NO)); }); it(@"Should get correctly when initialized", ^ { NSDictionary<NSString *, id> *dict = @{SDLNameRequest: - @{SDLNameParameters: - @{SDLNameAccelerationPedalPosition:@YES, - SDLNameAirbagStatus:@YES, - SDLNameBeltStatus:@YES, - SDLNameBodyInformation:@YES, - SDLNameClusterModeStatus:@YES, - SDLNameDeviceStatus:@YES, - SDLNameDriverBraking:@YES, - SDLNameECallInfo:@YES, - SDLNameEmergencyEvent:@NO, - SDLNameEngineOilLife:@YES, - SDLNameEngineTorque:@YES, - SDLNameExternalTemperature:@NO, - SDLNameFuelLevel:@YES, - SDLNameFuelLevelState:@YES, - SDLNameFuelRange:@YES, - SDLNameGPS:@YES, - SDLNameHeadLampStatus:@YES, - SDLNameInstantFuelConsumption:@YES, - SDLNameMyKey:@YES, - SDLNameOdometer:@YES, - SDLNamePRNDL:@YES, - SDLNameRPM:@YES, - SDLNameSpeed:@YES, - SDLNameSteeringWheelAngle:@NO, - SDLNameTirePressure:@YES, - SDLNameWiperStatus:@NO}, - SDLNameOperationName:SDLNameSubscribeVehicleData}}; + @{SDLNameParameters: + @{SDLNameAccelerationPedalPosition:@YES, + SDLNameAirbagStatus:@YES, + SDLNameBeltStatus:@YES, + SDLNameBodyInformation:@YES, + SDLNameClusterModeStatus:@YES, + SDLNameDeviceStatus:@YES, + SDLNameDriverBraking:@YES, + SDLNameECallInfo:@YES, + SDLNameElectronicParkBrakeStatus: @YES, + SDLNameEmergencyEvent:@NO, + SDLNameEngineOilLife:@YES, + SDLNameEngineTorque:@YES, + SDLNameExternalTemperature:@NO, + SDLNameFuelLevel:@YES, + SDLNameFuelLevelState:@YES, + SDLNameFuelRange:@YES, + SDLNameGPS:@YES, + SDLNameHeadLampStatus:@YES, + SDLNameInstantFuelConsumption:@YES, + SDLNameMyKey:@YES, + SDLNameOdometer:@YES, + SDLNamePRNDL:@YES, + SDLNameRPM:@YES, + SDLNameSpeed:@YES, + SDLNameSteeringWheelAngle:@NO, + SDLNameTirePressure:@YES, + SDLNameTurnSignal:@NO, + SDLNameWiperStatus:@NO}, + SDLNameOperationName:SDLNameSubscribeVehicleData}}; SDLSubscribeVehicleData* testRequest = [[SDLSubscribeVehicleData alloc] initWithDictionary:dict]; expect(testRequest.accPedalPosition).to(equal(@YES)); @@ -112,6 +118,7 @@ describe(@"Getter/Setter Tests", ^ { expect(testRequest.deviceStatus).to(equal(@YES)); expect(testRequest.driverBraking).to(equal(@YES)); expect(testRequest.eCallInfo).to(equal(@YES)); + expect(testRequest.electronicParkBrakeStatus).to(equal(@YES)); expect(testRequest.emergencyEvent).to(equal(@NO)); expect(testRequest.engineOilLife).to(equal(@YES)); expect(testRequest.engineTorque).to(equal(@YES)); @@ -129,6 +136,7 @@ describe(@"Getter/Setter Tests", ^ { expect(testRequest.speed).to(equal(@YES)); expect(testRequest.steeringWheelAngle).to(equal(@NO)); expect(testRequest.tirePressure).to(equal(@YES)); + expect(testRequest.turnSignal).to(equal(@NO)); expect(testRequest.wiperStatus).to(equal(@NO)); }); }); @@ -145,6 +153,7 @@ describe(@"initializers", ^{ expect(testRequest.deviceStatus).to(beNil()); expect(testRequest.driverBraking).to(beNil()); expect(testRequest.eCallInfo).to(beNil()); + expect(testRequest.electronicParkBrakeStatus).to(beNil()); expect(testRequest.emergencyEvent).to(beNil()); expect(testRequest.engineOilLife).to(beNil()); expect(testRequest.engineTorque).to(beNil()); @@ -162,11 +171,12 @@ describe(@"initializers", ^{ expect(testRequest.speed).to(beNil()); expect(testRequest.steeringWheelAngle).to(beNil()); expect(testRequest.tirePressure).to(beNil()); + expect(testRequest.turnSignal).to(beNil()); expect(testRequest.wiperStatus).to(beNil()); }); context(@"initWithAccelerationPedalPosition:airbagStatus:beltStatus:bodyInformation:clusterModeStatus:deviceStatus:driverBraking:eCallInfo:emergencyEvent:engineOilLife:engineTorque:externalTemperature:fuelLevel:fuelLevelState:gps:headLampStatus:instantFuelConsumption:myKey:odometer:prndl:rpm:speed:steeringWheelAngle:tirePressure:wiperStatus:", ^{ - SDLSubscribeVehicleData* testRequest = [[SDLSubscribeVehicleData alloc] initWithAccelerationPedalPosition:YES airbagStatus:YES beltStatus:YES bodyInformation:YES clusterModeStatus:YES deviceStatus:YES driverBraking:YES eCallInfo:YES emergencyEvent:YES engineOilLife:YES engineTorque:YES externalTemperature:YES fuelLevel:YES fuelLevelState:YES fuelRange:YES gps:YES headLampStatus:YES instantFuelConsumption:YES myKey:YES odometer:YES prndl:YES rpm:YES speed:YES steeringWheelAngle:YES tirePressure:YES wiperStatus:YES]; + SDLSubscribeVehicleData* testRequest = [[SDLSubscribeVehicleData alloc] initWithAccelerationPedalPosition:YES airbagStatus:YES beltStatus:YES bodyInformation:YES clusterModeStatus:YES deviceStatus:YES driverBraking:YES eCallInfo:YES electronicParkBrakeStatus:YES emergencyEvent:YES engineOilLife:YES engineTorque:YES externalTemperature:YES fuelLevel:YES fuelLevelState:YES fuelRange:YES gps:YES headLampStatus:YES instantFuelConsumption:YES myKey:YES odometer:YES prndl:YES rpm:YES speed:YES steeringWheelAngle:YES tirePressure:YES turnSignal:YES wiperStatus:YES]; expect(testRequest.accPedalPosition).to(equal(@YES)); expect(testRequest.airbagStatus).to(equal(@YES)); @@ -176,6 +186,7 @@ describe(@"initializers", ^{ expect(testRequest.deviceStatus).to(equal(@YES)); expect(testRequest.driverBraking).to(equal(@YES)); expect(testRequest.eCallInfo).to(equal(@YES)); + expect(testRequest.electronicParkBrakeStatus).to(equal(@YES)); expect(testRequest.emergencyEvent).to(equal(@YES)); expect(testRequest.engineOilLife).to(equal(@YES)); expect(testRequest.engineTorque).to(equal(@YES)); @@ -193,6 +204,7 @@ describe(@"initializers", ^{ expect(testRequest.speed).to(equal(@YES)); expect(testRequest.steeringWheelAngle).to(equal(@YES)); expect(testRequest.tirePressure).to(equal(@YES)); + expect(testRequest.turnSignal).to(equal(@YES)); expect(testRequest.wiperStatus).to(equal(@YES)); }); @@ -207,6 +219,7 @@ describe(@"initializers", ^{ expect(testRequest.deviceStatus).to(equal(@YES)); expect(testRequest.driverBraking).to(equal(@YES)); expect(testRequest.eCallInfo).to(equal(@YES)); + expect(testRequest.electronicParkBrakeStatus).to(equal(@NO)); expect(testRequest.emergencyEvent).to(equal(@YES)); expect(testRequest.engineOilLife).to(equal(@NO)); expect(testRequest.engineTorque).to(equal(@YES)); @@ -224,6 +237,7 @@ describe(@"initializers", ^{ expect(testRequest.speed).to(equal(@YES)); expect(testRequest.steeringWheelAngle).to(equal(@YES)); expect(testRequest.tirePressure).to(equal(@YES)); + expect(testRequest.turnSignal).to(equal(@NO)); expect(testRequest.wiperStatus).to(equal(@YES)); }); }); diff --git a/SmartDeviceLinkTests/RPCSpecs/RequestSpecs/SDLUnsubscribeVehicleDataSpec.m b/SmartDeviceLinkTests/RPCSpecs/RequestSpecs/SDLUnsubscribeVehicleDataSpec.m index f2131d8e7..d571d743e 100644 --- a/SmartDeviceLinkTests/RPCSpecs/RequestSpecs/SDLUnsubscribeVehicleDataSpec.m +++ b/SmartDeviceLinkTests/RPCSpecs/RequestSpecs/SDLUnsubscribeVehicleDataSpec.m @@ -25,6 +25,7 @@ describe(@"Getter/Setter Tests", ^ { testRequest.deviceStatus = @YES; testRequest.driverBraking = @YES; testRequest.eCallInfo = @YES; + testRequest.electronicParkBrakeStatus = @YES; testRequest.emergencyEvent = @YES; testRequest.engineOilLife = @YES; testRequest.engineTorque = @YES; @@ -42,6 +43,7 @@ describe(@"Getter/Setter Tests", ^ { testRequest.speed = @YES; testRequest.steeringWheelAngle = @YES; testRequest.tirePressure = @YES; + testRequest.turnSignal = @NO; testRequest.wiperStatus = @YES; expect(testRequest.accPedalPosition).to(equal(@YES)); @@ -52,6 +54,7 @@ describe(@"Getter/Setter Tests", ^ { expect(testRequest.deviceStatus).to(equal(@YES)); expect(testRequest.driverBraking).to(equal(@YES)); expect(testRequest.eCallInfo).to(equal(@YES)); + expect(testRequest.electronicParkBrakeStatus).to(equal(@YES)); expect(testRequest.emergencyEvent).to(equal(@YES)); expect(testRequest.engineOilLife).to(equal(@YES)); expect(testRequest.engineTorque).to(equal(@YES)); @@ -69,39 +72,42 @@ describe(@"Getter/Setter Tests", ^ { expect(testRequest.speed).to(equal(@YES)); expect(testRequest.steeringWheelAngle).to(equal(@YES)); expect(testRequest.tirePressure).to(equal(@YES)); + expect(testRequest.turnSignal).to(equal(@NO)); expect(testRequest.wiperStatus).to(equal(@YES)); }); it(@"Should get correctly when initialized", ^ { NSDictionary<NSString *, id> *dict = @{SDLNameRequest: - @{SDLNameParameters: - @{SDLNameAccelerationPedalPosition:@YES, - SDLNameAirbagStatus:@YES, - SDLNameBeltStatus:@YES, - SDLNameBodyInformation:@YES, - SDLNameClusterModeStatus:@YES, - SDLNameDeviceStatus:@YES, - SDLNameDriverBraking:@YES, - SDLNameECallInfo:@YES, - SDLNameEmergencyEvent:@YES, - SDLNameEngineOilLife:@YES, - SDLNameEngineTorque:@YES, - SDLNameExternalTemperature:@YES, - SDLNameFuelLevel:@YES, - SDLNameFuelLevelState:@YES, - SDLNameFuelRange:@YES, - SDLNameGPS:@YES, - SDLNameHeadLampStatus:@YES, - SDLNameInstantFuelConsumption:@YES, - SDLNameMyKey:@YES, - SDLNameOdometer:@YES, - SDLNamePRNDL:@YES, - SDLNameRPM:@YES, - SDLNameSpeed:@YES, - SDLNameSteeringWheelAngle:@YES, - SDLNameTirePressure:@YES, - SDLNameWiperStatus:@YES}, - SDLNameOperationName:SDLNameUnsubscribeVehicleData}}; + @{SDLNameParameters: + @{SDLNameAccelerationPedalPosition:@YES, + SDLNameAirbagStatus:@YES, + SDLNameBeltStatus:@YES, + SDLNameBodyInformation:@YES, + SDLNameClusterModeStatus:@YES, + SDLNameDeviceStatus:@YES, + SDLNameDriverBraking:@YES, + SDLNameECallInfo:@YES, + SDLNameElectronicParkBrakeStatus: @YES, + SDLNameEmergencyEvent:@YES, + SDLNameEngineOilLife:@YES, + SDLNameEngineTorque:@YES, + SDLNameExternalTemperature:@YES, + SDLNameFuelLevel:@YES, + SDLNameFuelLevelState:@YES, + SDLNameFuelRange:@YES, + SDLNameGPS:@YES, + SDLNameHeadLampStatus:@YES, + SDLNameInstantFuelConsumption:@YES, + SDLNameMyKey:@YES, + SDLNameOdometer:@YES, + SDLNamePRNDL:@YES, + SDLNameRPM:@YES, + SDLNameSpeed:@YES, + SDLNameSteeringWheelAngle:@YES, + SDLNameTirePressure:@YES, + SDLNameTurnSignal:@YES, + SDLNameWiperStatus:@YES}, + SDLNameOperationName:SDLNameUnsubscribeVehicleData}}; SDLUnsubscribeVehicleData* testRequest = [[SDLUnsubscribeVehicleData alloc] initWithDictionary:dict]; expect(testRequest.accPedalPosition).to(equal(@YES)); @@ -112,6 +118,7 @@ describe(@"Getter/Setter Tests", ^ { expect(testRequest.deviceStatus).to(equal(@YES)); expect(testRequest.driverBraking).to(equal(@YES)); expect(testRequest.eCallInfo).to(equal(@YES)); + expect(testRequest.electronicParkBrakeStatus).to(equal(@YES)); expect(testRequest.emergencyEvent).to(equal(@YES)); expect(testRequest.engineOilLife).to(equal(@YES)); expect(testRequest.engineTorque).to(equal(@YES)); @@ -129,6 +136,7 @@ describe(@"Getter/Setter Tests", ^ { expect(testRequest.speed).to(equal(@YES)); expect(testRequest.steeringWheelAngle).to(equal(@YES)); expect(testRequest.tirePressure).to(equal(@YES)); + expect(testRequest.turnSignal).to(equal(@YES)); expect(testRequest.wiperStatus).to(equal(@YES)); }); }); @@ -145,6 +153,7 @@ describe(@"initializers", ^{ expect(testRequest.deviceStatus).to(beNil()); expect(testRequest.driverBraking).to(beNil()); expect(testRequest.eCallInfo).to(beNil()); + expect(testRequest.electronicParkBrakeStatus).to(beNil()); expect(testRequest.emergencyEvent).to(beNil()); expect(testRequest.engineOilLife).to(beNil()); expect(testRequest.engineTorque).to(beNil()); @@ -162,11 +171,12 @@ describe(@"initializers", ^{ expect(testRequest.speed).to(beNil()); expect(testRequest.steeringWheelAngle).to(beNil()); expect(testRequest.tirePressure).to(beNil()); + expect(testRequest.turnSignal).to(beNil()); expect(testRequest.wiperStatus).to(beNil()); }); - context(@"initWithAccelerationPedalPosition:airbagStatus:beltStatus:bodyInformation:clusterModeStatus:deviceStatus:driverBraking:eCallInfo:emergencyEvent:engineOilLife:engineTorque:externalTemperature:fuelLevel:fuelLevelState:gps:headLampStatus:instantFuelConsumption:myKey:odometer:prndl:rpm:speed:steeringWheelAngle:tirePressure:wiperStatus:", ^{ - SDLUnsubscribeVehicleData *testRequest = [[SDLUnsubscribeVehicleData alloc] initWithAccelerationPedalPosition:YES airbagStatus:YES beltStatus:YES bodyInformation:YES clusterModeStatus:YES deviceStatus:YES driverBraking:YES eCallInfo:YES emergencyEvent:YES engineOilLife:YES engineTorque:YES externalTemperature:YES fuelLevel:YES fuelLevelState:YES fuelRange:YES gps:YES headLampStatus:YES instantFuelConsumption:YES myKey:YES odometer:YES prndl:YES rpm:YES speed:YES steeringWheelAngle:YES tirePressure:YES wiperStatus:YES]; + context(@"initWithAccelerationPedalPosition:airbagStatus:beltStatus:bodyInformation:clusterModeStatus:deviceStatus:driverBraking:eCallInfo:electronicParkBrakeStatus:emergencyEvent:engineOilLife:engineTorque:externalTemperature:fuelLevel:fuelLevelState:gps:headLampStatus:instantFuelConsumption:myKey:odometer:prndl:rpm:speed:steeringWheelAngle:tirePressure:turnSignal:wiperStatus:", ^{ + SDLUnsubscribeVehicleData *testRequest = [[SDLUnsubscribeVehicleData alloc] initWithAccelerationPedalPosition:YES airbagStatus:YES beltStatus:YES bodyInformation:YES clusterModeStatus:YES deviceStatus:YES driverBraking:YES eCallInfo:YES electronicParkBrakeStatus:YES emergencyEvent:YES engineOilLife:YES engineTorque:YES externalTemperature:YES fuelLevel:YES fuelLevelState:YES fuelRange:YES gps:YES headLampStatus:YES instantFuelConsumption:YES myKey:YES odometer:YES prndl:YES rpm:YES speed:YES steeringWheelAngle:YES tirePressure:YES turnSignal:YES wiperStatus:YES]; expect(testRequest.accPedalPosition).to(equal(@YES)); expect(testRequest.airbagStatus).to(equal(@YES)); @@ -176,6 +186,7 @@ describe(@"initializers", ^{ expect(testRequest.deviceStatus).to(equal(@YES)); expect(testRequest.driverBraking).to(equal(@YES)); expect(testRequest.eCallInfo).to(equal(@YES)); + expect(testRequest.electronicParkBrakeStatus).to(equal(@YES)); expect(testRequest.emergencyEvent).to(equal(@YES)); expect(testRequest.engineOilLife).to(equal(@YES)); expect(testRequest.engineTorque).to(equal(@YES)); @@ -193,6 +204,7 @@ describe(@"initializers", ^{ expect(testRequest.speed).to(equal(@YES)); expect(testRequest.steeringWheelAngle).to(equal(@YES)); expect(testRequest.tirePressure).to(equal(@YES)); + expect(testRequest.turnSignal).to(equal(@YES)); expect(testRequest.wiperStatus).to(equal(@YES)); }); @@ -207,6 +219,7 @@ describe(@"initializers", ^{ expect(testRequest.deviceStatus).to(equal(@YES)); expect(testRequest.driverBraking).to(equal(@YES)); expect(testRequest.eCallInfo).to(equal(@YES)); + expect(testRequest.electronicParkBrakeStatus).to(equal(@NO)); expect(testRequest.emergencyEvent).to(equal(@YES)); expect(testRequest.engineOilLife).to(equal(@NO)); expect(testRequest.engineTorque).to(equal(@YES)); @@ -224,6 +237,7 @@ describe(@"initializers", ^{ expect(testRequest.speed).to(equal(@YES)); expect(testRequest.steeringWheelAngle).to(equal(@YES)); expect(testRequest.tirePressure).to(equal(@YES)); + expect(testRequest.turnSignal).to(equal(@NO)); expect(testRequest.wiperStatus).to(equal(@YES)); }); }); diff --git a/SmartDeviceLinkTests/RPCSpecs/ResponseSpecs/SDLGetVehicleDataResponseSpec.m b/SmartDeviceLinkTests/RPCSpecs/ResponseSpecs/SDLGetVehicleDataResponseSpec.m index 1696ab8c9..9d7a69713 100644 --- a/SmartDeviceLinkTests/RPCSpecs/ResponseSpecs/SDLGetVehicleDataResponseSpec.m +++ b/SmartDeviceLinkTests/RPCSpecs/ResponseSpecs/SDLGetVehicleDataResponseSpec.m @@ -39,6 +39,7 @@ describe(@"Getter/Setter Tests", ^ { testResponse.deviceStatus = device; testResponse.driverBraking = SDLVehicleDataEventStatusNoEvent; testResponse.eCallInfo = eCall; + testResponse.electronicParkBrakeStatus = SDLElectronicParkBrakeStatusDriveActive; testResponse.emergencyEvent = event; testResponse.engineOilLife = @56.3; testResponse.engineTorque = @630.4; @@ -56,6 +57,7 @@ describe(@"Getter/Setter Tests", ^ { testResponse.speed = @100; testResponse.steeringWheelAngle = @-1500; testResponse.tirePressure = tires; + testResponse.turnSignal = SDLTurnSignalBoth; testResponse.vin = @"6574839201"; testResponse.wiperStatus = SDLWiperStatusAutomaticHigh; @@ -67,6 +69,7 @@ describe(@"Getter/Setter Tests", ^ { expect(testResponse.deviceStatus).to(equal(device)); expect(testResponse.driverBraking).to(equal(SDLVehicleDataEventStatusNoEvent)); expect(testResponse.eCallInfo).to(equal(eCall)); + expect(testResponse.electronicParkBrakeStatus).to(equal(SDLElectronicParkBrakeStatusDriveActive)); expect(testResponse.emergencyEvent).to(equal(event)); expect(testResponse.engineOilLife).to(equal(@56.3)); expect(testResponse.engineTorque).to(equal(@630.4)); @@ -84,6 +87,7 @@ describe(@"Getter/Setter Tests", ^ { expect(testResponse.speed).to(equal(@100)); expect(testResponse.steeringWheelAngle).to(equal(@-1500)); expect(testResponse.tirePressure).to(equal(tires)); + expect(testResponse.turnSignal).to(equal(SDLTurnSignalBoth)); expect(testResponse.vin).to(equal(@"6574839201")); expect(testResponse.wiperStatus).to(equal(SDLWiperStatusAutomaticHigh)); }); @@ -100,6 +104,7 @@ describe(@"Getter/Setter Tests", ^ { SDLNameDeviceStatus:device, SDLNameDriverBraking:SDLVehicleDataEventStatusNoEvent, SDLNameECallInfo:eCall, + SDLNameElectronicParkBrakeStatus:SDLElectronicParkBrakeStatusDriveActive, SDLNameEmergencyEvent:event, SDLNameEngineOilLife:@23.22, SDLNameEngineTorque:@630.4, @@ -117,6 +122,7 @@ describe(@"Getter/Setter Tests", ^ { SDLNameSpeed:@100, SDLNameSteeringWheelAngle:@-1500, SDLNameTirePressure:tires, + SDLNameTurnSignal:SDLTurnSignalOff, SDLNameVIN:@"6574839201", SDLNameWiperStatus:SDLWiperStatusAutomaticHigh}, SDLNameOperationName:SDLNameGetVehicleData}} mutableCopy]; @@ -130,6 +136,7 @@ describe(@"Getter/Setter Tests", ^ { expect(testResponse.deviceStatus).to(equal(device)); expect(testResponse.driverBraking).to(equal(SDLVehicleDataEventStatusNoEvent)); expect(testResponse.eCallInfo).to(equal(eCall)); + expect(testResponse.electronicParkBrakeStatus).to(equal(SDLElectronicParkBrakeStatusDriveActive)); expect(testResponse.emergencyEvent).to(equal(event)); expect(testResponse.engineOilLife).to(equal(@23.22)); expect(testResponse.engineTorque).to(equal(@630.4)); @@ -147,6 +154,7 @@ describe(@"Getter/Setter Tests", ^ { expect(testResponse.speed).to(equal(@100)); expect(testResponse.steeringWheelAngle).to(equal(@-1500)); expect(testResponse.tirePressure).to(equal(tires)); + expect(testResponse.turnSignal).to(equal(SDLTurnSignalOff)); expect(testResponse.vin).to(equal(@"6574839201")); expect(testResponse.wiperStatus).to(equal(SDLWiperStatusAutomaticHigh)); }); @@ -162,6 +170,7 @@ describe(@"Getter/Setter Tests", ^ { expect(testResponse.deviceStatus).to(beNil()); expect(testResponse.driverBraking).to(beNil()); expect(testResponse.eCallInfo).to(beNil()); + expect(testResponse.electronicParkBrakeStatus).to(beNil()); expect(testResponse.emergencyEvent).to(beNil()); expect(testResponse.engineOilLife).to(beNil()); expect(testResponse.engineTorque).to(beNil()); @@ -179,6 +188,7 @@ describe(@"Getter/Setter Tests", ^ { expect(testResponse.speed).to(beNil()); expect(testResponse.steeringWheelAngle).to(beNil()); expect(testResponse.tirePressure).to(beNil()); + expect(testResponse.turnSignal).to(beNil()); expect(testResponse.vin).to(beNil()); expect(testResponse.wiperStatus).to(beNil()); }); diff --git a/SmartDeviceLinkTests/RPCSpecs/ResponseSpecs/SDLSubscribeVehicleDataResponseSpec.m b/SmartDeviceLinkTests/RPCSpecs/ResponseSpecs/SDLSubscribeVehicleDataResponseSpec.m index b608a0174..aa8000b14 100644 --- a/SmartDeviceLinkTests/RPCSpecs/ResponseSpecs/SDLSubscribeVehicleDataResponseSpec.m +++ b/SmartDeviceLinkTests/RPCSpecs/ResponseSpecs/SDLSubscribeVehicleDataResponseSpec.m @@ -29,6 +29,7 @@ describe(@"Getter/Setter Tests", ^ { testResponse.deviceStatus = vehicleDataResult; testResponse.driverBraking = vehicleDataResult; testResponse.eCallInfo = vehicleDataResult; + testResponse.electronicParkBrakeStatus = vehicleDataResult; testResponse.emergencyEvent = vehicleDataResult; testResponse.engineOilLife = vehicleDataResult; testResponse.engineTorque = vehicleDataResult; @@ -46,6 +47,7 @@ describe(@"Getter/Setter Tests", ^ { testResponse.speed = vehicleDataResult; testResponse.steeringWheelAngle = vehicleDataResult; testResponse.tirePressure = vehicleDataResult; + testResponse.turnSignal = vehicleDataResult; testResponse.wiperStatus = vehicleDataResult; expect(testResponse.accPedalPosition).to(equal(vehicleDataResult)); @@ -56,6 +58,7 @@ describe(@"Getter/Setter Tests", ^ { expect(testResponse.deviceStatus).to(equal(vehicleDataResult)); expect(testResponse.driverBraking).to(equal(vehicleDataResult)); expect(testResponse.eCallInfo).to(equal(vehicleDataResult)); + expect(testResponse.electronicParkBrakeStatus).to(equal(vehicleDataResult)); expect(testResponse.emergencyEvent).to(equal(vehicleDataResult)); expect(testResponse.engineOilLife).to(equal(vehicleDataResult)); expect(testResponse.engineTorque).to(equal(vehicleDataResult)); @@ -73,6 +76,7 @@ describe(@"Getter/Setter Tests", ^ { expect(testResponse.speed).to(equal(vehicleDataResult)); expect(testResponse.steeringWheelAngle).to(equal(vehicleDataResult)); expect(testResponse.tirePressure).to(equal(vehicleDataResult)); + expect(testResponse.turnSignal).to(equal(vehicleDataResult)); expect(testResponse.wiperStatus).to(equal(vehicleDataResult)); }); @@ -87,6 +91,7 @@ describe(@"Getter/Setter Tests", ^ { SDLNameDeviceStatus:vehicleDataResult, SDLNameDriverBraking:vehicleDataResult, SDLNameECallInfo:vehicleDataResult, + SDLNameElectronicParkBrakeStatus:vehicleDataResult, SDLNameEmergencyEvent:vehicleDataResult, SDLNameEngineOilLife:vehicleDataResult, SDLNameEngineTorque:vehicleDataResult, @@ -104,6 +109,7 @@ describe(@"Getter/Setter Tests", ^ { SDLNameSpeed:vehicleDataResult, SDLNameSteeringWheelAngle:vehicleDataResult, SDLNameTirePressure:vehicleDataResult, + SDLNameTurnSignal:vehicleDataResult, SDLNameWiperStatus:vehicleDataResult}, SDLNameOperationName:SDLNameSubscribeVehicleData}}; SDLSubscribeVehicleDataResponse* testResponse = [[SDLSubscribeVehicleDataResponse alloc] initWithDictionary:dict]; @@ -116,6 +122,7 @@ describe(@"Getter/Setter Tests", ^ { expect(testResponse.deviceStatus).to(equal(vehicleDataResult)); expect(testResponse.driverBraking).to(equal(vehicleDataResult)); expect(testResponse.eCallInfo).to(equal(vehicleDataResult)); + expect(testResponse.electronicParkBrakeStatus).to(equal(vehicleDataResult)); expect(testResponse.emergencyEvent).to(equal(vehicleDataResult)); expect(testResponse.engineOilLife).to(equal(vehicleDataResult)); expect(testResponse.engineTorque).to(equal(vehicleDataResult)); @@ -133,6 +140,7 @@ describe(@"Getter/Setter Tests", ^ { expect(testResponse.speed).to(equal(vehicleDataResult)); expect(testResponse.steeringWheelAngle).to(equal(vehicleDataResult)); expect(testResponse.tirePressure).to(equal(vehicleDataResult)); + expect(testResponse.turnSignal).to(equal(vehicleDataResult)); expect(testResponse.wiperStatus).to(equal(vehicleDataResult)); }); @@ -147,6 +155,7 @@ describe(@"Getter/Setter Tests", ^ { expect(testResponse.deviceStatus).to(beNil()); expect(testResponse.driverBraking).to(beNil()); expect(testResponse.eCallInfo).to(beNil()); + expect(testResponse.electronicParkBrakeStatus).to(beNil()); expect(testResponse.emergencyEvent).to(beNil()); expect(testResponse.engineOilLife).to(beNil()); expect(testResponse.engineTorque).to(beNil()); @@ -164,6 +173,7 @@ describe(@"Getter/Setter Tests", ^ { expect(testResponse.speed).to(beNil()); expect(testResponse.steeringWheelAngle).to(beNil()); expect(testResponse.tirePressure).to(beNil()); + expect(testResponse.turnSignal).to(beNil()); expect(testResponse.wiperStatus).to(beNil()); }); }); diff --git a/SmartDeviceLinkTests/RPCSpecs/ResponseSpecs/SDLUnsubscribeVehicleDataResponseSpec.m b/SmartDeviceLinkTests/RPCSpecs/ResponseSpecs/SDLUnsubscribeVehicleDataResponseSpec.m index ce36c0c13..8af7ef673 100644 --- a/SmartDeviceLinkTests/RPCSpecs/ResponseSpecs/SDLUnsubscribeVehicleDataResponseSpec.m +++ b/SmartDeviceLinkTests/RPCSpecs/ResponseSpecs/SDLUnsubscribeVehicleDataResponseSpec.m @@ -47,6 +47,8 @@ describe(@"Getter/Setter Tests", ^ { testResponse.emergencyEvent = vehicleDataResult; testResponse.clusterModes = vehicleDataResult; testResponse.myKey = vehicleDataResult; + testResponse.electronicParkBrakeStatus = vehicleDataResult; + testResponse.turnSignal = vehicleDataResult; expect(testResponse.gps).to(equal(vehicleDataResult)); expect(testResponse.speed).to(equal(vehicleDataResult)); @@ -74,6 +76,8 @@ describe(@"Getter/Setter Tests", ^ { expect(testResponse.emergencyEvent).to(equal(vehicleDataResult)); expect(testResponse.clusterModes).to(equal(vehicleDataResult)); expect(testResponse.myKey).to(equal(vehicleDataResult)); + expect(testResponse.electronicParkBrakeStatus).to(equal(vehicleDataResult)); + expect(testResponse.turnSignal).to(equal(vehicleDataResult)); }); it(@"Should get correctly when initialized", ^ { @@ -104,7 +108,10 @@ describe(@"Getter/Setter Tests", ^ { SDLNameAirbagStatus:vehicleDataResult, SDLNameEmergencyEvent:vehicleDataResult, SDLNameClusterModes:vehicleDataResult, - SDLNameMyKey:vehicleDataResult}, + SDLNameMyKey:vehicleDataResult, + SDLNameElectronicParkBrakeStatus:vehicleDataResult, + SDLNameTurnSignal:vehicleDataResult, + }, SDLNameOperationName:SDLNameUnsubscribeVehicleData}} mutableCopy]; SDLUnsubscribeVehicleDataResponse* testResponse = [[SDLUnsubscribeVehicleDataResponse alloc] initWithDictionary:dict]; @@ -134,6 +141,8 @@ describe(@"Getter/Setter Tests", ^ { expect(testResponse.emergencyEvent).to(equal(vehicleDataResult)); expect(testResponse.clusterModes).to(equal(vehicleDataResult)); expect(testResponse.myKey).to(equal(vehicleDataResult)); + expect(testResponse.electronicParkBrakeStatus).to(equal(vehicleDataResult)); + expect(testResponse.turnSignal).to(equal(vehicleDataResult)); }); it(@"Should return nil if not set", ^ { @@ -165,6 +174,8 @@ describe(@"Getter/Setter Tests", ^ { expect(testResponse.emergencyEvent).to(beNil()); expect(testResponse.clusterModes).to(beNil()); expect(testResponse.myKey).to(beNil()); + expect(testResponse.electronicParkBrakeStatus).to(beNil()); + expect(testResponse.turnSignal).to(beNil()); }); }); diff --git a/SmartDeviceLinkTests/RPCSpecs/StructSpecs/SDLAudioControlCapabilitiesSpec.m b/SmartDeviceLinkTests/RPCSpecs/StructSpecs/SDLAudioControlCapabilitiesSpec.m new file mode 100644 index 000000000..0e01a3680 --- /dev/null +++ b/SmartDeviceLinkTests/RPCSpecs/StructSpecs/SDLAudioControlCapabilitiesSpec.m @@ -0,0 +1,83 @@ +// +// SDLAudioControlCapabilitiesSpec.m +// SmartDeviceLinkTests +// + +#import <Foundation/Foundation.h> + +#import <Quick/Quick.h> +#import <Nimble/Nimble.h> + +#import "SDLAudioControlCapabilities.h" +#import "SDLNames.h" + + +QuickSpecBegin( SDLAudioControlCapabilitiesSpec) + +describe(@"Getter/Setter Tests", ^ { + it(@"Should set and get correctly", ^ { + SDLAudioControlCapabilities* testStruct = [[SDLAudioControlCapabilities alloc] init]; + + testStruct.moduleName = @"module"; + testStruct.sourceAvailable = @(YES); + testStruct.volumeAvailable = @(NO); + testStruct.equalizerAvailable = @(NO); + testStruct.equalizerMaxChannelId = @56; + + expect(testStruct.moduleName).to(equal(@"module")); + expect(testStruct.sourceAvailable).to(equal(@(YES))); + expect(testStruct.volumeAvailable).to(equal(@(NO))); + expect(testStruct.equalizerAvailable).to(equal(@(NO))); + expect(testStruct.equalizerMaxChannelId).to(equal(@56)); + }); + + it(@"Should set and get correctly", ^ { + SDLAudioControlCapabilities* testStruct = [[SDLAudioControlCapabilities alloc] initWithModuleName:@"module"]; + + expect(testStruct.moduleName).to(equal(@"module")); + expect(testStruct.sourceAvailable).to(beNil()); + expect(testStruct.volumeAvailable).to(beNil()); + expect(testStruct.equalizerAvailable).to(beNil()); + expect(testStruct.equalizerMaxChannelId).to(beNil()); + }); + + it(@"Should set and get correctly", ^ { + SDLAudioControlCapabilities* testStruct = [[SDLAudioControlCapabilities alloc] initWithModuleName:@"module" sourceAvailable:@NO volueAvailable:@YES equalizerAvailable:@NO equalizerMaxChannelID:@34]; + + expect(testStruct.moduleName).to(equal(@"module")); + expect(testStruct.sourceAvailable).to(equal(@(NO))); + expect(testStruct.volumeAvailable).to(equal(@(YES))); + expect(testStruct.equalizerAvailable).to(equal(@(NO))); + expect(testStruct.equalizerMaxChannelId).to(equal(@34)); + }); + + it(@"Should get correctly when initialized", ^ { + NSMutableDictionary* dict = [@{SDLNameModuleName:@"module", + SDLNameSourceAvailable:@(NO), + SDLNameVolumeAvailable:@(YES), + SDLNameEqualizerAvailable:@(NO), + SDLNameEqualizerMaxChannelId:@12 + } mutableCopy]; + SDLAudioControlCapabilities* testStruct = [[SDLAudioControlCapabilities alloc] initWithDictionary:dict]; + + expect(testStruct.moduleName).to(equal(@"module")); + expect(testStruct.sourceAvailable).to(equal(@(NO))); + expect(testStruct.volumeAvailable).to(equal(@(YES))); + expect(testStruct.equalizerAvailable).to(equal(@(NO))); + expect(testStruct.equalizerMaxChannelId).to(equal(@12)); + + }); + + it(@"Should return nil if not set", ^ { + SDLAudioControlCapabilities* testStruct = [[SDLAudioControlCapabilities alloc] init]; + + expect(testStruct.moduleName).to(beNil()); + expect(testStruct.sourceAvailable).to(beNil()); + expect(testStruct.volumeAvailable).to(beNil()); + expect(testStruct.equalizerAvailable).to(beNil()); + expect(testStruct.equalizerMaxChannelId).to(beNil()); + + }); +}); + +QuickSpecEnd diff --git a/SmartDeviceLinkTests/RPCSpecs/StructSpecs/SDLAudioControlDataSpec.m b/SmartDeviceLinkTests/RPCSpecs/StructSpecs/SDLAudioControlDataSpec.m new file mode 100644 index 000000000..f12cbc52b --- /dev/null +++ b/SmartDeviceLinkTests/RPCSpecs/StructSpecs/SDLAudioControlDataSpec.m @@ -0,0 +1,71 @@ +// +// SDLAudioControlDataSpec.m +// SmartDeviceLinkTests +// + +#import <Foundation/Foundation.h> + +#import <Quick/Quick.h> +#import <Nimble/Nimble.h> + +#import "SDLAudioControlData.h" +#import "SDLPrimaryAudioSource.h" +#import "SDLEqualizerSettings.h" +#import "SDLNames.h" + + +QuickSpecBegin( SDLAudioControlDataSpec) + +SDLEqualizerSettings *someEqualizerSettings = [[SDLEqualizerSettings alloc] init]; + +describe(@"Getter/Setter Tests", ^ { + it(@"Should set and get correctly", ^ { + SDLAudioControlData* testStruct = [[SDLAudioControlData alloc] init]; + + testStruct.source = SDLPrimaryAudioSourceCD; + testStruct.keepContext = @(NO); + testStruct.volume = @(NO); + testStruct.equalizerSettings = [@[someEqualizerSettings] copy]; + + expect(testStruct.source).to(equal(SDLPrimaryAudioSourceCD)); + expect(testStruct.keepContext).to(equal(@(NO))); + expect(testStruct.volume).to(equal(@(NO))); + expect(testStruct.equalizerSettings).to(equal([@[someEqualizerSettings] copy])); + }); + + it(@"Should set and get correctly", ^ { + SDLAudioControlData* testStruct = [[SDLAudioControlData alloc] initWithSource:SDLPrimaryAudioSourceCD keepContext:@(NO) volume:@32 equalizerSettings:[@[someEqualizerSettings] copy]]; + + expect(testStruct.source).to(equal(SDLPrimaryAudioSourceCD)); + expect(testStruct.keepContext).to(equal(@(NO))); + expect(testStruct.volume).to(equal(@32)); + expect(testStruct.equalizerSettings).to(equal([@[someEqualizerSettings] copy])); + }); + + it(@"Should get correctly when initialized", ^ { + NSMutableDictionary* dict = [@{SDLNameSource:SDLPrimaryAudioSourceCD, + SDLNameKeepContext:@(NO), + SDLNameVolume:@(NO), + SDLNameEqualizerSettings:[@[someEqualizerSettings] copy] + } mutableCopy]; + SDLAudioControlData* testStruct = [[SDLAudioControlData alloc] initWithDictionary:dict]; + + expect(testStruct.source).to(equal(SDLPrimaryAudioSourceCD)); + expect(testStruct.keepContext).to(equal(@(NO))); + expect(testStruct.volume).to(equal(@(NO))); + expect(testStruct.equalizerSettings).to(equal([@[someEqualizerSettings] copy])); + + }); + + it(@"Should return nil if not set", ^ { + SDLAudioControlData* testStruct = [[SDLAudioControlData alloc] init]; + + expect(testStruct.source).to(beNil()); + expect(testStruct.keepContext).to(beNil()); + expect(testStruct.volume).to(beNil()); + expect(testStruct.equalizerSettings).to(beNil()); + + }); +}); + +QuickSpecEnd diff --git a/SmartDeviceLinkTests/RPCSpecs/StructSpecs/SDLClimateControlCapabilitiesSpec.m b/SmartDeviceLinkTests/RPCSpecs/StructSpecs/SDLClimateControlCapabilitiesSpec.m index d15d63185..b45784e78 100644 --- a/SmartDeviceLinkTests/RPCSpecs/StructSpecs/SDLClimateControlCapabilitiesSpec.m +++ b/SmartDeviceLinkTests/RPCSpecs/StructSpecs/SDLClimateControlCapabilitiesSpec.m @@ -32,6 +32,10 @@ describe(@"Getter/Setter Tests", ^ { testStruct.defrostZone = [@[SDLDefrostZoneFront] copy]; testStruct.ventilationModeAvailable = @NO; testStruct.ventilationMode = [@[SDLVentilationModeUpper] copy]; + testStruct.heatedSteeringWheelAvailable = @(YES); + testStruct.heatedWindshieldAvailable = @(NO); + testStruct.heatedRearWindowAvailable = @(YES); + testStruct.heatedMirrorsAvailable = @(NO); expect(testStruct.moduleName).to(equal(@"Name")); expect(testStruct.fanSpeedAvailable).to(equal(@YES)); @@ -45,6 +49,11 @@ describe(@"Getter/Setter Tests", ^ { expect(testStruct.defrostZone).to(equal([@[SDLDefrostZoneFront] copy])); expect(testStruct.ventilationModeAvailable).to(equal(@NO)); expect(testStruct.ventilationMode).to(equal([@[SDLVentilationModeUpper] copy])); + expect(testStruct.heatedSteeringWheelAvailable).to(equal(@YES)); + expect(testStruct.heatedWindshieldAvailable).to(equal(@NO)); + expect(testStruct.heatedRearWindowAvailable).to(equal(@YES)); + expect(testStruct.heatedMirrorsAvailable).to(equal(@NO)); + }); it(@"Should get correctly when initialized", ^ { @@ -59,7 +68,12 @@ describe(@"Getter/Setter Tests", ^ { SDLNameDefrostZoneAvailable:@YES, SDLNameDefrostZone:[@[SDLDefrostZoneFront] copy], SDLNameVentilationModeAvailable:@NO, - SDLNameVentilationMode:[@[SDLVentilationModeUpper] copy]} mutableCopy]; + SDLNameVentilationMode:[@[SDLVentilationModeUpper] copy], + SDLNameHeatedSteeringWheelAvailable:@YES, + SDLNameHeatedWindshieldAvailable:@NO, + SDLNameHeatedRearWindowAvailable:@YES, + SDLNameHeatedMirrorsAvailable:@NO + } mutableCopy]; SDLClimateControlCapabilities* testStruct = [[SDLClimateControlCapabilities alloc] initWithDictionary:dict]; expect(testStruct.moduleName).to(equal(@"Name")); @@ -74,6 +88,10 @@ describe(@"Getter/Setter Tests", ^ { expect(testStruct.defrostZone).to(equal([@[SDLDefrostZoneFront] copy])); expect(testStruct.ventilationModeAvailable).to(equal(@NO)); expect(testStruct.ventilationMode).to(equal([@[SDLVentilationModeUpper] copy])); + expect(testStruct.heatedSteeringWheelAvailable).to(equal(@YES)); + expect(testStruct.heatedWindshieldAvailable).to(equal(@NO)); + expect(testStruct.heatedRearWindowAvailable).to(equal(@YES)); + expect(testStruct.heatedMirrorsAvailable).to(equal(@NO)); }); it(@"Should get correctly when initialized with module data and other climate control capabilities parameters", ^ { @@ -89,6 +107,29 @@ describe(@"Getter/Setter Tests", ^ { expect(testStruct.dualModeEnableAvailable).to(equal(@NO)); expect(testStruct.defrostZoneAvailable).to(equal(@YES)); expect(testStruct.ventilationModeAvailable).to(equal(@YES)); + expect(testStruct.heatedSteeringWheelAvailable).to(equal(@NO)); + expect(testStruct.heatedWindshieldAvailable).to(equal(@NO)); + expect(testStruct.heatedRearWindowAvailable).to(equal(@NO)); + expect(testStruct.heatedMirrorsAvailable).to(equal(@NO));; + }); + + it(@"Should get correctly when initialized with module data and other climate control capabilities parameters", ^ { + SDLClimateControlCapabilities* testStruct = [[SDLClimateControlCapabilities alloc] initWithModuleName:@"Name" fanSpeedAvailable:YES desiredTemperatureAvailable:NO acEnableAvailable:NO acMaxEnableAvailable:YES circulateAirAvailable:NO autoModeEnableAvailable:NO dualModeEnableAvailable:NO defrostZoneAvailable:YES ventilationModeAvailable:YES heatedSteeringWheelAvailable:YES heatedWindshieldAvailable:NO heatedRearWindowAvailable:YES heatedMirrorsAvailable:NO]; + + expect(testStruct.moduleName).to(equal(@"Name")); + expect(testStruct.fanSpeedAvailable).to(equal(@YES)); + expect(testStruct.desiredTemperatureAvailable).to(equal(@NO)); + expect(testStruct.acEnableAvailable).to(equal(@NO)); + expect(testStruct.acMaxEnableAvailable).to(equal(@YES)); + expect(testStruct.circulateAirEnableAvailable).to(equal(@NO)); + expect(testStruct.autoModeEnableAvailable).to(equal(@NO)); + expect(testStruct.dualModeEnableAvailable).to(equal(@NO)); + expect(testStruct.defrostZoneAvailable).to(equal(@YES)); + expect(testStruct.ventilationModeAvailable).to(equal(@YES)); + expect(testStruct.heatedSteeringWheelAvailable).to(equal(@YES)); + expect(testStruct.heatedWindshieldAvailable).to(equal(@NO)); + expect(testStruct.heatedRearWindowAvailable).to(equal(@YES)); + expect(testStruct.heatedMirrorsAvailable).to(equal(@NO)); }); it(@"Should return nil if not set", ^ { @@ -106,6 +147,10 @@ describe(@"Getter/Setter Tests", ^ { expect(testStruct.defrostZone).to(beNil()); expect(testStruct.ventilationModeAvailable).to(beNil()); expect(testStruct.ventilationMode).to(beNil()); + expect(testStruct.heatedSteeringWheelAvailable).to(beNil()); + expect(testStruct.heatedWindshieldAvailable).to(beNil()); + expect(testStruct.heatedRearWindowAvailable).to(beNil()); + expect(testStruct.heatedMirrorsAvailable).to(beNil()); }); }); diff --git a/SmartDeviceLinkTests/RPCSpecs/StructSpecs/SDLClimateControlDataSpec.m b/SmartDeviceLinkTests/RPCSpecs/StructSpecs/SDLClimateControlDataSpec.m index 3ff841b8d..cb3fbff65 100644 --- a/SmartDeviceLinkTests/RPCSpecs/StructSpecs/SDLClimateControlDataSpec.m +++ b/SmartDeviceLinkTests/RPCSpecs/StructSpecs/SDLClimateControlDataSpec.m @@ -38,6 +38,10 @@ describe(@"Getter/Setter Tests", ^ { testStruct.dualModeEnable = @NO; testStruct.acMaxEnable = @YES; testStruct.ventilationMode = SDLVentilationModeBoth; + testStruct.heatedSteeringWheelEnable = @NO; + testStruct.heatedWindshieldEnable = @YES; + testStruct.heatedRearWindowEnable = @NO; + testStruct.heatedMirrorsEnable = @YES; expect(testStruct.fanSpeed).to(equal(@43)); expect(testStruct.currentTemperature).to(equal(currentTemp)); @@ -49,6 +53,11 @@ describe(@"Getter/Setter Tests", ^ { expect(testStruct.dualModeEnable).to(equal(NO)); expect(testStruct.acMaxEnable).to(equal(YES)); expect(testStruct.ventilationMode).to(equal(SDLVentilationModeBoth)); + expect(testStruct.heatedSteeringWheelEnable).to(equal(@NO)); + expect(testStruct.heatedWindshieldEnable).to(equal(@YES)); + expect(testStruct.heatedRearWindowEnable).to(equal(@NO)); + expect(testStruct.heatedMirrorsEnable).to(equal(@YES)); + }); it(@"Should get correctly when initialized with FanSpeed and other climate control parameters", ^ { @@ -63,6 +72,28 @@ describe(@"Getter/Setter Tests", ^ { expect(testStruct.dualModeEnable).to(equal(NO)); expect(testStruct.acMaxEnable).to(equal(YES)); expect(testStruct.ventilationMode).to(equal(SDLVentilationModeBoth)); + expect(testStruct.heatedSteeringWheelEnable).to(equal(NO)); + expect(testStruct.heatedWindshieldEnable).to(equal(NO)); + expect(testStruct.heatedRearWindowEnable).to(equal(NO)); + expect(testStruct.heatedMirrorsEnable).to(equal(NO)); + }); + + it(@"Should get correctly when initialized with FanSpeed and other climate control parameters", ^ { + SDLClimateControlData* testStruct = [[SDLClimateControlData alloc] initWithFanSpeed:@43 desiredTemperature:desiredTemp acEnable:@YES circulateAirEnable:@YES autoModeEnable:@NO defrostZone:SDLDefrostZoneFront dualModeEnable:@NO acMaxEnable:@YES ventilationMode:SDLVentilationModeBoth heatedSteeringWheelEnable:@NO heatedWindshieldEnable:@YES heatedRearWindowEnable:@NO heatedMirrorsEnable:@YES]; + + expect(testStruct.fanSpeed).to(equal(@43)); + expect(testStruct.desiredTemperature).to(equal(desiredTemp)); + expect(testStruct.acEnable).to(equal(YES)); + expect(testStruct.circulateAirEnable).to(equal(YES)); + expect(testStruct.autoModeEnable).to(equal(NO)); + expect(testStruct.defrostZone).to(equal(SDLDefrostZoneFront)); + expect(testStruct.dualModeEnable).to(equal(NO)); + expect(testStruct.acMaxEnable).to(equal(YES)); + expect(testStruct.ventilationMode).to(equal(SDLVentilationModeBoth)); + expect(testStruct.heatedSteeringWheelEnable).to(equal(@NO)); + expect(testStruct.heatedWindshieldEnable).to(equal(@YES)); + expect(testStruct.heatedRearWindowEnable).to(equal(@NO)); + expect(testStruct.heatedMirrorsEnable).to(equal(@YES)); }); it(@"Should get correctly when initialized with a dictionary", ^ { @@ -75,7 +106,13 @@ describe(@"Getter/Setter Tests", ^ { SDLNameDefrostZone : SDLDefrostZoneFront, SDLNameDualModeEnable : @NO, SDLNameACMaxEnable : @YES, - SDLNameVentilationMode :SDLVentilationModeBoth} mutableCopy]; + SDLNameVentilationMode :SDLVentilationModeBoth, + SDLNameHeatedSteeringWheelEnable:@NO, + SDLNameHeatedWindshieldEnable:@YES, + SDLNameHeatedRearWindowEnable:@NO, + SDLNameHeatedMirrorsEnable:@YES, + } mutableCopy]; + SDLClimateControlData* testStruct = [[SDLClimateControlData alloc] initWithDictionary:dict]; expect(testStruct.fanSpeed).to(equal(@43)); @@ -88,6 +125,10 @@ describe(@"Getter/Setter Tests", ^ { expect(testStruct.dualModeEnable).to(equal(NO)); expect(testStruct.acMaxEnable).to(equal(YES)); expect(testStruct.ventilationMode).to(equal(SDLVentilationModeBoth)); + expect(testStruct.heatedSteeringWheelEnable).to(equal(@NO)); + expect(testStruct.heatedWindshieldEnable).to(equal(@YES)); + expect(testStruct.heatedRearWindowEnable).to(equal(@NO)); + expect(testStruct.heatedMirrorsEnable).to(equal(@YES)); }); it(@"Should return nil if not set", ^ { @@ -103,6 +144,10 @@ describe(@"Getter/Setter Tests", ^ { expect(testStruct.dualModeEnable).to(beNil()); expect(testStruct.acMaxEnable).to(beNil()); expect(testStruct.ventilationMode).to(beNil()); + expect(testStruct.heatedSteeringWheelEnable).to(beNil()); + expect(testStruct.heatedWindshieldEnable).to(beNil()); + expect(testStruct.heatedRearWindowEnable).to(beNil()); + expect(testStruct.heatedMirrorsEnable).to(beNil()); }); }); diff --git a/SmartDeviceLinkTests/RPCSpecs/StructSpecs/SDLEqualizerSettingsSpec.m b/SmartDeviceLinkTests/RPCSpecs/StructSpecs/SDLEqualizerSettingsSpec.m new file mode 100644 index 000000000..39ae43e6d --- /dev/null +++ b/SmartDeviceLinkTests/RPCSpecs/StructSpecs/SDLEqualizerSettingsSpec.m @@ -0,0 +1,67 @@ +// +// SDLEqualizerSettingsSpec.m +// SmartDeviceLinkTests +// + +#import <Foundation/Foundation.h> +#import <Quick/Quick.h> +#import <Nimble/Nimble.h> + +#import "SDLEqualizerSettings.h" +#import "SDLNames.h" + + +QuickSpecBegin(SDLEqualizerSettingsSpec) + +describe(@"Getter/Setter Tests", ^ { + it(@"Should set and get correctly", ^ { + SDLEqualizerSettings* testStruct = [[SDLEqualizerSettings alloc] init]; + + testStruct.channelId = @2; + testStruct.channelName = @"channel"; + testStruct.channelSetting = @45; + + expect(testStruct.channelId).to(equal(@2)); + expect(testStruct.channelName).to(equal(@"channel")); + expect(testStruct.channelSetting).to(equal(@45)); + }); + + it(@"Should set and get correctly", ^ { + SDLEqualizerSettings* testStruct = [[SDLEqualizerSettings alloc] initWithChannelId:2 channelSetting:45]; + + expect(testStruct.channelId).to(equal(@2)); + expect(testStruct.channelName).to(beNil()); + expect(testStruct.channelSetting).to(equal(@45)); + }); + + it(@"Should set and get correctly", ^ { + SDLEqualizerSettings* testStruct = [[SDLEqualizerSettings alloc] initWithChannelId:2 channelName:@"channel" channelSetting:45]; + + expect(testStruct.channelId).to(equal(@2)); + expect(testStruct.channelName).to(equal(@"channel")); + expect(testStruct.channelSetting).to(equal(@45)); + }); + + it(@"Should get correctly when initialized", ^ { + NSMutableDictionary* dict = [@{SDLNameChannelId:@2, + SDLNameChannelName:@"channel", + SDLNameChannelSetting:@45 + } mutableCopy]; + SDLEqualizerSettings* testStruct = [[SDLEqualizerSettings alloc] initWithDictionary:dict]; + + expect(testStruct.channelId).to(equal(@2)); + expect(testStruct.channelName).to(equal(@"channel")); + expect(testStruct.channelSetting).to(equal(@45)); + + }); + + it(@"Should return nil if not set", ^ { + SDLEqualizerSettings* testStruct = [[SDLEqualizerSettings alloc] init]; + + expect(testStruct.channelId).to(beNil()); + expect(testStruct.channelName).to(beNil()); + expect(testStruct.channelSetting).to(beNil()); + }); +}); + +QuickSpecEnd diff --git a/SmartDeviceLinkTests/RPCSpecs/StructSpecs/SDLGPSLocationSpec.m b/SmartDeviceLinkTests/RPCSpecs/StructSpecs/SDLGPSLocationSpec.m new file mode 100644 index 000000000..2df315fe9 --- /dev/null +++ b/SmartDeviceLinkTests/RPCSpecs/StructSpecs/SDLGPSLocationSpec.m @@ -0,0 +1,70 @@ +// +// SDLGPSLocationSpec.m +// SmartDeviceLinkTests +// + +#import <Foundation/Foundation.h> + +#import <Quick/Quick.h> +#import <Nimble/Nimble.h> + +#import "SDLNames.h" +#import "SDLGPSLocation.h" + + + +QuickSpecBegin(SDLGPSLocationSpec) + +describe(@"Getter/Setter Tests", ^ { + it(@"Should set and get correctly", ^ { + SDLGPSLocation* testStruct = [[SDLGPSLocation alloc] init]; + + testStruct.longitudeDegrees = @(-60); + testStruct.latitudeDegrees = @60; + testStruct.altitudeMeters = @5000; + + expect(testStruct.longitudeDegrees).to(equal(@(-60))); + expect(testStruct.latitudeDegrees).to(equal(@60)); + expect(testStruct.altitudeMeters).to(equal(@5000)); + + }); + + it(@"Should set and get correctly", ^ { + SDLGPSLocation* testStruct = [[SDLGPSLocation alloc] initWithLatitudeDegrees:-60 longitudeDegrees:60]; + + expect(testStruct.latitudeDegrees).to(equal(@(-60))); + expect(testStruct.longitudeDegrees).to(equal(@60)); + }); + + it(@"Should set and get correctly", ^ { + SDLGPSLocation* testStruct = [[SDLGPSLocation alloc] initWithLatitudeDegrees:-60 longitudeDegrees:60 altitudeMeters:@5000]; + + expect(testStruct.latitudeDegrees).to(equal(@(-60))); + expect(testStruct.longitudeDegrees).to(equal(@60)); + expect(testStruct.altitudeMeters).to(equal(@5000)); + }); + + it(@"Should get correctly when initialized", ^ { + NSMutableDictionary* dict = [@{SDLNameLatitudeDegrees:@(-60), + SDLNameLongitudeDegrees:@60, + SDLNameAltitudeMeters:@5000 + } mutableCopy]; + + SDLGPSLocation* testStruct = [[SDLGPSLocation alloc] initWithDictionary:dict]; + + expect(testStruct.latitudeDegrees).to(equal(@(-60))); + expect(testStruct.longitudeDegrees).to(equal(@60)); + expect(testStruct.altitudeMeters).to(equal(@5000)); + }); + + it(@"Should return nil if not set", ^ { + SDLGPSLocation* testStruct = [[SDLGPSLocation alloc] init]; + + expect(testStruct.longitudeDegrees).to(beNil()); + expect(testStruct.latitudeDegrees).to(beNil()); + expect(testStruct.altitudeMeters).to(beNil()); + + }); +}); + +QuickSpecEnd diff --git a/SmartDeviceLinkTests/RPCSpecs/StructSpecs/SDLHMISettingsControlCapabilitiesSpec.m b/SmartDeviceLinkTests/RPCSpecs/StructSpecs/SDLHMISettingsControlCapabilitiesSpec.m new file mode 100644 index 000000000..f9b60810d --- /dev/null +++ b/SmartDeviceLinkTests/RPCSpecs/StructSpecs/SDLHMISettingsControlCapabilitiesSpec.m @@ -0,0 +1,76 @@ +// +// SDLHMISettingsControlCapabilitiesSpec.m +// SmartDeviceLinkTests +// + +#import <Foundation/Foundation.h> + +#import <Quick/Quick.h> +#import <Nimble/Nimble.h> + +#import "SDLHMISettingsControlCapabilities.h" +#import "SDLNames.h" + + +QuickSpecBegin(SDLHMISettingsControlCapabilitiesSpec) + +describe(@"Getter/Setter Tests", ^ { + it(@"Should set and get correctly", ^ { + SDLHMISettingsControlCapabilities* testStruct = [[SDLHMISettingsControlCapabilities alloc] init]; + + testStruct.moduleName = @"displayMode"; + testStruct.distanceUnitAvailable = @(NO); + testStruct.temperatureUnitAvailable = @(NO); + testStruct.displayModeUnitAvailable = @(YES); + + expect(testStruct.moduleName).to(equal(@"displayMode")); + expect(testStruct.distanceUnitAvailable).to(equal(@(NO))); + expect(testStruct.temperatureUnitAvailable).to(equal(@(NO))); + expect(testStruct.displayModeUnitAvailable).to(equal(@(YES))); + }); + + it(@"Should set and get correctly", ^ { + SDLHMISettingsControlCapabilities* testStruct = [[SDLHMISettingsControlCapabilities alloc] initWithModuleName:@"displayMode"]; + + expect(testStruct.moduleName).to(equal(@"displayMode")); + expect(testStruct.distanceUnitAvailable).to(beNil()); + expect(testStruct.temperatureUnitAvailable).to(beNil()); + expect(testStruct.displayModeUnitAvailable).to(beNil()); + }); + + it(@"Should set and get correctly", ^ { + SDLHMISettingsControlCapabilities* testStruct = [[SDLHMISettingsControlCapabilities alloc] initWithModuleName:@"displayMode" distanceUnitAvailable:NO temperatureUnitAvailable:YES displayModeUnitAvailable:NO]; + + expect(testStruct.moduleName).to(equal(@"displayMode")); + expect(testStruct.distanceUnitAvailable).to(equal(@(NO))); + expect(testStruct.temperatureUnitAvailable).to(equal(@(YES))); + expect(testStruct.displayModeUnitAvailable).to(equal(@(NO))); + }); + + it(@"Should get correctly when initialized", ^ { + NSMutableDictionary* dict = [@{SDLNameModuleName:@"temperatureUnit", + SDLNameTemperatureUnitAvailable:@(YES), + SDLNameDistanceUnitAvailable:@(YES), + SDLNameDisplayModeUnitAvailable:@(NO) + } mutableCopy]; + SDLHMISettingsControlCapabilities* testStruct = [[SDLHMISettingsControlCapabilities alloc] initWithDictionary:dict]; + + expect(testStruct.moduleName).to(equal(@"temperatureUnit")); + expect(testStruct.distanceUnitAvailable).to(equal(@(YES))); + expect(testStruct.temperatureUnitAvailable).to(equal(@(YES))); + expect(testStruct.displayModeUnitAvailable).to(equal(@(NO))); + + }); + + it(@"Should return nil if not set", ^ { + SDLHMISettingsControlCapabilities* testStruct = [[SDLHMISettingsControlCapabilities alloc] init]; + + expect(testStruct.moduleName).to(beNil()); + expect(testStruct.distanceUnitAvailable).to(beNil()); + expect(testStruct.temperatureUnitAvailable).to(beNil()); + expect(testStruct.displayModeUnitAvailable).to(beNil()); + + }); +}); + +QuickSpecEnd diff --git a/SmartDeviceLinkTests/RPCSpecs/StructSpecs/SDLHMISettingsControlDataSpec.m b/SmartDeviceLinkTests/RPCSpecs/StructSpecs/SDLHMISettingsControlDataSpec.m new file mode 100644 index 000000000..f2a1cd399 --- /dev/null +++ b/SmartDeviceLinkTests/RPCSpecs/StructSpecs/SDLHMISettingsControlDataSpec.m @@ -0,0 +1,57 @@ +// SDLHMISettingsControlDataSpec.m +// + +#import <Foundation/Foundation.h> + +#import <Quick/Quick.h> +#import <Nimble/Nimble.h> + +#import "SDLHMISettingsControlData.h" +#import "SDLNames.h" + + +QuickSpecBegin(SDLHMISettingsControlDataSpec) + +describe(@"Getter/Setter Tests", ^ { + it(@"Should set and get correctly", ^ { + SDLHMISettingsControlData* testStruct = [[SDLHMISettingsControlData alloc] init]; + + testStruct.displayMode = SDLDisplayModeAuto; + testStruct.temperatureUnit = SDLTemperatureUnitCelsius; + testStruct.distanceUnit = SDLDistanceUnitKilometers; + + expect(testStruct.displayMode).to(equal(SDLDisplayModeAuto)); + expect(testStruct.temperatureUnit).to(equal(SDLTemperatureUnitCelsius)); + expect(testStruct.distanceUnit).to(equal(SDLDistanceUnitKilometers)); + }); + + it(@"Should set and get correctly", ^ { + SDLHMISettingsControlData* testStruct = [[SDLHMISettingsControlData alloc] initWithDisplaymode:SDLDisplayModeAuto temperatureUnit:SDLTemperatureUnitCelsius distanceUnit:SDLDistanceUnitKilometers]; + + expect(testStruct.displayMode).to(equal(SDLDisplayModeAuto)); + expect(testStruct.temperatureUnit).to(equal(SDLTemperatureUnitCelsius)); + expect(testStruct.distanceUnit).to(equal(SDLDistanceUnitKilometers)); + }); + + it(@"Should get correctly when initialized", ^ { + NSMutableDictionary* dict = [@{SDLNameDisplayMode:SDLDisplayModeAuto, + SDLNameTemperatureUnit:SDLTemperatureUnitCelsius, + SDLNameDistanceUnit:SDLDistanceUnitKilometers} mutableCopy]; + SDLHMISettingsControlData* testStruct = [[SDLHMISettingsControlData alloc] initWithDictionary:dict]; + + expect(testStruct.displayMode).to(equal(SDLDisplayModeAuto)); + expect(testStruct.temperatureUnit).to(equal(SDLTemperatureUnitCelsius)); + expect(testStruct.distanceUnit).to(equal(SDLDistanceUnitKilometers)); + + }); + + it(@"Should return nil if not set", ^ { + SDLHMISettingsControlData* testStruct = [[SDLHMISettingsControlData alloc] init]; + + expect(testStruct.displayMode).to(beNil()); + expect(testStruct.temperatureUnit).to(beNil()); + expect(testStruct.distanceUnit).to(beNil()); + }); +}); + +QuickSpecEnd diff --git a/SmartDeviceLinkTests/RPCSpecs/StructSpecs/SDLImageSpec.m b/SmartDeviceLinkTests/RPCSpecs/StructSpecs/SDLImageSpec.m index b4a0b2be6..56939ee0e 100644 --- a/SmartDeviceLinkTests/RPCSpecs/StructSpecs/SDLImageSpec.m +++ b/SmartDeviceLinkTests/RPCSpecs/StructSpecs/SDLImageSpec.m @@ -137,6 +137,16 @@ describe(@"initializers", ^{ expect(testImage.imageType).to(equal(SDLImageTypeStatic)); expect(testImage.isTemplate).to(beTrue()); }); + + context(@"initWithStaticIconName:", ^{ + SDLStaticIconName staticIconName = SDLStaticIconNameFavoriteStar; + testImage = [[SDLImage alloc] initWithStaticIconName:staticIconName]; + + expect(testImage).toNot(beNil()); + expect(testImage.value).to(equal(staticIconName)); + expect(testImage.imageType).to(equal(SDLImageTypeStatic)); + expect(testImage.isTemplate).to(beTrue()); + }); }); QuickSpecEnd diff --git a/SmartDeviceLinkTests/RPCSpecs/StructSpecs/SDLLightCapabilitiesSpec.m b/SmartDeviceLinkTests/RPCSpecs/StructSpecs/SDLLightCapabilitiesSpec.m new file mode 100644 index 000000000..55fad3f9c --- /dev/null +++ b/SmartDeviceLinkTests/RPCSpecs/StructSpecs/SDLLightCapabilitiesSpec.m @@ -0,0 +1,62 @@ +// +// SDLLightCapabilitiesSpec.m +// SmartDeviceLinkTests +// + +#import <Foundation/Foundation.h> +#import <Quick/Quick.h> +#import <Nimble/Nimble.h> + +#import "SDLNames.h" +#import "SDLLightName.h" +#import "SDLLightCapabilities.h" + +QuickSpecBegin( SDLLightCapabilitiesSpec) + +describe(@"Getter/Setter Tests", ^ { + it(@"Should set and get correctly", ^ { + SDLLightCapabilities* testStruct = [[SDLLightCapabilities alloc] init]; + + testStruct.name = SDLLightNameFogLights; + testStruct.densityAvailable = @YES; + testStruct.sRGBColorSpaceAvailable = @NO; + + expect(testStruct.name).to(equal(SDLLightNameFogLights)); + expect(testStruct.densityAvailable).to(equal(@YES)); + expect(testStruct.sRGBColorSpaceAvailable).to(equal(@NO)); + }); + + it(@"Should set and get correctly", ^ { + SDLLightCapabilities* testStruct = [[SDLLightCapabilities alloc] initWithName:SDLLightNameFogLights densityAvailable:YES sRGBColorSpaceAvailable:NO statusAvailable:NO]; + + expect(testStruct.name).to(equal(SDLLightNameFogLights)); + expect(testStruct.densityAvailable).to(equal(@YES)); + expect(testStruct.sRGBColorSpaceAvailable).to(equal(@NO)); + expect(testStruct.statusAvailable).to(equal(@NO)); + + }); + + it(@"Should get correctly when initialized", ^ { + NSMutableDictionary* dict = [@{SDLNameName:SDLLightNameFogLights, + SDLNameDensityAvailable:@YES, + SDLNameSRGBColorSpaceAvailable:@NO + } mutableCopy]; + + SDLLightCapabilities* testStruct = [[SDLLightCapabilities alloc] initWithDictionary:dict]; + + expect(testStruct.name).to(equal(SDLLightNameFogLights)); + expect(testStruct.densityAvailable).to(equal(@YES)); + expect(testStruct.sRGBColorSpaceAvailable).to(equal(@NO)); + }); + + it(@"Should return nil if not set", ^ { + SDLLightCapabilities* testStruct = [[SDLLightCapabilities alloc] init]; + + expect(testStruct.name).to(beNil()); + expect(testStruct.densityAvailable).to(beNil()); + expect(testStruct.sRGBColorSpaceAvailable).to(beNil()); + + }); +}); + +QuickSpecEnd diff --git a/SmartDeviceLinkTests/RPCSpecs/StructSpecs/SDLLightControlCapabilitiesSpec.m b/SmartDeviceLinkTests/RPCSpecs/StructSpecs/SDLLightControlCapabilitiesSpec.m new file mode 100644 index 000000000..1bcfad24c --- /dev/null +++ b/SmartDeviceLinkTests/RPCSpecs/StructSpecs/SDLLightControlCapabilitiesSpec.m @@ -0,0 +1,58 @@ +// +// SDLLightControlCapabilitiesSpec.m +// SmartDeviceLinkTests +// + +#import <Foundation/Foundation.h> + +#import <Quick/Quick.h> +#import <Nimble/Nimble.h> + +#import "SDLLightControlCapabilities.h" +#import "SDLNames.h" +#import "SDLLightCapabilities.h" + +QuickSpecBegin( SDLLightControlCapabilitiesSpec) + +SDLLightCapabilities* somelightCapabilities = [[SDLLightCapabilities alloc] init]; + +describe(@"Getter/Setter Tests", ^ { + it(@"Should set and get correctly", ^ { + SDLLightControlCapabilities* testStruct = [[SDLLightControlCapabilities alloc] init]; + + testStruct.moduleName = @"moduleName"; + testStruct.supportedLights = [@[somelightCapabilities] copy]; + + expect(testStruct.moduleName).to(equal(@"moduleName")); + expect(testStruct.supportedLights).to(equal([@[somelightCapabilities] copy])); + + }); + + it(@"Should set and get correctly", ^ { + SDLLightControlCapabilities* testStruct = [[SDLLightControlCapabilities alloc] initWithModuleName:@"moduleName" supportedLights:[@[somelightCapabilities] copy]]; + + expect(testStruct.moduleName).to(equal(@"moduleName")); + expect(testStruct.supportedLights).to(equal([@[somelightCapabilities] copy])); + + }); + + it(@"Should get correctly when initialized", ^ { + NSMutableDictionary* dict = [@{SDLNameModuleName:@"moduleName", + SDLNameSupportedLights:[@[somelightCapabilities] copy] + } mutableCopy]; + + SDLLightControlCapabilities* testStruct = [[SDLLightControlCapabilities alloc] initWithDictionary:dict]; + + expect(testStruct.moduleName).to(equal(@"moduleName")); + expect(testStruct.supportedLights).to(equal([@[somelightCapabilities] copy])); + }); + + it(@"Should return nil if not set", ^ { + SDLLightControlCapabilities* testStruct = [[SDLLightControlCapabilities alloc] init]; + + expect(testStruct.moduleName).to(beNil()); + expect(testStruct.supportedLights).to(beNil()); + }); +}); + +QuickSpecEnd diff --git a/SmartDeviceLinkTests/RPCSpecs/StructSpecs/SDLLightControlDataSpec.m b/SmartDeviceLinkTests/RPCSpecs/StructSpecs/SDLLightControlDataSpec.m new file mode 100644 index 000000000..d2b2d6e1b --- /dev/null +++ b/SmartDeviceLinkTests/RPCSpecs/StructSpecs/SDLLightControlDataSpec.m @@ -0,0 +1,48 @@ +// +// SDLLightControlDataSpec.m +// SmartDeviceLinkTests +// + +#import <Foundation/Foundation.h> + +#import <Quick/Quick.h> +#import <Nimble/Nimble.h> + +#import "SDLLightControlData.h" +#import "SDLNames.h" +#import "SDLLightState.h" + +QuickSpecBegin(SDLLightControlDataSpec) + +SDLLightState* someLightState = [[SDLLightState alloc] init]; + +describe(@"Getter/Setter Tests", ^ { + it(@"Should set and get correctly", ^ { + SDLLightControlData* testStruct = [[SDLLightControlData alloc] init]; + + testStruct.lightState = [@[someLightState] copy]; + + expect(testStruct.lightState).to(equal([@[someLightState] copy])); + }); + + it(@"Should set and get correctly", ^ { + SDLLightControlData* testStruct = [[SDLLightControlData alloc] initWithLightStateArray:[@[someLightState] copy]]; + expect(testStruct.lightState).to(equal([@[someLightState] copy])); + }); + + it(@"Should get correctly when initialized", ^ { + NSMutableDictionary* dict = [@{SDLNameLightState:[@[someLightState] copy]} mutableCopy]; + + SDLLightControlData* testStruct = [[SDLLightControlData alloc] initWithDictionary:dict]; + + expect(testStruct.lightState).to(equal([@[someLightState] copy])); + }); + + it(@"Should return nil if not set", ^ { + SDLLightControlData* testStruct = [[SDLLightControlData alloc] init]; + + expect(testStruct.lightState).to(beNil()); + }); +}); + +QuickSpecEnd diff --git a/SmartDeviceLinkTests/RPCSpecs/StructSpecs/SDLLightStateSpec.m b/SmartDeviceLinkTests/RPCSpecs/StructSpecs/SDLLightStateSpec.m new file mode 100644 index 000000000..7d3fd57cb --- /dev/null +++ b/SmartDeviceLinkTests/RPCSpecs/StructSpecs/SDLLightStateSpec.m @@ -0,0 +1,79 @@ +// +// SDLLightStateSpec.m +// SmartDeviceLinkTests +// + +#import <Foundation/Foundation.h> +#import <Quick/Quick.h> +#import <Nimble/Nimble.h> + +#import "SDLLightState.h" +#import "SDLLightStatus.h" +#import "SDLSRGBColor.h" +#import "SDLLightName.h" +#import "SDLNames.h" + +QuickSpecBegin(SDLLightStateSpec) + +SDLSRGBColor* somesRGBColor = [[SDLSRGBColor alloc] init]; + +describe(@"Getter/Setter Tests", ^ { + it(@"Should set and get correctly", ^ { + SDLLightState* testStruct = [[SDLLightState alloc] init]; + + testStruct.id = SDLLightNameFogLights; + testStruct.status = SDLLightStatusOn; + testStruct.density = @(0.5); + testStruct.sRGBColor = somesRGBColor; + + expect(testStruct.id).to(equal(SDLLightNameFogLights)); + expect(testStruct.status).to(equal(SDLLightStatusOn)); + expect(testStruct.density).to(equal(@(0.5))); + expect(testStruct.sRGBColor).to(equal(somesRGBColor)); + }); + + it(@"Should set and get correctly", ^ { + SDLLightState* testStruct = [[SDLLightState alloc] initWithId:SDLLightNameFogLights status:SDLLightStatusOFF]; + expect(testStruct.id).to(equal(SDLLightNameFogLights)); + expect(testStruct.status).to(equal(SDLLightStatusOFF)); + expect(testStruct.density).to(beNil()); + expect(testStruct.sRGBColor).to(beNil()); + + }); + + it(@"Should set and get correctly", ^ { + SDLLightState* testStruct = [[SDLLightState alloc] initWithId:SDLLightNameFogLights status:SDLLightStatusOFF density:0.5 sRGBColor:somesRGBColor]; + + expect(testStruct.id).to(equal(SDLLightNameFogLights)); + expect(testStruct.status).to(equal(SDLLightStatusOFF)); + expect(testStruct.density).to(equal(@(0.5))); + expect(testStruct.sRGBColor).to(equal(somesRGBColor)); + + }); + + it(@"Should get correctly when initialized", ^ { + NSMutableDictionary* dict = [@{SDLNameId:SDLLightNameFogLights, + SDLNameStatus:SDLLightStatusOn, + SDLNameDensity:@(0.5), + SDLNameSRGBColor:somesRGBColor} mutableCopy]; + + SDLLightState* testStruct = [[SDLLightState alloc] initWithDictionary:dict]; + + expect(testStruct.id).to(equal(SDLLightNameFogLights)); + expect(testStruct.status).to(equal(SDLLightStatusOn)); + expect(testStruct.density).to(equal(@(0.5))); + expect(testStruct.sRGBColor).to(equal(somesRGBColor)); + + }); + + it(@"Should return nil if not set", ^ { + SDLLightState* testStruct = [[SDLLightState alloc] init]; + + expect(testStruct.id).to(beNil()); + expect(testStruct.status).to(beNil()); + expect(testStruct.density).to(beNil()); + expect(testStruct.sRGBColor).to(beNil()); + }); +}); + +QuickSpecEnd diff --git a/SmartDeviceLinkTests/RPCSpecs/StructSpecs/SDLMassageCushionFirmnessSpec.m b/SmartDeviceLinkTests/RPCSpecs/StructSpecs/SDLMassageCushionFirmnessSpec.m new file mode 100644 index 000000000..4fc8f0b43 --- /dev/null +++ b/SmartDeviceLinkTests/RPCSpecs/StructSpecs/SDLMassageCushionFirmnessSpec.m @@ -0,0 +1,52 @@ +// +// SDLMassageCushionFirmnessSpec.m +// SmartDeviceLinkTests +// + +#import <Foundation/Foundation.h> +#import <Quick/Quick.h> +#import <Nimble/Nimble.h> + +#import "SDLNames.h" +#import "SDLMassageCushionFirmness.h" + +QuickSpecBegin(SDLMassageCushionFirmnessSpec) + +describe(@"Getter/Setter Tests", ^ { + it(@"Should set and get correctly", ^ { + SDLMassageCushionFirmness* testStruct = [[SDLMassageCushionFirmness alloc] init]; + + testStruct.cushion = SDLMassageCushionSeatBolsters; + testStruct.firmness = @2; + + expect(testStruct.cushion).to(equal(SDLMassageCushionSeatBolsters)); + expect(testStruct.firmness).to(equal(@2)); + }); + + it(@"Should set and get correctly", ^ { + SDLMassageCushionFirmness* testStruct = [[SDLMassageCushionFirmness alloc] initWithMassageCushion:SDLMassageCushionBackBolsters firmness:12]; + + expect(testStruct.cushion).to(equal(SDLMassageCushionBackBolsters)); + expect(testStruct.firmness).to(equal(@12)); + }); + + it(@"Should get correctly when initialized", ^ { + NSMutableDictionary* dict = [@{SDLNameCushion:SDLMassageCushionSeatBolsters, + SDLNameFirmness:@12 + } mutableCopy]; + SDLMassageCushionFirmness* testStruct = [[SDLMassageCushionFirmness alloc] initWithDictionary:dict]; + + expect(testStruct.cushion).to(equal(SDLMassageCushionSeatBolsters)); + expect(testStruct.firmness).to(equal(@12)); + + }); + + it(@"Should return nil if not set", ^ { + SDLMassageCushionFirmness* testStruct = [[SDLMassageCushionFirmness alloc] init]; + + expect(testStruct.cushion).to(beNil()); + expect(testStruct.firmness).to(beNil()); + }); +}); + +QuickSpecEnd diff --git a/SmartDeviceLinkTests/RPCSpecs/StructSpecs/SDLMassageModeDataSpec.m b/SmartDeviceLinkTests/RPCSpecs/StructSpecs/SDLMassageModeDataSpec.m new file mode 100644 index 000000000..6b52a36b2 --- /dev/null +++ b/SmartDeviceLinkTests/RPCSpecs/StructSpecs/SDLMassageModeDataSpec.m @@ -0,0 +1,53 @@ +// +// SDLMassageModeDataSpec.m +// SmartDeviceLinkTests +// + +#import <Foundation/Foundation.h> + +#import <Quick/Quick.h> +#import <Nimble/Nimble.h> + +#import "SDLNames.h" +#import "SDLMassageModeData.h" + +QuickSpecBegin(SDLMassageModeDataSpec) + +describe(@"Getter/Setter Tests", ^ { + it(@"Should set and get correctly", ^ { + SDLMassageModeData* testStruct = [[SDLMassageModeData alloc] init]; + + testStruct.massageMode = SDLMassageModeHigh; + testStruct.massageZone = SDLMassageZoneLumbar; + + expect(testStruct.massageZone).to(equal(SDLMassageZoneLumbar)); + expect(testStruct.massageMode).to(equal(SDLMassageModeHigh)); + }); + + it(@"Should set and get correctly", ^ { + SDLMassageModeData* testStruct = [[SDLMassageModeData alloc] initWithMassageMode:SDLMassageZoneLumbar massageZone:SDLMassageModeHigh]; + + expect(testStruct.massageZone).to(equal(SDLMassageModeHigh)); + expect(testStruct.massageMode).to(equal(SDLMassageZoneLumbar)); + }); + + it(@"Should get correctly when initialized", ^ { + NSMutableDictionary* dict = [@{SDLNameMassageMode:SDLMassageModeLow, + SDLNameMassageZone:SDLMassageZoneLumbar + } mutableCopy]; + SDLMassageModeData* testStruct = [[SDLMassageModeData alloc] initWithDictionary:dict]; + + expect(testStruct.massageZone).to(equal(SDLMassageZoneLumbar)); + expect(testStruct.massageMode).to(equal(SDLMassageModeLow)); + }); + + it(@"Should return nil if not set", ^ { + SDLMassageModeData* testStruct = [[SDLMassageModeData alloc] init]; + + expect(testStruct.massageZone).to(beNil()); + expect(testStruct.massageMode).to(beNil()); + }); +}); + +QuickSpecEnd + diff --git a/SmartDeviceLinkTests/RPCSpecs/StructSpecs/SDLModuleDataSpec.m b/SmartDeviceLinkTests/RPCSpecs/StructSpecs/SDLModuleDataSpec.m index ee14ff803..8e57eef6b 100644 --- a/SmartDeviceLinkTests/RPCSpecs/StructSpecs/SDLModuleDataSpec.m +++ b/SmartDeviceLinkTests/RPCSpecs/StructSpecs/SDLModuleDataSpec.m @@ -12,6 +12,10 @@ #import "SDLModuleType.h" #import "SDLClimateControlData.h" #import "SDLRadioControlData.h" +#import "SDLSeatControlData.h" +#import "SDLAudioControlData.h" +#import "SDLLightControlData.h" +#import "SDLHMISettingsControlData.h" #import "SDLNames.h" QuickSpecBegin(SDLModuleDataSpec) @@ -19,25 +23,43 @@ QuickSpecBegin(SDLModuleDataSpec) describe(@"Initialization tests", ^{ __block SDLRadioControlData* someRadioData = [[SDLRadioControlData alloc] init]; __block SDLClimateControlData* someClimateData = [[SDLClimateControlData alloc] init]; + __block SDLAudioControlData* someAudioData = [[SDLAudioControlData alloc] init]; + __block SDLLightControlData* someLightData = [[SDLLightControlData alloc] init]; + __block SDLHMISettingsControlData* someHMISettingsData = [[SDLHMISettingsControlData alloc] init]; + __block SDLSeatControlData* someSeatData = [[SDLSeatControlData alloc] init]; it(@"should properly initialize init", ^{ SDLModuleData* testStruct = [[SDLModuleData alloc] init]; - + expect(testStruct.moduleType).to(beNil()); expect(testStruct.radioControlData).to(beNil()); expect(testStruct.climateControlData).to(beNil()); + expect(testStruct.seatControlData).to(beNil()); + expect(testStruct.audioControlData).to(beNil()); + expect(testStruct.hmiSettingsControlData).to(beNil()); + expect(testStruct.lightControlData).to(beNil()); + }); it(@"should properly initialize initWithDictionary", ^{ NSMutableDictionary* dict = [@{SDLNameModuleType:SDLModuleTypeRadio, SDLNameRadioControlData:someRadioData, - SDLNameClimateControlData:someClimateData} mutableCopy]; + SDLNameClimateControlData:someClimateData, + SDLNameSeatControlData:someSeatData, + SDLNameAudioControlData:someAudioData, + SDLNameLightControlData:someLightData, + SDLNameHmiSettingsControlData:someHMISettingsData} mutableCopy]; SDLModuleData* testStruct = [[SDLModuleData alloc] initWithDictionary:dict]; expect(testStruct.moduleType).to(equal(SDLModuleTypeRadio)); expect(testStruct.radioControlData).to(equal(someRadioData)); + expect(testStruct.seatControlData).to(equal(someSeatData)); expect(testStruct.climateControlData).to(equal(someClimateData)); + expect(testStruct.audioControlData).to(equal(someAudioData)); + expect(testStruct.hmiSettingsControlData).to(equal(someHMISettingsData)); + expect(testStruct.lightControlData).to(equal(someLightData)); + }); it(@"Should set and get correctly", ^{ @@ -45,10 +67,18 @@ describe(@"Initialization tests", ^{ testStruct.moduleType = SDLModuleTypeRadio; testStruct.radioControlData = someRadioData; testStruct.climateControlData = someClimateData; + testStruct.seatControlData = someSeatData; + testStruct.audioControlData = someAudioData; + testStruct.lightControlData = someLightData; + testStruct.hmiSettingsControlData = someHMISettingsData; expect(testStruct.moduleType).to(equal(SDLModuleTypeRadio)); + expect(testStruct.seatControlData).to(equal(someSeatData)); expect(testStruct.radioControlData).to(equal(someRadioData)); expect(testStruct.climateControlData).to(equal(someClimateData)); + expect(testStruct.audioControlData).to(equal(someAudioData)); + expect(testStruct.hmiSettingsControlData).to(equal(someHMISettingsData)); + expect(testStruct.lightControlData).to(equal(someLightData)); }); it(@"Should get correctly when initialized with RadioControlData", ^ { @@ -57,6 +87,7 @@ describe(@"Initialization tests", ^{ expect(testStruct.moduleType).to(equal(SDLModuleTypeRadio)); expect(testStruct.radioControlData).to(equal(someRadioData)); expect(testStruct.climateControlData).to(beNil()); + expect(testStruct.seatControlData).to(beNil()); }); it(@"Should get correctly when initialized with ClimateControlData", ^ { @@ -65,6 +96,49 @@ describe(@"Initialization tests", ^{ expect(testStruct.moduleType).to(equal(SDLModuleTypeClimate)); expect(testStruct.climateControlData).to(equal(someClimateData)); expect(testStruct.radioControlData).to(beNil()); + expect(testStruct.seatControlData).to(beNil()); + }); + + it(@"Should get correctly when initialized with ClimateControlData", ^ { + SDLModuleData* testStruct = [[SDLModuleData alloc] initWithSeatControlData:someSeatData]; + + expect(testStruct.moduleType).to(equal(SDLModuleTypeSeat)); + expect(testStruct.seatControlData).to(equal(someSeatData)); + expect(testStruct.radioControlData).to(beNil()); + expect(testStruct.climateControlData).to(beNil()); + }); + + it(@"Should get correctly when initialized with ClimateControlData", ^ { + SDLModuleData* testStruct = [[SDLModuleData alloc] initWithHMISettingsControlData:someHMISettingsData]; + + expect(testStruct.moduleType).to(equal(SDLModuleTypeHMISettings)); + expect(testStruct.climateControlData).to(beNil()); + expect(testStruct.radioControlData).to(beNil()); + expect(testStruct.audioControlData).to(beNil()); + expect(testStruct.lightControlData).to(beNil()); + expect(testStruct.hmiSettingsControlData).to(equal(someHMISettingsData)); + }); + + it(@"Should get correctly when initialized with ClimateControlData", ^ { + SDLModuleData* testStruct = [[SDLModuleData alloc] initWithLightControlData:someLightData]; + + expect(testStruct.moduleType).to(equal(SDLModuleTypeLight)); + expect(testStruct.climateControlData).to(beNil()); + expect(testStruct.radioControlData).to(beNil()); + expect(testStruct.audioControlData).to(beNil()); + expect(testStruct.lightControlData).to(equal(someLightData)); + expect(testStruct.hmiSettingsControlData).to(beNil()); + }); + + it(@"Should get correctly when initialized with ClimateControlData", ^ { + SDLModuleData* testStruct = [[SDLModuleData alloc] initWithAudioControlData:someAudioData]; + + expect(testStruct.moduleType).to(equal(SDLModuleTypeAudio)); + expect(testStruct.climateControlData).to(beNil()); + expect(testStruct.radioControlData).to(beNil()); + expect(testStruct.audioControlData).to(equal(someAudioData)); + expect(testStruct.lightControlData).to(beNil()); + expect(testStruct.hmiSettingsControlData).to(beNil()); }); }); diff --git a/SmartDeviceLinkTests/RPCSpecs/StructSpecs/SDLRadioControlCapabilitiesSpec.m b/SmartDeviceLinkTests/RPCSpecs/StructSpecs/SDLRadioControlCapabilitiesSpec.m index d6e07fe11..70873d96e 100644 --- a/SmartDeviceLinkTests/RPCSpecs/StructSpecs/SDLRadioControlCapabilitiesSpec.m +++ b/SmartDeviceLinkTests/RPCSpecs/StructSpecs/SDLRadioControlCapabilitiesSpec.m @@ -28,6 +28,10 @@ describe(@"Initialization tests", ^{ expect(testStruct.stateAvailable).to(beNil()); expect(testStruct.signalStrengthAvailable).to(beNil()); expect(testStruct.signalChangeThresholdAvailable).to(beNil()); + expect(testStruct.hdRadioEnableAvailable).to(beNil()); + expect(testStruct.siriusXMRadioAvailable).to(beNil()); + expect(testStruct.sisDataAvailable).to(beNil()); + }); it(@"should properly initialize initWithDictionary", ^{ @@ -41,7 +45,11 @@ describe(@"Initialization tests", ^{ SDLNameAvailableHDsAvailable : @NO, SDLNameStateAvailable : @YES, SDLNameSignalStrengthAvailable : @YES, - SDLNameSignalChangeThresholdAvailable : @NO} mutableCopy]; + SDLNameSignalChangeThresholdAvailable : @NO, + SDLNameHDRadioEnableAvailable : @YES, + SDLNameSiriusXMRadioAvailable : @NO, + SDLNameSISDataAvailable:@YES + } mutableCopy]; SDLRadioControlCapabilities* testStruct = [[SDLRadioControlCapabilities alloc] initWithDictionary:dict]; expect(testStruct.moduleName).to(equal(@"someName")); @@ -54,6 +62,10 @@ describe(@"Initialization tests", ^{ expect(testStruct.stateAvailable).to(equal(@YES)); expect(testStruct.signalStrengthAvailable).to(equal(@YES)); expect(testStruct.signalChangeThresholdAvailable).to(equal(@NO)); + expect(testStruct.hdRadioEnableAvailable).to(equal(@YES)); + expect(testStruct.siriusXMRadioAvailable).to(equal(@NO)); + expect(testStruct.sisDataAvailable).to(equal(@YES)); + }); it(@"Should set and get correctly", ^{ @@ -69,6 +81,9 @@ describe(@"Initialization tests", ^{ testStruct.stateAvailable = @YES; testStruct.signalStrengthAvailable = @YES; testStruct.signalChangeThresholdAvailable = @NO; + testStruct.hdRadioEnableAvailable = @YES; + testStruct.siriusXMRadioAvailable = @YES; + testStruct.sisDataAvailable = @YES; expect(testStruct.moduleName).to(equal(@"someName")); expect(testStruct.radioEnableAvailable).to(equal(@YES)); @@ -80,8 +95,12 @@ describe(@"Initialization tests", ^{ expect(testStruct.stateAvailable).to(equal(@YES)); expect(testStruct.signalStrengthAvailable).to(equal(@YES)); expect(testStruct.signalChangeThresholdAvailable).to(equal(@NO)); + expect(testStruct.hdRadioEnableAvailable).to(equal(@YES)); + expect(testStruct.siriusXMRadioAvailable).to(equal(@YES)); + expect(testStruct.sisDataAvailable).to(equal(@YES)); + }); - + it(@"Should get correctly when initialized with Module Name and other radio control capabilite's parameters", ^ { SDLRadioControlCapabilities* testStruct = [[SDLRadioControlCapabilities alloc] initWithModuleName:@"someName" radioEnableAvailable:YES radioBandAvailable:NO radioFrequencyAvailable:YES hdChannelAvailable:NO rdsDataAvailable:NO availableHDsAvailable:NO stateAvailable:YES signalStrengthAvailable:YES signalChangeThresholdAvailable:NO]; @@ -95,6 +114,27 @@ describe(@"Initialization tests", ^{ expect(testStruct.stateAvailable).to(equal(@YES)); expect(testStruct.signalStrengthAvailable).to(equal(@YES)); expect(testStruct.signalChangeThresholdAvailable).to(equal(@NO)); + expect(testStruct.hdRadioEnableAvailable).to(equal(@NO)); + expect(testStruct.siriusXMRadioAvailable).to(equal(@NO)); + }); + + it(@"Should get correctly when initialized with Module Name and other radio control capabilite's parameters", ^ { + SDLRadioControlCapabilities* testStruct = [[SDLRadioControlCapabilities alloc] initWithModuleName:@"someName" radioEnableAvailable:YES radioBandAvailable:NO radioFrequencyAvailable:YES hdChannelAvailable:NO rdsDataAvailable:NO availableHDsAvailable:NO stateAvailable:YES signalStrengthAvailable:YES signalChangeThresholdAvailable:NO hdRadioEnableAvailable:YES siriusXMRadioAvailable:YES sisDataAvailable:YES]; + + expect(testStruct.moduleName).to(equal(@"someName")); + expect(testStruct.radioEnableAvailable).to(equal(@YES)); + expect(testStruct.radioBandAvailable).to(equal(@NO)); + expect(testStruct.radioFrequencyAvailable).to(equal(@YES)); + expect(testStruct.hdChannelAvailable).to(equal(@NO)); + expect(testStruct.rdsDataAvailable).to(equal(@NO)); + expect(testStruct.availableHDsAvailable).to(equal(@NO)); + expect(testStruct.stateAvailable).to(equal(@YES)); + expect(testStruct.signalStrengthAvailable).to(equal(@YES)); + expect(testStruct.signalChangeThresholdAvailable).to(equal(@NO)); + expect(testStruct.hdRadioEnableAvailable).to(equal(YES)); + expect(testStruct.siriusXMRadioAvailable).to(equal(@YES)); + expect(testStruct.sisDataAvailable).to(equal(@YES)); + }); }); diff --git a/SmartDeviceLinkTests/RPCSpecs/StructSpecs/SDLRadioControlDataSpec.m b/SmartDeviceLinkTests/RPCSpecs/StructSpecs/SDLRadioControlDataSpec.m index 4a5ebee64..02e38bcaa 100644 --- a/SmartDeviceLinkTests/RPCSpecs/StructSpecs/SDLRadioControlDataSpec.m +++ b/SmartDeviceLinkTests/RPCSpecs/StructSpecs/SDLRadioControlDataSpec.m @@ -12,10 +12,12 @@ #import "SDLRadioBand.h" #import "SDLRadioState.h" #import "SDLRDSData.h" +#import "SDLSISData.h" #import "SDLNames.h" QuickSpecBegin(SDLRadioControlDataSpec) __block SDLRDSData* someRdsData = [[SDLRDSData alloc] init]; +__block SDLSISData* someSisData = [[SDLSISData alloc] init]; describe(@"Initialization tests", ^{ @@ -32,6 +34,9 @@ describe(@"Initialization tests", ^{ expect(testStruct.signalChangeThreshold).to(beNil()); expect(testStruct.radioEnable).to(beNil()); expect(testStruct.state).to(beNil()); + expect(testStruct.hdRadioEnable).to(beNil()); + expect(testStruct.sisData).to(beNil()); + }); it(@"should properly initialize initWithDictionary", ^{ @@ -45,7 +50,10 @@ describe(@"Initialization tests", ^{ SDLNameSignalStrength : @54, SDLNameSignalChangeThreshold : @76, SDLNameRadioEnable : @YES, - SDLNameState : SDLRadioStateNotFound} mutableCopy]; + SDLNameState : SDLRadioStateNotFound, + SDLNameHDRadioEnable : @NO, + SDLNameSISData:someSisData + } mutableCopy]; SDLRadioControlData* testStruct = [[SDLRadioControlData alloc] initWithDictionary:dict]; expect(testStruct.frequencyInteger).to(equal(@101)); @@ -58,6 +66,9 @@ describe(@"Initialization tests", ^{ expect(testStruct.signalChangeThreshold).to(equal(@76)); expect(testStruct.radioEnable).to(equal(@YES)); expect(testStruct.state).to(equal(SDLRadioStateNotFound)); + expect(testStruct.hdRadioEnable).to(equal(@NO)); + expect(testStruct.sisData).to(equal(someSisData)); + }); it(@"Should set and get correctly", ^{ @@ -72,6 +83,8 @@ describe(@"Initialization tests", ^{ testStruct.signalChangeThreshold = @76; testStruct.radioEnable = @YES; testStruct.state = SDLRadioStateNotFound; + testStruct.hdRadioEnable = @YES; + testStruct.sisData = someSisData; expect(testStruct.frequencyInteger).to(equal(@101)); expect(testStruct.frequencyFraction).to(equal(@7)); @@ -83,6 +96,8 @@ describe(@"Initialization tests", ^{ expect(testStruct.signalChangeThreshold).to(equal(@76)); expect(testStruct.radioEnable).to(equal(@YES)); expect(testStruct.state).to(equal(SDLRadioStateNotFound)); + expect(testStruct.hdRadioEnable).to(equal(@YES)); + expect(testStruct.sisData).to(equal(someSisData)); }); it(@"Should get correctly when initialized with Module Name and other radio control capabilite's parameters", ^ { @@ -94,6 +109,39 @@ describe(@"Initialization tests", ^{ expect(testStruct.hdChannel).to(equal(@2)); expect(testStruct.radioEnable).to(equal(@YES)); }); + + it(@"Should get correctly when initialized with Module Name and other radio control capabilite's parameters", ^ { + SDLRadioControlData* testStruct = [[SDLRadioControlData alloc] initWithFrequencyInteger:@101 frequencyFraction:@7 band:SDLRadioBandAM hdChannel:@2 radioEnable:@YES]; + + expect(testStruct.frequencyInteger).to(equal(@101)); + expect(testStruct.frequencyFraction).to(equal(@7)); + expect(testStruct.band).to(equal(SDLRadioBandAM)); + expect(testStruct.hdChannel).to(equal(@2)); + expect(testStruct.radioEnable).to(equal(@YES)); + }); + + it(@"Should get correctly when initialized with Module Name and other radio control capabilite's parameters", ^ { + SDLRadioControlData* testStruct = [[SDLRadioControlData alloc] initWithFrequencyInteger:@101 frequencyFraction:@7 band:SDLRadioBandAM hdChannel:@2 radioEnable:@YES]; + + expect(testStruct.frequencyInteger).to(equal(@101)); + expect(testStruct.frequencyFraction).to(equal(@7)); + expect(testStruct.band).to(equal(SDLRadioBandAM)); + expect(testStruct.hdChannel).to(equal(@2)); + expect(testStruct.radioEnable).to(equal(@YES)); + expect(testStruct.sisData).to(beNil()); + }); + + it(@"Should get correctly when initialized with Module Name and other radio control capabilite's parameters", ^ { + SDLRadioControlData* testStruct = [[SDLRadioControlData alloc] initWithFrequencyInteger:@101 frequencyFraction:@7 band:SDLRadioBandAM hdChannel:@2 radioEnable:@YES sisData:someSisData]; + + expect(testStruct.frequencyInteger).to(equal(@101)); + expect(testStruct.frequencyFraction).to(equal(@7)); + expect(testStruct.band).to(equal(SDLRadioBandAM)); + expect(testStruct.hdChannel).to(equal(@2)); + expect(testStruct.radioEnable).to(equal(@YES)); + expect(testStruct.sisData).to(equal(someSisData)); + }); + }); QuickSpecEnd diff --git a/SmartDeviceLinkTests/RPCSpecs/StructSpecs/SDLRemoteControlCapabilitiesSpec.m b/SmartDeviceLinkTests/RPCSpecs/StructSpecs/SDLRemoteControlCapabilitiesSpec.m index 0dc04323a..f7547af26 100644 --- a/SmartDeviceLinkTests/RPCSpecs/StructSpecs/SDLRemoteControlCapabilitiesSpec.m +++ b/SmartDeviceLinkTests/RPCSpecs/StructSpecs/SDLRemoteControlCapabilitiesSpec.m @@ -8,9 +8,13 @@ #import <Quick/Quick.h> #import <Nimble/Nimble.h> +#import "SDLAudioControlCapabilities.h" #import "SDLRemoteControlCapabilities.h" #import "SDLClimateControlCapabilities.h" +#import "SDLLightControlCapabilities.h" +#import "SDLHMISettingsControlCapabilities.h" #import "SDLRadioControlCapabilities.h" +#import "SDLSeatControlCapabilities.h" #import "SDLButtonCapabilities.h" #import "SDLNames.h" @@ -19,47 +23,89 @@ QuickSpecBegin(SDLRemoteControlCapabilitiesSpec) __block SDLClimateControlCapabilities* someClimateControlCapabilities = [[SDLClimateControlCapabilities alloc] init]; __block SDLRadioControlCapabilities* someRadioControlCapabilities = [[SDLRadioControlCapabilities alloc] init]; __block SDLButtonCapabilities* someButtonControlCapabilities = [[SDLButtonCapabilities alloc] init]; +__block SDLSeatControlCapabilities* someSeatControlCapabilities = [[SDLSeatControlCapabilities alloc] init]; + + +__block SDLAudioControlCapabilities* someAudioControlCapabilities = [[SDLAudioControlCapabilities alloc] init]; + +__block SDLLightControlCapabilities* someLightControlCapabilities = [[SDLLightControlCapabilities alloc] init]; + +__block SDLHMISettingsControlCapabilities* someHMISettingsControlCapabilities = [[SDLHMISettingsControlCapabilities alloc] init]; describe(@"Initialization tests", ^{ it(@"should properly initialize init", ^{ SDLRemoteControlCapabilities* testStruct = [[SDLRemoteControlCapabilities alloc] init]; - + + expect(testStruct.seatControlCapabilities).to(beNil()); expect(testStruct.climateControlCapabilities).to(beNil()); expect(testStruct.radioControlCapabilities).to(beNil()); expect(testStruct.buttonCapabilities).to(beNil()); + expect(testStruct.audioControlCapabilities).to(beNil()); + expect(testStruct.hmiSettingsControlCapabilities).to(beNil()); + expect(testStruct.lightControlCapabilities).to(beNil()); + }); it(@"should properly initialize initWithDictionary", ^{ NSMutableDictionary* dict = [@{SDLNameClimateControlCapabilities : [@[someClimateControlCapabilities] copy], SDLNameRadioControlCapabilities :[@[someRadioControlCapabilities] copy], - SDLNameButtonCapabilities :[@[someButtonControlCapabilities] copy] } mutableCopy]; + SDLNameButtonCapabilities :[@[someButtonControlCapabilities] copy], + SDLNameSeatControlCapabilities:[@[someSeatControlCapabilities]copy], + SDLNameAudioControlCapabilities :[@[someAudioControlCapabilities] copy], + SDLNameLightControlCapabilities :[@[someLightControlCapabilities] copy], + SDLNameHmiSettingsControlCapabilities : [@[someHMISettingsControlCapabilities] copy] + } mutableCopy]; SDLRemoteControlCapabilities* testStruct = [[SDLRemoteControlCapabilities alloc] initWithDictionary:dict]; - + + expect(testStruct.seatControlCapabilities).to(equal([@[someSeatControlCapabilities] copy])); expect(testStruct.climateControlCapabilities).to(equal([@[someClimateControlCapabilities] copy])); expect(testStruct.radioControlCapabilities).to(equal([@[someRadioControlCapabilities] copy])); expect(testStruct.buttonCapabilities).to(equal([@[someButtonControlCapabilities] copy])); + expect(testStruct.audioControlCapabilities).to(equal([@[someAudioControlCapabilities] copy])); + expect(testStruct.hmiSettingsControlCapabilities).to(equal([@[someHMISettingsControlCapabilities] copy])); + expect(testStruct.lightControlCapabilities).to(equal([@[someLightControlCapabilities] copy])); }); it(@"Should set and get correctly", ^{ SDLRemoteControlCapabilities* testStruct = [[SDLRemoteControlCapabilities alloc] init]; - + + testStruct.seatControlCapabilities = ([@[someSeatControlCapabilities] copy]); testStruct.climateControlCapabilities = ([@[someClimateControlCapabilities] copy]); testStruct.radioControlCapabilities = [@[someRadioControlCapabilities] copy]; testStruct.buttonCapabilities = [@[someButtonControlCapabilities] copy]; + testStruct.audioControlCapabilities = [@[someAudioControlCapabilities] copy]; + testStruct.hmiSettingsControlCapabilities = [@[someHMISettingsControlCapabilities]copy]; + testStruct.lightControlCapabilities = [@[someLightControlCapabilities]copy]; + expect(testStruct.seatControlCapabilities).to(equal([@[someSeatControlCapabilities] copy])); expect(testStruct.climateControlCapabilities).to(equal(([@[someClimateControlCapabilities] copy]))); expect(testStruct.radioControlCapabilities).to(equal([@[someRadioControlCapabilities] copy])); expect(testStruct.buttonCapabilities).to(equal([@[someButtonControlCapabilities] copy])); + expect(testStruct.audioControlCapabilities).to(equal([@[someAudioControlCapabilities] copy])); + expect(testStruct.hmiSettingsControlCapabilities).to(equal([@[someHMISettingsControlCapabilities] copy])); + expect(testStruct.lightControlCapabilities).to(equal([@[someLightControlCapabilities] copy])); }); it(@"Should get correctly when initialized with climateControlCapabilities and other RemoteControlCapabilities parameters", ^ { SDLRemoteControlCapabilities* testStruct = [[SDLRemoteControlCapabilities alloc] initWithClimateControlCapabilities:[@[someClimateControlCapabilities] copy] radioControlCapabilities:[@[someRadioControlCapabilities] copy] buttonCapabilities:[@[someButtonControlCapabilities] copy]]; + expect(testStruct.seatControlCapabilities).to(beNil()); + expect(testStruct.climateControlCapabilities).to(equal(([@[someClimateControlCapabilities] copy]))); + expect(testStruct.radioControlCapabilities).to(equal([@[someRadioControlCapabilities] copy])); + expect(testStruct.buttonCapabilities).to(equal([@[someButtonControlCapabilities] copy])); + }); + + it(@"Should get correctly when initialized with climateControlCapabilities and other RemoteControlCapabilities parameters", ^ { + SDLRemoteControlCapabilities* testStruct = [[SDLRemoteControlCapabilities alloc] initWithClimateControlCapabilities:[@[someClimateControlCapabilities] copy] radioControlCapabilities:[@[someRadioControlCapabilities] copy] buttonCapabilities:[@[someButtonControlCapabilities] copy] seatControlCapabilities:[@[someSeatControlCapabilities] copy] audioControlCapabilities:[@[someAudioControlCapabilities] copy] hmiSettingsControlCapabilities:[@[someHMISettingsControlCapabilities] copy] lightControlCapabilities:[@[someLightControlCapabilities] copy]]; + expect(testStruct.climateControlCapabilities).to(equal(([@[someClimateControlCapabilities] copy]))); expect(testStruct.radioControlCapabilities).to(equal([@[someRadioControlCapabilities] copy])); expect(testStruct.buttonCapabilities).to(equal([@[someButtonControlCapabilities] copy])); + expect(testStruct.audioControlCapabilities).to(equal([@[someAudioControlCapabilities] copy])); + expect(testStruct.hmiSettingsControlCapabilities).to(equal([@[someHMISettingsControlCapabilities] copy])); + expect(testStruct.lightControlCapabilities).to(equal([@[someLightControlCapabilities] copy])); }); }); diff --git a/SmartDeviceLinkTests/RPCSpecs/StructSpecs/SDLSDLSRGBColorSpec.m b/SmartDeviceLinkTests/RPCSpecs/StructSpecs/SDLSDLSRGBColorSpec.m new file mode 100644 index 000000000..6fc596d10 --- /dev/null +++ b/SmartDeviceLinkTests/RPCSpecs/StructSpecs/SDLSDLSRGBColorSpec.m @@ -0,0 +1,63 @@ +// +// SDLSDLSRGBColorSpec.m +// SmartDeviceLinkTests +// + +#import <Foundation/Foundation.h> + +#import <Quick/Quick.h> +#import <Nimble/Nimble.h> + +#import "SDLNames.h" +#import "SDLSRGBColor.h" + + +QuickSpecBegin( SDLSDLSRGBColorSpec) + +describe(@"Getter/Setter Tests", ^ { + it(@"Should set and get correctly", ^ { + SDLSRGBColor* testStruct = [[SDLSRGBColor alloc] init]; + + testStruct.red = @123; + testStruct.green = @23; + testStruct.blue = @54; + + expect(testStruct.red).to(equal(@123)); + expect(testStruct.green).to(equal(@23)); + expect(testStruct.blue).to(equal(@54)); + + }); + + it(@"Should set and get correctly", ^ { + SDLSRGBColor* testStruct = [[SDLSRGBColor alloc] initWithRed:123 green:23 blue:54]; + + expect(testStruct.red).to(equal(@123)); + expect(testStruct.green).to(equal(@23)); + expect(testStruct.blue).to(equal(@54)); + }); + + it(@"Should get correctly when initialized", ^ { + NSMutableDictionary* dict = [@{SDLNameRed:@123, + SDLNameBlue:@23, + SDLNameGreen:@54 + } mutableCopy]; + + SDLSRGBColor* testStruct = [[SDLSRGBColor alloc] initWithDictionary:dict]; + + expect(testStruct.red).to(equal(@123)); + expect(testStruct.green).to(equal(@54)); + expect(testStruct.blue).to(equal(@23)); + }); + + it(@"Should return nil if not set", ^ { + SDLSRGBColor* testStruct = [[SDLSRGBColor alloc] init]; + + expect(testStruct.red).to(beNil()); + expect(testStruct.green).to(beNil()); + expect(testStruct.blue).to(beNil()); + + }); +}); + +QuickSpecEnd + diff --git a/SmartDeviceLinkTests/RPCSpecs/StructSpecs/SDLSISDataSpec.m b/SmartDeviceLinkTests/RPCSpecs/StructSpecs/SDLSISDataSpec.m new file mode 100644 index 000000000..e9ff6afd9 --- /dev/null +++ b/SmartDeviceLinkTests/RPCSpecs/StructSpecs/SDLSISDataSpec.m @@ -0,0 +1,81 @@ +// +// SDLSISDataSpec.m +// SmartDeviceLinkTests +// + +#import <Foundation/Foundation.h> + +#import <Quick/Quick.h> +#import <Nimble/Nimble.h> + +#import "SDLNames.h" +#import "SDLSISData.h" +#import "SDLStationIDNumber.h" +#import "SDLGPSLocation.h" + + +QuickSpecBegin(SDLSISDataSpec) + +SDLStationIDNumber *someID = [[SDLStationIDNumber alloc] init]; +SDLGPSLocation *someLocation = [[SDLGPSLocation alloc] init]; + +describe(@"Getter/Setter Tests", ^ { + it(@"Should set and get correctly", ^ { + SDLSISData* testStruct = [[SDLSISData alloc] init]; + + testStruct.stationShortName = @"short"; + testStruct.stationIDNumber = someID; + testStruct.stationLongName = @"long"; + testStruct.stationLocation = someLocation; + testStruct.stationMessage = @"message"; + + + expect(testStruct.stationShortName).to(equal(@"short")); + expect(testStruct.stationIDNumber).to(equal(someID)); + expect(testStruct.stationLongName).to(equal(@"long")); + expect(testStruct.stationLocation).to(equal(someLocation)); + expect(testStruct.stationMessage).to(equal(@"message")); + + }); + + it(@"Should set and get correctly", ^ { + SDLSISData* testStruct = [[SDLSISData alloc] initWithStationShortName:@"short" stationIDNumber:someID stationLongName:@"long" stationLocation:someLocation stationMessage:@"message"]; + + expect(testStruct.stationShortName).to(equal(@"short")); + expect(testStruct.stationIDNumber).to(equal(someID)); + expect(testStruct.stationLongName).to(equal(@"long")); + expect(testStruct.stationLocation).to(equal(someLocation)); + expect(testStruct.stationMessage).to(equal(@"message")); + }); + + it(@"Should get correctly when initialized", ^ { + NSMutableDictionary* dict = [@{SDLNameStationShortName:@"short", + SDLNameStationLongName:@"long", + SDLNameStationLocation:someLocation, + SDLNameStationIDNumber:someID, + SDLNameStationMessage:@"message" + } mutableCopy]; + + SDLSISData* testStruct = [[SDLSISData alloc] initWithDictionary:dict]; + + expect(testStruct.stationShortName).to(equal(@"short")); + expect(testStruct.stationIDNumber).to(equal(someID)); + expect(testStruct.stationLongName).to(equal(@"long")); + expect(testStruct.stationLocation).to(equal(someLocation)); + expect(testStruct.stationMessage).to(equal(@"message")); + }); + + it(@"Should return nil if not set", ^ { + SDLSISData* testStruct = [[SDLSISData alloc] init]; + + expect(testStruct.stationShortName).to(beNil()); + expect(testStruct.stationIDNumber).to(beNil()); + expect(testStruct.stationLongName).to(beNil()); + expect(testStruct.stationLocation).to(beNil()); + expect(testStruct.stationMessage).to(beNil()); + + + }); +}); + +QuickSpecEnd diff --git a/SmartDeviceLinkTests/RPCSpecs/StructSpecs/SDLSeatControlCapabilitiesSpec.m b/SmartDeviceLinkTests/RPCSpecs/StructSpecs/SDLSeatControlCapabilitiesSpec.m new file mode 100644 index 000000000..07f6b8c4a --- /dev/null +++ b/SmartDeviceLinkTests/RPCSpecs/StructSpecs/SDLSeatControlCapabilitiesSpec.m @@ -0,0 +1,162 @@ +// +// SDLSeatControlCapabilitiesSpec.m +// SmartDeviceLinkTests +// +#import <Foundation/Foundation.h> + +#import <Foundation/Foundation.h> + +#import <Quick/Quick.h> +#import <Nimble/Nimble.h> + +#import "SDLNames.h" +#import "SDLSeatControlCapabilities.h" + + +QuickSpecBegin(SDLSeatControlCapabilitiesSpec) + +describe(@"Getter/Setter Tests", ^ { + it(@"Should set and get correctly", ^ { + SDLSeatControlCapabilities* testStruct = [[SDLSeatControlCapabilities alloc] init]; + + testStruct.moduleName = @"moduleName"; + testStruct.heatingEnabledAvailable = @YES; + testStruct.coolingEnabledAvailable = @NO; + testStruct.heatingLevelAvailable = @YES; + testStruct.coolingLevelAvailable = @NO; + testStruct.horizontalPositionAvailable = @NO; + testStruct.verticalPositionAvailable = @NO; + testStruct.frontVerticalPositionAvailable = @NO; + testStruct.backVerticalPositionAvailable = @NO; + testStruct.backTiltAngleAvailable = @YES; + testStruct.headSupportVerticalPositionAvailable = @NO; + testStruct.headSupportHorizontalPositionAvailable = @YES; + testStruct.massageEnabledAvailable = @NO; + testStruct.massageModeAvailable = @YES; + testStruct.massageCushionFirmnessAvailable = @NO; + testStruct.memoryAvailable = @NO; + + expect(testStruct.moduleName).to(equal(@"moduleName")); + expect(testStruct.heatingEnabledAvailable).to(equal(@YES)); + expect(testStruct.coolingEnabledAvailable).to(equal(@NO)); + expect(testStruct.heatingLevelAvailable).to(equal(@YES)); + expect(testStruct.coolingLevelAvailable).to(equal(@NO)); + expect(testStruct.horizontalPositionAvailable).to(equal(@NO)); + expect(testStruct.verticalPositionAvailable).to(equal(@NO)); + expect(testStruct.frontVerticalPositionAvailable).to(equal(@NO)); + expect(testStruct.backVerticalPositionAvailable).to(equal(@NO)); + expect(testStruct.backTiltAngleAvailable).to(equal(@YES)); + expect(testStruct.headSupportVerticalPositionAvailable).to(equal(@NO)); + expect(testStruct.headSupportHorizontalPositionAvailable).to(equal(@YES)); + expect(testStruct.massageEnabledAvailable).to(equal(@NO)); + expect(testStruct.massageModeAvailable).to(equal(@YES)); + expect(testStruct.massageCushionFirmnessAvailable).to(equal(@NO)); + expect(testStruct.memoryAvailable).to(equal(@NO)); + + }); + + it(@"Should set and get correctly", ^ { + SDLSeatControlCapabilities* testStruct = [[SDLSeatControlCapabilities alloc] initWithName:@"moduleName" heatingEnabledAvailable:YES coolingEnabledAvailable:NO heatingLevelAvailable:YES coolingLevelAvailable:NO horizontalPositionAvailable:NO verticalPositionAvailable:NO frontVerticalPositionAvailable:NO backVerticalPositionAvailable:NO backTiltAngleAvailable:YES headSupportHorizontalPositionAvailable:NO headSupportVerticalPositionAvailable:YES massageEnabledAvailable:NO massageModeAvailable:YES massageCushionFirmnessAvailable:NO memoryAvailable:YES]; + + expect(testStruct.moduleName).to(equal(@"moduleName")); + expect(testStruct.heatingEnabledAvailable).to(equal(@YES)); + expect(testStruct.coolingEnabledAvailable).to(equal(@NO)); + expect(testStruct.heatingLevelAvailable).to(equal(@YES)); + expect(testStruct.coolingLevelAvailable).to(equal(@NO)); + expect(testStruct.horizontalPositionAvailable).to(equal(@NO)); + expect(testStruct.verticalPositionAvailable).to(equal(@NO)); + expect(testStruct.frontVerticalPositionAvailable).to(equal(@NO)); + expect(testStruct.backVerticalPositionAvailable).to(equal(@NO)); + expect(testStruct.backTiltAngleAvailable).to(equal(@YES)); + expect(testStruct.headSupportHorizontalPositionAvailable).to(equal(@NO)); + expect(testStruct.headSupportVerticalPositionAvailable).to(equal(@YES)); + expect(testStruct.massageEnabledAvailable).to(equal(@NO)); + expect(testStruct.massageModeAvailable).to(equal(@YES)); + expect(testStruct.massageCushionFirmnessAvailable).to(equal(@NO)); + expect(testStruct.memoryAvailable).to(equal(@YES)); + + }); + + it(@"Should set and get correctly", ^ { + SDLSeatControlCapabilities* testStruct = [[SDLSeatControlCapabilities alloc] initWithName:@"moduleName"]; + + expect(testStruct.moduleName).to(equal(@"moduleName")); + expect(testStruct.heatingEnabledAvailable).to(beNil()); + expect(testStruct.heatingEnabledAvailable).to(beNil()); + expect(testStruct.heatingLevelAvailable).to(beNil()); + expect(testStruct.coolingLevelAvailable).to(beNil()); + expect(testStruct.horizontalPositionAvailable).to(beNil()); + expect(testStruct.verticalPositionAvailable).to(beNil()); + expect(testStruct.frontVerticalPositionAvailable).to(beNil()); + expect(testStruct.backVerticalPositionAvailable).to(beNil()); + expect(testStruct.backTiltAngleAvailable).to(beNil()); + expect(testStruct.headSupportHorizontalPositionAvailable).to(beNil()); + expect(testStruct.headSupportVerticalPositionAvailable).to(beNil()); + expect(testStruct.massageEnabledAvailable).to(beNil()); + expect(testStruct.massageModeAvailable).to(beNil()); + expect(testStruct.massageCushionFirmnessAvailable).to(beNil()); + expect(testStruct.memoryAvailable).to(beNil()); + + }); + + it(@"Should get correctly when initialized", ^ { + NSMutableDictionary* dict = [@{SDLNameModuleName:@"moduleName", + SDLNameHeatingEnabledAvailable:(@YES), + SDLNameCoolingEnabledAvailable:@YES, + SDLNameHeatingLevelAvailable:@YES, + SDLNameCoolingLevelAvailable:@NO, + SDLNameHorizontalPositionAvailable:@NO, + SDLNameVerticalPositionAvailable:@NO, + SDLNameFrontVerticalPositionAvailable:@NO, + SDLNameBackVerticalPositionAvailable:@NO, + SDLNameBackTiltAngleAvailable:@YES, + SDLNameHeadSupportHorizontalPositionAvailable:@NO, + SDLNameHeadSupportVerticalPositionAvailable:@YES, + SDLNameMassageEnabledAvailable:@NO, + SDLNameMassageModeAvailable:@YES, + SDLNameMassageCushionFirmnessAvailable:@NO, + SDLNameMemoryAvailable:@NO + } mutableCopy]; + SDLSeatControlCapabilities *testStruct = [[SDLSeatControlCapabilities alloc] initWithDictionary:dict]; + + expect(testStruct.moduleName).to(equal(@"moduleName")); + expect(testStruct.heatingEnabledAvailable).to(equal(@YES)); + expect(testStruct.coolingEnabledAvailable).to(equal(@YES)); + expect(testStruct.heatingLevelAvailable).to(equal(@YES)); + expect(testStruct.coolingLevelAvailable).to(equal(@NO)); + expect(testStruct.horizontalPositionAvailable).to(equal(@NO)); + expect(testStruct.verticalPositionAvailable).to(equal(@NO)); + expect(testStruct.frontVerticalPositionAvailable).to(equal(@NO)); + expect(testStruct.backVerticalPositionAvailable).to(equal(@NO)); + expect(testStruct.backTiltAngleAvailable).to(equal(@YES)); + expect(testStruct.headSupportHorizontalPositionAvailable).to(equal(@NO)); + expect(testStruct.headSupportVerticalPositionAvailable).to(equal(@YES)); + expect(testStruct.massageEnabledAvailable).to(equal(@NO)); + expect(testStruct.massageModeAvailable).to(equal(@YES)); + expect(testStruct.massageCushionFirmnessAvailable).to(equal(@NO)); + expect(testStruct.memoryAvailable).to(equal(@NO)); + }); + + it(@"Should return nil if not set", ^ { + SDLSeatControlCapabilities* testStruct = [[SDLSeatControlCapabilities alloc] init]; + + expect(testStruct.moduleName).to(beNil()); + expect(testStruct.heatingEnabledAvailable).to(beNil()); + expect(testStruct.heatingEnabledAvailable).to(beNil()); + expect(testStruct.heatingLevelAvailable).to(beNil()); + expect(testStruct.coolingLevelAvailable).to(beNil()); + expect(testStruct.horizontalPositionAvailable).to(beNil()); + expect(testStruct.verticalPositionAvailable).to(beNil()); + expect(testStruct.frontVerticalPositionAvailable).to(beNil()); + expect(testStruct.backVerticalPositionAvailable).to(beNil()); + expect(testStruct.backTiltAngleAvailable).to(beNil()); + expect(testStruct.headSupportHorizontalPositionAvailable).to(beNil()); + expect(testStruct.headSupportVerticalPositionAvailable).to(beNil()); + expect(testStruct.massageEnabledAvailable).to(beNil()); + expect(testStruct.massageModeAvailable).to(beNil()); + expect(testStruct.massageCushionFirmnessAvailable).to(beNil()); + expect(testStruct.memoryAvailable).to(beNil()); + }); +}); + +QuickSpecEnd diff --git a/SmartDeviceLinkTests/RPCSpecs/StructSpecs/SDLSeatControlDataSpec.m b/SmartDeviceLinkTests/RPCSpecs/StructSpecs/SDLSeatControlDataSpec.m new file mode 100644 index 000000000..02dc0500f --- /dev/null +++ b/SmartDeviceLinkTests/RPCSpecs/StructSpecs/SDLSeatControlDataSpec.m @@ -0,0 +1,171 @@ +// +// SDLSeatControlDataSpec.m +// SmartDeviceLinkTests +// + +#import <Foundation/Foundation.h> + +#import <Quick/Quick.h> +#import <Nimble/Nimble.h> + +#import "SDLNames.h" +#import "SDLSeatControlData.h" +#import "SDLMassageModeData.h" +#import "SDLMassageCushionFirmness.h" +#import "SDLSeatMemoryAction.h" + + +QuickSpecBegin(SDLSeatControlDataSpec) + +SDLMassageCushionFirmness* massageCushionFirmness = [[SDLMassageCushionFirmness alloc] init]; +SDLMassageModeData *massageModeData = [[SDLMassageModeData alloc] init]; +SDLSeatMemoryAction *seatMemoryAction = [[SDLSeatMemoryAction alloc] init]; + +describe(@"Getter/Setter Tests", ^ { + it(@"Should set and get correctly", ^ { + SDLSeatControlData* testStruct = [[SDLSeatControlData alloc] init]; + + testStruct.id = SDLSupportedSeatDriver; + testStruct.heatingEnabled = @NO; + testStruct.coolingEnabled = @YES; + testStruct.heatingLevel = @25; + testStruct.coolingLevel = @10; + + testStruct.horizontalPosition = @23; + testStruct.verticalPosition = @25; + testStruct.frontVerticalPosition = @12; + testStruct.backVerticalPosition = @34; + testStruct.backTiltAngle = @12; + + testStruct.headSupportHorizontalPosition = @3; + testStruct.headSupportVerticalPosition = @43; + + testStruct.massageEnabled = @YES; + testStruct.massageMode = [@[massageModeData] copy]; + testStruct.massageCushionFirmness = [@[massageCushionFirmness] copy]; + testStruct.memory = seatMemoryAction; + + expect(testStruct.id).to(equal(SDLSupportedSeatDriver)); + expect(testStruct.heatingEnabled).to(equal(@NO)); + expect(testStruct.coolingEnabled).to(equal(@YES)); + expect(testStruct.heatingLevel).to(equal(@25)); + expect(testStruct.coolingLevel).to(equal(@10)); + expect(testStruct.horizontalPosition).to(equal(@23)); + expect(testStruct.verticalPosition).to(equal(@25)); + expect(testStruct.frontVerticalPosition).to(equal(@12)); + expect(testStruct.backVerticalPosition).to(equal(@34)); + expect(testStruct.backTiltAngle).to(equal(@12)); + expect(testStruct.headSupportHorizontalPosition).to(equal(@3)); + expect(testStruct.headSupportVerticalPosition).to(equal(@43)); + expect(testStruct.massageEnabled).to(equal(@YES)); + expect(testStruct.massageMode).to(equal([@[massageModeData] copy])); + expect(testStruct.massageCushionFirmness).to(equal([@[massageCushionFirmness] copy])); + expect(testStruct.memory).to(equal(seatMemoryAction)); + + }); + + it(@"Should set and get correctly", ^ { + SDLSeatControlData* testStruct = [[SDLSeatControlData alloc] initWithId:SDLSupportedSeatDriver heatingEnabled:NO coolingEnable:YES heatingLevel:25 coolingLevel:10 horizontalPostion:23 verticalPostion:25 frontVerticalPostion:12 backVerticalPostion:25 backTiltAngle:2 headSupportedHorizontalPostion:3 headSupportedVerticalPostion:43 massageEnabled:YES massageMode:[@[massageModeData] copy] massageCussionFirmness:[@[massageCushionFirmness] copy] memory:seatMemoryAction]; + + expect(testStruct.id).to(equal(SDLSupportedSeatDriver)); + expect(testStruct.heatingEnabled).to(equal(@NO)); + expect(testStruct.coolingEnabled).to(equal(@YES)); + expect(testStruct.heatingLevel).to(equal(@25)); + expect(testStruct.coolingLevel).to(equal(@10)); + expect(testStruct.horizontalPosition).to(equal(@23)); + expect(testStruct.verticalPosition).to(equal(@25)); + expect(testStruct.frontVerticalPosition).to(equal(@12)); + expect(testStruct.backVerticalPosition).to(equal(@25)); + expect(testStruct.backTiltAngle).to(equal(@2)); + expect(testStruct.headSupportHorizontalPosition).to(equal(@3)); + expect(testStruct.headSupportVerticalPosition).to(equal(@43)); + expect(testStruct.massageEnabled).to(equal(@YES)); + expect(testStruct.massageMode).to(equal([@[massageModeData] copy])); + expect(testStruct.massageCushionFirmness).to(equal([@[massageCushionFirmness] copy])); + expect(testStruct.memory).to(equal(seatMemoryAction)); + + }); + + it(@"Should set and get correctly", ^ { + SDLSeatControlData* testStruct = [[SDLSeatControlData alloc] initWithId:SDLSupportedSeatDriver]; + + expect(testStruct.id).to(equal(SDLSupportedSeatDriver)); + expect(testStruct.heatingEnabled).to(beNil()); + expect(testStruct.coolingEnabled).to(beNil()); + expect(testStruct.heatingLevel).to(beNil()); + expect(testStruct.coolingLevel).to(beNil()); + expect(testStruct.horizontalPosition).to(beNil()); + expect(testStruct.verticalPosition).to(beNil()); + expect(testStruct.frontVerticalPosition).to(beNil()); + expect(testStruct.backVerticalPosition).to(beNil()); + expect(testStruct.backTiltAngle).to(beNil()); + expect(testStruct.headSupportHorizontalPosition).to(beNil()); + expect(testStruct.headSupportVerticalPosition).to(beNil()); + expect(testStruct.massageEnabled).to(beNil()); + expect(testStruct.massageMode).to(beNil()); + expect(testStruct.massageCushionFirmness).to(beNil()); + expect(testStruct.memory).to(beNil()); + + }); + + it(@"Should get correctly when initialized", ^ { + NSMutableDictionary* dict = [@{SDLNameId:SDLSupportedSeatDriver, + SDLNameHeatingEnabled:@NO, + SDLNameCoolingEnabled:@YES, + SDLNameHeatingLevel:@25, + SDLNameCoolingLevel:@10, + SDLNameHorizontalPosition:@23, + SDLNameVerticalPosition:@25, + SDLNameFrontVerticalPosition:@12, + SDLNameBackVerticalPosition:@34, + SDLNameBackTiltAngle:@2, + SDLNameHeadSupportHorizontalPosition:@3, + SDLNameHeadSupportVerticalPosition:@43, + SDLNameMassageEnabled:@YES, + SDLNameMassageMode:[@[massageModeData] mutableCopy], + SDLNameMassageCushionFirmness:[@[massageCushionFirmness] mutableCopy], + SDLNameMemory:seatMemoryAction + } mutableCopy]; + SDLSeatControlData *testStruct = [[SDLSeatControlData alloc] initWithDictionary:dict]; + + expect(testStruct.id).to(equal(SDLSupportedSeatDriver)); + expect(testStruct.heatingEnabled).to(equal(@NO)); + expect(testStruct.coolingEnabled).to(equal(@YES)); + expect(testStruct.heatingLevel).to(equal(@25)); + expect(testStruct.coolingLevel).to(equal(@10)); + expect(testStruct.horizontalPosition).to(equal(@23)); + expect(testStruct.verticalPosition).to(equal(@25)); + expect(testStruct.frontVerticalPosition).to(equal(@12)); + expect(testStruct.backVerticalPosition).to(equal(@34)); + expect(testStruct.backTiltAngle).to(equal(@2)); + expect(testStruct.headSupportHorizontalPosition).to(equal(@3)); + expect(testStruct.headSupportVerticalPosition).to(equal(@43)); + expect(testStruct.massageEnabled).to(equal(@YES)); + expect(testStruct.massageMode).to(equal([@[massageModeData] mutableCopy])); + expect(testStruct.massageCushionFirmness).to(equal([@[massageCushionFirmness] mutableCopy])); + expect(testStruct.memory).to(equal(seatMemoryAction)); + }); + + it(@"Should return nil if not set", ^ { + SDLSeatControlData* testStruct = [[SDLSeatControlData alloc] init]; + + expect(testStruct.id).to(beNil()); + expect(testStruct.heatingEnabled).to(beNil()); + expect(testStruct.coolingEnabled).to(beNil()); + expect(testStruct.heatingLevel).to(beNil()); + expect(testStruct.coolingLevel).to(beNil()); + expect(testStruct.horizontalPosition).to(beNil()); + expect(testStruct.verticalPosition).to(beNil()); + expect(testStruct.frontVerticalPosition).to(beNil()); + expect(testStruct.backVerticalPosition).to(beNil()); + expect(testStruct.backTiltAngle).to(beNil()); + expect(testStruct.headSupportHorizontalPosition).to(beNil()); + expect(testStruct.headSupportVerticalPosition).to(beNil()); + expect(testStruct.massageEnabled).to(beNil()); + expect(testStruct.massageMode).to(beNil()); + expect(testStruct.massageCushionFirmness).to(beNil()); + expect(testStruct.memory).to(beNil()); + }); +}); + +QuickSpecEnd diff --git a/SmartDeviceLinkTests/RPCSpecs/StructSpecs/SDLSeatMemoryActionSpec.m b/SmartDeviceLinkTests/RPCSpecs/StructSpecs/SDLSeatMemoryActionSpec.m new file mode 100644 index 000000000..a256e50a8 --- /dev/null +++ b/SmartDeviceLinkTests/RPCSpecs/StructSpecs/SDLSeatMemoryActionSpec.m @@ -0,0 +1,60 @@ +// +// SDLSeatMemoryActionSpec.m +// SmartDeviceLinkTests +// + +#import <Foundation/Foundation.h> + +#import <Quick/Quick.h> +#import <Nimble/Nimble.h> + +#import "SDLNames.h" +#import "SDLSeatMemoryAction.h" + +QuickSpecBegin(SDLSeatMemoryActionSpec) + +describe(@"Getter/Setter Tests", ^ { + it(@"Should set and get correctly", ^ { + SDLSeatMemoryAction* testStruct = [[SDLSeatMemoryAction alloc] init]; + + testStruct.id = @12; + testStruct.action = SDLSeatMemoryActionTypeSave; + testStruct.label = @"Save"; + + expect(testStruct.id).to(equal(@12)); + expect(testStruct.action).to(equal(SDLSeatMemoryActionTypeSave)); + expect(testStruct.label).to(equal(@"Save")); + + }); + + it(@"Should set and get correctly", ^ { + SDLSeatMemoryAction* testStruct = [[SDLSeatMemoryAction alloc] initWithId:23 label:@"restore" action:SDLSeatMemoryActionTypeRestore]; + + expect(testStruct.id).to(equal(@23)); + expect(testStruct.action).to(equal(SDLSeatMemoryActionTypeRestore)); + expect(testStruct.label).to(equal(@"restore")); + + }); + + it(@"Should get correctly when initialized", ^ { + NSMutableDictionary* dict = [@{SDLNameId:@54, + SDLNameLabel:@"none", + SDLNameAction: SDLSeatMemoryActionTypeNone + } mutableCopy]; + SDLSeatMemoryAction *testStruct = [[SDLSeatMemoryAction alloc] initWithDictionary:dict]; + + expect(testStruct.id).to(equal(@54)); + expect(testStruct.action).to(equal(SDLSeatMemoryActionTypeNone)); + expect(testStruct.label).to(equal(@"none")); + }); + + it(@"Should return nil if not set", ^ { + SDLSeatMemoryAction* testStruct = [[SDLSeatMemoryAction alloc] init]; + + expect(testStruct.id).to(beNil()); + expect(testStruct.action).to(beNil()); + expect(testStruct.label).to(beNil()); + }); +}); + +QuickSpecEnd diff --git a/SmartDeviceLinkTests/RPCSpecs/StructSpecs/SDLSingleTireStatusSpec.m b/SmartDeviceLinkTests/RPCSpecs/StructSpecs/SDLSingleTireStatusSpec.m index 69c0d347d..1fc06535e 100644 --- a/SmartDeviceLinkTests/RPCSpecs/StructSpecs/SDLSingleTireStatusSpec.m +++ b/SmartDeviceLinkTests/RPCSpecs/StructSpecs/SDLSingleTireStatusSpec.m @@ -19,21 +19,33 @@ describe(@"Getter/Setter Tests", ^ { SDLSingleTireStatus* testStruct = [[SDLSingleTireStatus alloc] init]; testStruct.status = SDLComponentVolumeStatusNormal; + testStruct.monitoringSystemStatus = SDLTPMSLow; + testStruct.pressure = @67.78; expect(testStruct.status).to(equal(SDLComponentVolumeStatusNormal)); + expect(testStruct.monitoringSystemStatus).to(equal(SDLTPMSLow)); + expect(testStruct.pressure).to(equal(@67.78)); }); it(@"Should get correctly when initialized", ^ { - NSMutableDictionary* dict = [@{SDLNameStatus:SDLComponentVolumeStatusLow} mutableCopy]; + NSDictionary* dict = @{ + SDLNameStatus: SDLComponentVolumeStatusLow, + SDLNameTPMS: SDLTPMSLow, + SDLNamePressure: @67.78 + }; SDLSingleTireStatus* testStruct = [[SDLSingleTireStatus alloc] initWithDictionary:dict]; expect(testStruct.status).to(equal(SDLComponentVolumeStatusLow)); + expect(testStruct.monitoringSystemStatus).to(equal(SDLTPMSLow)); + expect(testStruct.pressure).to(equal(@67.78)); }); it(@"Should return nil if not set", ^ { SDLSingleTireStatus* testStruct = [[SDLSingleTireStatus alloc] init]; expect(testStruct.status).to(beNil()); + expect(testStruct.monitoringSystemStatus).to(beNil()); + expect(testStruct.pressure).to(beNil()); }); }); diff --git a/SmartDeviceLinkTests/RPCSpecs/StructSpecs/SDLStationIDNumberSpec.m b/SmartDeviceLinkTests/RPCSpecs/StructSpecs/SDLStationIDNumberSpec.m new file mode 100644 index 000000000..3cd543f80 --- /dev/null +++ b/SmartDeviceLinkTests/RPCSpecs/StructSpecs/SDLStationIDNumberSpec.m @@ -0,0 +1,54 @@ +// +// SDLStationIDNumberSpec.m +// SmartDeviceLinkTests= +// + +#import <Foundation/Foundation.h> + +#import <Quick/Quick.h> +#import <Nimble/Nimble.h> + +#import "SDLNames.h" +#import "SDLStationIDNumber.h" + +QuickSpecBegin(SDLStationIDNumberSpec) + +describe(@"Getter/Setter Tests", ^ { + it(@"Should set and get correctly", ^ { + SDLStationIDNumber* testStruct = [[SDLStationIDNumber alloc] init]; + + testStruct.countryCode = @91; + testStruct.fccFacilityId = @23; + + expect(testStruct.countryCode).to(equal(@91)); + expect(testStruct.fccFacilityId).to(equal(@23));; + + }); + + it(@"Should set and get correctly", ^ { + SDLStationIDNumber* testStruct = [[SDLStationIDNumber alloc] initWithCountryCode:@91 fccFacilityId:@23]; + + expect(testStruct.countryCode).to(equal(@91)); + expect(testStruct.fccFacilityId).to(equal(@23)); + }); + + it(@"Should get correctly when initialized", ^ { + NSMutableDictionary* dict = [@{SDLNameCountryCode:@91, + SDLNameFCCFacilityId:@23 + } mutableCopy]; + + SDLStationIDNumber* testStruct = [[SDLStationIDNumber alloc] initWithDictionary:dict]; + + expect(testStruct.countryCode).to(equal(@91)); + expect(testStruct.fccFacilityId).to(equal(@23)); + }); + + it(@"Should return nil if not set", ^ { + SDLStationIDNumber* testStruct = [[SDLStationIDNumber alloc] init]; + + expect(testStruct.countryCode).to(beNil()); + expect(testStruct.fccFacilityId).to(beNil()); + }); +}); + +QuickSpecEnd diff --git a/SmartDeviceLinkTests/RPCSpecs/StructSpecs/SDLTTSChunkSpec.m b/SmartDeviceLinkTests/RPCSpecs/StructSpecs/SDLTTSChunkSpec.m index 52fef2d53..ef4d741ec 100644 --- a/SmartDeviceLinkTests/RPCSpecs/StructSpecs/SDLTTSChunkSpec.m +++ b/SmartDeviceLinkTests/RPCSpecs/StructSpecs/SDLTTSChunkSpec.m @@ -15,32 +15,98 @@ QuickSpecBegin(SDLTTSChunkSpec) -describe(@"Getter/Setter Tests", ^ { - it(@"Should set and get correctly", ^ { - SDLTTSChunk* testStruct = [[SDLTTSChunk alloc] init]; - - testStruct.text = @"TEXT"; - testStruct.type = SDLSpeechCapabilitiesPrerecorded; - - expect(testStruct.text).to(equal(@"TEXT")); - expect(testStruct.type).to(equal(SDLSpeechCapabilitiesPrerecorded)); - }); - - it(@"Should get correctly when initialized", ^ { - NSMutableDictionary* dict = [@{SDLNameText:@"TEXT", - SDLNameType:SDLSpeechCapabilitiesPrerecorded} mutableCopy]; - SDLTTSChunk* testStruct = [[SDLTTSChunk alloc] initWithDictionary:dict]; - - expect(testStruct.text).to(equal(@"TEXT")); - expect(testStruct.type).to(equal(SDLSpeechCapabilitiesPrerecorded)); +describe(@"TTS Chunk Tests", ^{ + __block SDLTTSChunk *testStruct = nil; + __block NSArray<SDLTTSChunk *> *testChunks = nil; + __block NSString *testText = @"Text"; + __block SDLSpeechCapabilities testCapabilities = SDLSpeechCapabilitiesFile; + + describe(@"initializers", ^{ + it(@"should correctly initialize with init", ^{ + testStruct = [[SDLTTSChunk alloc] init]; + + expect(testStruct.text).to(beNil()); + expect(testStruct.type).to(beNil()); + }); + + it(@"should correctly initialize with initWithDictionary", ^{ + NSDictionary* dict = @{SDLNameText: testText, + SDLNameType: testCapabilities}; + testStruct = [[SDLTTSChunk alloc] initWithDictionary:dict]; + + expect(testStruct.text).to(equal(testText)); + expect(testStruct.type).to(equal(testCapabilities)); + }); + + it(@"should correctly initialize with initWithText:type:", ^{ + testStruct = [[SDLTTSChunk alloc] initWithText:testText type:testCapabilities]; + + expect(testStruct.text).to(equal(testText)); + expect(testStruct.type).to(equal(testCapabilities)); + }); + + it(@"should correctly initialize with textChunksFromString:", ^{ + testChunks = [SDLTTSChunk textChunksFromString:testText]; + + expect(testChunks).to(haveCount(1)); + expect(testChunks[0].text).to(equal(testText)); + expect(testChunks[0].type).to(equal(SDLSpeechCapabilitiesText)); + }); + + it(@"should correctly initialize with sapiChunksFromString:", ^{ + testChunks = [SDLTTSChunk sapiChunksFromString:testText]; + + expect(testChunks).to(haveCount(1)); + expect(testChunks[0].text).to(equal(testText)); + expect(testChunks[0].type).to(equal(SDLSpeechCapabilitiesSAPIPhonemes)); + }); + + it(@"should correctly initialize with lhPlusChunksFromString:", ^{ + testChunks = [SDLTTSChunk lhPlusChunksFromString:testText]; + + expect(testChunks).to(haveCount(1)); + expect(testChunks[0].text).to(equal(testText)); + expect(testChunks[0].type).to(equal(SDLSpeechCapabilitiesLHPlusPhonemes)); + }); + + it(@"should correctly initialize with prerecordedChunksFromString:", ^{ + testChunks = [SDLTTSChunk prerecordedChunksFromString:testText]; + + expect(testChunks).to(haveCount(1)); + expect(testChunks[0].text).to(equal(testText)); + expect(testChunks[0].type).to(equal(SDLSpeechCapabilitiesPrerecorded)); + }); + + it(@"should correctly initialize with silenceChunksFromString:", ^{ + testChunks = [SDLTTSChunk silenceChunks]; + + expect(testChunks).to(haveCount(1)); + expect(testChunks[0].text).to(beEmpty()); + expect(testChunks[0].type).to(equal(SDLSpeechCapabilitiesSilence)); + }); + + it(@"should correctly initialize with fileChunksWithName:", ^{ + testChunks = [SDLTTSChunk fileChunksWithName:testText]; + + expect(testChunks).to(haveCount(1)); + expect(testChunks[0].text).to(equal(testText)); + expect(testChunks[0].type).to(equal(SDLSpeechCapabilitiesFile)); + }); }); - - it(@"Should return nil if not set", ^ { - SDLTTSChunk* testStruct = [[SDLTTSChunk alloc] init]; - - expect(testStruct.text).to(beNil()); - expect(testStruct.type).to(beNil()); + + describe(@"Getter/Setter Tests", ^ { + it(@"Should set and get correctly", ^ { + SDLTTSChunk* testStruct = [[SDLTTSChunk alloc] init]; + + testStruct.text = testText; + testStruct.type = testCapabilities; + + expect(testStruct.text).to(equal(testText)); + expect(testStruct.type).to(equal(testCapabilities)); + }); }); }); + + QuickSpecEnd |