diff options
author | Joel Fischer <joeljfischer@gmail.com> | 2021-11-05 09:04:34 -0400 |
---|---|---|
committer | Joel Fischer <joeljfischer@gmail.com> | 2021-11-05 09:04:34 -0400 |
commit | 983dabca17485c784545bef84c7ba720388d06ca (patch) | |
tree | 2d8877c3b57fd23cdebfe03f848086dc13991e47 | |
parent | 88814f2687087f7a00de91554972b5817b9414d5 (diff) | |
download | sdl_ios-983dabca17485c784545bef84c7ba720388d06ca.tar.gz |
Fixes for tests and version numbers
3 files changed, 10 insertions, 8 deletions
diff --git a/SmartDeviceLink/private/SDLMenuReplaceOperation.m b/SmartDeviceLink/private/SDLMenuReplaceOperation.m index 91c667579..d99febe0e 100644 --- a/SmartDeviceLink/private/SDLMenuReplaceOperation.m +++ b/SmartDeviceLink/private/SDLMenuReplaceOperation.m @@ -344,8 +344,8 @@ NS_ASSUME_NONNULL_BEGIN if (cell.subCells != nil) { // If we're >= 5.0 && < 7.0, but don't have command icon image, no icon. If we're < 5.0 || >= 7.0 and don't have submenu icon, no icon. if (![windowCapability hasImageFieldOfName:SDLImageFieldNameSubMenuIcon] - || ([[SDLGlobals sharedGlobals].rpcVersion isGreaterThanOrEqualToVersion:[SDLVersion versionWithString:@"5.0"]] - && [[SDLGlobals sharedGlobals].rpcVersion isLessThanVersion:[SDLVersion versionWithString:@"7.0"]] + || ([[SDLGlobals sharedGlobals].rpcVersion isGreaterThanOrEqualToVersion:[SDLVersion versionWithMajor:5 minor:0 patch:0]] + && [[SDLGlobals sharedGlobals].rpcVersion isLessThanVersion:[SDLVersion versionWithMajor:7 minor:0 patch:0]] && ![windowCapability hasImageFieldOfName:SDLImageFieldNameCommandIcon])) { cell.icon = nil; } diff --git a/SmartDeviceLinkTests/DevAPISpecs/SDLMenuReplaceUtilitiesSpec.m b/SmartDeviceLinkTests/DevAPISpecs/SDLMenuReplaceUtilitiesSpec.m index 3290bc5d2..dc0abb1f6 100644 --- a/SmartDeviceLinkTests/DevAPISpecs/SDLMenuReplaceUtilitiesSpec.m +++ b/SmartDeviceLinkTests/DevAPISpecs/SDLMenuReplaceUtilitiesSpec.m @@ -129,15 +129,15 @@ describe(@"finding all artworks from cells", ^{ beforeEach(^{ mockFileManager = OCMClassMock([SDLFileManager class]); testWindowCapability = [[SDLWindowCapability alloc] init]; - testWindowCapability.imageFields = @[[[SDLImageField alloc] initWithName:SDLImageFieldNameCommandIcon imageTypeSupported:@[SDLImageTypeDynamic] imageResolution:nil]]; [SDLGlobals sharedGlobals].rpcVersion = [SDLVersion versionWithString:@"8.0.0"]; }); - context(@"when checking a submenu cell artwork on RPC 5.0–7.0 without the submenu image field", ^{ + context(@"when checking a submenu cell artwork on RPC 5.0–7.0 without the submenu image field but with the command image field", ^{ beforeEach(^{ OCMStub([mockFileManager fileNeedsUpload:[OCMArg any]]).andReturn(YES); OCMStub([mockFileManager hasUploadedFile:[OCMArg any]]).andReturn(YES); [SDLGlobals sharedGlobals].rpcVersion = [SDLVersion versionWithString:@"6.0.0"]; + testWindowCapability.imageFields = @[allSupportedImageFields[0]]; }); it(@"should include the submenu primary artwork", ^{ @@ -154,6 +154,7 @@ describe(@"finding all artworks from cells", ^{ context(@"when the window capability doesn't support the primary image", ^{ beforeEach(^{ testWindowCapability.textFields = allSupportedTextFields; + testWindowCapability.imageFields = @[]; }); it(@"should return an empty list of artworks to upload", ^{ @@ -172,7 +173,7 @@ describe(@"finding all artworks from cells", ^{ it(@"should only return primary images to upload", ^{ NSArray<SDLArtwork *> *artworksToUpload = [SDLMenuReplaceUtilities findAllArtworksToBeUploadedFromCells:SDLMenuReplaceUtilitiesSpecHelpers.topLevelOnlyMenu fileManager:mockFileManager windowCapability:testWindowCapability]; - expect(artworksToUpload).to(haveCount(2)); + expect(artworksToUpload).to(haveCount(1)); }); }); @@ -287,6 +288,7 @@ describe(@"generating RPCs", ^{ mockFileManager = OCMClassMock([SDLFileManager class]); OCMStub([mockFileManager hasUploadedFile:[OCMArg any]]).andReturn(YES); testWindowCapability = [[SDLWindowCapability alloc] init]; + testWindowCapability.imageFields = @[[[SDLImageField alloc] initWithName:SDLImageFieldNameCommandIcon imageTypeSupported:@[SDLImageTypeDynamic] imageResolution:nil]]; }); context(@"delete commands", ^{ @@ -361,7 +363,7 @@ describe(@"generating RPCs", ^{ [SDLGlobals sharedGlobals].rpcVersion = [SDLVersion versionWithString:@"6.0.0"]; }); - fit(@"should generate the correct RPCs", ^{ + it(@"should generate the correct RPCs", ^{ NSArray<SDLRPCRequest *> *requests = [SDLMenuReplaceUtilities mainMenuCommandsForCells:testMenuCells fileManager:mockFileManager usingPositionsFromFullMenu:testMenuCells windowCapability:testWindowCapability defaultSubmenuLayout:testMenuLayout]; expect(requests).to(haveCount(3)); expect(requests[0]).to(beAnInstanceOf(SDLAddSubMenu.class)); diff --git a/SmartDeviceLinkTests/SDLSystemCapabilityManagerSpec.m b/SmartDeviceLinkTests/SDLSystemCapabilityManagerSpec.m index 681e074b5..613030611 100644 --- a/SmartDeviceLinkTests/SDLSystemCapabilityManagerSpec.m +++ b/SmartDeviceLinkTests/SDLSystemCapabilityManagerSpec.m @@ -699,8 +699,8 @@ describe(@"a system capability manager", ^{ it(@"should should save the capabilities", ^{ // All the text fields and image fields should be available - expect(testSystemCapabilityManager.defaultMainWindowCapability.textFields).to(haveCount(31)); - expect(testSystemCapabilityManager.defaultMainWindowCapability.imageFields).to(haveCount(14)); + expect(testSystemCapabilityManager.defaultMainWindowCapability.textFields).to(haveCount(38)); + expect(testSystemCapabilityManager.defaultMainWindowCapability.imageFields).to(haveCount(18)); }); }); }); |