[test] Reinstate CoreGraphics↔︎NSValue bridging tests on iOS/watchOS/tvOS

This commit is contained in:
Karoy Lorentey
2020-06-23 14:36:10 -07:00
committed by Károly Lőrentey
parent 79bdd43557
commit 73c99acf29

View File

@@ -23,6 +23,10 @@ import StdlibUnittestFoundationExtras
import Foundation
import CoreGraphics
#if os(iOS) || os(tvOS) || os(watchOS)
import UIKit
#endif
var nsValueBridging = TestSuite("NSValueBridging")
func rangesEqual(_ x: NSRange, _ y: NSRange) -> Bool {
@@ -66,6 +70,16 @@ ${ testCase("CGAffineTransform", "CGAffineTransform(rotationAngle: .pi)", N
#endif
#if os(iOS) || os(tvOS) || os(watchOS)
${ testCase("CGRect", "CGRect(x: 17, y: 38, width: 6, height: 79)", "cgRect", "(==)") }
${ testCase("CGPoint", "CGPoint(x: 17, y: 38)", "cgPoint", "(==)") }
${ testCase("CGSize", "CGSize(width: 6, height: 79)", "cgSize", "(==)") }
${ testCase("CGVector", "CGVector(dx: 6, dy: 79)", "cgVector", "(==)") }
${ testCase("CGAffineTransform", "CGAffineTransform(rotationAngle: .pi)", "cgAffineTransform", "(==)") }
#endif
nsValueBridging.test("NSValue can only be cast back to its original type") {
let range = NSRange(location: 17, length: 38)
let rangeObject: Any = NSValue(range: range)