/
SnapshotTests.m
84 lines (64 loc) · 2.04 KB
/
SnapshotTests.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
//
// SnapshotTests.m
// Tests
//
// Created by Yuji Nakayama on 1/22/14.
// Copyright (c) 2014 Yuji Nakayama. All rights reserved.
//
#import <XCTest/XCTest.h>
#import <FBSnapshotTestCase/FBSnapshotTestCase.h>
#import "NAKPlaybackIndicatorView.h"
@interface SnapshotTests : FBSnapshotTestCase
@end
@implementation SnapshotTests {
NAKPlaybackIndicatorView* _view;
}
- (void)setUp
{
[super setUp];
// Flip this to YES to record images in the reference image directory.
// You need to do this the first time you create a test and whenever you change the snapshotted views.
// Be careful not to commit with recordMode on though, or your tests will never fail.
self.recordMode = NO;
_view = [[NAKPlaybackIndicatorView alloc] initWithFrame:[self minimumFrame]];
_view.state = NAKPlaybackIndicatorViewStatePaused;
}
- (void)testPausedContent
{
FBSnapshotVerifyView(_view, nil);
}
- (void)testConteredContentPositionInLargeFrame
{
_view = [[NAKPlaybackIndicatorView alloc] initWithFrame:CGRectMake(0.0, 0.0, 50.0, 50.0)];
_view.state = NAKPlaybackIndicatorViewStatePaused;
FBSnapshotVerifyView(_view, nil);
}
- (void)testClippedContentInSmallFrame
{
UIView* baseView = [[UIView alloc] initWithFrame:CGRectMake(0.0, 0.0, 20.0, 20.0)];
_view = [[NAKPlaybackIndicatorView alloc] initWithFrame:CGRectMake(5.0, 5.0, 10.0, 10.0)];
_view.state = NAKPlaybackIndicatorViewStatePaused;
[baseView addSubview:_view];
FBSnapshotVerifyView(baseView, nil);
}
- (void)testTintColor
{
_view.tintColor = [self musicAppTintColor];
FBSnapshotVerifyView(_view, nil);
}
- (void)testSuperviewTintColor
{
UIView* baseView = [[UIView alloc] initWithFrame:CGRectMake(0.0, 0.0, 100.0, 100.0)];
baseView.tintColor = [self musicAppTintColor];
[baseView addSubview:_view];
FBSnapshotVerifyView(_view, nil);
}
- (CGRect)minimumFrame
{
return CGRectMake(0.0, 0.0, 13.0, 12.0);
}
- (UIColor*)musicAppTintColor
{
return [UIColor colorWithHue:0.968 saturation:0.827 brightness:1.000 alpha:1.000];
}
@end