diff --git a/MacawTests/Animation/DelayedAnimationTests.swift b/MacawTests/Animation/DelayedAnimationTests.swift index 7c6b1b37..adcbc23c 100644 --- a/MacawTests/Animation/DelayedAnimationTests.swift +++ b/MacawTests/Animation/DelayedAnimationTests.swift @@ -6,25 +6,28 @@ // Copyright © 2017 Exyte. All rights reserved. // -#if os(iOS) - import XCTest +#if os(OSX) +@testable import MacawOSX +#endif + +#if os(iOS) @testable import Macaw +#endif class DelayedAnimationTests: XCTestCase { - var testView: MacawView! var testGroup: Group! - var window: UIWindow! + var window: MWindow! override func setUp() { super.setUp() testGroup = [Shape(form:Rect(x: 0.0, y: 0.0, w: 0.0, h: 0.0))].group() - testView = MacawView(node: testGroup, frame: CGRect.zero) + testView = MacawView(node: testGroup, frame: .zero) - window = UIWindow() + window = MWindow() window.addSubview(testView) } @@ -54,5 +57,3 @@ class DelayedAnimationTests: XCTestCase { XCTAssert(animation.paused && !animation.manualStop, "Wrong animation state on pause") } } - -#endif diff --git a/Source/platform/iOS/Common_iOS.swift b/Source/platform/iOS/Common_iOS.swift index d271ed47..219342fe 100644 --- a/Source/platform/iOS/Common_iOS.swift +++ b/Source/platform/iOS/Common_iOS.swift @@ -11,6 +11,7 @@ import Foundation #if os(iOS) import UIKit +public typealias MWindow = UIWindow public typealias MRectCorner = UIRectCorner public typealias MFont = UIFont public typealias MFontDescriptor = UIFontDescriptor diff --git a/Source/platform/macOS/Common_macOS.swift b/Source/platform/macOS/Common_macOS.swift index 3fdca8c1..b987e957 100644 --- a/Source/platform/macOS/Common_macOS.swift +++ b/Source/platform/macOS/Common_macOS.swift @@ -12,6 +12,7 @@ import Foundation import Cocoa import Quartz +public typealias MWindow = NSWindow public typealias MFont = NSFont public typealias MFontDescriptor = NSFontDescriptor public typealias MColor = NSColor @@ -176,4 +177,11 @@ extension CGContext { } } +extension NSWindow { + + func addSubview(_ subview: NSView) { + contentView?.addSubview(subview) + } +} + #endif