-
Notifications
You must be signed in to change notification settings - Fork 27
/
LoginTableViewCellRefTests.swift
111 lines (95 loc) · 3.44 KB
/
LoginTableViewCellRefTests.swift
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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
import Foundation
import XCTest
import Storage
@testable import Client
class LoginTableViewCellRefTests: FXSnapshotTestCase {
let defaultFrame = CGRect(origin: CGPointZero, size: CGSize(width: 320, height: 64))
let compressedFrame = CGRect(origin: CGPointZero, size: CGSize(width: 160, height: 64))
let stretchedFrame = CGRect(origin: CGPointZero, size: CGSize(width: 728, height: 64))
var cell: LoginTableViewCell!
let mockLogin = Login.createWithHostname("alphabet.com", username: "myawesomeusername@email.com", password: "hunter2")
override func setUp() {
super.setUp()
cell = LoginTableViewCell(frame: defaultFrame)
}
func testDefaultCellLayout() {
cell.updateCellWithLogin(mockLogin)
cell.layoutIfNeeded()
FBSnapshotVerifyView(cell!)
}
func testCellNoIconBothLabelsLayout() {
cell.style = .NoIconAndBothLabels
cell.updateCellWithLogin(mockLogin)
cell.layoutIfNeeded()
FBSnapshotVerifyView(cell!)
}
func testCellIconAndDescriptionLayout() {
cell.style = .IconAndDescriptionLabel
cell.updateCellWithLogin(mockLogin)
cell.layoutIfNeeded()
FBSnapshotVerifyView(cell!)
}
func testCellIconAndBothLabelsLayout() {
cell.style = .IconAndBothLabels
cell.updateCellWithLogin(mockLogin)
cell.layoutIfNeeded()
FBSnapshotVerifyView(cell!)
}
func testCompressedDefaultCellLayout() {
cell.frame = compressedFrame
cell.updateCellWithLogin(mockLogin)
cell.layoutIfNeeded()
FBSnapshotVerifyView(cell!)
}
func testCompressedNoIconBothLabelsLayout() {
cell.frame = compressedFrame
cell.style = .NoIconAndBothLabels
cell.updateCellWithLogin(mockLogin)
cell.layoutIfNeeded()
FBSnapshotVerifyView(cell!)
}
func testCompressedIconAndDescriptionLayout() {
cell.frame = compressedFrame
cell.style = .IconAndDescriptionLabel
cell.updateCellWithLogin(mockLogin)
cell.layoutIfNeeded()
FBSnapshotVerifyView(cell!)
}
func testCompressedIconAndBothLabelsLayout() {
cell.frame = compressedFrame
cell.style = .IconAndBothLabels
cell.updateCellWithLogin(mockLogin)
cell.layoutIfNeeded()
FBSnapshotVerifyView(cell!)
}
func testStretchedDefaultCellLayout() {
cell.frame = stretchedFrame
cell.updateCellWithLogin(mockLogin)
cell.layoutIfNeeded()
FBSnapshotVerifyView(cell!)
}
func testStretchedNoIconBothLabelsLayout() {
cell.frame = stretchedFrame
cell.style = .NoIconAndBothLabels
cell.updateCellWithLogin(mockLogin)
cell.layoutIfNeeded()
FBSnapshotVerifyView(cell!)
}
func testStretchedIconAndDescriptionLayout() {
cell.frame = stretchedFrame
cell.style = .IconAndDescriptionLabel
cell.updateCellWithLogin(mockLogin)
cell.layoutIfNeeded()
FBSnapshotVerifyView(cell!)
}
func testStretchedIconAndBothLabelsLayout() {
cell.frame = stretchedFrame
cell.style = .IconAndBothLabels
cell.updateCellWithLogin(mockLogin)
cell.layoutIfNeeded()
FBSnapshotVerifyView(cell!)
}
}