Skip to content

Commit a2e8bf8

Browse files
committed
CoreGraphics: make Vector.zero public
This member is meant to be public, but was accidentally internal.
1 parent 2e3bb12 commit a2e8bf8

File tree

4 files changed

+20
-3
lines changed

4 files changed

+20
-3
lines changed

Sources/SwiftWin32/CG/Vector.swift

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@ public struct Vector {
66
// MARK - Special Values
77

88
/// The vector whose components are both zero.
9-
static let zero: Vector = Vector(dx: 0.0, dy: 0.0)
9+
public static var zero: Vector {
10+
Vector(dx: 0.0, dy: 0.0)
11+
}
1012

1113
/// Creates a vector whose components are both zero.
1214
public init() {

Tests/CoreGraphicsTests/CoreGraphicsTests.swift

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -280,6 +280,20 @@ final class CoreGraphicsTests: XCTestCase {
280280
XCTAssertTrue(null1 == null2)
281281
}
282282

283+
func testVectorConstructors() {
284+
let v1: Vector = Vector()
285+
XCTAssertEqual(v1, .zero)
286+
287+
let v2: Vector = Vector(dx: 0.0 as Float, dy: 0.0 as Float)
288+
XCTAssertEqual(v2, .zero)
289+
290+
let v3: Vector = Vector(dx: 0.0 as Double, dy: 0.0 as Double)
291+
XCTAssertEqual(v3, .zero)
292+
293+
let v4: Vector = Vector(dx: 0, dy: 0)
294+
XCTAssertEqual(v4, .zero)
295+
}
296+
283297
static var allTests = [
284298
("testAffineTransformIdentity", testAffineTransformIdentity),
285299
("testAffineTransformIdentityIsIdentity", testAffineTransformIdentityIsIdentity),
@@ -296,5 +310,6 @@ final class CoreGraphicsTests: XCTestCase {
296310
("testRectUnion", testRectUnion),
297311
("testRectContains", testRectContains),
298312
("testRectNonstandardEquality", testRectNonstandardEquality),
313+
("testVectorConstructors", testVectorConstructors)
299314
]
300315
}

Tests/UICoreTests/CubicTimingParametersTests.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// SPDX-License-Identifier: BSD-3-Clause
33

44
import XCTest
5-
@testable import SwiftWin32
5+
import SwiftWin32
66

77
final class CubicTimingParametersTests: XCTestCase {
88
func testDefaultState() {

Tests/UICoreTests/SpringTimingParametersTests.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// SPDX-License-Identifier: BSD-3-Clause
33

44
import XCTest
5-
@testable import SwiftWin32
5+
import SwiftWin32
66

77
final class SpringTimingParametersTests: XCTestCase {
88
func testDefaultState() {

0 commit comments

Comments
 (0)