Skip to content

Commit

Permalink
Fixed Unit Tests and Swift 3 compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
colemancda committed Nov 22, 2017
1 parent 199e3e7 commit b504b03
Show file tree
Hide file tree
Showing 17 changed files with 523 additions and 161 deletions.
16 changes: 8 additions & 8 deletions Package.pins
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
{
"autoPin": true,
"pins": [
{
"package": "Cairo",
"reason": null,
"repositoryURL": "https://github.com/PureSwift/Cairo.git",
"version": "1.2.3"
},
{
"package": "CCairo",
"reason": null,
Expand All @@ -17,25 +23,19 @@
"package": "CFreeType",
"reason": null,
"repositoryURL": "https://github.com/PureSwift/CFreeType.git",
"version": "1.0.3"
"version": "1.0.4"
},
{
"package": "CLCMS",
"reason": null,
"repositoryURL": "https://github.com/PureSwift/CLCMS.git",
"version": "1.0.0"
},
{
"package": "Cairo",
"reason": null,
"repositoryURL": "https://github.com/PureSwift/Cairo.git",
"version": "1.2.2"
},
{
"package": "LittleCMS",
"reason": null,
"repositoryURL": "https://github.com/PureSwift/LittleCMS.git",
"version": "1.0.1"
"version": "1.0.2"
}
],
"version": 1
Expand Down
80 changes: 31 additions & 49 deletions Package.resolved
Original file line number Diff line number Diff line change
Expand Up @@ -2,78 +2,60 @@
"object": {
"pins": [
{
"reference": {
"identity": "cairo",
"isLocal": false,
"path": "https://github.com/PureSwift/Cairo.git"
},
"package": "CCairo",
"repositoryURL": "https://github.com/PureSwift/CCairo.git",
"state": {
"branch": "master",
"revision": "9fa92e223d8f596e3c545f320f1235178dec79d2",
"version": null
"branch": null,
"revision": "1bd46ac81056766182be22fccc2cdf0e457f042f",
"version": "1.1.1"
}
},
{
"reference": {
"identity": "ccairo",
"isLocal": false,
"path": "https://github.com/PureSwift/CCairo.git"
},
"package": "CFontConfig",
"repositoryURL": "https://github.com/PureSwift/CFontConfig.git",
"state": {
"branch": "master",
"revision": "9828dafe5d7d4df38cc81614416c52df1c707d7d",
"version": null
"branch": null,
"revision": "e5bae817dbd1eb402f395d960485c52350b2bd88",
"version": "1.0.1"
}
},
{
"reference": {
"identity": "cfontconfig",
"isLocal": false,
"path": "https://github.com/PureSwift/CFontConfig.git"
},
"package": "CFreeType",
"repositoryURL": "https://github.com/PureSwift/CFreeType.git",
"state": {
"branch": "master",
"revision": "149b01e9a29e265f785dc6ab5003b4a6f1074a5f",
"version": null
"branch": null,
"revision": "079909dc68c13c700bb6bab3059ddf51f642b43a",
"version": "1.0.4"
}
},
{
"reference": {
"identity": "cfreetype",
"isLocal": false,
"path": "https://github.com/PureSwift/CFreeType.git"
},
"package": "CLCMS",
"repositoryURL": "https://github.com/PureSwift/CLCMS.git",
"state": {
"branch": "master",
"revision": "5d65c8825addca5f30ff2c16e8b7e6f61562f618",
"version": null
"branch": null,
"revision": "20d18d62ebc642e52758512cab59af06f2d3655e",
"version": "1.0.0"
}
},
{
"reference": {
"identity": "clcms",
"isLocal": false,
"path": "https://github.com/PureSwift/CLCMS.git"
},
"package": "Cairo",
"repositoryURL": "https://github.com/PureSwift/Cairo.git",
"state": {
"branch": "master",
"revision": "4808ad3fa6d244eb5a328a1b3fe0439f5954a831",
"version": null
"branch": null,
"revision": "bc207ab2e367fbafef51a47b85a7e1eb2821ce57",
"version": "1.2.3"
}
},
{
"reference": {
"identity": "littlecms",
"isLocal": false,
"path": "https://github.com/PureSwift/LittleCMS.git"
},
"package": "LittleCMS",
"repositoryURL": "https://github.com/PureSwift/LittleCMS.git",
"state": {
"branch": "master",
"revision": "5bfebf596b080f8c7dc5f403f2f0784cef130906",
"version": null
"branch": null,
"revision": "4143dfd3916be5b1ccd3cc46c27d939e9b63c0dd",
"version": "1.0.2"
}
}
]
},
"version": 2
"version": 1
}
27 changes: 7 additions & 20 deletions Package.swift
Original file line number Diff line number Diff line change
@@ -1,28 +1,15 @@
// swift-tools-version:4.0
// swift-tools-version:3.0.2
// The swift-tools-version declares the minimum version of Swift required to build this package.

import PackageDescription

let package = Package(
name: "Silica",
products: [
// Products define the executables and libraries produced by a package, and make them visible to other packages.
.library(
name: "Silica",
targets: ["Silica"]),
],
dependencies: [
.package(url: "https://github.com/PureSwift/Cairo.git", .branch("master")),
.package(url: "https://github.com/PureSwift/LittleCMS.git", .branch("master"))
],
targets: [
// Targets are the basic building blocks of a package. A target can define a module or a test suite.
// Targets can depend on other targets in this package, and on products in packages which this package depends on.
.target(
name: "Silica",
dependencies: ["Cairo", "LittleCMS"]),
.testTarget(
name: "SilicaTests",
dependencies: ["Silica"]),
]
Target(name: "Silica")
],
dependencies: [
.Package(url: "https://github.com/PureSwift/Cairo.git", majorVersion: 1),
.Package(url: "https://github.com/PureSwift/LittleCMS.git", majorVersion: 1)
]
)
7 changes: 6 additions & 1 deletion Sources/Silica/CGAffineTransform.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,12 @@ import Cairo
import CCairo
import Foundation

#if os(Linux)
#if os(macOS)

import struct CoreGraphics.CGAffineTransform
public typealias CGAffineTransform = CoreGraphics.CGAffineTransform

#else

/// Affine Transform
public struct CGAffineTransform {
Expand Down
5 changes: 1 addition & 4 deletions Sources/Silica/CGContext.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,7 @@

import Cairo
import CCairo
import struct Foundation.CGFloat
import struct Foundation.CGPoint
import struct Foundation.CGSize
import struct Foundation.CGRect
import Foundation

public final class CGContext {

Expand Down
5 changes: 4 additions & 1 deletion Sources/Silica/CGFont.swift
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,10 @@ internal extension String {

func substring(range: Range<Int>) -> String? {
let indexRange = utf8.index(utf8.startIndex, offsetBy: range.lowerBound) ..< utf8.index(utf8.startIndex, offsetBy: range.upperBound)
return String(utf8[indexRange])

let substring = String(utf8[indexRange])

return substring
}
}

Expand Down
19 changes: 19 additions & 0 deletions Sources/Silica/CGPoint.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
//
// CGPoint.swift
// Silica
//
// Created by Alsey Coleman Miller on 6/16/17.
//

import struct Foundation.CGFloat
import struct Foundation.CGPoint

#if os(Linux)
public extension CGPoint {

#if swift(>=4)
#elseif swift(>=3.0.2)
public static var zero: CGPoint { return CGPoint() }
#endif
}
#endif
Loading

0 comments on commit b504b03

Please sign in to comment.