summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoel Fischer <joeljfischer@gmail.com>2020-03-11 16:19:38 -0400
committerJoel Fischer <joeljfischer@gmail.com>2020-03-11 16:19:38 -0400
commit6d4f80a731e724d53a8f1504ed8046bf74c45b01 (patch)
tree17ab26003eb3021d7b419c2a9a1594746a8ef1b8
parentb002f1e1aa0009310c1d1583948e6c4851044c93 (diff)
downloadsdl_ios-6d4f80a731e724d53a8f1504ed8046bf74c45b01.tar.gz
Fix tests
-rw-r--r--SmartDeviceLinkTests/DevAPISpecs/SDLChoiceSetManagerSpec.m34
-rw-r--r--SmartDeviceLinkTests/DevAPISpecs/SDLSoftButtonManagerSpec.m41
2 files changed, 24 insertions, 51 deletions
diff --git a/SmartDeviceLinkTests/DevAPISpecs/SDLChoiceSetManagerSpec.m b/SmartDeviceLinkTests/DevAPISpecs/SDLChoiceSetManagerSpec.m
index 204eb9464..40edaeed3 100644
--- a/SmartDeviceLinkTests/DevAPISpecs/SDLChoiceSetManagerSpec.m
+++ b/SmartDeviceLinkTests/DevAPISpecs/SDLChoiceSetManagerSpec.m
@@ -119,7 +119,6 @@ describe(@"choice set manager tests", ^{
beforeEach(^{
testManager.transactionQueue.suspended = YES;
testManager.currentHMILevel = SDLHMILevelFull;
- testManager.currentSystemContext = SDLSystemContextMain;
testManager.currentWindowCapability = enabledWindowCapability;
});
@@ -133,20 +132,10 @@ describe(@"choice set manager tests", ^{
expect(testManager.transactionQueue.isSuspended).to(beFalse());
});
- it(@"should enable the queue when entering SystemContext Main", ^{
- testManager.currentSystemContext = SDLSystemContextAlert;
-
- SDLOnHMIStatus *newHMIStatus = [[SDLOnHMIStatus alloc] initWithHMILevel:SDLHMILevelFull systemContext:SDLSystemContextMain audioStreamingState:SDLAudioStreamingStateNotAudible videoStreamingState:nil windowID:@0];
- SDLRPCNotificationNotification *notification = [[SDLRPCNotificationNotification alloc] initWithName:SDLDidChangeHMIStatusNotification object:nil rpcNotification:newHMIStatus];
- [testManager sdl_hmiStatusNotification:notification];
-
- expect(testManager.transactionQueue.isSuspended).to(beFalse());
- });
-
it(@"should enable the queue when receiving a good window capability", ^{
testManager.currentWindowCapability = disabledWindowCapability;
- SDLDisplayCapability *displayCapability = [[SDLDisplayCapability alloc] initWithDisplayName:@"TEST" windowTypeSupported:nil windowCapabilities:@[enabledWindowCapability]];
+ SDLDisplayCapability *displayCapability = [[SDLDisplayCapability alloc] initWithDisplayName:@"TEST" windowCapabilities:@[enabledWindowCapability] windowTypeSupported:nil];
[testManager sdl_displayCapabilityDidUpdate:[[SDLSystemCapability alloc] initWithDisplayCapabilities:@[displayCapability]]];
expect(testManager.transactionQueue.isSuspended).to(beFalse());
@@ -157,7 +146,6 @@ describe(@"choice set manager tests", ^{
beforeEach(^{
testManager.transactionQueue.suspended = NO;
testManager.currentHMILevel = SDLHMILevelFull;
- testManager.currentSystemContext = SDLSystemContextMain;
testManager.currentWindowCapability = enabledWindowCapability;
});
@@ -169,31 +157,15 @@ describe(@"choice set manager tests", ^{
expect(testManager.transactionQueue.isSuspended).to(beTrue());
});
- it(@"should suspend the queue when entering SystemContext Alert", ^{
- SDLOnHMIStatus *newHMIStatus = [[SDLOnHMIStatus alloc] initWithHMILevel:SDLHMILevelFull systemContext:SDLSystemContextAlert audioStreamingState:SDLAudioStreamingStateNotAudible videoStreamingState:nil windowID:@0];
- SDLRPCNotificationNotification *notification = [[SDLRPCNotificationNotification alloc] initWithName:SDLDidChangeHMIStatusNotification object:nil rpcNotification:newHMIStatus];
- [testManager sdl_hmiStatusNotification:notification];
-
- expect(testManager.transactionQueue.isSuspended).to(beTrue());
- });
-
- it(@"should suspend the queue when entering SystemContext HMIObscured", ^{
- SDLOnHMIStatus *newHMIStatus = [[SDLOnHMIStatus alloc] initWithHMILevel:SDLHMILevelFull systemContext:SDLSystemContextHMIObscured audioStreamingState:SDLAudioStreamingStateNotAudible videoStreamingState:nil windowID:@0];
- SDLRPCNotificationNotification *notification = [[SDLRPCNotificationNotification alloc] initWithName:SDLDidChangeHMIStatusNotification object:nil rpcNotification:newHMIStatus];
- [testManager sdl_hmiStatusNotification:notification];
-
- expect(testManager.transactionQueue.isSuspended).to(beTrue());
- });
-
it(@"should suspend the queue when receiving a bad display capability", ^{
- SDLDisplayCapability *displayCapability = [[SDLDisplayCapability alloc] initWithDisplayName:@"TEST" windowTypeSupported:nil windowCapabilities:@[disabledWindowCapability]];
+ SDLDisplayCapability *displayCapability = [[SDLDisplayCapability alloc] initWithDisplayName:@"TEST" windowCapabilities:@[disabledWindowCapability] windowTypeSupported:nil];
[testManager sdl_displayCapabilityDidUpdate:[[SDLSystemCapability alloc] initWithDisplayCapabilities:@[displayCapability]]];
expect(testManager.transactionQueue.isSuspended).to(beTrue());
});
it(@"should not suspend the queue when receiving an empty display capability", ^{
- SDLDisplayCapability *displayCapability = [[SDLDisplayCapability alloc] initWithDisplayName:@"TEST" windowTypeSupported:nil windowCapabilities:@[blankWindowCapability]];
+ SDLDisplayCapability *displayCapability = [[SDLDisplayCapability alloc] initWithDisplayName:@"TEST" windowCapabilities:@[blankWindowCapability] windowTypeSupported:nil];
[testManager sdl_displayCapabilityDidUpdate:[[SDLSystemCapability alloc] initWithDisplayCapabilities:@[displayCapability]]];
expect(testManager.transactionQueue.isSuspended).to(beTrue());
diff --git a/SmartDeviceLinkTests/DevAPISpecs/SDLSoftButtonManagerSpec.m b/SmartDeviceLinkTests/DevAPISpecs/SDLSoftButtonManagerSpec.m
index 27fdb99e6..730af59f7 100644
--- a/SmartDeviceLinkTests/DevAPISpecs/SDLSoftButtonManagerSpec.m
+++ b/SmartDeviceLinkTests/DevAPISpecs/SDLSoftButtonManagerSpec.m
@@ -40,7 +40,7 @@
@property (strong, nonatomic) NSOperationQueue *transactionQueue;
-@property (strong, nonatomic, nullable, readwrite) SDLWindowCapability *windowCapability;
+@property (strong, nonatomic, nullable) SDLSoftButtonCapabilities *softButtonCapabilities;
@property (copy, nonatomic, nullable) SDLHMILevel currentLevel;
@property (strong, nonatomic) NSMutableArray<SDLAsynchronousOperation *> *batchQueue;
@@ -96,7 +96,7 @@ describe(@"a soft button manager", ^{
SDLWindowCapability *windowCapability = [[SDLWindowCapability alloc] init];
windowCapability.softButtonCapabilities = @[softButtonCapabilities];
- SDLDisplayCapability *displayCapability = [[SDLDisplayCapability alloc] initWithDisplayName:@"TEST" windowTypeSupported:nil windowCapabilities:@[windowCapability]];
+ SDLDisplayCapability *displayCapability = [[SDLDisplayCapability alloc] initWithDisplayName:@"TEST" windowCapabilities:@[windowCapability] windowTypeSupported:nil];
[testManager sdl_displayCapabilityDidUpdate:[[SDLSystemCapability alloc] initWithDisplayCapabilities:@[displayCapability]]];
});
@@ -108,7 +108,7 @@ describe(@"a soft button manager", ^{
expect(testManager.currentMainField1).to(beNil());
expect(testManager.transactionQueue).toNot(beNil());
expect(testManager.transactionQueue.isSuspended).to(beFalse());
- expect(testManager.windowCapability).toNot(beNil());
+ expect(testManager.softButtonCapabilities).toNot(beNil());
expect(testManager.currentLevel).to(equal(SDLHMILevelFull));
// These are set up earlier for future tests and therefore won't be nil
@@ -137,7 +137,7 @@ describe(@"a soft button manager", ^{
context(@"when there are no soft button capabilities", ^{
beforeEach(^{
SDLWindowCapability *windowCapability = [[SDLWindowCapability alloc] init];
- SDLDisplayCapability *displayCapability = [[SDLDisplayCapability alloc] initWithDisplayName:@"TEST" windowTypeSupported:nil windowCapabilities:@[windowCapability]];
+ SDLDisplayCapability *displayCapability = [[SDLDisplayCapability alloc] initWithDisplayName:@"TEST" windowCapabilities:@[windowCapability] windowTypeSupported:nil];
[testManager sdl_displayCapabilityDidUpdate:[[SDLSystemCapability alloc] initWithDisplayCapabilities:@[displayCapability]]];
});
@@ -169,21 +169,6 @@ describe(@"a soft button manager", ^{
testManager.softButtonObjects = @[testObject1, testObject2];
});
- describe(@"while batching", ^{
- beforeEach(^{
- testManager.batchUpdates = YES;
-
- [testObject1 transitionToNextState];
- [testObject2 transitionToNextState];
- testManager.softButtonObjects = @[testObject2, testObject1];
- });
-
- it(@"should properly queue the batching updates", ^{
- expect(testManager.transactionQueue.operationCount).to(equal(1));
- expect(testManager.batchQueue).to(haveCount(1));
- });
- });
-
it(@"should set soft buttons correctly", ^{
expect(testManager.softButtonObjects).toNot(beNil());
expect(testObject1.buttonId).to(equal(0));
@@ -191,6 +176,7 @@ describe(@"a soft button manager", ^{
expect(testObject1.manager).to(equal(testManager));
expect(testObject2.manager).to(equal(testManager));
+ // One replace operation
expect(testManager.transactionQueue.operationCount).to(equal(1));
});
@@ -207,6 +193,21 @@ describe(@"a soft button manager", ^{
expect([testManager softButtonObjectNamed:object1Name].name).to(equal(object1Name));
});
+ describe(@"while batching", ^{
+ beforeEach(^{
+ testManager.batchUpdates = YES;
+
+ [testObject1 transitionToNextState];
+ [testObject2 transitionToNextState];
+ testManager.softButtonObjects = @[testObject2, testObject1];
+ });
+
+ it(@"should properly queue the batching updates", ^{
+ expect(testManager.transactionQueue.operationCount).to(equal(1));
+ expect(testManager.batchQueue).to(haveCount(1));
+ });
+ });
+
context(@"when the HMI level is now NONE", ^{
beforeEach(^{
SDLOnHMIStatus *status = [[SDLOnHMIStatus alloc] init];
@@ -274,7 +275,7 @@ describe(@"a soft button manager", ^{
expect(testManager.currentMainField1).to(beNil());
expect(testManager.transactionQueue.operationCount).to(equal(0));
expect(testManager.currentLevel).to(beNil());
- expect(testManager.windowCapability).to(beNil());
+ expect(testManager.softButtonCapabilities).to(beNil());
});
});
});