Files
swift-mirror/test/1_stdlib/UIKit.swift
Jordan Rose e83c117c30 [test] Hack: run stdlib tests first to start long-running tests earlier.
This decreases total testing time by over a minute on my old Mac Pro.
It probably has much less effect on systems with fewer cores, but shouldn't
be any worse there.

Swift SVN r22745
2014-10-15 01:30:51 +00:00

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