Skip to content

Commit c3ecd9b

Browse files
committed
WIP: Fixes unit tests
1 parent 0523405 commit c3ecd9b

13 files changed

+64
-51
lines changed

Tests/SteviaTests/BaselineTests.swift

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,14 @@
99
import XCTest
1010
import Stevia
1111

12-
class BaselineTests: XCTestCase {
12+
@MainActor class BaselineTests: XCTestCase {
1313

1414
var win: UIWindow!
1515
var ctrler: UIViewController!
1616
var label1 = UILabel()
1717
var label2 = UILabel()
1818

19-
override func setUp() {
19+
override func setUp() async throws {
2020
win = UIWindow(frame: UIScreen.main.bounds)
2121
ctrler = UIViewController()
2222
win.rootViewController = ctrler
@@ -29,6 +29,8 @@ class BaselineTests: XCTestCase {
2929
}
3030
}
3131

32+
33+
3234
func testAlignLastBaselines() {
3335
label1.top(100)
3436
align(lastBaselines: label1, label2)

Tests/SteviaTests/CenterTests.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,14 @@ import XCTest
1010

1111
let magicalIphoneXShift = 0.17
1212

13-
class CenterTests: XCTestCase {
13+
@MainActor class CenterTests: XCTestCase {
1414

1515
var win: UIWindow!
1616
var ctrler: UIViewController!
1717
var v: UIView!
1818

19-
override func setUp() {
20-
super.setUp()
19+
override func setUp() async throws {
20+
// try await super.setUp()
2121
win = UIWindow(frame: UIScreen.main.bounds)
2222
ctrler = UIViewController()
2323
win.rootViewController = ctrler

Tests/SteviaTests/ContentTests.swift

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,11 @@ import Stevia
1212

1313
let title = "TitleTest"
1414

15-
class UIButtonContentTests: XCTestCase {
15+
@MainActor class UIButtonContentTests: XCTestCase {
1616
var button = UIButton()
1717

18-
override func setUp() {
19-
super.setUp()
18+
override func setUp() async throws {
19+
//
2020
button = UIButton()
2121
}
2222

@@ -41,11 +41,12 @@ class UIButtonContentTests: XCTestCase {
4141
}
4242
}
4343

44-
class UILabelContentTests: XCTestCase {
44+
45+
@MainActor class UILabelContentTests: XCTestCase {
4546
var label = UILabel()
4647

47-
override func setUp() {
48-
super.setUp()
48+
override func setUp() async throws {
49+
// super.setUp()
4950
label = UILabel()
5051
}
5152

@@ -64,11 +65,11 @@ class UILabelContentTests: XCTestCase {
6465
}
6566
}
6667

67-
class UITextFieldContentTests: XCTestCase {
68+
@MainActor class UITextFieldContentTests: XCTestCase {
6869
var textField = UITextField()
6970

70-
override func setUp() {
71-
super.setUp()
71+
override func setUp() async throws {
72+
// super.setUp()
7273
textField = UITextField()
7374
}
7475

@@ -82,11 +83,11 @@ class UITextFieldContentTests: XCTestCase {
8283
}
8384
}
8485

85-
class UIImageViewContentTests: XCTestCase {
86+
@MainActor class UIImageViewContentTests: XCTestCase {
8687
var imageView = UIImageView()
8788

88-
override func setUp() {
89-
super.setUp()
89+
override func setUp() async throws {
90+
// super.setUp()
9091
imageView = UIImageView()
9192
}
9293

Tests/SteviaTests/EquationTests.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,13 @@
99
import XCTest
1010
import Stevia
1111

12-
class EquationTests: XCTestCase {
12+
@MainActor class EquationTests: XCTestCase {
1313

1414
var win: UIWindow!
1515
var ctrler: UIViewController!
1616

17-
override func setUp() {
18-
super.setUp()
17+
override func setUp() async throws {
18+
// super.setUp()
1919
win = UIWindow(frame: UIScreen.main.bounds)
2020
ctrler = UIViewController()
2121
win.rootViewController = ctrler

Tests/SteviaTests/FillTests.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,12 @@ import XCTest
1010

1111
import Stevia
1212

13-
class FillTests: XCTestCase {
13+
@MainActor class FillTests: XCTestCase {
1414
var win: UIWindow!
1515
var ctrler: UIViewController!
1616

17-
override func setUp() {
18-
super.setUp()
17+
override func setUp() async throws {
18+
// super.setUp()
1919
win = UIWindow(frame: UIScreen.main.bounds)
2020
ctrler = UIViewController()
2121
win.rootViewController = ctrler

Tests/SteviaTests/FlexibleMarginTests.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,14 @@
99
import XCTest
1010
import Stevia
1111

12-
class FlexibleMarginTests: XCTestCase {
12+
@MainActor class FlexibleMarginTests: XCTestCase {
1313

1414
var win: UIWindow!
1515
var ctrler: UIViewController!
1616
var v: UIView!
1717

18-
override func setUp() {
19-
super.setUp()
18+
override func setUp() async throws {
19+
// super.setUp()
2020
win = UIWindow(frame: UIScreen.main.bounds)
2121
ctrler = UIViewController()
2222
win.rootViewController = ctrler

Tests/SteviaTests/FullLayoutTests.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,14 +53,14 @@ class TestView: UIView {
5353
}
5454
}
5555

56-
class FullLayoutTests: XCTestCase {
56+
@MainActor class FullLayoutTests: XCTestCase {
5757

5858
var win: UIWindow!
5959
var vc: UIViewController!
6060
var v: TestView!
6161

62-
override func setUp() {
63-
super.setUp()
62+
override func setUp() async throws {
63+
// super.setUp()
6464
win = UIWindow(frame: UIScreen.main.bounds)
6565
vc = UIViewController()///TestVC()
6666
win.rootViewController = vc

Tests/SteviaTests/GetConstraintsTests.swift

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,14 @@
99
import XCTest
1010
import Stevia
1111

12-
class GetConstraintsTests: XCTestCase {
12+
@MainActor class GetConstraintsTests: XCTestCase {
1313

1414
var v: UIView!
1515
var spv: UIView!
1616

17-
override func setUp() {
18-
spv = UIView()
19-
v = UIView()
17+
override func setUp() async throws {
18+
spv = await UIView()
19+
v = await UIView()
2020
spv.subviews { v! }
2121
}
2222

@@ -68,7 +68,7 @@ class GetConstraintsTests: XCTestCase {
6868
XCTAssertEqual(c?.isActive, true)
6969
}
7070

71-
func testCanGetBottomConstraint() {
71+
@MainActor func testCanGetBottomConstraint() {
7272
XCTAssertNil(v.bottomConstraint)
7373
v.bottom(145)
7474
let c = v.bottomConstraint
@@ -84,7 +84,7 @@ class GetConstraintsTests: XCTestCase {
8484
XCTAssertEqual(c?.isActive, true)
8585
}
8686

87-
func testCanGetHeightConstraint() {
87+
@MainActor func testCanGetHeightConstraint() {
8888
XCTAssertNil(v.heightConstraint)
8989
v.height(35)
9090
let c = v.heightConstraint
@@ -100,7 +100,7 @@ class GetConstraintsTests: XCTestCase {
100100
XCTAssertEqual(c?.isActive, true)
101101
}
102102

103-
func testCanGetWidthConstraint() {
103+
@MainActor func testCanGetWidthConstraint() {
104104
XCTAssertNil(v.widthConstraint)
105105
v.width(51)
106106
let c = v.widthConstraint
@@ -116,7 +116,7 @@ class GetConstraintsTests: XCTestCase {
116116
XCTAssertEqual(c?.isActive, true)
117117
}
118118

119-
func testCanGetTrailingConstraint() {
119+
@MainActor func testCanGetTrailingConstraint() {
120120
XCTAssertNil(v.trailingConstraint)
121121
v.trailingAnchor.constraint(equalTo: spv.trailingAnchor, constant: 104).isActive = true
122122
let c = v.trailingConstraint
@@ -132,7 +132,7 @@ class GetConstraintsTests: XCTestCase {
132132
XCTAssertEqual(c?.isActive, true)
133133
}
134134

135-
func testCanGetLeadingonstraint() {
135+
@MainActor func testCanGetLeadingonstraint() {
136136
XCTAssertNil(v.leadingConstraint)
137137
v.leadingAnchor.constraint(equalTo: spv.leadingAnchor, constant: 73).isActive = true
138138
let c = v.leadingConstraint
@@ -148,7 +148,7 @@ class GetConstraintsTests: XCTestCase {
148148
XCTAssertEqual(c?.isActive, true)
149149
}
150150

151-
func testCanGetCenterXConstraint() {
151+
@MainActor func testCanGetCenterXConstraint() {
152152
XCTAssertNil(v.centerXConstraint)
153153
v.CenterX == spv.CenterX + 27
154154
let c = v.centerXConstraint
@@ -164,7 +164,7 @@ class GetConstraintsTests: XCTestCase {
164164
XCTAssertEqual(c?.isActive, true)
165165
}
166166

167-
func testCanGetCenterYConstraint() {
167+
@MainActor func testCanGetCenterYConstraint() {
168168
XCTAssertNil(v.centerYConstraint)
169169
v.CenterY == spv.CenterY - 32
170170
let c = v.centerYConstraint

Tests/SteviaTests/HierarchyTests.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
import XCTest
1010
import Stevia
1111

12-
class HierarchyTests: XCTestCase {
12+
@MainActor class HierarchyTests: XCTestCase {
1313

1414
override func setUp() {
1515
super.setUp()

Tests/SteviaTests/LayoutTests.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,14 @@
99
import XCTest
1010
import Stevia
1111

12-
class LayoutTests: XCTestCase {
12+
@MainActor class LayoutTests: XCTestCase {
1313

1414
var win: UIWindow!
1515
var ctrler: UIViewController!
1616
var v: UIView!
1717

18-
override func setUp() {
19-
super.setUp()
18+
override func setUp() async throws {
19+
// super.setUp()
2020
win = UIWindow(frame: UIScreen.main.bounds)
2121
ctrler = UIViewController()
2222
win.rootViewController = ctrler

0 commit comments

Comments
 (0)