mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
48 lines
1.9 KiB
Swift
48 lines
1.9 KiB
Swift
// RUN: %target-run-simple-swift | FileCheck %s
|
|
// REQUIRES: OS=ios
|
|
|
|
import UIKit
|
|
|
|
func printOrientation(o: UIDeviceOrientation) {
|
|
print ("\(o.isPortrait) \(UIDeviceOrientationIsPortrait(o)), ")
|
|
print ("\(o.isLandscape) \(UIDeviceOrientationIsLandscape(o)), ")
|
|
print ("\(o.isFlat), ")
|
|
println("\(o.isValidInterfaceOrientation) \(UIDeviceOrientationIsValidInterfaceOrientation(o))")
|
|
}
|
|
|
|
println("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)), ")
|
|
println("\(o.isLandscape) \(UIInterfaceOrientationIsLandscape(o))")
|
|
}
|
|
|
|
println("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
|