summaryrefslogtreecommitdiff
path: root/SmartDeviceLinkTests/DevAPISpecs
diff options
context:
space:
mode:
authorMuller, Alexander (A.) <amulle19@ford.com>2017-03-13 17:45:40 -0700
committerMuller, Alexander (A.) <amulle19@ford.com>2017-03-13 17:45:40 -0700
commit36139eb71ca33a75f96e2ad116ce95ba020fdac8 (patch)
treee6259e9d072807370b7a1f783cebcd9a923dda67 /SmartDeviceLinkTests/DevAPISpecs
parent707489a9f0c5a9947f867955e828bce8df1469f4 (diff)
parent14adcab8724b7b62908b13c90da35394bb44cf35 (diff)
downloadsdl_ios-36139eb71ca33a75f96e2ad116ce95ba020fdac8.tar.gz
Merge remote-tracking branch 'origin/develop' into feature/streaming_media_manager
* origin/develop: Changed NSString category name from Enum to SDLEnum. Added convenience isEqualToEnum function. Update README.md Removed unnecessary comments. Update naming of notification constants Added delegate callbacks for audio streaming state and system context changes. Fix handler updates in example app and unit tests Implement SDL 0027 # Conflicts: # SmartDeviceLink-iOS.xcodeproj/project.pbxproj # SmartDeviceLink/SDLTouchManager.m
Diffstat (limited to 'SmartDeviceLinkTests/DevAPISpecs')
-rw-r--r--SmartDeviceLinkTests/DevAPISpecs/SDLLifecycleConfigurationSpec.m20
-rw-r--r--SmartDeviceLinkTests/DevAPISpecs/SDLLifecycleManagerSpec.m58
-rw-r--r--SmartDeviceLinkTests/DevAPISpecs/SDLResponseDispatcherSpec.m14
3 files changed, 74 insertions, 18 deletions
diff --git a/SmartDeviceLinkTests/DevAPISpecs/SDLLifecycleConfigurationSpec.m b/SmartDeviceLinkTests/DevAPISpecs/SDLLifecycleConfigurationSpec.m
index 70d65cce9..7d02980a0 100644
--- a/SmartDeviceLinkTests/DevAPISpecs/SDLLifecycleConfigurationSpec.m
+++ b/SmartDeviceLinkTests/DevAPISpecs/SDLLifecycleConfigurationSpec.m
@@ -29,10 +29,10 @@ describe(@"a lifecycle configuration", ^{
expect(@(testConfig.tcpDebugMode)).to(beFalsy());
expect(testConfig.tcpDebugIPAddress).to(match(@"192.168.0.1"));
expect(@(testConfig.tcpDebugPort)).to(equal(@12345));
- expect(@([testConfig.appType isEqualToString:SDLAppHMITypeDefault])).to(equal(@YES));
+ expect(@([testConfig.appType isEqualToEnum:SDLAppHMITypeDefault])).to(equal(@YES));
expect(@(testConfig.isMedia)).to(beFalsy());
- expect(@([testConfig.language isEqualToString:SDLLanguageEnUs])).to(equal(@YES));
- expect(@([[testConfig.languagesSupported firstObject] isEqualToString:SDLLanguageEnUs])).to(equal(@YES));
+ expect(@([testConfig.language isEqualToEnum:SDLLanguageEnUs])).to(equal(@YES));
+ expect(@([[testConfig.languagesSupported firstObject] isEqualToEnum:SDLLanguageEnUs])).to(equal(@YES));
expect(testConfig.shortAppName).to(beNil());
expect(testConfig.ttsName).to(beNil());
expect(testConfig.voiceRecognitionCommandNames).to(beNil());
@@ -82,9 +82,9 @@ describe(@"a lifecycle configuration", ^{
expect(@(testConfig.tcpDebugMode)).to(beFalsy());
expect(testConfig.tcpDebugIPAddress).to(match(@"192.168.0.1"));
expect(@(testConfig.tcpDebugPort)).to(equal(@12345));
- expect(@([testConfig.appType isEqualToString:SDLAppHMITypeMedia])).to(equal(@YES));
+ expect(@([testConfig.appType isEqualToEnum:SDLAppHMITypeMedia])).to(equal(@YES));
expect(@(testConfig.isMedia)).to(beTruthy());
- expect(@([testConfig.language isEqualToString:SDLLanguageArSa])).to(equal(@YES));
+ expect(@([testConfig.language isEqualToEnum:SDLLanguageArSa])).to(equal(@YES));
expect(testConfig.languagesSupported).to(haveCount(@3));
expect(testConfig.shortAppName).to(match(someShortAppName));
expect(testConfig.ttsName).to(contain(someTTSChunk));
@@ -119,9 +119,9 @@ describe(@"a lifecycle configuration", ^{
expect(@(testConfig.tcpDebugMode)).to(beTruthy());
expect(testConfig.tcpDebugIPAddress).to(match(someIPAddress));
expect(@(testConfig.tcpDebugPort)).to(equal(@(somePort)));
- expect(@([testConfig.appType isEqualToString:SDLAppHMITypeDefault])).to(equal(@YES));
- expect(@([testConfig.language isEqualToString:SDLLanguageEnUs])).to(equal(@YES));
- expect(@([[testConfig.languagesSupported firstObject] isEqualToString:SDLLanguageEnUs])).to(equal(@YES));
+ expect(@([testConfig.appType isEqualToEnum:SDLAppHMITypeDefault])).to(equal(@YES));
+ expect(@([testConfig.language isEqualToEnum:SDLLanguageEnUs])).to(equal(@YES));
+ expect(@([[testConfig.languagesSupported firstObject] isEqualToEnum:SDLLanguageEnUs])).to(equal(@YES));
expect(testConfig.shortAppName).to(beNil());
expect(testConfig.ttsName).to(beNil());
expect(testConfig.voiceRecognitionCommandNames).to(beNil());
@@ -169,9 +169,9 @@ describe(@"a lifecycle configuration", ^{
expect(@(testConfig.tcpDebugMode)).to(beTruthy());
expect(testConfig.tcpDebugIPAddress).to(match(someIPAddress));
expect(@(testConfig.tcpDebugPort)).to(equal(@(somePort)));
- expect(@([testConfig.appType isEqualToString:SDLAppHMITypeMedia])).to(equal(@YES));
+ expect(@([testConfig.appType isEqualToEnum:SDLAppHMITypeMedia])).to(equal(@YES));
expect(@(testConfig.isMedia)).to(beTruthy());
- expect(@([testConfig.language isEqualToString:SDLLanguageArSa])).to(equal(@YES));
+ expect(@([testConfig.language isEqualToEnum:SDLLanguageArSa])).to(equal(@YES));
expect(testConfig.languagesSupported).to(haveCount(@3));
expect(testConfig.shortAppName).to(match(someShortAppName));
expect(testConfig.ttsName).to(contain(someTTSChunk));
diff --git a/SmartDeviceLinkTests/DevAPISpecs/SDLLifecycleManagerSpec.m b/SmartDeviceLinkTests/DevAPISpecs/SDLLifecycleManagerSpec.m
index eee8f74e6..d1863df19 100644
--- a/SmartDeviceLinkTests/DevAPISpecs/SDLLifecycleManagerSpec.m
+++ b/SmartDeviceLinkTests/DevAPISpecs/SDLLifecycleManagerSpec.m
@@ -377,7 +377,63 @@ describe(@"a lifecycle manager", ^{
});
});
});
- });
+
+ describe(@"receiving an audio state change", ^{
+ __block SDLOnHMIStatus *testHMIStatus = nil;
+ __block SDLAudioStreamingState testAudioStreamingState = nil;
+ __block SDLAudioStreamingState oldAudioStreamingState = nil;
+
+ beforeEach(^{
+ oldAudioStreamingState = testManager.audioStreamingState;
+ testHMIStatus = [[SDLOnHMIStatus alloc] init];
+ });
+
+ context(@"a not audible audio state", ^{
+ beforeEach(^{
+ testAudioStreamingState = SDLAudioStreamingStateNotAudible;
+ testHMIStatus.audioStreamingState = testAudioStreamingState;
+
+ [testManager.notificationDispatcher postRPCNotificationNotification:SDLDidChangeHMIStatusNotification notification:testHMIStatus];
+ });
+
+ it(@"should set the audio state", ^{
+ expect(testManager.audioStreamingState).toEventually(equal(testAudioStreamingState));
+ });
+
+ it(@"should call the delegate", ^{
+ OCMVerify([managerDelegateMock audioStreamingState:oldAudioStreamingState didChangeToState:testAudioStreamingState]);
+ });
+ });
+ });
+
+ describe(@"receiving a system context change", ^{
+ __block SDLOnHMIStatus *testHMIStatus = nil;
+ __block SDLSystemContext testSystemContext = nil;
+ __block SDLSystemContext oldSystemContext = nil;
+
+ beforeEach(^{
+ oldSystemContext = testManager.systemContext;
+ testHMIStatus = [[SDLOnHMIStatus alloc] init];
+ });
+
+ context(@"a alert system context state", ^{
+ beforeEach(^{
+ testSystemContext = SDLSystemContextAlert;
+ testHMIStatus.systemContext = testSystemContext;
+
+ [testManager.notificationDispatcher postRPCNotificationNotification:SDLDidChangeHMIStatusNotification notification:testHMIStatus];
+ });
+
+ it(@"should set the system context", ^{
+ expect(testManager.systemContext).toEventually(equal(testSystemContext));
+ });
+
+ it(@"should call the delegate", ^{
+ OCMVerify([managerDelegateMock systemContext:oldSystemContext didChangeToContext:testSystemContext]);
+ });
+ });
+ });
+ });
});
});
diff --git a/SmartDeviceLinkTests/DevAPISpecs/SDLResponseDispatcherSpec.m b/SmartDeviceLinkTests/DevAPISpecs/SDLResponseDispatcherSpec.m
index ceb27c7d7..bcbc95631 100644
--- a/SmartDeviceLinkTests/DevAPISpecs/SDLResponseDispatcherSpec.m
+++ b/SmartDeviceLinkTests/DevAPISpecs/SDLResponseDispatcherSpec.m
@@ -126,7 +126,7 @@ describe(@"a response dispatcher", ^{
beforeEach(^{
numTimesHandlerCalled = 0;
- testSoftButton1 = [[SDLSoftButton alloc] initWithType:SDLSoftButtonTypeText text:@"test" image:nil highlighted:NO buttonId:1 systemAction:SDLSystemActionDefaultAction handler:^(__kindof SDLRPCNotification * _Nonnull notification) {
+ testSoftButton1 = [[SDLSoftButton alloc] initWithType:SDLSoftButtonTypeText text:@"test" image:nil highlighted:NO buttonId:1 systemAction:SDLSystemActionDefaultAction handler:^(SDLOnButtonPress * _Nullable buttonPressNotification, SDLOnButtonEvent * _Nullable buttonEventNotification) {
numTimesHandlerCalled++;
}];
testShow.softButtons = [@[testSoftButton1] mutableCopy];
@@ -199,7 +199,7 @@ describe(@"a response dispatcher", ^{
context(@"with a malformed soft button", ^{
beforeEach(^{
- testSoftButton1 = [[SDLSoftButton alloc] initWithType:SDLSoftButtonTypeText text:@"test" image:nil highlighted:NO buttonId:1 systemAction:SDLSystemActionDefaultAction handler:^(__kindof SDLRPCNotification * _Nonnull notification) {}];
+ testSoftButton1 = [[SDLSoftButton alloc] initWithType:SDLSoftButtonTypeText text:@"test" image:nil highlighted:NO buttonId:1 systemAction:SDLSystemActionDefaultAction handler:nil];
});
it(@"should throw an exception if there's no button id", ^{
@@ -355,7 +355,7 @@ describe(@"a response dispatcher", ^{
testSubscribeCorrelationId = @42;
numTimesHandlerCalled = 0;
- testSubscribeButton = [[SDLSubscribeButton alloc] initWithButtonName:testButtonName handler:^(__kindof SDLRPCNotification * _Nonnull notification) {
+ testSubscribeButton = [[SDLSubscribeButton alloc] initWithButtonName:testButtonName handler:^(SDLOnButtonPress * _Nullable buttonPressNotification, SDLOnButtonEvent * _Nullable buttonEventNotification) {
numTimesHandlerCalled++;
}];
testSubscribeButton.correlationID = testSubscribeCorrelationId;
@@ -485,7 +485,7 @@ describe(@"a response dispatcher", ^{
beforeEach(^{
numTimesHandlerCalled = 0;
- testSoftButton1 = [[SDLSoftButton alloc] initWithType:SDLSoftButtonTypeText text:@"test" image:nil highlighted:NO buttonId:1 systemAction:SDLSystemActionDefaultAction handler:^(__kindof SDLRPCNotification * _Nonnull notification) {
+ testSoftButton1 = [[SDLSoftButton alloc] initWithType:SDLSoftButtonTypeText text:@"test" image:nil highlighted:NO buttonId:1 systemAction:SDLSystemActionDefaultAction handler:^(SDLOnButtonPress * _Nullable buttonPressNotification, SDLOnButtonEvent * _Nullable buttonEventNotification) {
numTimesHandlerCalled++;
}];
@@ -558,7 +558,7 @@ describe(@"a response dispatcher", ^{
context(@"with a malformed soft button", ^{
beforeEach(^{
- testSoftButton1 = [[SDLSoftButton alloc] initWithType:SDLSoftButtonTypeText text:@"test" image:nil highlighted:NO buttonId:1 systemAction:SDLSystemActionDefaultAction handler:^(__kindof SDLRPCNotification * _Nonnull notification) {}];
+ testSoftButton1 = [[SDLSoftButton alloc] initWithType:SDLSoftButtonTypeText text:@"test" image:nil highlighted:NO buttonId:1 systemAction:SDLSystemActionDefaultAction handler:nil];
});
it(@"should throw an exception if there's no button id", ^{
@@ -596,7 +596,7 @@ describe(@"a response dispatcher", ^{
beforeEach(^{
numTimesHandlerCalled = 0;
- testSoftButton1 = [[SDLSoftButton alloc] initWithType:SDLSoftButtonTypeText text:@"test" image:nil highlighted:NO buttonId:1 systemAction:SDLSystemActionDefaultAction handler:^(__kindof SDLRPCNotification * _Nonnull notification) {
+ testSoftButton1 = [[SDLSoftButton alloc] initWithType:SDLSoftButtonTypeText text:@"test" image:nil highlighted:NO buttonId:1 systemAction:SDLSystemActionDefaultAction handler:^(SDLOnButtonPress * _Nullable buttonPressNotification, SDLOnButtonEvent * _Nullable buttonEventNotification) {
numTimesHandlerCalled++;
}];
@@ -669,7 +669,7 @@ describe(@"a response dispatcher", ^{
context(@"with a malformed soft button", ^{
beforeEach(^{
- testSoftButton1 = [[SDLSoftButton alloc] initWithType:SDLSoftButtonTypeText text:@"test" image:nil highlighted:NO buttonId:1 systemAction:SDLSystemActionDefaultAction handler:^(__kindof SDLRPCNotification * _Nonnull notification) {}];
+ testSoftButton1 = [[SDLSoftButton alloc] initWithType:SDLSoftButtonTypeText text:@"test" image:nil highlighted:NO buttonId:1 systemAction:SDLSystemActionDefaultAction handler:nil];
});
it(@"should throw an exception if there's no button id", ^{