Files
swift-mirror/test/1_stdlib/UIKit.swift
Joe Pamer 828eb68e72 Commit DaveA's API changes to 'print', along with the compiler changes necessary to support them.
There's still work left to do. In terms of next steps, there's still rdar://problem/22126141, which covers removing the 'workaround' overloads for print (that prevent bogus overload resolution failures), as well as providing a decent diagnostic when users invoke print with 'appendNewline'.

Swift SVN r30976
2015-08-04 01:57:11 +00:00

68 lines
2.7 KiB
Swift

// RUN: %target-run-simple-swift | FileCheck %s
// REQUIRES: executable_test
// REQUIRES: OS=ios
import UIKit
func printOrientation(o: UIDeviceOrientation) {
print("\(o.isPortrait) \(UIDeviceOrientationIsPortrait(o)), ", terminator: "")
print("\(o.isLandscape) \(UIDeviceOrientationIsLandscape(o)), ", terminator: "")
print("\(o.isFlat), ", terminator: "")
print("\(o.isValidInterfaceOrientation) \(UIDeviceOrientationIsValidInterfaceOrientation(o))")
}
print("Device orientations")
printOrientation(UIDeviceOrientation.Unknown)
printOrientation(UIDeviceOrientation.Portrait)
printOrientation(UIDeviceOrientation.PortraitUpsideDown)
printOrientation(UIDeviceOrientation.LandscapeLeft)
printOrientation(UIDeviceOrientation.LandscapeRight)
printOrientation(UIDeviceOrientation.FaceUp)
printOrientation(UIDeviceOrientation.FaceDown)
// CHECK: Device orientations
// CHECK-NEXT: false false, false false, false, false false
// CHECK-NEXT: true true, false false, false, true true
// CHECK-NEXT: true true, false false, false, true true
// CHECK-NEXT: false false, true true, false, true true
// CHECK-NEXT: false false, true true, false, true true
// CHECK-NEXT: false false, false false, true, false false
// CHECK-NEXT: false false, false false, true, false false
func printOrientation(o: UIInterfaceOrientation) {
print("\(o.isPortrait) \(UIInterfaceOrientationIsPortrait(o)), ", terminator: "")
print("\(o.isLandscape) \(UIInterfaceOrientationIsLandscape(o))")
}
print("Interface orientations")
printOrientation(UIInterfaceOrientation.Unknown)
printOrientation(UIInterfaceOrientation.Portrait)
printOrientation(UIInterfaceOrientation.PortraitUpsideDown)
printOrientation(UIInterfaceOrientation.LandscapeLeft)
printOrientation(UIInterfaceOrientation.LandscapeRight)
// CHECK: Interface orientations
// CHECK-NEXT: false false, false false
// CHECK-NEXT: true true, false false
// CHECK-NEXT: true true, false false
// CHECK-NEXT: false false, true true
// CHECK-NEXT: false false, true true
var inset1 = UIEdgeInsets(top: 1.0, left: 2.0, bottom: 3.0, right: 4.0)
var inset2 = UIEdgeInsets(top: 1.0, left: 2.0, bottom: 3.1, right: 4.0)
print("inset1 == inset1: \(inset1 == inset1)")
print("inset1 != inset1: \(inset1 != inset1)")
print("inset1 == inset2: \(inset1 == inset2)")
// CHECK: inset1 == inset1: true
// CHECK: inset1 != inset1: false
// CHECK: inset1 == inset2: false
var offset1 = UIOffset(horizontal: 1.0, vertical: 2.0)
var offset2 = UIOffset(horizontal: 1.0, vertical: 3.0)
print("offset1 == offset1: \(offset1 == offset1)")
print("offset1 != offset1: \(offset1 != offset1)")
print("offset1 == offset2: \(offset1 == offset2)")
// CHECK: offset1 == offset1: true
// CHECK: offset1 != offset1: false
// CHECK: offset1 == offset2: false