Files
swift-mirror/test/stdlib/NSEvent.swift
2020-03-24 11:30:45 -07:00

29 lines
862 B
Swift

// RUN: %target-run-simple-swift
// REQUIRES: executable_test
// REQUIRES: OS=macosx
// REQUIRES: objc_interop
import AppKit
import StdlibUnittest
import StdlibUnittestFoundationExtras
var NSEventTests = TestSuite("NSEventTests")
func testSpecialKey(_ specialKey: NSEvent.SpecialKey, rawValue: Int) {
expectEqual(specialKey.rawValue, rawValue)
expectEqual(specialKey.unicodeScalar, Unicode.Scalar(rawValue))
}
NSEventTests.test("NSEvent.specialKey") {
testSpecialKey(NSEvent.SpecialKey.upArrow, rawValue: 0xF700)
if #available(macOS 10.15.4, *) {
// NSEvent.SpecialKey.deleteForward used to have the wrong rawValue in
// macOS versions below 10.15.4. See
// https://github.com/apple/swift/pull/26853 (rdar://54725550).
testSpecialKey(NSEvent.SpecialKey.deleteForward, rawValue: 0xF728)
}
}
runAllTests()