-
Notifications
You must be signed in to change notification settings - Fork 51
/
Copy pathCGRect_AreaTests.swift
31 lines (24 loc) · 1.52 KB
/
CGRect_AreaTests.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
//
// ContextMenuTests.swift
// ContextMenuTests
//
// Created by Ryan Nystrom on 5/28/18.
// Copyright © 2018 Ryan Nystrom. All rights reserved.
//
import XCTest
@testable import ContextMenu
class CGRect_AreaTests: XCTestCase {
let rect = CGRect(x: 0, y: 0, width: 100, height: 100)
func test_whenCornersHavePadding() {
XCTAssertEqual(rect.area(corner: SourceViewCorner(rect: CGRect(x: 10, y: 10, width: 0, height: 0), position: .topLeft)), 100)
XCTAssertEqual(rect.area(corner: SourceViewCorner(rect: CGRect(x: 90, y: 10, width: 0, height: 0), position: .topRight)), 100)
XCTAssertEqual(rect.area(corner: SourceViewCorner(rect: CGRect(x: 90, y: 90, width: 0, height: 0), position: .bottomRight)), 100)
XCTAssertEqual(rect.area(corner: SourceViewCorner(rect: CGRect(x: 10, y: 90, width: 0, height: 0), position: .bottomLeft)), 100)
}
func test_whenCornersHaveNoPadding() {
XCTAssertEqual(rect.area(corner: SourceViewCorner(rect: CGRect(x: 0, y: 0, width: rect.width, height: rect.height), position: .topLeft)), 0)
XCTAssertEqual(rect.area(corner: SourceViewCorner(rect: CGRect(x: 100, y: 0, width: rect.width, height: rect.height), position: .topRight)), 0)
XCTAssertEqual(rect.area(corner: SourceViewCorner(rect: CGRect(x: 100, y: 100, width: rect.width, height: rect.height), position: .bottomRight)), 0)
XCTAssertEqual(rect.area(corner: SourceViewCorner(rect: CGRect(x: 0, y: 100, width: rect.width, height: rect.height), position: .bottomLeft)), 0)
}
}