Skip to content

Commit

Permalink
Merge pull request #4 from IFTTT/slather
Browse files Browse the repository at this point in the history
Added test coverage
  • Loading branch information
jhersh committed Feb 24, 2015
2 parents 8410d29 + 39234c9 commit 2f92b8e
Show file tree
Hide file tree
Showing 29 changed files with 801 additions and 409 deletions.
3 changes: 3 additions & 0 deletions .slather.yml
@@ -0,0 +1,3 @@
coverage_service: coveralls
xcodeproj: ExampleImage/IFTTTLaunchImage.xcodeproj
source_directory: IFTTTLaunchImage
7 changes: 4 additions & 3 deletions .travis.yml
@@ -1,16 +1,17 @@
osx_image: xcode611
language: objective-c
before_install: gem install cocoapods xcpretty obcd -N
before_install: gem install cocoapods xcpretty obcd slather -N
cache: cocoapods
podfile: ExampleImage/Podfile
env:
- LC_CTYPE=en_US.UTF-8 LANG=en_US.UTF-8
script:
- set -o pipefail && xcodebuild -workspace ExampleImage/IFTTTLaunchImage.xcworkspace -scheme
IFTTTLaunchImage -sdk iphonesimulator -destination "platform=iOS Simulator,name=iPhone 6"
clean test | xcpretty -c
IFTTTLaunchImage -sdk iphonesimulator -destination "platform=iOS Simulator,name=iPhone 6"
GCC_INSTRUMENT_PROGRAM_FLOW_ARCS=YES GCC_GENERATE_TEST_COVERAGE_FILES=YES clean test | xcpretty -c
- pod lib lint --quick
- obcd --path IFTTTLaunchImage find HeaderStyle
notifications:
slack:
secure: n2L86+NPkdA9OJ2dNFZwO/2Qt+bfImI0pSy999FJCieBzPBSSnDfzHEbPz8DvR/f5TvL1uCTJ1iRQ1sPU0CnYu8HOgiJkpRTX1cUVsYwN1LiPfq2ONXr6kc+RUJ0j76Z+gMGN6wIDUhHluy1aD+yo5lOPRbA1BrGW0Qf/oIs3/U=
after_success: slather
4 changes: 4 additions & 0 deletions ExampleImage/IFTTTLaunchImage.xcodeproj/project.pbxproj
Expand Up @@ -357,6 +357,8 @@
ENABLE_STRICT_OBJC_MSGSEND = YES;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_DYNAMIC_NO_PIC = NO;
GCC_GENERATE_TEST_COVERAGE_FILES = YES;
GCC_INSTRUMENT_PROGRAM_FLOW_ARCS = YES;
GCC_OPTIMIZATION_LEVEL = 0;
GCC_PREPROCESSOR_DEFINITIONS = (
"DEBUG=1",
Expand Down Expand Up @@ -399,6 +401,8 @@
ENABLE_NS_ASSERTIONS = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_GENERATE_TEST_COVERAGE_FILES = YES;
GCC_INSTRUMENT_PROGRAM_FLOW_ARCS = YES;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNDECLARED_SELECTOR = YES;
Expand Down
53 changes: 52 additions & 1 deletion ExampleImage/IFTTTLaunchImageTests/IFTTTLaunchImageTests.m
Expand Up @@ -10,7 +10,9 @@
@import XCTest;
#import <FBSnapshotTestCase.h>
#import <UIImage+IFTTTLaunchImage.h>
#import <UIDevice+IFTTTLaunchImage.h>
#import <IFTTTSplashView.h>
#import <XCTest+MXGSynchronizeTest.h>

@interface IFTTTLaunchImageTests : FBSnapshotTestCase

Expand Down Expand Up @@ -43,9 +45,58 @@ - (void)testLaunchSnapshot {
FBSnapshotVerifyView(launchImageView, nil);
}

- (void)testSplashView {
#pragma mark - Splash View

- (void)testSplashViewShowsImage {
[[IFTTTSplashView sharedSplash] showSplash];
FBSnapshotVerifyView([IFTTTSplashView sharedSplash], nil);
}

- (void)testSplashViewImageAccess {
UIImage *image = [UIImage IFTTTDefaultLaunchImage];

[[IFTTTSplashView sharedSplash] setImage:image];

XCTAssertEqualObjects([IFTTTSplashView sharedSplash].image, image, @"Images should be equal");
}

- (void)testSplashCustomViewAccess {
UIView *view = [UIView new];

[[IFTTTSplashView sharedSplash] setCustomView:view];

XCTAssertEqualObjects([IFTTTSplashView sharedSplash].customView, view, @"Views should be set and retrieved");
}

- (void)testSplashViewDismissalTypes {

for (NSNumber *dismissalType in @[ @(IFTTTSplashAnimationDrop),
@(IFTTTSplashAnimationFade),
@(IFTTTSplashAnimationGrowFade),
@(IFTTTSplashAnimationNone) ]) {
[[IFTTTSplashView sharedSplash] showSplash];

XCTAssertFalse([IFTTTSplashView sharedSplash].hidden, @"Splash should be visible");

[XCTest mxg_synchronizeTest:^(BOOL *finished) {
[[IFTTTSplashView sharedSplash] dismissSplashWithAnimation:[dismissalType unsignedIntegerValue]
completion:^
{
*finished = YES;
XCTAssertTrue([IFTTTSplashView sharedSplash].hidden, @"Should be hidden");
}];
}];
}
}

#pragma mark - UIDevice

- (void)testIsIPhone {
XCTAssertFalse([[UIDevice currentDevice] IFTTTDeviceIsiPad], @"This test should be run on iPhone");
}

- (void)testIsPortrait {
XCTAssertFalse([[UIDevice currentDevice] IFTTTDeviceIsLandscape], @"This test should be run in portrait");
}

@end
1 change: 1 addition & 0 deletions ExampleImage/Podfile
Expand Up @@ -15,4 +15,5 @@ end
target 'IFTTTLaunchImageTests', :exclusive => true do
install_pods
pod 'FBSnapshotTestCase'
pod 'MXGSynchronizeTest'
end
3 changes: 3 additions & 0 deletions ExampleImage/Podfile.lock
@@ -1,10 +1,12 @@
PODS:
- FBSnapshotTestCase (1.5)
- IFTTTLaunchImage (0.4.0)
- MXGSynchronizeTest (1.1.0)

DEPENDENCIES:
- FBSnapshotTestCase
- IFTTTLaunchImage (from `../IFTTTLaunchImage.podspec`)
- MXGSynchronizeTest

EXTERNAL SOURCES:
IFTTTLaunchImage:
Expand All @@ -13,5 +15,6 @@ EXTERNAL SOURCES:
SPEC CHECKSUMS:
FBSnapshotTestCase: e2914fbaabccea1dcc773d6a16b1c24540642488
IFTTTLaunchImage: ab9e6adfce1699a480cae7ccbfda7697502ed871
MXGSynchronizeTest: 8f2f041ca6896caec74463ab43743d97d3dc8c18

COCOAPODS: 0.35.0

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 21 additions & 0 deletions ExampleImage/Pods/MXGSynchronizeTest/LICENSE

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

30 changes: 30 additions & 0 deletions ExampleImage/Pods/MXGSynchronizeTest/README.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 14 additions & 0 deletions ExampleImage/Pods/MXGSynchronizeTest/XCTest+MXGSynchronizeTest.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 21 additions & 0 deletions ExampleImage/Pods/MXGSynchronizeTest/XCTest+MXGSynchronizeTest.m

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions ExampleImage/Pods/Manifest.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 2f92b8e

Please sign in to comment.