Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Primary graphic now sent on reconnects #963

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion SmartDeviceLink/SDLMenuManager.m
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ - (void)stop {
_menuCells = @[];
_oldMenuCells = @[];

_currentHMILevel = SDLHMILevelNone;
_currentHMILevel = nil;
_currentSystemContext = SDLSystemContextMain;
_displayCapabilities = nil;
_inProgressUpdate = nil;
Expand Down
4 changes: 2 additions & 2 deletions SmartDeviceLink/SDLSoftButtonManager.m
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ - (instancetype)initWithConnectionManager:(id<SDLConnectionManagerType>)connecti
_fileManager = fileManager;
_softButtonObjects = @[];

_currentLevel = SDLHMILevelNone; // Assume NONE until we get something else
_currentLevel = nil;
_waitingOnHMILevelUpdateToSetButtons = NO;

[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(sdl_registerResponse:) name:SDLDidReceiveRegisterAppInterfaceResponse object:nil];
Expand All @@ -82,7 +82,7 @@ - (void)stop {
_inProgressHandler = nil;
_hasQueuedUpdate = NO;
_queuedUpdateHandler = nil;
_currentLevel = SDLHMILevelNone;
_currentLevel = nil;
_displayCapabilities = nil;
_softButtonCapabilities = nil;
_waitingOnHMILevelUpdateToSetButtons = NO;
Expand Down
1 change: 1 addition & 0 deletions SmartDeviceLink/SDLTextAndGraphicManager.m
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ - (void)stop {
_textField3Type = nil;
_textField4Type = nil;

_currentScreenData = [[SDLShow alloc] init];
_inProgressUpdate = nil;
_inProgressHandler = nil;
_queuedImageUpdate = nil;
Expand Down
2 changes: 1 addition & 1 deletion SmartDeviceLink/SDLVoiceCommandManager.m
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ - (void)stop {
_oldVoiceCommands = @[];

_waitingOnHMIUpdate = NO;
_currentHMILevel = SDLHMILevelNone;
_currentHMILevel = nil;
_inProgressUpdate = nil;
_hasQueuedUpdate = NO;
}
Expand Down
22 changes: 22 additions & 0 deletions SmartDeviceLinkTests/DevAPISpecs/SDLMenuManagerSpec.m
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ @interface SDLMenuManager()
expect(testManager.waitingOnHMIUpdate).to(beFalse());
expect(testManager.lastMenuId).to(equal(1));
expect(testManager.oldMenuCells).to(beEmpty());
expect(testManager.waitingUpdateMenuCells).to(beNil());
});

describe(@"updating menu cells before HMI is ready", ^{
Expand Down Expand Up @@ -310,6 +311,27 @@ @interface SDLMenuManager()
});
});

context(@"On disconnects", ^{
beforeEach(^{
[testManager stop];
});

it(@"should reset correctly", ^{
expect(testManager.connectionManager).to(equal(mockConnectionManager));
expect(testManager.fileManager).to(equal(mockFileManager));

expect(testManager.menuCells).to(beEmpty());
expect(testManager.currentHMILevel).to(beNil());
expect(testManager.displayCapabilities).to(beNil());
expect(testManager.inProgressUpdate).to(beNil());
expect(testManager.hasQueuedUpdate).to(beFalse());
expect(testManager.waitingOnHMIUpdate).to(beFalse());
expect(testManager.lastMenuId).to(equal(1));
expect(testManager.oldMenuCells).to(beEmpty());
expect(testManager.waitingUpdateMenuCells).to(beEmpty());
});
});

afterEach(^{
testManager = nil;
});
Expand Down
37 changes: 37 additions & 0 deletions SmartDeviceLinkTests/DevAPISpecs/SDLSoftButtonManagerSpec.m
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ @interface SDLSoftButtonObject()

@interface SDLSoftButtonManager()

@property (weak, nonatomic) id<SDLConnectionManagerType> connectionManager;
@property (weak, nonatomic) SDLFileManager *fileManager;

@property (strong, nonatomic) NSArray<SDLSoftButton *> *currentSoftButtons;

@property (strong, nonatomic, nullable) SDLShow *inProgressUpdate;
Expand Down Expand Up @@ -74,9 +77,23 @@ @interface SDLSoftButtonManager()

testManager = [[SDLSoftButtonManager alloc] initWithConnectionManager:testConnectionManager fileManager:testFileManager];

expect(testManager.currentLevel).to(beNil());
testManager.currentLevel = SDLHMILevelFull;
});

it(@"should instantiate correctly", ^{
expect(testManager.connectionManager).to(equal(testConnectionManager));
expect(testManager.fileManager).to(equal(testFileManager));

expect(testManager.softButtonObjects).to(beEmpty());
expect(testManager.currentMainField1).to(beNil());
expect(testManager.inProgressUpdate).to(beNil());
expect(testManager.hasQueuedUpdate).to(beFalse());
expect(testManager.displayCapabilities).to(beNil());
expect(testManager.softButtonCapabilities).to(beNil());
expect(testManager.waitingOnHMILevelUpdateToSetButtons).to(beFalse());
});

context(@"when in HMI NONE", ^{
beforeEach(^{
testManager.currentLevel = SDLHMILevelNone;
Expand Down Expand Up @@ -325,6 +342,26 @@ @interface SDLSoftButtonManager()
expect(testManager.inProgressUpdate.softButtons[1].text).to(equal(object2State1Text));
});
});

