diff options
author | Joel Fischer <joeljfischer@gmail.com> | 2021-06-24 11:16:23 -0400 |
---|---|---|
committer | Joel Fischer <joeljfischer@gmail.com> | 2021-06-24 11:16:23 -0400 |
commit | c3af93dc6faaeff35a87534af2d499343ca874e0 (patch) | |
tree | b27bfc804e05514bc85829f0b14a20ab28f27da1 | |
parent | 4c27cf88becafbd73cab2a730a58cc8b792f4d96 (diff) | |
parent | 01e22c6b2ba7265058fb06fe9303bc4fab66bb5d (diff) | |
download | sdl_ios-c3af93dc6faaeff35a87534af2d499343ca874e0.tar.gz |
Merge branch 'develop' into bugfix/issue-2011-fix-sdlvideostreamingrange
-rw-r--r-- | SmartDeviceLink/private/CGPoint_Util.m | 2 | ||||
-rw-r--r-- | SmartDeviceLink/private/SDLStreamingVideoLifecycleManager.m | 21 | ||||
-rw-r--r-- | SmartDeviceLinkTests/DevAPISpecs/SDLVoiceCommandManagerSpec.m | 126 |
3 files changed, 70 insertions, 79 deletions
diff --git a/SmartDeviceLink/private/CGPoint_Util.m b/SmartDeviceLink/private/CGPoint_Util.m index 91c7ce26e..6e607d343 100644 --- a/SmartDeviceLink/private/CGPoint_Util.m +++ b/SmartDeviceLink/private/CGPoint_Util.m @@ -7,7 +7,7 @@ // #include "CGPoint_Util.h" -#include "math.h" +#include <math.h> CGPoint CGPointCenterOfPoints(CGPoint point1, CGPoint point2) { CGFloat xCenter = (point1.x + point2.x) / 2.0f; diff --git a/SmartDeviceLink/private/SDLStreamingVideoLifecycleManager.m b/SmartDeviceLink/private/SDLStreamingVideoLifecycleManager.m index 1a052eee2..7ee9a9500 100644 --- a/SmartDeviceLink/private/SDLStreamingVideoLifecycleManager.m +++ b/SmartDeviceLink/private/SDLStreamingVideoLifecycleManager.m @@ -1047,27 +1047,6 @@ typedef void(^SDLVideoCapabilityResponseHandler)(SDLVideoStreamingCapability *_N } } -- (void)sdl_requestVideoCapabilities:(SDLVideoCapabilityResponseHandler)responseHandler { - SDLLogD(@"Requesting video capabilities"); - SDLGetSystemCapability *getVideoCapabilityRequest = [[SDLGetSystemCapability alloc] initWithType:SDLSystemCapabilityTypeVideoStreaming]; - - typeof(self) weakSelf = self; - [self.connectionManager sendConnectionManagerRequest:getVideoCapabilityRequest withResponseHandler:^(__kindof SDLRPCRequest * _Nullable request, __kindof SDLRPCResponse * _Nullable response, NSError * _Nullable error) { - if (!response.success || [response isMemberOfClass:SDLGenericResponse.class]) { - SDLLogW(@"Video capabilities response failed: %@", error); - responseHandler(nil); - BLOCK_RETURN; - } - - SDLVideoStreamingCapability *videoCapability = ((SDLGetSystemCapabilityResponse *)response).systemCapability.videoStreamingCapability; - SDLLogD(@"Video capabilities response received: %@", videoCapability); - - weakSelf.videoScaleManager.scale = (videoCapability != nil && videoCapability.scale != nil) ? videoCapability.scale.floatValue : (float)0.0; - - responseHandler(videoCapability); - }]; -} - /** Pull the current format / resolution out of our preferred resolutions and craft a start video service payload out of it, then send a start service. If the format isn't one that we support, we're going to try the next format. */ diff --git a/SmartDeviceLinkTests/DevAPISpecs/SDLVoiceCommandManagerSpec.m b/SmartDeviceLinkTests/DevAPISpecs/SDLVoiceCommandManagerSpec.m index 15ccb66e4..612d89aa2 100644 --- a/SmartDeviceLinkTests/DevAPISpecs/SDLVoiceCommandManagerSpec.m +++ b/SmartDeviceLinkTests/DevAPISpecs/SDLVoiceCommandManagerSpec.m @@ -104,95 +104,106 @@ describe(@"voice command manager", ^{ }); }); - // updating voice commands - describe(@"when voice commands are set", ^{ + // when the hmi is ready + describe(@"when the hmi is ready", ^{ beforeEach(^{ newHMIStatus.hmiLevel = SDLHMILevelFull; newHMIStatus.windowID = @(SDLPredefinedWindowsDefaultWindow); SDLRPCNotificationNotification *notification = [[SDLRPCNotificationNotification alloc] initWithName:SDLDidChangeHMIStatusNotification object:nil rpcNotification:newHMIStatus]; [[NSNotificationCenter defaultCenter] postNotification:notification]; - - testManager.voiceCommands = testVCArray; }); - // should properly update a command - it(@"should properly update a command", ^{ - expect(testManager.voiceCommands.firstObject.commandId).to(equal(VoiceCommandIdMin)); + // should update the transactionQueue's suspension to false + it(@"should update the transactionQueue's suspension to false", ^{ expect(testManager.transactionQueue.isSuspended).to(beFalse()); - expect(testManager.transactionQueue.operations).to(haveCount(1)); }); - // when new voice commands is identical to the existing ones - describe(@"when new voice commands is identical to the existing ones", ^{ + // when setting voiceCommands + describe(@"when setting voiceCommands", ^{ beforeEach(^{ + testManager.transactionQueue.suspended = YES; testManager.voiceCommands = testVCArray; }); - // should only have one operation - it(@"should only have one operation", ^{ + // should properly update a command + it(@"should properly update a command", ^{ + expect(testManager.voiceCommands.firstObject.commandId).to(equal(VoiceCommandIdMin)); expect(testManager.transactionQueue.operations).to(haveCount(1)); + expect(testManager.transactionQueue.operations.firstObject.isExecuting).to(beFalse()); }); - }); - // when new voice commands are set - describe(@"when new voice commands are set", ^{ - beforeEach(^{ - testManager.voiceCommands = @[testVoiceCommand2]; - }); + // when new voice commands are identical to the existing ones + describe(@"when new voice commands are identical to the existing ones", ^{ + beforeEach(^{ + testManager.voiceCommands = testVCArray; + }); - // should queue another operation - it(@"should queue another operation", ^{ - expect(testManager.transactionQueue.operations).to(haveCount(2)); + // should only have one operation + it(@"should only have one operation", ^{ + expect(testManager.transactionQueue.operations).to(haveCount(1)); + }); }); - // when the first operation finishes and updates the current voice commands - describe(@"when the first operation finishes and updates the current voice commands", ^{ + // when new voice commands are different from the existing ones + describe(@"when new voice commands are different from the existing ones", ^{ beforeEach(^{ - SDLVoiceCommandUpdateOperation *firstOp = testManager.transactionQueue.operations[0]; - firstOp.currentVoiceCommands = [@[testVoiceCommand2] mutableCopy]; - [firstOp finishOperation]; + testManager.voiceCommands = @[testVoiceCommand2]; + }); - [NSThread sleepForTimeInterval:0.5]; + it(@"should queue another operation", ^{ + expect(testManager.transactionQueue.operations).to(haveCount(2)); }); - it(@"should update the second operation", ^{ - expect(((SDLVoiceCommandUpdateOperation *)testManager.transactionQueue.operations.firstObject).oldVoiceCommands.firstObject).withTimeout(3.0).toEventually(equal(testVoiceCommand2)); + // when the first operation finishes and updates the current voice commands + describe(@"when the first operation finishes and updates the current voice commands", ^{ + beforeEach(^{ + testManager.transactionQueue.suspended = NO; + + SDLVoiceCommandUpdateOperation *firstOp = testManager.transactionQueue.operations[0]; + firstOp.currentVoiceCommands = [@[testVoiceCommand2] mutableCopy]; + [firstOp finishOperation]; + }); + + it(@"should update the second operation", ^{ + expect(((SDLVoiceCommandUpdateOperation *)testManager.transactionQueue.operations.firstObject).oldVoiceCommands.firstObject).to(equal(testVoiceCommand2)); + }); }); }); - }); - context(@"if any of the voice commands contains an empty string", ^{ - // should remove the empty strings and queue another operation - it(@"should remove the empty strings and queue another operation", ^{ - testManager.voiceCommands = @[testVoiceCommand2, testVoiceCommand3, testVoiceCommand4, testVoiceCommand5, testVoiceCommand6]; - expect(testManager.transactionQueue.operations).to(haveCount(2)); - expect(testManager.voiceCommands).to(haveCount(2)); - expect(testManager.voiceCommands[0].voiceCommands).to(haveCount(1)); - expect(testManager.voiceCommands[0].voiceCommands).to(equal(@[@"Test 2"])); - expect(testManager.voiceCommands[1].voiceCommands).to(haveCount(2)); - expect(testManager.voiceCommands[1].voiceCommands).to(equal(@[@"Test 3", @"Test 4"])); - }); + // if any of the voice commands contains an empty string + context(@"if any of the voice commands contains an empty string", ^{ + // should remove the empty strings and queue another operation + it(@"should remove the empty strings and queue another operation", ^{ + testManager.voiceCommands = @[testVoiceCommand2, testVoiceCommand3, testVoiceCommand4, testVoiceCommand5, testVoiceCommand6]; + expect(testManager.transactionQueue.operations).to(haveCount(2)); + expect(testManager.voiceCommands).to(haveCount(2)); + expect(testManager.voiceCommands[0].voiceCommands).to(haveCount(1)); + expect(testManager.voiceCommands[0].voiceCommands).to(equal(@[@"Test 2"])); + expect(testManager.voiceCommands[1].voiceCommands).to(haveCount(2)); + expect(testManager.voiceCommands[1].voiceCommands).to(equal(@[@"Test 3", @"Test 4"])); + }); - // should not queue another operation if all the voice command strings are empty strings - it(@"should not queue another operation if all the voice command strings are empty strings", ^{ - testManager.voiceCommands = @[testVoiceCommand4, testVoiceCommand5]; - expect(testManager.transactionQueue.operations).to(haveCount(1)); - expect(testManager.voiceCommands).to(haveCount(1)); - expect(testManager.voiceCommands.firstObject.voiceCommands).to(haveCount(1)); - expect(testManager.voiceCommands.firstObject.voiceCommands).to(equal(@[@"Test 1"])); + // should not queue another operation if all the voice command strings are empty strings + it(@"should not queue another operation if all the voice command strings are empty strings", ^{ + testManager.voiceCommands = @[testVoiceCommand4, testVoiceCommand5]; + expect(testManager.transactionQueue.operations).to(haveCount(1)); + expect(testManager.voiceCommands).to(haveCount(1)); + expect(testManager.voiceCommands.firstObject.voiceCommands).to(haveCount(1)); + expect(testManager.voiceCommands.firstObject.voiceCommands).to(equal(@[@"Test 1"])); + }); }); - }); - // updating voice commands with duplicate string in different voice commands - describe(@"when new voice commands are set and have duplicate strings in different voice commands", ^{ - beforeEach(^{ - testManager.voiceCommands = @[testVoiceCommand2, testVoiceCommand7]; - }); + // updating voice commands with duplicate string in different voice commands + describe(@"when new voice commands are set and have duplicate strings in different voice commands", ^{ + beforeEach(^{ + testManager.voiceCommands = @[testVoiceCommand2, testVoiceCommand7]; + }); - it(@"should only have one operation", ^{ - expect(testManager.transactionQueue.operations).to(haveCount(1)); - expect([testManager.class sdl_arePendingVoiceCommandsUnique:@[testVoiceCommand2, testVoiceCommand7]]).to(equal(NO)); + it(@"should only have one operation", ^{ + expect(testManager.transactionQueue.operations).to(haveCount(1)); + expect([testManager.class sdl_arePendingVoiceCommandsUnique:@[testVoiceCommand2, testVoiceCommand7]]).to(equal(NO)); + }); }); }); }); @@ -203,6 +214,7 @@ describe(@"voice command manager", ^{ [testManager stop]; }); + // should reset correctly it(@"should reset correctly", ^{ expect(testManager.connectionManager).to(equal(mockConnectionManager)); expect(testManager.voiceCommands).to(beEmpty()); |