summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoel Fischer <joeljfischer@gmail.com>2021-08-10 13:08:18 -0400
committerJoel Fischer <joeljfischer@gmail.com>2021-08-10 13:08:18 -0400
commitdf856a454990e5ffdcb3f7bb8a14c9d53373e3fc (patch)
tree7d9b9327c8a19c35322880b85485ccee5c4acf70
parent63e70a946890fb119ee02ef62606fd40730c6f5c (diff)
downloadsdl_ios-df856a454990e5ffdcb3f7bb8a14c9d53373e3fc.tar.gz
Finish menu replace tests
-rw-r--r--SmartDeviceLink/private/SDLMenuReplaceOperation.m6
-rw-r--r--SmartDeviceLink/private/SDLMenuReplaceUtilities.h4
-rw-r--r--SmartDeviceLink/private/SDLMenuReplaceUtilities.m10
-rw-r--r--SmartDeviceLinkTests/DevAPISpecs/SDLMenuReplaceUtilitiesSpec.m170
-rw-r--r--SmartDeviceLinkTests/DevAPISpecs/SDLMenuReplaceUtilitiesSpecHelpers.h4
-rw-r--r--SmartDeviceLinkTests/DevAPISpecs/SDLMenuReplaceUtilitiesSpecHelpers.m72
6 files changed, 219 insertions, 47 deletions
diff --git a/SmartDeviceLink/private/SDLMenuReplaceOperation.m b/SmartDeviceLink/private/SDLMenuReplaceOperation.m
index a47e9f1c1..b15663695 100644
--- a/SmartDeviceLink/private/SDLMenuReplaceOperation.m
+++ b/SmartDeviceLink/private/SDLMenuReplaceOperation.m
@@ -222,7 +222,7 @@ NS_ASSUME_NONNULL_BEGIN
} else if (response.success.boolValue) {
// Find the id of the successful request and remove it from the current menu list wherever it may have been
UInt32 commandId = [SDLMenuReplaceUtilities commandIdForRPCRequest:request];
- [SDLMenuReplaceUtilities removeMenuCellFromList:self.mutableCurrentMenu withCmdId:commandId];
+ [SDLMenuReplaceUtilities removeCellFromList:self.mutableCurrentMenu withCellId:commandId];
}
} completionHandler:^(BOOL success) {
if (!success) {
@@ -257,7 +257,7 @@ NS_ASSUME_NONNULL_BEGIN
// Find the id of the successful request and add it from the current menu list wherever it needs to be
UInt32 commandId = [SDLMenuReplaceUtilities commandIdForRPCRequest:request];
UInt16 position = [SDLMenuReplaceUtilities positionForRPCRequest:request];
- [SDLMenuReplaceUtilities addMenuRequestWithCommandId:commandId position:position fromNewMenuList:newMenuCells toMainMenuList:weakSelf.mutableCurrentMenu];
+ [SDLMenuReplaceUtilities addCellWithCellId:commandId position:position fromNewMenuList:newMenuCells toMainMenuList:weakSelf.mutableCurrentMenu];
}
} completionHandler:^(BOOL success) {
if (!success) {
@@ -272,7 +272,7 @@ NS_ASSUME_NONNULL_BEGIN
// Find the id of the successful request and add it from the current menu list wherever it needs to be
UInt32 commandId = [SDLMenuReplaceUtilities commandIdForRPCRequest:request];
UInt16 position = [SDLMenuReplaceUtilities positionForRPCRequest:request];
- [SDLMenuReplaceUtilities addMenuRequestWithCommandId:commandId position:position fromNewMenuList:newMenuCells toMainMenuList:weakSelf.mutableCurrentMenu];
+ [SDLMenuReplaceUtilities addCellWithCellId:commandId position:position fromNewMenuList:newMenuCells toMainMenuList:weakSelf.mutableCurrentMenu];
}
} completionHandler:^(BOOL success) {
if (!success) {
diff --git a/SmartDeviceLink/private/SDLMenuReplaceUtilities.h b/SmartDeviceLink/private/SDLMenuReplaceUtilities.h
index 239fb5623..c90845382 100644
--- a/SmartDeviceLink/private/SDLMenuReplaceUtilities.h
+++ b/SmartDeviceLink/private/SDLMenuReplaceUtilities.h
@@ -64,7 +64,7 @@ NS_ASSUME_NONNULL_BEGIN
/// @param menuCellList The list to mutate and remove the item from
/// @param commandId The id of the cell to find and remove
/// @return YES if the cell was found and removed successfully, NO if it was not
-+ (BOOL)removeMenuCellFromList:(NSMutableArray<SDLMenuCell *> *)menuCellList withCmdId:(UInt32)commandId;
++ (BOOL)removeCellFromList:(NSMutableArray<SDLMenuCell *> *)menuCellList withCellId:(UInt32)commandId;
/// Finds a menu cell from newMenuList with the given commandId and inserts it into the main menu list (or a subcell list) at the given position
/// @param commandId The command id for the cell to be found
@@ -72,7 +72,7 @@ NS_ASSUME_NONNULL_BEGIN
/// @param newMenuList The complete requested new menu list. We will find the cell to insert from this list.
/// @param mainMenuList The mutable main menu list. The place to insert the cell will be in this list or one of its cell's subcell list (or one of it's cell's subcell's subcell's list, etc.)
/// @return YES if the cell was added successfully, NO if the cell was not
-+ (BOOL)addMenuRequestWithCommandId:(UInt32)commandId position:(UInt16)position fromNewMenuList:(NSArray<SDLMenuCell *> *)newMenuList toMainMenuList:(NSMutableArray <SDLMenuCell *> *)mainMenuList;
++ (BOOL)addCellWithCellId:(UInt32)commandId position:(UInt16)position fromNewMenuList:(NSArray<SDLMenuCell *> *)newMenuList toMainMenuList:(NSMutableArray <SDLMenuCell *> *)mainMenuList;
@end
diff --git a/SmartDeviceLink/private/SDLMenuReplaceUtilities.m b/SmartDeviceLink/private/SDLMenuReplaceUtilities.m
index 5b899eb70..3412b1b92 100644
--- a/SmartDeviceLink/private/SDLMenuReplaceUtilities.m
+++ b/SmartDeviceLink/private/SDLMenuReplaceUtilities.m
@@ -197,7 +197,7 @@
#pragma mark - Updating Menu Cells In Lists
-+ (BOOL)removeMenuCellFromList:(NSMutableArray<SDLMenuCell *> *)menuCellList withCmdId:(UInt32)commandId {
++ (BOOL)removeCellFromList:(NSMutableArray<SDLMenuCell *> *)menuCellList withCellId:(UInt32)commandId {
for (SDLMenuCell *menuCell in menuCellList) {
if (menuCell.cellId == commandId) {
// If the cell id matches the command id, remove it from the list and return
@@ -206,7 +206,7 @@
} else if (menuCell.subCells.count > 0) {
// If the menu cell has subcells, we need to recurse and check the subcells
NSMutableArray<SDLMenuCell *> *newList = [menuCell.subCells mutableCopy];
- BOOL foundAndRemovedItem = [self removeMenuCellFromList:newList withCmdId:commandId];
+ BOOL foundAndRemovedItem = [self removeCellFromList:newList withCellId:commandId];
if (foundAndRemovedItem) {
menuCell.subCells = [newList copy];
return YES;
@@ -217,14 +217,14 @@
return NO;
}
-+ (BOOL)addMenuRequestWithCommandId:(UInt32)commandId position:(UInt16)position fromNewMenuList:(NSArray<SDLMenuCell *> *)newMenuList toMainMenuList:(NSMutableArray <SDLMenuCell *> *)mainMenuList {
++ (BOOL)addCellWithCellId:(UInt32)cellId position:(UInt16)position fromNewMenuList:(NSArray<SDLMenuCell *> *)newMenuList toMainMenuList:(NSMutableArray <SDLMenuCell *> *)mainMenuList {
SDLMenuCell *addedCell = nil;
for (SDLMenuCell *cell in newMenuList) {
- if (cell.cellId == commandId) {
+ if (cell.cellId == cellId) {
addedCell = cell;
break;
} else if (cell.subCells.count > 0) {
- BOOL success = [self addMenuRequestWithCommandId:commandId position:position fromNewMenuList:cell.subCells toMainMenuList:mainMenuList];
+ BOOL success = [self addCellWithCellId:cellId position:position fromNewMenuList:cell.subCells toMainMenuList:mainMenuList];
if (success) { return YES; }
}
}
diff --git a/SmartDeviceLinkTests/DevAPISpecs/SDLMenuReplaceUtilitiesSpec.m b/SmartDeviceLinkTests/DevAPISpecs/SDLMenuReplaceUtilitiesSpec.m
index 3f5e2c2e5..fd1a19b01 100644
--- a/SmartDeviceLinkTests/DevAPISpecs/SDLMenuReplaceUtilitiesSpec.m
+++ b/SmartDeviceLinkTests/DevAPISpecs/SDLMenuReplaceUtilitiesSpec.m
@@ -20,7 +20,7 @@
QuickSpecBegin(SDLMenuReplaceUtilitiesSpec)
-__block NSArray<SDLMenuCell *> *testMenuCells = nil;
+__block NSMutableArray<SDLMenuCell *> *testMenuCells = nil;
__block SDLFileManager *mockFileManager = nil;
__block SDLWindowCapability *testWindowCapability = nil;
__block NSArray<SDLTextField *> *allSupportedTextFields = @[
@@ -261,19 +261,173 @@ describe(@"generating RPCs", ^{
// updating menu cells
describe(@"updating menu cell lists", ^{
- __block NSArray<SDLMenuCell *> *testNewMenuCells = nil;
__block UInt32 testCommandId = 0;
- // removeMenuCellFromList:withCmdId:
- describe(@"removing commands from a list", ^{
- context(@"the list only has one level", ^{
+ describe(@"removing commands", ^{
+ context(@"from a shallow list", ^{
+ beforeEach(^{
+ testMenuCells = SDLMenuReplaceUtilitiesSpecHelpers.topLevelOnlyMenu;
+ });
+
+ context(@"when the cell is in the menu", ^{
+ beforeEach(^{
+ testCommandId = testMenuCells[1].cellId;
+ });
+
+ it(@"should return the menu without the cell and return YES", ^{
+ NSMutableArray<SDLMenuCell *> *testMutableMenuCells = [testMenuCells mutableCopy];
+ BOOL foundItem = [SDLMenuReplaceUtilities removeCellFromList:testMutableMenuCells withCellId:testCommandId];
+
+ expect(foundItem).to(beTrue());
+ expect(testMutableMenuCells).to(haveCount(2));
+ expect(testMutableMenuCells[0]).to(equal(testMenuCells[0]));
+ expect(testMutableMenuCells[1]).to(equal(testMenuCells[2]));
+ });
+ });
+
+ context(@"when the cell is not in the menu", ^{
+ beforeEach(^{
+ testCommandId = 100;
+ });
+
+ it(@"should return the menu with all cells and return NO", ^{
+ NSMutableArray<SDLMenuCell *> *testMutableMenuCells = [testMenuCells mutableCopy];
+ BOOL foundItem = [SDLMenuReplaceUtilities removeCellFromList:testMutableMenuCells withCellId:testCommandId];
+
+ expect(foundItem).to(beFalse());
+ expect(testMutableMenuCells).to(haveCount(3));
+ });
+ });
+ });
+
+ context(@"from a deep list", ^{
+ beforeEach(^{
+ testMenuCells = SDLMenuReplaceUtilitiesSpecHelpers.deepMenu;
+ });
+
+ context(@"when the cell is in the top menu", ^{
+ beforeEach(^{
+ testCommandId = testMenuCells[1].cellId;
+ });
+
+ it(@"should return the menu without the cell and return YES", ^{
+ NSMutableArray<SDLMenuCell *> *testMutableMenuCells = [testMenuCells mutableCopy];
+ BOOL foundItem = [SDLMenuReplaceUtilities removeCellFromList:testMutableMenuCells withCellId:testCommandId];
+
+ expect(foundItem).to(beTrue());
+ expect(testMutableMenuCells).to(haveCount(2));
+ expect(testMutableMenuCells[0]).to(equal(testMenuCells[0]));
+ expect(testMutableMenuCells[1]).to(equal(testMenuCells[2]));
+ });
+ });
+
+ context(@"when the cell is in the submenu", ^{
+ beforeEach(^{
+ testCommandId = 5;
+ });
+
+ it(@"should return the menu without the cell and return YES", ^{
+ NSMutableArray<SDLMenuCell *> *testMutableMenuCells = [testMenuCells mutableCopy];
+ BOOL foundItem = [SDLMenuReplaceUtilities removeCellFromList:testMutableMenuCells withCellId:testCommandId];
+
+ expect(foundItem).to(beTrue());
+ expect(testMutableMenuCells).to(haveCount(3));
+ expect(testMutableMenuCells[2].subCells).to(haveCount(1));
+ });
+ });
+
+ context(@"when the cell is not in the menu", ^{
+ beforeEach(^{
+ testCommandId = 100;
+ });
+
+ it(@"should return the menu with all cells and return NO", ^{
+ NSMutableArray<SDLMenuCell *> *testMutableMenuCells = [testMenuCells mutableCopy];
+ BOOL foundItem = [SDLMenuReplaceUtilities removeCellFromList:testMutableMenuCells withCellId:testCommandId];
+ expect(foundItem).to(beFalse());
+ expect(testMutableMenuCells).to(haveCount(3));
+ expect(testMutableMenuCells[0].subCells).to(haveCount(2));
+ expect(testMutableMenuCells[2].subCells).to(haveCount(2));
+ });
+ });
});
});
- describe(@"add commands to the list", ^{
- __block NSMutableArray<SDLMenuCell *> *testMenuCells = nil;
- __block UInt16 testPosition = 0;
+ describe(@"add commands to the main list", ^{
+ __block NSMutableArray<SDLMenuCell *> *newCellList = nil;
+
+ context(@"from a shallow list", ^{
+ beforeEach(^{
+ testMenuCells = SDLMenuReplaceUtilitiesSpecHelpers.topLevelOnlyMenu;
+
+ SDLMenuCell *newCell = [[SDLMenuCell alloc] initWithTitle:@"New Cell" secondaryText:nil tertiaryText:nil icon:nil secondaryArtwork:nil voiceCommands:nil handler:^(SDLTriggerSource _Nonnull triggerSource) {}];
+ newCell.cellId = 99;
+ newCellList = [@[newCell] mutableCopy];
+ });
+
+ describe(@"if the cell is not in the cell list", ^{
+ beforeEach(^{
+ newCellList = [[NSMutableArray alloc] init];
+ });
+
+ it(@"should return NO", ^{
+ BOOL didAddCell = [SDLMenuReplaceUtilities addCellWithCellId:99 position:0 fromNewMenuList:newCellList toMainMenuList:testMenuCells];
+
+ expect(didAddCell).to(beFalse());
+ });
+ });
+
+ context(@"at the beginning", ^{
+ it(@"should return YES and the cell should be included", ^{
+ BOOL didAddCell = [SDLMenuReplaceUtilities addCellWithCellId:newCellList[0].cellId position:0 fromNewMenuList:newCellList toMainMenuList:testMenuCells];
+
+ expect(didAddCell).to(beTrue());
+ expect(testMenuCells).to(haveCount(4));
+ expect(testMenuCells[0]).to(equal(newCellList[0]));
+ });
+ });
+
+ context(@"in the middle", ^{
+ it(@"should return YES and the cell should be included", ^{
+ BOOL didAddCell = [SDLMenuReplaceUtilities addCellWithCellId:newCellList[0].cellId position:1 fromNewMenuList:newCellList toMainMenuList:testMenuCells];
+
+ expect(didAddCell).to(beTrue());
+ expect(testMenuCells).to(haveCount(4));
+ expect(testMenuCells[1]).to(equal(newCellList[0]));
+ });
+ });
+
+ context(@"at the end", ^{
+ it(@"should return YES and the cell should be included", ^{
+ BOOL didAddCell = [SDLMenuReplaceUtilities addCellWithCellId:newCellList[0].cellId position:3 fromNewMenuList:newCellList toMainMenuList:testMenuCells];
+
+ expect(didAddCell).to(beTrue());
+ expect(testMenuCells).to(haveCount(4));
+ expect(testMenuCells[3]).to(equal(newCellList[0]));
+ });
+ });
+ });
+
+ context(@"from a deep list", ^{
+ beforeEach(^{
+ testMenuCells = SDLMenuReplaceUtilitiesSpecHelpers.deepMenu;
+
+ SDLMenuCell *subCell = [[SDLMenuCell alloc] initWithTitle:@"New SubCell" secondaryText:nil tertiaryText:nil icon:nil secondaryArtwork:nil voiceCommands:nil handler:^(SDLTriggerSource _Nonnull triggerSource) {}];
+ subCell.cellId = 98;
+ SDLMenuCell *newCell = [[SDLMenuCell alloc] initWithTitle:@"New Cell" secondaryText:nil tertiaryText:nil icon:nil secondaryArtwork:nil submenuLayout:nil subCells:@[subCell]];
+ newCell.cellId = 99;
+ newCellList = [@[newCell] mutableCopy];
+ });
+
+ it(@"should properly add the subcell to the list", ^{
+ BOOL didAddCell = [SDLMenuReplaceUtilities addCellWithCellId:98 position:0 fromNewMenuList:newCellList toMainMenuList:testMenuCells];
+
+ expect(didAddCell).to(beTrue());
+ expect(testMenuCells).to(haveCount(4));
+ expect(testMenuCells[0]).to(equal(newCellList[0].subCells[0]));
+ });
+ });
});
});
diff --git a/SmartDeviceLinkTests/DevAPISpecs/SDLMenuReplaceUtilitiesSpecHelpers.h b/SmartDeviceLinkTests/DevAPISpecs/SDLMenuReplaceUtilitiesSpecHelpers.h
index 908e6b59d..7106cb567 100644
--- a/SmartDeviceLinkTests/DevAPISpecs/SDLMenuReplaceUtilitiesSpecHelpers.h
+++ b/SmartDeviceLinkTests/DevAPISpecs/SDLMenuReplaceUtilitiesSpecHelpers.h
@@ -14,8 +14,8 @@ NS_ASSUME_NONNULL_BEGIN
@interface SDLMenuReplaceUtilitiesSpecHelpers : NSObject
-@property (class, nonatomic, readonly) NSArray<SDLMenuCell *> *topLevelOnlyMenu;
-@property (class, nonatomic, readonly) NSArray<SDLMenuCell *> *deepMenu;
+@property (class, nonatomic, readonly) NSMutableArray<SDLMenuCell *> *topLevelOnlyMenu;
+@property (class, nonatomic, readonly) NSMutableArray<SDLMenuCell *> *deepMenu;
@end
diff --git a/SmartDeviceLinkTests/DevAPISpecs/SDLMenuReplaceUtilitiesSpecHelpers.m b/SmartDeviceLinkTests/DevAPISpecs/SDLMenuReplaceUtilitiesSpecHelpers.m
index 8c71d8dc5..2b9bef2b9 100644
--- a/SmartDeviceLinkTests/DevAPISpecs/SDLMenuReplaceUtilitiesSpecHelpers.m
+++ b/SmartDeviceLinkTests/DevAPISpecs/SDLMenuReplaceUtilitiesSpecHelpers.m
@@ -11,22 +11,34 @@
#import "SDLArtwork.h"
#import "SDLMenuCell.h"
+@interface SDLMenuCell()
+
+@property (assign, nonatomic) UInt32 parentCellId;
+@property (assign, nonatomic) UInt32 cellId;
+
+@end
+
@implementation SDLMenuReplaceUtilitiesSpecHelpers
-+ (NSArray<SDLMenuCell *> *)topLevelOnlyMenu {
++ (NSMutableArray<SDLMenuCell *> *)topLevelOnlyMenu {
NSData *cellArtData = [@"testart" dataUsingEncoding:NSUTF8StringEncoding];
NSData *cellArtData2 = [@"testart2" dataUsingEncoding:NSUTF8StringEncoding];
SDLArtwork *artwork1 = [[SDLArtwork alloc] initWithData:cellArtData name:@"Test Art 1" fileExtension:@"png" persistent:NO];
SDLArtwork *artwork2 = [[SDLArtwork alloc] initWithData:cellArtData2 name:@"Test Art 2" fileExtension:@"png" persistent:NO];
- return @[
- [[SDLMenuCell alloc] initWithTitle:@"Item 1" secondaryText:nil tertiaryText:nil icon:artwork1 secondaryArtwork:nil voiceCommands:nil handler:^(SDLTriggerSource _Nonnull triggerSource) {}],
- [[SDLMenuCell alloc] initWithTitle:@"Item 2" secondaryText:nil tertiaryText:nil icon:artwork1 secondaryArtwork:nil voiceCommands:nil handler:^(SDLTriggerSource _Nonnull triggerSource) {}],
- [[SDLMenuCell alloc] initWithTitle:@"Item 3" secondaryText:nil tertiaryText:nil icon:nil secondaryArtwork:artwork2 voiceCommands:nil handler:^(SDLTriggerSource _Nonnull triggerSource) {}]
- ];
+ SDLMenuCell *cell1 = [[SDLMenuCell alloc] initWithTitle:@"Item 1" secondaryText:nil tertiaryText:nil icon:artwork1 secondaryArtwork:nil voiceCommands:nil handler:^(SDLTriggerSource _Nonnull triggerSource) {}];
+ cell1.cellId = 1;
+
+ SDLMenuCell *cell2 = [[SDLMenuCell alloc] initWithTitle:@"Item 2" secondaryText:nil tertiaryText:nil icon:artwork1 secondaryArtwork:nil voiceCommands:nil handler:^(SDLTriggerSource _Nonnull triggerSource) {}];
+ cell2.cellId = 2;
+
+ SDLMenuCell *cell3 = [[SDLMenuCell alloc] initWithTitle:@"Item 3" secondaryText:nil tertiaryText:nil icon:nil secondaryArtwork:artwork2 voiceCommands:nil handler:^(SDLTriggerSource _Nonnull triggerSource) {}];
+ cell3.cellId = 3;
+
+ return [@[cell1, cell2, cell3] mutableCopy];
}
-+ (NSArray<SDLMenuCell *> *)deepMenu {
++ (NSMutableArray<SDLMenuCell *> *)deepMenu {
NSData *cellArtData = [@"testart" dataUsingEncoding:NSUTF8StringEncoding];
NSData *cellArtData2 = [@"testart2" dataUsingEncoding:NSUTF8StringEncoding];
NSData *cellArtData3 = [@"testart3" dataUsingEncoding:NSUTF8StringEncoding];
@@ -36,26 +48,32 @@
SDLArtwork *artwork3 = [[SDLArtwork alloc] initWithData:cellArtData3 name:@"Test Art 3" fileExtension:@"png" persistent:NO];
SDLArtwork *artwork4 = [[SDLArtwork alloc] initWithData:cellArtData4 name:@"Test Art 4" fileExtension:@"png" persistent:NO];
- NSArray<SDLMenuCell *> *subList1SubList1 = @[
- [[SDLMenuCell alloc] initWithTitle:@"Item 1" secondaryText:@"SubItem 1" tertiaryText:@"Sub-SubItem 1" icon:nil secondaryArtwork:artwork3 voiceCommands:nil handler:^(SDLTriggerSource _Nonnull triggerSource) {}],
- [[SDLMenuCell alloc] initWithTitle:@"Item 1" secondaryText:@"SubItem 1" tertiaryText:@"Sub-SubItem 2" icon:artwork1 secondaryArtwork:nil voiceCommands:nil handler:^(SDLTriggerSource _Nonnull triggerSource) {}]
- ];
-
- NSArray<SDLMenuCell *> *subList1 = @[
- [[SDLMenuCell alloc] initWithTitle:@"Item 1" secondaryText:@"SubItem 1" tertiaryText:nil icon:artwork4 secondaryArtwork:nil submenuLayout:nil subCells:subList1SubList1],
- [[SDLMenuCell alloc] initWithTitle:@"Item 1" secondaryText:@"SubItem 2" tertiaryText:nil icon:artwork2 secondaryArtwork:nil voiceCommands:nil handler:^(SDLTriggerSource _Nonnull triggerSource) {}]
- ];
-
- NSArray<SDLMenuCell *> *subList2 = @[
- [[SDLMenuCell alloc] initWithTitle:@"Item 2" secondaryText:@"SubItem 1" tertiaryText:nil icon:artwork1 secondaryArtwork:artwork4 voiceCommands:nil handler:^(SDLTriggerSource _Nonnull triggerSource) {}],
- [[SDLMenuCell alloc] initWithTitle:@"Item 1" secondaryText:@"SubItem 2" tertiaryText:nil icon:artwork1 secondaryArtwork:artwork2 voiceCommands:nil handler:^(SDLTriggerSource _Nonnull triggerSource) {}]
- ];
-
- return @[
- [[SDLMenuCell alloc] initWithTitle:@"Item 1" secondaryText:nil tertiaryText:nil icon:artwork1 secondaryArtwork:nil submenuLayout:nil subCells:subList1],
- [[SDLMenuCell alloc] initWithTitle:@"Item 2" secondaryText:nil tertiaryText:nil icon:nil secondaryArtwork:nil voiceCommands:nil handler:^(SDLTriggerSource _Nonnull triggerSource) {}],
- [[SDLMenuCell alloc] initWithTitle:@"Item 3" secondaryText:nil tertiaryText:nil icon:nil secondaryArtwork:nil submenuLayout:nil subCells:subList2]
- ];
+ SDLMenuCell *subList1SubList1Cell1 = [[SDLMenuCell alloc] initWithTitle:@"Item 1" secondaryText:@"SubItem 1" tertiaryText:@"Sub-SubItem 1" icon:nil secondaryArtwork:artwork3 voiceCommands:nil handler:^(SDLTriggerSource _Nonnull triggerSource) {}];
+ subList1SubList1Cell1.cellId = 1;
+ SDLMenuCell *subList1SubList1Cell2 = [[SDLMenuCell alloc] initWithTitle:@"Item 1" secondaryText:@"SubItem 1" tertiaryText:@"Sub-SubItem 2" icon:artwork1 secondaryArtwork:nil voiceCommands:nil handler:^(SDLTriggerSource _Nonnull triggerSource) {}];
+ subList1SubList1Cell2.cellId = 2;
+ NSArray<SDLMenuCell *> *subList1SubList1 = @[subList1SubList1Cell1, subList1SubList1Cell2];
+
+ SDLMenuCell *subList1Cell1 = [[SDLMenuCell alloc] initWithTitle:@"Item 1" secondaryText:@"SubItem 1" tertiaryText:nil icon:artwork4 secondaryArtwork:nil submenuLayout:nil subCells:subList1SubList1];
+ subList1Cell1.cellId = 3;
+ SDLMenuCell *subList1Cell2 = [[SDLMenuCell alloc] initWithTitle:@"Item 1" secondaryText:@"SubItem 2" tertiaryText:nil icon:artwork2 secondaryArtwork:nil voiceCommands:nil handler:^(SDLTriggerSource _Nonnull triggerSource) {}];
+ subList1Cell2.cellId = 4;
+ NSArray<SDLMenuCell *> *subList1 = @[subList1Cell1, subList1Cell2];
+
+ SDLMenuCell *subList2Cell1 = [[SDLMenuCell alloc] initWithTitle:@"Item 3" secondaryText:@"SubItem 1" tertiaryText:nil icon:artwork1 secondaryArtwork:artwork4 voiceCommands:nil handler:^(SDLTriggerSource _Nonnull triggerSource) {}];
+ subList2Cell1.cellId = 5;
+ SDLMenuCell *subList2Cell2 = [[SDLMenuCell alloc] initWithTitle:@"Item 3" secondaryText:@"SubItem 2" tertiaryText:nil icon:artwork1 secondaryArtwork:artwork2 voiceCommands:nil handler:^(SDLTriggerSource _Nonnull triggerSource) {}];
+ subList2Cell2.cellId = 6;
+ NSArray<SDLMenuCell *> *subList2 = @[subList2Cell1, subList2Cell2];
+
+ SDLMenuCell *topListCell1 = [[SDLMenuCell alloc] initWithTitle:@"Item 1" secondaryText:nil tertiaryText:nil icon:artwork1 secondaryArtwork:nil submenuLayout:nil subCells:subList1];
+ topListCell1.cellId = 7;
+ SDLMenuCell *topListCell2 = [[SDLMenuCell alloc] initWithTitle:@"Item 2" secondaryText:nil tertiaryText:nil icon:nil secondaryArtwork:nil voiceCommands:nil handler:^(SDLTriggerSource _Nonnull triggerSource) {}];
+ topListCell2.cellId = 8;
+ SDLMenuCell *topListCell3 = [[SDLMenuCell alloc] initWithTitle:@"Item 3" secondaryText:nil tertiaryText:nil icon:nil secondaryArtwork:nil submenuLayout:nil subCells:subList2];
+ topListCell3.cellId = 9;
+
+ return [@[topListCell1, topListCell2, topListCell3] mutableCopy];
}
@end