Skip to content

Commit

Permalink
#587 add DelayedAnimationTests for OSX, add MWindow aka UIWindow(iOS)…
Browse files Browse the repository at this point in the history
… aka NSWindow(OSX)
  • Loading branch information
Daniil Manin committed Jun 3, 2019
1 parent 12d3dd3 commit ebdad34
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 8 deletions.
17 changes: 9 additions & 8 deletions MacawTests/Animation/DelayedAnimationTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}

Expand Down Expand Up @@ -54,5 +57,3 @@ class DelayedAnimationTests: XCTestCase {
XCTAssert(animation.paused && !animation.manualStop, "Wrong animation state on pause")
}
}

#endif
1 change: 1 addition & 0 deletions Source/platform/iOS/Common_iOS.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 8 additions & 0 deletions Source/platform/macOS/Common_macOS.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -176,4 +177,11 @@ extension CGContext {
}
}

extension NSWindow {

func addSubview(_ subview: NSView) {
contentView?.addSubview(subview)
}
}

#endif

0 comments on commit ebdad34

Please sign in to comment.