diff options
author | Justin Beharry <justin.beharry@livio.io> | 2022-08-29 14:15:17 -0400 |
---|---|---|
committer | Justin Beharry <justin.beharry@livio.io> | 2022-08-29 14:15:17 -0400 |
commit | 494784242cc4b8422785cee59e49b0f3ee805990 (patch) | |
tree | 73a00c4142832c5dbc1c8fabc4edd82d5c103d8e | |
parent | 37e476b1721f3778eb935aa22bd177290c093a39 (diff) | |
download | sdl_ios-494784242cc4b8422785cee59e49b0f3ee805990.tar.gz |
fix memory issue and update tests
-Add null check for errorState
-Update and add unit tests for SDLTextAndGraphicManager
-Update unit tests for SDLTextAndGraphicUpdateOperation
3 files changed, 62 insertions, 47 deletions
diff --git a/SmartDeviceLink/private/SDLTextAndGraphicManager.m b/SmartDeviceLink/private/SDLTextAndGraphicManager.m index 35daf8323..9d6ec1585 100644 --- a/SmartDeviceLink/private/SDLTextAndGraphicManager.m +++ b/SmartDeviceLink/private/SDLTextAndGraphicManager.m @@ -197,7 +197,10 @@ NS_ASSUME_NONNULL_BEGIN SDLTextAndGraphicUpdateOperation *updateOp = (SDLTextAndGraphicUpdateOperation *)operation; updateOp.currentScreenData = newScreenData; - [updateOp updateStateDataWithErrorData:errorData]; + + if (errorData != nil) { + [updateOp updateStateDataWithErrorData:errorData]; + } } } diff --git a/SmartDeviceLinkTests/DevAPISpecs/SDLTextAndGraphicManagerSpec.m b/SmartDeviceLinkTests/DevAPISpecs/SDLTextAndGraphicManagerSpec.m index ea230248c..89aec0e09 100644 --- a/SmartDeviceLinkTests/DevAPISpecs/SDLTextAndGraphicManagerSpec.m +++ b/SmartDeviceLinkTests/DevAPISpecs/SDLTextAndGraphicManagerSpec.m @@ -140,19 +140,23 @@ describe(@"text and graphic manager", ^{ }); }); - // when previous updates have bene cancelled - context(@"when previous updates have bene cancelled", ^{ + // without batching + context(@"without batching", ^{ beforeEach(^{ - testManager.textField1 = @"Hello"; - - // This should cancel the first operation - testManager.textField2 = @"Goodbye"; + testManager.batchUpdates = NO; + testManager.textField1 = @"test1"; + testManager.textField2 = @"test2"; + testManager.textField3 = @"test3"; + testManager.textField4 = @"test4"; }); - it(@"should properly queue the new update", ^{ + it(@"should create indiviudal operations and not be cancelled", ^{ expect(testManager.transactionQueue.isSuspended).to(beTrue()); - expect(testManager.transactionQueue.operationCount).to(equal(2)); - expect(testManager.transactionQueue.operations[0].cancelled).to(beTrue()); + expect(testManager.transactionQueue.operationCount).to(equal(4)); + expect(testManager.transactionQueue.operations[0].cancelled).to(beFalse()); + expect(testManager.transactionQueue.operations[1].cancelled).to(beFalse()); + expect(testManager.transactionQueue.operations[2].cancelled).to(beFalse()); + expect(testManager.transactionQueue.operations[3].cancelled).to(beFalse()); }); }); @@ -450,6 +454,7 @@ describe(@"text and graphic manager", ^{ describe(@"when the operation updates the current screen data", ^{ __block SDLTextAndGraphicUpdateOperation *testOperation = nil; __block SDLTextAndGraphicUpdateOperation *testOperation2 = nil; + __block SDLTextAndGraphicUpdateOperation *testOperation3 = nil; beforeEach(^{ testManager.textField1 = @"test"; @@ -461,7 +466,7 @@ describe(@"text and graphic manager", ^{ // with good data context(@"with good data", ^{ beforeEach(^{ - testOperation.currentDataUpdatedHandler(testOperation.updatedState, nil); + testOperation.currentDataUpdatedHandler(testOperation.updatedState, nil, nil); }); it(@"should update the manager's and pending operations' current screen data", ^{ @@ -475,11 +480,18 @@ describe(@"text and graphic manager", ^{ beforeEach(^{ testManager.currentScreenData = [[SDLTextAndGraphicState alloc] init]; testManager.currentScreenData.textField1 = @"Test1"; - testOperation.currentDataUpdatedHandler(nil, [NSError errorWithDomain:@"any" code:1 userInfo:nil]); + + SDLTextAndGraphicState *errorState = [[SDLTextAndGraphicState alloc] init]; + errorState.textField1 = @"Bad Data"; + testManager.textField1 = errorState.textField1; + testManager.textField4 = @"Good Data"; + testOperation3 = testManager.transactionQueue.operations[3]; + testOperation.currentDataUpdatedHandler(nil, [NSError errorWithDomain:@"any" code:1 userInfo:nil], errorState); }); - it(@"should reset the manager's data", ^{ + it(@"should reset the manager's data and update other operations updated state", ^{ expect(testManager.textField1).to(equal(testManager.currentScreenData.textField1)); + expect(testOperation3.updatedState.textField1).to(equal(@"Test1")); }); }); }); diff --git a/SmartDeviceLinkTests/DevAPISpecs/SDLTextAndGraphicUpdateOperationSpec.m b/SmartDeviceLinkTests/DevAPISpecs/SDLTextAndGraphicUpdateOperationSpec.m index b03252c25..81bca428e 100644 --- a/SmartDeviceLinkTests/DevAPISpecs/SDLTextAndGraphicUpdateOperationSpec.m +++ b/SmartDeviceLinkTests/DevAPISpecs/SDLTextAndGraphicUpdateOperationSpec.m @@ -120,7 +120,7 @@ describe(@"the text and graphic operation", ^{ updatedState.textField3 = field3String; updatedState.textField4 = field4String; - testOp = [[SDLTextAndGraphicUpdateOperation alloc] initWithConnectionManager:testConnectionManager fileManager:mockFileManager currentCapabilities:windowCapability currentScreenData:emptyCurrentData newState:updatedState currentScreenDataUpdatedHandler:^(SDLTextAndGraphicState * _Nullable newScreenData, NSError * _Nullable error) {} updateCompletionHandler:nil]; + testOp = [[SDLTextAndGraphicUpdateOperation alloc] initWithConnectionManager:testConnectionManager fileManager:mockFileManager currentCapabilities:windowCapability currentScreenData:emptyCurrentData newState:updatedState currentScreenDataUpdatedHandler:^(SDLTextAndGraphicState * _Nullable newScreenData, NSError * _Nullable error, SDLTextAndGraphicState *_Nullable errorScreenData) {} updateCompletionHandler:nil]; [testOp start]; [testConnectionManager respondToLastRequestWithResponse:successShowResponse]; @@ -163,7 +163,7 @@ describe(@"the text and graphic operation", ^{ }); it(@"should send the media track and title", ^{ - testOp = [[SDLTextAndGraphicUpdateOperation alloc] initWithConnectionManager:testConnectionManager fileManager:mockFileManager currentCapabilities:windowCapability currentScreenData:emptyCurrentData newState:updatedState currentScreenDataUpdatedHandler:^(SDLTextAndGraphicState * _Nullable newScreenData, NSError * _Nullable error) {} updateCompletionHandler:nil]; + testOp = [[SDLTextAndGraphicUpdateOperation alloc] initWithConnectionManager:testConnectionManager fileManager:mockFileManager currentCapabilities:windowCapability currentScreenData:emptyCurrentData newState:updatedState currentScreenDataUpdatedHandler:^(SDLTextAndGraphicState * _Nullable newScreenData, NSError * _Nullable error, SDLTextAndGraphicState *_Nullable errorScreenData) {} updateCompletionHandler:nil]; [testOp start]; SDLShow *sentShow = testConnectionManager.receivedRequests.firstObject; @@ -179,7 +179,7 @@ describe(@"the text and graphic operation", ^{ }); it(@"should not send the media track and title", ^{ - testOp = [[SDLTextAndGraphicUpdateOperation alloc] initWithConnectionManager:testConnectionManager fileManager:mockFileManager currentCapabilities:windowCapability currentScreenData:emptyCurrentData newState:updatedState currentScreenDataUpdatedHandler:^(SDLTextAndGraphicState * _Nullable newScreenData, NSError * _Nullable error) {} updateCompletionHandler:nil]; + testOp = [[SDLTextAndGraphicUpdateOperation alloc] initWithConnectionManager:testConnectionManager fileManager:mockFileManager currentCapabilities:windowCapability currentScreenData:emptyCurrentData newState:updatedState currentScreenDataUpdatedHandler:^(SDLTextAndGraphicState * _Nullable newScreenData, NSError * _Nullable error, SDLTextAndGraphicState *_Nullable errorScreenData) {} updateCompletionHandler:nil]; [testOp start]; SDLShow *sentShow = testConnectionManager.receivedRequests.firstObject; @@ -201,7 +201,7 @@ describe(@"the text and graphic operation", ^{ updatedState = [[SDLTextAndGraphicState alloc] init]; updatedState.textField1 = field1String; - testOp = [[SDLTextAndGraphicUpdateOperation alloc] initWithConnectionManager:testConnectionManager fileManager:mockFileManager currentCapabilities:windowCapability currentScreenData:emptyCurrentData newState:updatedState currentScreenDataUpdatedHandler:^(SDLTextAndGraphicState * _Nullable newScreenData, NSError * _Nullable error) {} updateCompletionHandler:nil]; + testOp = [[SDLTextAndGraphicUpdateOperation alloc] initWithConnectionManager:testConnectionManager fileManager:mockFileManager currentCapabilities:windowCapability currentScreenData:emptyCurrentData newState:updatedState currentScreenDataUpdatedHandler:^(SDLTextAndGraphicState * _Nullable newScreenData, NSError * _Nullable error, SDLTextAndGraphicState *_Nullable errorScreenData) {} updateCompletionHandler:nil]; [testOp start]; [testConnectionManager respondToLastRequestWithResponse:successShowResponse]; @@ -233,7 +233,7 @@ describe(@"the text and graphic operation", ^{ updatedState.textField1 = field1String; updatedState.textField2 = field2String; - testOp = [[SDLTextAndGraphicUpdateOperation alloc] initWithConnectionManager:testConnectionManager fileManager:mockFileManager currentCapabilities:windowCapability currentScreenData:emptyCurrentData newState:updatedState currentScreenDataUpdatedHandler:^(SDLTextAndGraphicState * _Nullable newScreenData, NSError * _Nullable error) {} updateCompletionHandler:nil]; + testOp = [[SDLTextAndGraphicUpdateOperation alloc] initWithConnectionManager:testConnectionManager fileManager:mockFileManager currentCapabilities:windowCapability currentScreenData:emptyCurrentData newState:updatedState currentScreenDataUpdatedHandler:^(SDLTextAndGraphicState * _Nullable newScreenData, NSError * _Nullable error, SDLTextAndGraphicState *_Nullable errorScreenData) {} updateCompletionHandler:nil]; [testOp start]; [testConnectionManager respondToLastRequestWithResponse:successShowResponse]; @@ -266,7 +266,7 @@ describe(@"the text and graphic operation", ^{ updatedState.textField2 = field2String; updatedState.textField3 = field3String; - testOp = [[SDLTextAndGraphicUpdateOperation alloc] initWithConnectionManager:testConnectionManager fileManager:mockFileManager currentCapabilities:windowCapability currentScreenData:emptyCurrentData newState:updatedState currentScreenDataUpdatedHandler:^(SDLTextAndGraphicState * _Nullable newScreenData, NSError * _Nullable error) {} updateCompletionHandler:nil]; + testOp = [[SDLTextAndGraphicUpdateOperation alloc] initWithConnectionManager:testConnectionManager fileManager:mockFileManager currentCapabilities:windowCapability currentScreenData:emptyCurrentData newState:updatedState currentScreenDataUpdatedHandler:^(SDLTextAndGraphicState * _Nullable newScreenData, NSError * _Nullable error, SDLTextAndGraphicState *_Nullable errorScreenData) {} updateCompletionHandler:nil]; [testOp start]; [testConnectionManager respondToLastRequestWithResponse:successShowResponse]; @@ -300,7 +300,7 @@ describe(@"the text and graphic operation", ^{ updatedState.textField3 = field3String; updatedState.textField4 = field4String; - testOp = [[SDLTextAndGraphicUpdateOperation alloc] initWithConnectionManager:testConnectionManager fileManager:mockFileManager currentCapabilities:windowCapability currentScreenData:emptyCurrentData newState:updatedState currentScreenDataUpdatedHandler:^(SDLTextAndGraphicState * _Nullable newScreenData, NSError * _Nullable error) {} updateCompletionHandler:nil]; + testOp = [[SDLTextAndGraphicUpdateOperation alloc] initWithConnectionManager:testConnectionManager fileManager:mockFileManager currentCapabilities:windowCapability currentScreenData:emptyCurrentData newState:updatedState currentScreenDataUpdatedHandler:^(SDLTextAndGraphicState * _Nullable newScreenData, NSError * _Nullable error, SDLTextAndGraphicState *_Nullable errorScreenData) {} updateCompletionHandler:nil]; [testOp start]; [testConnectionManager respondToLastRequestWithResponse:successShowResponse]; @@ -339,7 +339,7 @@ describe(@"the text and graphic operation", ^{ updatedState = [[SDLTextAndGraphicState alloc] init]; updatedState.textField1 = field1String; - testOp = [[SDLTextAndGraphicUpdateOperation alloc] initWithConnectionManager:testConnectionManager fileManager:mockFileManager currentCapabilities:windowCapability currentScreenData:emptyCurrentData newState:updatedState currentScreenDataUpdatedHandler:^(SDLTextAndGraphicState * _Nullable newScreenData, NSError * _Nullable error) {} updateCompletionHandler:nil]; + testOp = [[SDLTextAndGraphicUpdateOperation alloc] initWithConnectionManager:testConnectionManager fileManager:mockFileManager currentCapabilities:windowCapability currentScreenData:emptyCurrentData newState:updatedState currentScreenDataUpdatedHandler:^(SDLTextAndGraphicState * _Nullable newScreenData, NSError * _Nullable error, SDLTextAndGraphicState *_Nullable errorScreenData) {} updateCompletionHandler:nil]; [testOp start]; [testConnectionManager respondToLastRequestWithResponse:successShowResponse]; @@ -371,7 +371,7 @@ describe(@"the text and graphic operation", ^{ updatedState.textField1 = field1String; updatedState.textField2 = field2String; - testOp = [[SDLTextAndGraphicUpdateOperation alloc] initWithConnectionManager:testConnectionManager fileManager:mockFileManager currentCapabilities:windowCapability currentScreenData:emptyCurrentData newState:updatedState currentScreenDataUpdatedHandler:^(SDLTextAndGraphicState * _Nullable newScreenData, NSError * _Nullable error) {} updateCompletionHandler:nil]; + testOp = [[SDLTextAndGraphicUpdateOperation alloc] initWithConnectionManager:testConnectionManager fileManager:mockFileManager currentCapabilities:windowCapability currentScreenData:emptyCurrentData newState:updatedState currentScreenDataUpdatedHandler:^(SDLTextAndGraphicState * _Nullable newScreenData, NSError * _Nullable error, SDLTextAndGraphicState *_Nullable errorScreenData) {} updateCompletionHandler:nil]; [testOp start]; [testConnectionManager respondToLastRequestWithResponse:successShowResponse]; @@ -404,7 +404,7 @@ describe(@"the text and graphic operation", ^{ updatedState.textField2 = field2String; updatedState.textField3 = field3String; - testOp = [[SDLTextAndGraphicUpdateOperation alloc] initWithConnectionManager:testConnectionManager fileManager:mockFileManager currentCapabilities:windowCapability currentScreenData:emptyCurrentData newState:updatedState currentScreenDataUpdatedHandler:^(SDLTextAndGraphicState * _Nullable newScreenData, NSError * _Nullable error) {} updateCompletionHandler:nil]; + testOp = [[SDLTextAndGraphicUpdateOperation alloc] initWithConnectionManager:testConnectionManager fileManager:mockFileManager currentCapabilities:windowCapability currentScreenData:emptyCurrentData newState:updatedState currentScreenDataUpdatedHandler:^(SDLTextAndGraphicState * _Nullable newScreenData, NSError * _Nullable error, SDLTextAndGraphicState *_Nullable errorScreenData) {} updateCompletionHandler:nil]; [testOp start]; [testConnectionManager respondToLastRequestWithResponse:successShowResponse]; @@ -438,7 +438,7 @@ describe(@"the text and graphic operation", ^{ updatedState.textField3 = field3String; updatedState.textField4 = field4String; - testOp = [[SDLTextAndGraphicUpdateOperation alloc] initWithConnectionManager:testConnectionManager fileManager:mockFileManager currentCapabilities:windowCapability currentScreenData:emptyCurrentData newState:updatedState currentScreenDataUpdatedHandler:^(SDLTextAndGraphicState * _Nullable newScreenData, NSError * _Nullable error) {} updateCompletionHandler:nil]; + testOp = [[SDLTextAndGraphicUpdateOperation alloc] initWithConnectionManager:testConnectionManager fileManager:mockFileManager currentCapabilities:windowCapability currentScreenData:emptyCurrentData newState:updatedState currentScreenDataUpdatedHandler:^(SDLTextAndGraphicState * _Nullable newScreenData, NSError * _Nullable error, SDLTextAndGraphicState *_Nullable errorScreenData) {} updateCompletionHandler:nil]; [testOp start]; [testConnectionManager respondToLastRequestWithResponse:successShowResponse]; @@ -477,7 +477,7 @@ describe(@"the text and graphic operation", ^{ updatedState = [[SDLTextAndGraphicState alloc] init]; updatedState.textField1 = field1String; - testOp = [[SDLTextAndGraphicUpdateOperation alloc] initWithConnectionManager:testConnectionManager fileManager:mockFileManager currentCapabilities:windowCapability currentScreenData:emptyCurrentData newState:updatedState currentScreenDataUpdatedHandler:^(SDLTextAndGraphicState * _Nullable newScreenData, NSError * _Nullable error) {} updateCompletionHandler:nil]; + testOp = [[SDLTextAndGraphicUpdateOperation alloc] initWithConnectionManager:testConnectionManager fileManager:mockFileManager currentCapabilities:windowCapability currentScreenData:emptyCurrentData newState:updatedState currentScreenDataUpdatedHandler:^(SDLTextAndGraphicState * _Nullable newScreenData, NSError * _Nullable error, SDLTextAndGraphicState *_Nullable errorScreenData) {} updateCompletionHandler:nil]; [testOp start]; [testConnectionManager respondToLastRequestWithResponse:successShowResponse]; @@ -509,7 +509,7 @@ describe(@"the text and graphic operation", ^{ updatedState.textField1 = field1String; updatedState.textField2 = field2String; - testOp = [[SDLTextAndGraphicUpdateOperation alloc] initWithConnectionManager:testConnectionManager fileManager:mockFileManager currentCapabilities:windowCapability currentScreenData:emptyCurrentData newState:updatedState currentScreenDataUpdatedHandler:^(SDLTextAndGraphicState * _Nullable newScreenData, NSError * _Nullable error) {} updateCompletionHandler:nil]; + testOp = [[SDLTextAndGraphicUpdateOperation alloc] initWithConnectionManager:testConnectionManager fileManager:mockFileManager currentCapabilities:windowCapability currentScreenData:emptyCurrentData newState:updatedState currentScreenDataUpdatedHandler:^(SDLTextAndGraphicState * _Nullable newScreenData, NSError * _Nullable error, SDLTextAndGraphicState *_Nullable errorScreenData) {} updateCompletionHandler:nil]; [testOp start]; [testConnectionManager respondToLastRequestWithResponse:successShowResponse]; @@ -542,7 +542,7 @@ describe(@"the text and graphic operation", ^{ updatedState.textField2 = field2String; updatedState.textField3 = field3String; - testOp = [[SDLTextAndGraphicUpdateOperation alloc] initWithConnectionManager:testConnectionManager fileManager:mockFileManager currentCapabilities:windowCapability currentScreenData:emptyCurrentData newState:updatedState currentScreenDataUpdatedHandler:^(SDLTextAndGraphicState * _Nullable newScreenData, NSError * _Nullable error) {} updateCompletionHandler:nil]; + testOp = [[SDLTextAndGraphicUpdateOperation alloc] initWithConnectionManager:testConnectionManager fileManager:mockFileManager currentCapabilities:windowCapability currentScreenData:emptyCurrentData newState:updatedState currentScreenDataUpdatedHandler:^(SDLTextAndGraphicState * _Nullable newScreenData, NSError * _Nullable error, SDLTextAndGraphicState *_Nullable errorScreenData) {} updateCompletionHandler:nil]; [testOp start]; [testConnectionManager respondToLastRequestWithResponse:successShowResponse]; @@ -576,7 +576,7 @@ describe(@"the text and graphic operation", ^{ updatedState.textField3 = field3String; updatedState.textField4 = field4String; - testOp = [[SDLTextAndGraphicUpdateOperation alloc] initWithConnectionManager:testConnectionManager fileManager:mockFileManager currentCapabilities:windowCapability currentScreenData:emptyCurrentData newState:updatedState currentScreenDataUpdatedHandler:^(SDLTextAndGraphicState * _Nullable newScreenData, NSError * _Nullable error) {} updateCompletionHandler:nil]; + testOp = [[SDLTextAndGraphicUpdateOperation alloc] initWithConnectionManager:testConnectionManager fileManager:mockFileManager currentCapabilities:windowCapability currentScreenData:emptyCurrentData newState:updatedState currentScreenDataUpdatedHandler:^(SDLTextAndGraphicState * _Nullable newScreenData, NSError * _Nullable error, SDLTextAndGraphicState *_Nullable errorScreenData) {} updateCompletionHandler:nil]; [testOp start]; [testConnectionManager respondToLastRequestWithResponse:successShowResponse]; @@ -615,7 +615,7 @@ describe(@"the text and graphic operation", ^{ updatedState = [[SDLTextAndGraphicState alloc] init]; updatedState.textField1 = field1String; - testOp = [[SDLTextAndGraphicUpdateOperation alloc] initWithConnectionManager:testConnectionManager fileManager:mockFileManager currentCapabilities:windowCapability currentScreenData:emptyCurrentData newState:updatedState currentScreenDataUpdatedHandler:^(SDLTextAndGraphicState * _Nullable newScreenData, NSError * _Nullable error) {} updateCompletionHandler:nil]; + testOp = [[SDLTextAndGraphicUpdateOperation alloc] initWithConnectionManager:testConnectionManager fileManager:mockFileManager currentCapabilities:windowCapability currentScreenData:emptyCurrentData newState:updatedState currentScreenDataUpdatedHandler:^(SDLTextAndGraphicState * _Nullable newScreenData, NSError * _Nullable error, SDLTextAndGraphicState *_Nullable errorScreenData) {} updateCompletionHandler:nil]; [testOp start]; [testConnectionManager respondToLastRequestWithResponse:successShowResponse]; @@ -647,7 +647,7 @@ describe(@"the text and graphic operation", ^{ updatedState.textField1 = field1String; updatedState.textField2 = field2String; - testOp = [[SDLTextAndGraphicUpdateOperation alloc] initWithConnectionManager:testConnectionManager fileManager:mockFileManager currentCapabilities:windowCapability currentScreenData:emptyCurrentData newState:updatedState currentScreenDataUpdatedHandler:^(SDLTextAndGraphicState * _Nullable newScreenData, NSError * _Nullable error) {} updateCompletionHandler:nil]; + testOp = [[SDLTextAndGraphicUpdateOperation alloc] initWithConnectionManager:testConnectionManager fileManager:mockFileManager currentCapabilities:windowCapability currentScreenData:emptyCurrentData newState:updatedState currentScreenDataUpdatedHandler:^(SDLTextAndGraphicState * _Nullable newScreenData, NSError * _Nullable error, SDLTextAndGraphicState *_Nullable errorScreenData) {} updateCompletionHandler:nil]; [testOp start]; [testConnectionManager respondToLastRequestWithResponse:successShowResponse]; @@ -680,7 +680,7 @@ describe(@"the text and graphic operation", ^{ updatedState.textField2 = field2String; updatedState.textField3 = field3String; - testOp = [[SDLTextAndGraphicUpdateOperation alloc] initWithConnectionManager:testConnectionManager fileManager:mockFileManager currentCapabilities:windowCapability currentScreenData:emptyCurrentData newState:updatedState currentScreenDataUpdatedHandler:^(SDLTextAndGraphicState * _Nullable newScreenData, NSError * _Nullable error) {} updateCompletionHandler:nil]; + testOp = [[SDLTextAndGraphicUpdateOperation alloc] initWithConnectionManager:testConnectionManager fileManager:mockFileManager currentCapabilities:windowCapability currentScreenData:emptyCurrentData newState:updatedState currentScreenDataUpdatedHandler:^(SDLTextAndGraphicState * _Nullable newScreenData, NSError * _Nullable error, SDLTextAndGraphicState *_Nullable errorScreenData) {} updateCompletionHandler:nil]; [testOp start]; [testConnectionManager respondToLastRequestWithResponse:successShowResponse]; @@ -714,7 +714,7 @@ describe(@"the text and graphic operation", ^{ updatedState.textField3 = field3String; updatedState.textField4 = field4String; - testOp = [[SDLTextAndGraphicUpdateOperation alloc] initWithConnectionManager:testConnectionManager fileManager:mockFileManager currentCapabilities:windowCapability currentScreenData:emptyCurrentData newState:updatedState currentScreenDataUpdatedHandler:^(SDLTextAndGraphicState * _Nullable newScreenData, NSError * _Nullable error) {} updateCompletionHandler:nil]; + testOp = [[SDLTextAndGraphicUpdateOperation alloc] initWithConnectionManager:testConnectionManager fileManager:mockFileManager currentCapabilities:windowCapability currentScreenData:emptyCurrentData newState:updatedState currentScreenDataUpdatedHandler:^(SDLTextAndGraphicState * _Nullable newScreenData, NSError * _Nullable error, SDLTextAndGraphicState *_Nullable errorScreenData) {} updateCompletionHandler:nil]; [testOp start]; [testConnectionManager respondToLastRequestWithResponse:successShowResponse]; @@ -754,7 +754,7 @@ describe(@"the text and graphic operation", ^{ updatedState.textField3 = field3String; updatedState.textField4 = field4String; - testOp = [[SDLTextAndGraphicUpdateOperation alloc] initWithConnectionManager:testConnectionManager fileManager:mockFileManager currentCapabilities:windowCapability currentScreenData:emptyCurrentData newState:updatedState currentScreenDataUpdatedHandler:^(SDLTextAndGraphicState * _Nullable newScreenData, NSError * _Nullable error) {} updateCompletionHandler:^(NSError * _Nullable error) { + testOp = [[SDLTextAndGraphicUpdateOperation alloc] initWithConnectionManager:testConnectionManager fileManager:mockFileManager currentCapabilities:windowCapability currentScreenData:emptyCurrentData newState:updatedState currentScreenDataUpdatedHandler:^(SDLTextAndGraphicState * _Nullable newScreenData, NSError * _Nullable error, SDLTextAndGraphicState *_Nullable errorScreenData) {} updateCompletionHandler:^(NSError * _Nullable error) { didCallHandler = YES; }]; [testOp start]; @@ -780,7 +780,7 @@ describe(@"the text and graphic operation", ^{ updatedState.textField3 = field3String; updatedState.textField4 = field4String; - testOp = [[SDLTextAndGraphicUpdateOperation alloc] initWithConnectionManager:testConnectionManager fileManager:mockFileManager currentCapabilities:windowCapability currentScreenData:emptyCurrentData newState:updatedState currentScreenDataUpdatedHandler:^(SDLTextAndGraphicState *_Nullable newScreenData, NSError *_Nullable error) { + testOp = [[SDLTextAndGraphicUpdateOperation alloc] initWithConnectionManager:testConnectionManager fileManager:mockFileManager currentCapabilities:windowCapability currentScreenData:emptyCurrentData newState:updatedState currentScreenDataUpdatedHandler:^(SDLTextAndGraphicState * _Nullable newScreenData, NSError * _Nullable error, SDLTextAndGraphicState *_Nullable errorScreenData) { updatedData = newScreenData; } updateCompletionHandler:nil]; [testOp start]; @@ -823,7 +823,7 @@ describe(@"the text and graphic operation", ^{ }); it(@"should send a show and not upload any artworks", ^{ - testOp = [[SDLTextAndGraphicUpdateOperation alloc] initWithConnectionManager:testConnectionManager fileManager:mockFileManager currentCapabilities:windowCapability currentScreenData:emptyCurrentData newState:updatedState currentScreenDataUpdatedHandler:^(SDLTextAndGraphicState * _Nullable newScreenData, NSError * _Nullable error) {} updateCompletionHandler:nil]; + testOp = [[SDLTextAndGraphicUpdateOperation alloc] initWithConnectionManager:testConnectionManager fileManager:mockFileManager currentCapabilities:windowCapability currentScreenData:emptyCurrentData newState:updatedState currentScreenDataUpdatedHandler:^(SDLTextAndGraphicState * _Nullable newScreenData, NSError * _Nullable error, SDLTextAndGraphicState *_Nullable errorScreenData) {} updateCompletionHandler:nil]; [testOp start]; expect(testConnectionManager.receivedRequests).to(haveCount(1)); @@ -845,7 +845,7 @@ describe(@"the text and graphic operation", ^{ updatedState2.primaryGraphic = testArtwork3; updatedState2.secondaryGraphic = testArtwork2; - SDLTextAndGraphicUpdateOperation *testOp2 = [[SDLTextAndGraphicUpdateOperation alloc] initWithConnectionManager:testConnectionManager fileManager:mockFileManager currentCapabilities:windowCapability currentScreenData:updatedState newState:updatedState2 currentScreenDataUpdatedHandler:^(SDLTextAndGraphicState * _Nullable newScreenData, NSError * _Nullable error) {} updateCompletionHandler:nil]; + SDLTextAndGraphicUpdateOperation *testOp2 = [[SDLTextAndGraphicUpdateOperation alloc] initWithConnectionManager:testConnectionManager fileManager:mockFileManager currentCapabilities:windowCapability currentScreenData:updatedState newState:updatedState2 currentScreenDataUpdatedHandler:^(SDLTextAndGraphicState * _Nullable newScreenData, NSError * _Nullable error, SDLTextAndGraphicState *_Nullable errorScreenData) {} updateCompletionHandler:nil]; [testOp2 start]; [testConnectionManager respondToLastRequestWithResponse:successShowResponse]; @@ -862,7 +862,7 @@ describe(@"the text and graphic operation", ^{ updatedState.primaryGraphic = testArtwork; updatedState.secondaryGraphic = testArtwork2; - testOp = [[SDLTextAndGraphicUpdateOperation alloc] initWithConnectionManager:testConnectionManager fileManager:mockFileManager currentCapabilities:windowCapability currentScreenData:emptyCurrentData newState:updatedState currentScreenDataUpdatedHandler:^(SDLTextAndGraphicState * _Nullable newScreenData, NSError * _Nullable error) {} updateCompletionHandler:nil]; + testOp = [[SDLTextAndGraphicUpdateOperation alloc] initWithConnectionManager:testConnectionManager fileManager:mockFileManager currentCapabilities:windowCapability currentScreenData:emptyCurrentData newState:updatedState currentScreenDataUpdatedHandler:^(SDLTextAndGraphicState * _Nullable newScreenData, NSError * _Nullable error, SDLTextAndGraphicState *_Nullable errorScreenData) {} updateCompletionHandler:nil]; [testOp start]; }); @@ -892,7 +892,7 @@ describe(@"the text and graphic operation", ^{ updatedState.textField1 = field1String; updatedState.primaryGraphic = testArtwork; - testOp = [[SDLTextAndGraphicUpdateOperation alloc] initWithConnectionManager:testConnectionManager fileManager:mockFileManager currentCapabilities:windowCapability currentScreenData:emptyCurrentData newState:updatedState currentScreenDataUpdatedHandler:^(SDLTextAndGraphicState * _Nullable newScreenData, NSError * _Nullable error) { + testOp = [[SDLTextAndGraphicUpdateOperation alloc] initWithConnectionManager:testConnectionManager fileManager:mockFileManager currentCapabilities:windowCapability currentScreenData:emptyCurrentData newState:updatedState currentScreenDataUpdatedHandler:^(SDLTextAndGraphicState * _Nullable newScreenData, NSError * _Nullable error, SDLTextAndGraphicState *_Nullable errorScreenData) { receivedState = newScreenData; receivedError = error; } updateCompletionHandler:^(NSError * _Nullable error) { @@ -967,7 +967,7 @@ describe(@"the text and graphic operation", ^{ updatedState = [[SDLTextAndGraphicState alloc] init]; updatedState.primaryGraphic = testArtwork; - testOp = [[SDLTextAndGraphicUpdateOperation alloc] initWithConnectionManager:testConnectionManager fileManager:mockFileManager currentCapabilities:windowCapability currentScreenData:emptyCurrentData newState:updatedState currentScreenDataUpdatedHandler:^(SDLTextAndGraphicState * _Nullable newScreenData, NSError * _Nullable error) {} updateCompletionHandler:nil]; + testOp = [[SDLTextAndGraphicUpdateOperation alloc] initWithConnectionManager:testConnectionManager fileManager:mockFileManager currentCapabilities:windowCapability currentScreenData:emptyCurrentData newState:updatedState currentScreenDataUpdatedHandler:^(SDLTextAndGraphicState * _Nullable newScreenData, NSError * _Nullable error, SDLTextAndGraphicState *_Nullable errorScreenData) {} updateCompletionHandler:nil]; [testOp start]; }); @@ -997,7 +997,7 @@ describe(@"the text and graphic operation", ^{ updatedState = [[SDLTextAndGraphicState alloc] init]; updatedState.primaryGraphic = testStaticIcon; - testOp = [[SDLTextAndGraphicUpdateOperation alloc] initWithConnectionManager:testConnectionManager fileManager:mockFileManager currentCapabilities:windowCapability currentScreenData:emptyCurrentData newState:updatedState currentScreenDataUpdatedHandler:^(SDLTextAndGraphicState * _Nullable newScreenData, NSError * _Nullable error) {} updateCompletionHandler:nil]; + testOp = [[SDLTextAndGraphicUpdateOperation alloc] initWithConnectionManager:testConnectionManager fileManager:mockFileManager currentCapabilities:windowCapability currentScreenData:emptyCurrentData newState:updatedState currentScreenDataUpdatedHandler:^(SDLTextAndGraphicState * _Nullable newScreenData, NSError * _Nullable error, SDLTextAndGraphicState *_Nullable errorScreenData) {} updateCompletionHandler:nil]; [testOp start]; }); @@ -1032,7 +1032,7 @@ describe(@"the text and graphic operation", ^{ updatedState.primaryGraphic = testArtwork; updatedState.secondaryGraphic = testArtwork2; - testOp = [[SDLTextAndGraphicUpdateOperation alloc] initWithConnectionManager:testConnectionManager fileManager:mockFileManager currentCapabilities:windowCapability currentScreenData:emptyCurrentData newState:updatedState currentScreenDataUpdatedHandler:^(SDLTextAndGraphicState * _Nullable newScreenData, NSError * _Nullable error) {} updateCompletionHandler:nil]; + testOp = [[SDLTextAndGraphicUpdateOperation alloc] initWithConnectionManager:testConnectionManager fileManager:mockFileManager currentCapabilities:windowCapability currentScreenData:emptyCurrentData newState:updatedState currentScreenDataUpdatedHandler:^(SDLTextAndGraphicState * _Nullable newScreenData, NSError * _Nullable error, SDLTextAndGraphicState *_Nullable errorScreenData) {} updateCompletionHandler:nil]; [testOp start]; }); @@ -1059,7 +1059,7 @@ describe(@"the text and graphic operation", ^{ updatedState.primaryGraphic = testArtwork; updatedState.secondaryGraphic = testArtwork2; - testOp = [[SDLTextAndGraphicUpdateOperation alloc] initWithConnectionManager:testConnectionManager fileManager:mockFileManager currentCapabilities:windowCapability currentScreenData:emptyCurrentData newState:updatedState currentScreenDataUpdatedHandler:^(SDLTextAndGraphicState * _Nullable newScreenData, NSError * _Nullable error) {} updateCompletionHandler:nil]; + testOp = [[SDLTextAndGraphicUpdateOperation alloc] initWithConnectionManager:testConnectionManager fileManager:mockFileManager currentCapabilities:windowCapability currentScreenData:emptyCurrentData newState:updatedState currentScreenDataUpdatedHandler:^(SDLTextAndGraphicState * _Nullable newScreenData, NSError * _Nullable error, SDLTextAndGraphicState *_Nullable errorScreenData) {} updateCompletionHandler:nil]; [testOp start]; expect(testConnectionManager.receivedRequests).to(haveCount(1)); @@ -1088,7 +1088,7 @@ describe(@"the text and graphic operation", ^{ updatedState.primaryGraphic = testArtwork; updatedState.secondaryGraphic = testArtwork2; - testOp = [[SDLTextAndGraphicUpdateOperation alloc] initWithConnectionManager:testConnectionManager fileManager:mockFileManager currentCapabilities:windowCapability currentScreenData:emptyCurrentData newState:updatedState currentScreenDataUpdatedHandler:^(SDLTextAndGraphicState * _Nullable newScreenData, NSError * _Nullable error) {} updateCompletionHandler:nil]; + testOp = [[SDLTextAndGraphicUpdateOperation alloc] initWithConnectionManager:testConnectionManager fileManager:mockFileManager currentCapabilities:windowCapability currentScreenData:emptyCurrentData newState:updatedState currentScreenDataUpdatedHandler:^(SDLTextAndGraphicState * _Nullable newScreenData, NSError * _Nullable error, SDLTextAndGraphicState *_Nullable errorScreenData) {} updateCompletionHandler:nil]; [testOp start]; expect(testConnectionManager.receivedRequests).to(haveCount(1)); @@ -1121,7 +1121,7 @@ describe(@"the text and graphic operation", ^{ beforeEach(^{ updatedState = [[SDLTextAndGraphicState alloc] init]; updatedState.templateConfig = newConfiguration; - testOp = [[SDLTextAndGraphicUpdateOperation alloc] initWithConnectionManager:testConnectionManager fileManager:mockFileManager currentCapabilities:allEnabledCapability currentScreenData:emptyCurrentData newState:updatedState currentScreenDataUpdatedHandler:^(SDLTextAndGraphicState * _Nullable newScreenData, NSError * _Nullable error) { + testOp = [[SDLTextAndGraphicUpdateOperation alloc] initWithConnectionManager:testConnectionManager fileManager:mockFileManager currentCapabilities:allEnabledCapability currentScreenData:emptyCurrentData newState:updatedState currentScreenDataUpdatedHandler:^(SDLTextAndGraphicState * _Nullable newScreenData, NSError * _Nullable error, SDLTextAndGraphicState *_Nullable errorScreenData) { receivedState = newScreenData; receivedError = error; } updateCompletionHandler:nil]; @@ -1153,7 +1153,7 @@ describe(@"the text and graphic operation", ^{ updatedState = [[SDLTextAndGraphicState alloc] init]; updatedState.templateConfig = newConfiguration; updatedState.textField1 = field1String; - testOp = [[SDLTextAndGraphicUpdateOperation alloc] initWithConnectionManager:testConnectionManager fileManager:mockFileManager currentCapabilities:allEnabledCapability currentScreenData:emptyCurrentData newState:updatedState currentScreenDataUpdatedHandler:^(SDLTextAndGraphicState * _Nullable newScreenData, NSError * _Nullable error) { + testOp = [[SDLTextAndGraphicUpdateOperation alloc] initWithConnectionManager:testConnectionManager fileManager:mockFileManager currentCapabilities:allEnabledCapability currentScreenData:emptyCurrentData newState:updatedState currentScreenDataUpdatedHandler:^(SDLTextAndGraphicState * _Nullable newScreenData, NSError * _Nullable error, SDLTextAndGraphicState *_Nullable errorScreenData) { receivedState = newScreenData; receivedError = error; } updateCompletionHandler:^(NSError * _Nullable error) { @@ -1240,7 +1240,7 @@ describe(@"the text and graphic operation", ^{ beforeEach(^{ updatedState = [[SDLTextAndGraphicState alloc] init]; updatedState.templateConfig = newConfiguration; - testOp = [[SDLTextAndGraphicUpdateOperation alloc] initWithConnectionManager:testConnectionManager fileManager:mockFileManager currentCapabilities:allEnabledCapability currentScreenData:emptyCurrentData newState:updatedState currentScreenDataUpdatedHandler:^(SDLTextAndGraphicState * _Nullable newScreenData, NSError * _Nullable error) { + testOp = [[SDLTextAndGraphicUpdateOperation alloc] initWithConnectionManager:testConnectionManager fileManager:mockFileManager currentCapabilities:allEnabledCapability currentScreenData:emptyCurrentData newState:updatedState currentScreenDataUpdatedHandler:^(SDLTextAndGraphicState * _Nullable newScreenData, NSError * _Nullable error, SDLTextAndGraphicState *_Nullable errorScreenData) { receivedState = newScreenData; receivedError = error; } updateCompletionHandler:nil]; @@ -1266,7 +1266,7 @@ describe(@"the text and graphic operation", ^{ updatedState = [[SDLTextAndGraphicState alloc] init]; updatedState.templateConfig = newConfiguration; updatedState.textField1 = field1String; - testOp = [[SDLTextAndGraphicUpdateOperation alloc] initWithConnectionManager:testConnectionManager fileManager:mockFileManager currentCapabilities:allEnabledCapability currentScreenData:emptyCurrentData newState:updatedState currentScreenDataUpdatedHandler:^(SDLTextAndGraphicState * _Nullable newScreenData, NSError * _Nullable error) { + testOp = [[SDLTextAndGraphicUpdateOperation alloc] initWithConnectionManager:testConnectionManager fileManager:mockFileManager currentCapabilities:allEnabledCapability currentScreenData:emptyCurrentData newState:updatedState currentScreenDataUpdatedHandler:^(SDLTextAndGraphicState * _Nullable newScreenData, NSError * _Nullable error, SDLTextAndGraphicState *_Nullable errorScreenData) { receivedState = newScreenData; receivedError = error; } updateCompletionHandler:nil]; |