66// Copyright © 2017 Exyte. All rights reserved.
77//
88
9- #if os(iOS)
10-
119import XCTest
10+
11+ #if os(OSX)
12+ @testable import MacawOSX
13+ #elseif os(iOS)
1214@testable import Macaw
15+ #endif
1316
1417class ImageBoundsTests : XCTestCase {
1518
@@ -26,7 +29,11 @@ class ImageBoundsTests: XCTestCase {
2629 return
2730 }
2831
29- XCTAssert ( bounds. w == 1174.0 && bounds. h == 862.0 , " Wrong bounds for path src " )
32+ #if os(iOS)
33+ XCTAssert ( bounds. w == 1174.0 && bounds. h == 862.0 , " Wrong bounds for path src " )
34+ #elseif os(OSX)
35+ XCTAssert ( bounds. w == 587.0 && bounds. h == 431.0 , " Wrong bounds for path src " )
36+ #endif
3037 }
3138
3239 func testSrcAsBase64( ) {
@@ -36,7 +43,6 @@ class ImageBoundsTests: XCTestCase {
3643 return
3744 }
3845
39-
4046 let url = URL ( fileURLWithPath: path)
4147 guard let base64Content = try ? String ( contentsOf: url) else {
4248 XCTFail ( )
@@ -49,25 +55,40 @@ class ImageBoundsTests: XCTestCase {
4955 return
5056 }
5157
52- XCTAssert ( bounds. w == 1174.0 && bounds. h == 862.0 , " Wrong bounds for base64 src " )
58+ #if os(iOS)
59+ XCTAssert ( bounds. w == 1174.0 && bounds. h == 862.0 , " Wrong bounds for base64 src " )
60+ #elseif os(OSX)
61+ XCTAssert ( bounds. w == 587.0 && bounds. h == 431.0 , " Wrong bounds for base64 src " )
62+ #endif
5363 }
5464
5565 func testInMemoryImage( ) {
5666 let bundle = Bundle ( for: type ( of: TestUtils ( ) ) )
67+
68+ #if os(iOS)
5769 guard let mImage = MImage ( named: " logo.png " , in: bundle, compatibleWith: . none) else {
5870 XCTFail ( )
5971 return
6072 }
6173
74+ #elseif os(OSX)
75+ guard let mImage = bundle. image ( forResource: " logo.png " ) else {
76+ XCTFail ( )
77+ return
78+ }
79+ #endif
80+
6281 let image = Image ( image: mImage)
6382 guard let bounds = image. bounds else {
6483 XCTFail ( " Bounds not available " )
6584 return
6685 }
6786
68- XCTAssert ( bounds. w == 1174.0 && bounds. h == 862.0 , " Wrong bounds for in-memory image " )
87+ #if os(iOS)
88+ XCTAssert ( bounds. w == 1174.0 && bounds. h == 862.0 , " Wrong bounds for in-memory image " )
89+ #elseif os(OSX)
90+ XCTAssert ( bounds. w == 587.0 && bounds. h == 431.0 , " Wrong bounds for in-memory image " )
91+ #endif
6992 }
7093
7194}
72-
73- #endif
0 commit comments