summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicoleYarroch <nicole@livio.io>2019-06-05 11:21:34 -0400
committerNicoleYarroch <nicole@livio.io>2019-06-05 11:21:34 -0400
commitdd9bb6f799c0cf438c1e58ba65e8ffd31621f614 (patch)
treea751a12d65c41a28161d949c36d84e65766a887a
parentb7f13d11037bb29a213fc07036489c97d897ce36 (diff)
downloadsdl_ios-bugfix/issue_1294_softbutton_finish_operation_not_called.tar.gz
-rw-r--r--SmartDeviceLinkTests/SDLSoftButtonReplaceOperationSpec.m40
1 files changed, 40 insertions, 0 deletions
diff --git a/SmartDeviceLinkTests/SDLSoftButtonReplaceOperationSpec.m b/SmartDeviceLinkTests/SDLSoftButtonReplaceOperationSpec.m
index 2c8de460f..8b162d283 100644
--- a/SmartDeviceLinkTests/SDLSoftButtonReplaceOperationSpec.m
+++ b/SmartDeviceLinkTests/SDLSoftButtonReplaceOperationSpec.m
@@ -52,6 +52,13 @@ describe(@"a soft button replace operation", ^{
__block SDLSoftButtonState *object3State1 = nil;
__block SDLSoftButtonObject *button3 = nil;
+ __block NSString *object4Name = @"O4 Name";
+ __block NSString *object4State1Name = @"O4S1 Name";
+ __block NSString *object4State1IconName = SDLStaticIconNameAlbum;
+ __block SDLArtwork *object4State1Art = nil;
+ __block SDLSoftButtonState *object4State1 = nil;
+ __block SDLSoftButtonObject *button4 = nil;
+
__block NSString *testMainField1 = @"Test main field 1";
beforeEach(^{
@@ -73,6 +80,10 @@ describe(@"a soft button replace operation", ^{
object3State1 = [[SDLSoftButtonState alloc] initWithStateName:object3State1Name text:object3State1Text artwork:object3State1Art];
button3 = [[SDLSoftButtonObject alloc] initWithName:object3Name state:object3State1 handler:^(SDLOnButtonPress * _Nullable buttonPress, SDLOnButtonEvent * _Nullable buttonEvent) {}];
+ object4State1Art = [[SDLArtwork alloc] initWithStaticIcon:object4State1IconName];
+ object4State1 = [[SDLSoftButtonState alloc] initWithStateName:object4State1Name text:nil artwork:object4State1Art];;
+ button4 = [[SDLSoftButtonObject alloc] initWithName:object4Name state:object4State1 handler:^(SDLOnButtonPress * _Nullable buttonPress, SDLOnButtonEvent * _Nullable buttonEvent) {}];;
+
OCMStub([testFileManager uploadArtworks:[OCMArg any] progressHandler:[OCMArg invokeBlock] completionHandler:[OCMArg invokeBlock]]);
});
@@ -139,6 +150,35 @@ describe(@"a soft button replace operation", ^{
});
});
+ context(@"but we don't support artworks and some buttons are image-only", ^{
+ __block NSArray<SDLSoftButtonObject *> *testImageOnlySoftButtonObjects = nil;
+
+ beforeEach(^{
+ testImageOnlySoftButtonObjects = @[button3, button4];
+ });
+
+ beforeEach(^{
+ SDLSoftButtonCapabilities *capabilities = [[SDLSoftButtonCapabilities alloc] init];
+ capabilities.imageSupported = @NO;
+
+ testOp = [[SDLSoftButtonReplaceOperation alloc] initWithConnectionManager:testConnectionManager fileManager:testFileManager capabilities:capabilities softButtonObjects:testImageOnlySoftButtonObjects mainField1:testMainField1];
+ [testOp start];
+ });
+
+ it(@"should not send artworks", ^{
+ OCMReject([testFileManager uploadArtworks:[OCMArg any] completionHandler:[OCMArg any]]);
+ });
+
+ it(@"should not send any buttons", ^{
+ NSArray<SDLShow *> *sentRequests = testConnectionManager.receivedRequests;
+ expect(sentRequests).to(haveCount(0));
+ });
+
+ it(@"should have set the operation to finished", ^ {
+ expect(testOp.isFinished).to(beTrue());
+ });
+ });
+
context(@"and we support artworks", ^{
__block SDLSoftButtonCapabilities *buttonCapabilities = nil;