summaryrefslogtreecommitdiff
path: root/SmartDeviceLinkTests/SDLSoftButtonObjectSpec.m
diff options
context:
space:
mode:
Diffstat (limited to 'SmartDeviceLinkTests/SDLSoftButtonObjectSpec.m')
-rw-r--r--SmartDeviceLinkTests/SDLSoftButtonObjectSpec.m31
1 files changed, 31 insertions, 0 deletions
diff --git a/SmartDeviceLinkTests/SDLSoftButtonObjectSpec.m b/SmartDeviceLinkTests/SDLSoftButtonObjectSpec.m
index 6122c6a8b..201b08dd3 100644
--- a/SmartDeviceLinkTests/SDLSoftButtonObjectSpec.m
+++ b/SmartDeviceLinkTests/SDLSoftButtonObjectSpec.m
@@ -2,6 +2,7 @@
#import <Nimble/Nimble.h>
#import <OCMock/OCMock.h>
+#import "SDLArtwork.h"
#import "SDLSoftButton.h"
#import "SDLSoftButtonObject.h"
#import "SDLSoftButtonState.h"
@@ -45,6 +46,36 @@ describe(@"a soft button object", ^{
});
});
+ context(@"with a single state implicitly created", ^{
+ NSString *testText = @"Hello";
+ SDLArtwork *testArt = [[SDLArtwork alloc] initWithStaticIcon:SDLStaticIconNameKey];
+
+ beforeEach(^{
+ testObject = [[SDLSoftButtonObject alloc] initWithName:testObjectName text:testText artwork:testArt handler:nil];
+ });
+
+ it(@"should create correctly", ^{
+ expect(testObject.name).to(equal(testObjectName));
+ expect(testObject.currentState.name).to(equal(testObjectName));
+ expect(testObject.currentState.text).to(equal(testText));
+ expect(testObject.currentState.artwork).to(equal(testArt));
+ expect(testObject.states).to(haveCount(1));
+ });
+
+ it(@"should not allow transitioning to another state", ^{
+ BOOL performedTransition = [testObject transitionToStateNamed:@"Some other state"];
+ expect(performedTransition).to(beFalse());
+ });
+
+ it(@"should return a state when asked and not when incorrect", ^{
+ SDLSoftButtonState *returnedState = [testObject stateWithName:testObjectName];
+ expect(returnedState).toNot(beNil());
+
+ returnedState = [testObject stateWithName:@"Some other state"];
+ expect(returnedState).to(beNil());
+ });
+ });
+
context(@"with multiple states", ^{
__block SDLSoftButtonState *testFirstState = OCMClassMock([SDLSoftButtonState class]);
__block NSString *testFirstStateName = @"Test First Name";