summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJustin Beharry <109764059+jshivabeharry@users.noreply.github.com>2022-08-30 16:13:48 -0400
committerGitHub <noreply@github.com>2022-08-30 16:13:48 -0400
commitc0e8c36acb61a40bcd1b0d95502e50767d85aa0d (patch)
treeac5730525bb1803a4ea8f0385859aeca5ba297d9
parenteab723bf427c2a01086e17b007a0a2656a7b2bb7 (diff)
downloadsdl_ios-c0e8c36acb61a40bcd1b0d95502e50767d85aa0d.tar.gz
Apply suggestions from code review
Co-authored-by: Joel Fischer <joeljfischer@gmail.com>
-rw-r--r--SmartDeviceLink/private/SDLTextAndGraphicUpdateOperation.m7
-rw-r--r--SmartDeviceLinkTests/DevAPISpecs/SDLTextAndGraphicManagerSpec.m8
-rw-r--r--SmartDeviceLinkTests/DevAPISpecs/SDLTextAndGraphicUpdateOperationSpec.m2
3 files changed, 10 insertions, 7 deletions
diff --git a/SmartDeviceLink/private/SDLTextAndGraphicUpdateOperation.m b/SmartDeviceLink/private/SDLTextAndGraphicUpdateOperation.m
index 51f16ade0..9e7bfc483 100644
--- a/SmartDeviceLink/private/SDLTextAndGraphicUpdateOperation.m
+++ b/SmartDeviceLink/private/SDLTextAndGraphicUpdateOperation.m
@@ -176,11 +176,10 @@ NS_ASSUME_NONNULL_BEGIN
[strongSelf sdl_updateCurrentScreenDataFromShow:request];
} else {
SDLLogD(@"Text and Graphic Show failed");
- NSDictionary *newUserInfo = @{
- @"NSUnderlyingErrorKey": error.userInfo,
+ NSError *updateError = [NSError errorWithDomain:error.domain code:error.code userInfo:@{
+ NSUnderlyingErrorKey: error.userInfo,
@"failedScreenState": self.updatedState
- };
- NSError *updateError = [NSError errorWithDomain:error.domain code:error.code userInfo:newUserInfo];
+ }];
self.currentDataUpdatedHandler(nil, updateError);
}
diff --git a/SmartDeviceLinkTests/DevAPISpecs/SDLTextAndGraphicManagerSpec.m b/SmartDeviceLinkTests/DevAPISpecs/SDLTextAndGraphicManagerSpec.m
index 18ac8e32f..53cd1161f 100644
--- a/SmartDeviceLinkTests/DevAPISpecs/SDLTextAndGraphicManagerSpec.m
+++ b/SmartDeviceLinkTests/DevAPISpecs/SDLTextAndGraphicManagerSpec.m
@@ -150,7 +150,7 @@ describe(@"text and graphic manager", ^{
testManager.textField4 = @"test4";
});
- it(@"should create indiviudal operations and not be cancelled", ^{
+ it(@"should create individual operations and not be cancelled", ^{
expect(testManager.transactionQueue.isSuspended).to(beTrue());
expect(testManager.transactionQueue.operationCount).to(equal(4));
expect(testManager.transactionQueue.operations[0].cancelled).to(beFalse());
@@ -481,12 +481,16 @@ describe(@"text and graphic manager", ^{
testManager.currentScreenData = [[SDLTextAndGraphicState alloc] init];
testManager.currentScreenData.textField1 = @"Test1";
+ // Create a "bad data" text field 1, then set it in the manager, which should create an operation (op 2)
SDLTextAndGraphicState *errorState = [[SDLTextAndGraphicState alloc] init];
errorState.textField1 = @"Bad Data";
testManager.textField1 = errorState.textField1;
+
+ // Create a "good data text field 4, which should create a second operation (op 3)
testManager.textField4 = @"Good Data";
testOperation3 = testManager.transactionQueue.operations[3];
+ // Simulate a failure of the first operation
NSDictionary *userInfo = @{
@"failedScreenState": errorState
};
@@ -495,7 +499,7 @@ describe(@"text and graphic manager", ^{
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"));
+ expect(testOperation3.updatedState.textField1).to(equal(testManager.currentScreenData.textField1));
});
});
});
diff --git a/SmartDeviceLinkTests/DevAPISpecs/SDLTextAndGraphicUpdateOperationSpec.m b/SmartDeviceLinkTests/DevAPISpecs/SDLTextAndGraphicUpdateOperationSpec.m
index 4a3ace47d..b03252c25 100644
--- a/SmartDeviceLinkTests/DevAPISpecs/SDLTextAndGraphicUpdateOperationSpec.m
+++ b/SmartDeviceLinkTests/DevAPISpecs/SDLTextAndGraphicUpdateOperationSpec.m
@@ -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) {
updatedData = newScreenData;
} updateCompletionHandler:nil];
[testOp start];