context(@"On disconnects", ^{
beforeEach(^{
[testManager stop];
});

it(@"should reset correctly", ^{
expect(testManager.connectionManager).to(equal(testConnectionManager));
expect(testManager.fileManager).to(equal(testFileManager));

expect(testManager.softButtonObjects).to(beEmpty());
expect(testManager.currentMainField1).to(beNil());
expect(testManager.inProgressUpdate).to(beNil());
expect(testManager.hasQueuedUpdate).to(beFalse());
expect(testManager.currentLevel).to(beNil());
expect(testManager.displayCapabilities).to(beNil());
expect(testManager.softButtonCapabilities).to(beNil());
expect(testManager.waitingOnHMILevelUpdateToSetButtons).to(beFalse());
});
});
});

QuickSpecEnd
46 changes: 46 additions & 0 deletions SmartDeviceLinkTests/DevAPISpecs/SDLTextAndGraphicManagerSpec.m
Original file line number Diff line number Diff line change
Expand Up @@ -53,17 +53,30 @@ @interface SDLTextAndGraphicManager()
});

it(@"should instantiate correctly", ^{
expect(testManager.connectionManager).to(equal(mockConnectionManager));
expect(testManager.fileManager).to(equal(mockFileManager));

expect(testManager.textField1).to(beNil());
expect(testManager.textField2).to(beNil());
expect(testManager.textField3).to(beNil());
expect(testManager.textField4).to(beNil());
expect(testManager.mediaTrackTextField).to(beNil());
expect(testManager.primaryGraphic).to(beNil());
expect(testManager.secondaryGraphic).to(beNil());
expect(testManager.alignment).to(equal(SDLTextAlignmentCenter));
expect(testManager.textField1Type).to(beNil());
expect(testManager.textField2Type).to(beNil());
expect(testManager.textField3Type).to(beNil());
expect(testManager.textField4Type).to(beNil());

expect(testManager.currentScreenData).to(equal([[SDLShow alloc] init]));
expect(testManager.inProgressUpdate).to(beNil());
expect(testManager.queuedImageUpdate).to(beNil());
expect(testManager.hasQueuedUpdate).to(beFalse());
expect(testManager.displayCapabilities).to(beNil());
expect(testManager.currentLevel).to(equal(SDLHMILevelNone));
expect(testManager.blankArtwork).toNot(beNil());
expect(testManager.isDirty).to(beFalse());
});

describe(@"setting setters", ^{
Expand Down Expand Up @@ -706,6 +719,39 @@ @interface SDLTextAndGraphicManager()
});
});
});

context(@"On disconnects", ^{
beforeEach(^{
[testManager stop];
});

it(@"should reset correctly", ^{
expect(testManager.connectionManager).to(equal(mockConnectionManager));
expect(testManager.fileManager).to(equal(mockFileManager));

expect(testManager.textField1).to(beNil());
expect(testManager.textField2).to(beNil());
expect(testManager.textField3).to(beNil());
expect(testManager.textField4).to(beNil());
expect(testManager.mediaTrackTextField).to(beNil());
expect(testManager.primaryGraphic).to(beNil());
expect(testManager.secondaryGraphic).to(beNil());
expect(testManager.alignment).to(equal(SDLTextAlignmentCenter));
expect(testManager.textField1Type).to(beNil());
expect(testManager.textField2Type).to(beNil());
expect(testManager.textField3Type).to(beNil());
expect(testManager.textField4Type).to(beNil());

expect(testManager.currentScreenData).to(equal([[SDLShow alloc] init]));
expect(testManager.inProgressUpdate).to(beNil());
expect(testManager.queuedImageUpdate).to(beNil());
expect(testManager.hasQueuedUpdate).to(beFalse());
expect(testManager.displayCapabilities).to(beNil());
expect(testManager.currentLevel).to(equal(SDLHMILevelNone));
expect(testManager.blankArtwork).toNot(beNil());
expect(testManager.isDirty).to(beFalse());
});
});
});

QuickSpecEnd
21 changes: 21 additions & 0 deletions SmartDeviceLinkTests/DevAPISpecs/SDLVoiceCommandManagerSpec.m
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ @interface SDLVoiceCommandManager()
});

it(@"should instantiate correctly", ^{
expect(testManager.connectionManager).to(equal(mockConnectionManager));

expect(testManager.voiceCommands).to(beEmpty());
expect(testManager.connectionManager).to(equal(mockConnectionManager));
expect(testManager.currentHMILevel).to(beNil());
Expand Down Expand Up @@ -118,6 +120,25 @@ @interface SDLVoiceCommandManager()
});
});
});

context(@"On disconnects", ^{
beforeEach(^{
[testManager stop];
});

it(@"should reset correctly", ^{
expect(testManager.connectionManager).to(equal(mockConnectionManager));

expect(testManager.voiceCommands).to(beEmpty());
expect(testManager.connectionManager).to(equal(mockConnectionManager));
expect(testManager.currentHMILevel).to(beNil());
expect(testManager.inProgressUpdate).to(beNil());
expect(testManager.hasQueuedUpdate).to(beFalse());
expect(testManager.waitingOnHMIUpdate).to(beFalse());
expect(testManager.lastVoiceCommandId).to(equal(VoiceCommandIdMin));
expect(testManager.oldVoiceCommands).to(beEmpty());
});
});
});

QuickSpecEnd