diff options
author | Joel Fischer <joeljfischer@gmail.com> | 2018-07-02 14:37:25 -0400 |
---|---|---|
committer | Joel Fischer <joeljfischer@gmail.com> | 2018-07-02 14:39:27 -0400 |
commit | 906c99ab2e621e9e710ad0cdf57eaab8d2d7fe24 (patch) | |
tree | 3adeee85ac43ae5b80cea2e99858d238b97c7bb1 | |
parent | ca85a83380c5bf50bceed18e43fbe64460a2e3fe (diff) | |
download | sdl_ios-906c99ab2e621e9e710ad0cdf57eaab8d2d7fe24.tar.gz |
Fix tests
-rw-r--r-- | SmartDeviceLink/SDLSoftButtonManager.m | 6 | ||||
-rw-r--r-- | SmartDeviceLinkTests/DevAPISpecs/SDLSoftButtonManagerSpec.m | 34 |
2 files changed, 20 insertions, 20 deletions
diff --git a/SmartDeviceLink/SDLSoftButtonManager.m b/SmartDeviceLink/SDLSoftButtonManager.m index 204838bf1..95158b117 100644 --- a/SmartDeviceLink/SDLSoftButtonManager.m +++ b/SmartDeviceLink/SDLSoftButtonManager.m @@ -116,12 +116,12 @@ NS_ASSUME_NONNULL_BEGIN } } - _softButtonObjects = softButtonObjects; - - for (SDLSoftButtonObject *button in _softButtonObjects) { + for (SDLSoftButtonObject *button in softButtonObjects) { button.manager = self; } + _softButtonObjects = softButtonObjects; + [self updateWithCompletionHandler:nil]; } diff --git a/SmartDeviceLinkTests/DevAPISpecs/SDLSoftButtonManagerSpec.m b/SmartDeviceLinkTests/DevAPISpecs/SDLSoftButtonManagerSpec.m index 7eaad7142..17be53b19 100644 --- a/SmartDeviceLinkTests/DevAPISpecs/SDLSoftButtonManagerSpec.m +++ b/SmartDeviceLinkTests/DevAPISpecs/SDLSoftButtonManagerSpec.m @@ -24,23 +24,23 @@ @interface SDLSoftButtonManager() +@property (strong, nonatomic) NSArray<SDLSoftButton *> *currentSoftButtons; + @property (weak, nonatomic) id<SDLConnectionManagerType> connectionManager; @property (weak, nonatomic) SDLFileManager *fileManager; -@property (strong, nonatomic) NSArray<SDLSoftButton *> *currentSoftButtons; - @property (strong, nonatomic, nullable) SDLShow *inProgressUpdate; @property (copy, nonatomic, nullable) SDLSoftButtonUpdateCompletionHandler inProgressHandler; -@property (strong, nonatomic, nullable) SDLShow *queuedImageUpdate; @property (assign, nonatomic) BOOL hasQueuedUpdate; @property (copy, nonatomic, nullable) SDLSoftButtonUpdateCompletionHandler queuedUpdateHandler; -@property (strong, nonatomic, nullable) SDLHMILevel currentLevel; -@property (assign, nonatomic) BOOL waitingOnHMILevelUpdateToSetButtons; +@property (copy, nonatomic, nullable) SDLHMILevel currentLevel; @property (strong, nonatomic, nullable) SDLDisplayCapabilities *displayCapabilities; @property (strong, nonatomic, nullable) SDLSoftButtonCapabilities *softButtonCapabilities; +@property (assign, nonatomic) BOOL waitingOnHMILevelUpdateToUpdate; + @end QuickSpecBegin(SDLSoftButtonManagerSpec) @@ -91,22 +91,22 @@ describe(@"a soft button manager", ^{ expect(testManager.hasQueuedUpdate).to(beFalse()); expect(testManager.displayCapabilities).to(beNil()); expect(testManager.softButtonCapabilities).to(beNil()); - expect(testManager.waitingOnHMILevelUpdateToSetButtons).to(beFalse()); + expect(testManager.waitingOnHMILevelUpdateToUpdate).to(beFalse()); }); context(@"when in HMI NONE", ^{ beforeEach(^{ testManager.currentLevel = SDLHMILevelNone; - NSString *sameName = @"Same name"; - testObject1 = [[SDLSoftButtonObject alloc] initWithName:sameName states:@[object1State1, object1State2] initialStateName:object1State1Name handler:nil]; - testObject2 = [[SDLSoftButtonObject alloc] initWithName:sameName state:object2State1 handler:nil]; + testObject1 = [[SDLSoftButtonObject alloc] initWithName:@"name1" states:@[object1State1, object1State2] initialStateName:object1State1Name handler:nil]; + testObject2 = [[SDLSoftButtonObject alloc] initWithName:@"name2" state:object2State1 handler:nil]; testManager.softButtonObjects = @[testObject1, testObject2]; }); - it(@"should not set the soft buttons", ^{ - expect(testManager.waitingOnHMILevelUpdateToSetButtons).to(beTrue()); + it(@"should set the soft buttons, but not update", ^{ + expect(testManager.softButtonObjects).toNot(beEmpty()); + expect(testManager.waitingOnHMILevelUpdateToUpdate).to(beTrue()); expect(testManager.inProgressUpdate).to(beNil()); }); }); @@ -115,15 +115,15 @@ describe(@"a soft button manager", ^{ beforeEach(^{ testManager.currentLevel = nil; - NSString *sameName = @"Same name"; - testObject1 = [[SDLSoftButtonObject alloc] initWithName:sameName states:@[object1State1, object1State2] initialStateName:object1State1Name handler:nil]; - testObject2 = [[SDLSoftButtonObject alloc] initWithName:sameName state:object2State1 handler:nil]; + testObject1 = [[SDLSoftButtonObject alloc] initWithName:@"name1" states:@[object1State1, object1State2] initialStateName:object1State1Name handler:nil]; + testObject2 = [[SDLSoftButtonObject alloc] initWithName:@"name2" state:object2State1 handler:nil]; testManager.softButtonObjects = @[testObject1, testObject2]; }); - it(@"should not set the soft buttons", ^{ - expect(testManager.waitingOnHMILevelUpdateToSetButtons).to(beTrue()); + it(@"should set the soft buttons, but not update", ^{ + expect(testManager.softButtonObjects).toNot(beEmpty()); + expect(testManager.waitingOnHMILevelUpdateToUpdate).to(beTrue()); expect(testManager.inProgressUpdate).to(beNil()); }); }); @@ -359,7 +359,7 @@ describe(@"a soft button manager", ^{ expect(testManager.currentLevel).to(beNil()); expect(testManager.displayCapabilities).to(beNil()); expect(testManager.softButtonCapabilities).to(beNil()); - expect(testManager.waitingOnHMILevelUpdateToSetButtons).to(beFalse()); + expect(testManager.waitingOnHMILevelUpdateToUpdate).to(beFalse()); }); }); }); |