summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoel Fischer <joeljfischer@gmail.com>2020-08-24 11:11:27 -0400
committerJoel Fischer <joeljfischer@gmail.com>2020-08-24 11:11:27 -0400
commit0401683660022846d58a83639defd3508227bf8f (patch)
treeec288c7cfda43aeda3ee8aad50db154ae1f91b1b
parent7e23021802d3749fb1864e0caa5ce9a76b2d0174 (diff)
downloadsdl_ios-0401683660022846d58a83639defd3508227bf8f.tar.gz
Fix bugs in text and graphic operation
* Fix update handler not being sent if the handler was cancelled before starting * Fix update not being queued if an update is already queued * Fix a focus on a test
-rw-r--r--SmartDeviceLink/SDLTextAndGraphicManager.m2
-rw-r--r--SmartDeviceLink/SDLTextAndGraphicUpdateOperation.m9
-rw-r--r--SmartDeviceLinkTests/DevAPISpecs/SDLTextAndGraphicManagerSpec.m2
3 files changed, 8 insertions, 5 deletions
diff --git a/SmartDeviceLink/SDLTextAndGraphicManager.m b/SmartDeviceLink/SDLTextAndGraphicManager.m
index 2633497fd..1be655481 100644
--- a/SmartDeviceLink/SDLTextAndGraphicManager.m
+++ b/SmartDeviceLink/SDLTextAndGraphicManager.m
@@ -159,8 +159,6 @@ NS_ASSUME_NONNULL_BEGIN
if (self.transactionQueue.operationCount > 0) {
SDLLogV(@"Transactions already exist, cancelling them");
[self.transactionQueue cancelAllOperations];
-
- return;
}
__weak typeof(self) weakSelf = self;
diff --git a/SmartDeviceLink/SDLTextAndGraphicUpdateOperation.m b/SmartDeviceLink/SDLTextAndGraphicUpdateOperation.m
index d18727052..9f0b636b1 100644
--- a/SmartDeviceLink/SDLTextAndGraphicUpdateOperation.m
+++ b/SmartDeviceLink/SDLTextAndGraphicUpdateOperation.m
@@ -10,6 +10,7 @@
#import "SDLArtwork.h"
#import "SDLConnectionManagerType.h"
+#import "SDLError.h"
#import "SDLFileManager.h"
#import "SDLImage.h"
#import "SDLLogMacros.h"
@@ -52,12 +53,16 @@
- (void)start {
[super start];
- if (self.cancelled) { return; }
+ if (self.cancelled) {
+ // Make sure the update handler is called
+ self.internalError = [NSError sdl_textAndGraphicManager_pendingUpdateSuperseded];
+ [self finishOperation];
+ return;
+ }
// Build a show with everything from `self.newState`, we'll pull things out later if we can.
SDLShow *fullShow = [[SDLShow alloc] init];
fullShow.alignment = self.updatedState.alignment;
- fullShow.metadataTags = [[SDLMetadataTags alloc] init];
fullShow = [self sdl_assembleShowText:fullShow];
fullShow = [self sdl_assembleShowImages:fullShow];
diff --git a/SmartDeviceLinkTests/DevAPISpecs/SDLTextAndGraphicManagerSpec.m b/SmartDeviceLinkTests/DevAPISpecs/SDLTextAndGraphicManagerSpec.m
index 825cb57a9..c9f58ce27 100644
--- a/SmartDeviceLinkTests/DevAPISpecs/SDLTextAndGraphicManagerSpec.m
+++ b/SmartDeviceLinkTests/DevAPISpecs/SDLTextAndGraphicManagerSpec.m
@@ -374,7 +374,7 @@ describe(@"text and graphic manager", ^{
testManager.textField4Type = line4Type;
});
- fit(@"should wait until batching ends to create an update operation", ^{
+ it(@"should wait until batching ends to create an update operation", ^{
expect(testManager.transactionQueue.operationCount).to(equal(0));
testManager.batchUpdates = NO;