-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathTriangleTests.swift
More file actions
37 lines (32 loc) · 1.22 KB
/
TriangleTests.swift
File metadata and controls
37 lines (32 loc) · 1.22 KB
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
import Testing
import SwiftUI
@testable import SlidableImage
struct TriangleTests {
@Test func pathFitsInRect() {
let rect = CGRect(x: 0, y: 0, width: 100, height: 100)
let path = Triangle().path(in: rect)
#expect(path.boundingRect.width <= rect.width)
#expect(path.boundingRect.height <= rect.height)
}
@Test func pathBoundingRectMatchesRect() {
let rect = CGRect(x: 0, y: 0, width: 50, height: 80)
let path = Triangle().path(in: rect)
#expect(path.boundingRect.minX >= rect.minX)
#expect(path.boundingRect.minY >= rect.minY)
#expect(path.boundingRect.maxX <= rect.maxX)
#expect(path.boundingRect.maxY <= rect.maxY)
}
@Test func pathWithNonZeroOrigin() {
let rect = CGRect(x: 10, y: 20, width: 60, height: 80)
let path = Triangle().path(in: rect)
#expect(path.boundingRect.minX >= rect.minX)
#expect(path.boundingRect.minY >= rect.minY)
#expect(path.boundingRect.maxX <= rect.maxX)
#expect(path.boundingRect.maxY <= rect.maxY)
}
@Test func pathWithZeroSize() {
let rect = CGRect.zero
let path = Triangle().path(in: rect)
#expect(path.boundingRect == .zero)
}
}