Skip to content

Commit

Permalink
Merge branch 'Swift3'
Browse files Browse the repository at this point in the history
  • Loading branch information
mtynior committed Nov 2, 2016
2 parents f6f6f4d + 066daa9 commit 25c8ec5
Show file tree
Hide file tree
Showing 21 changed files with 326 additions and 262 deletions.
28 changes: 28 additions & 0 deletions .swiftlint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
disabled_rules: # rule identifiers to exclude from running
- force_cast
- trailing_whitespace
- control_statement
- type_name
- variable_name
- force_try
# Find all the available rules by running:
# swiftlint rules

included: # paths to include during linting. `--path` is ignored if present.


excluded: # paths to ignore during linting. Takes precedence over `included`.

# parameterized rules can be customized from this configuration file
line_length: 256

function_parameter_count:
- 30
- 40

# parameterized rules are first parameterized as a warning level, then error level.
type_body_length:
- 500 # warning
- 1000 # error

#reporter: "csv" # reporter type (xcode, json, csv, checkstyle)
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
language: objective-c
osx_image: xcode7.3
osx_image: xcode8

script: fastlane test
11 changes: 10 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,22 @@
# Change Log

#### 1.x Releases

- `1.x.x` Releases - [1.4.0](#140)
- `1.3.x` Releases - [1.3.0](#130)
- `1.2.x` Releases - [1.2.0](#120)
- `1.1.x` Releases - [1.1.0](#110)
- `1.0.x` Releases - [1.0.0](#100)

---
## [1.4.0](https://github.com/mtynior/Felucia/releases/tag/1.4.0)
Released on 2016-11-01.

#### Added
- Support for Swift Package Manager

#### Updated
- Source code to Swift 3.0
- Project to Xcode 8

## [1.3.0](https://github.com/mtynior/Felucia/releases/tag/1.3.0)
Released on 2016-06-29.
Expand Down
138 changes: 101 additions & 37 deletions Felucia.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0710"
LastUpgradeVersion = "0810"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0730"
LastUpgradeVersion = "0810"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0730"
LastUpgradeVersion = "0810"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
26 changes: 0 additions & 26 deletions Felucia/Info-tvOS.plist

This file was deleted.

26 changes: 0 additions & 26 deletions Felucia/Info-watchOS.plist

This file was deleted.

16 changes: 8 additions & 8 deletions FeluciaTests/FeluciaTestsCMYK.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ import XCTest
class FeluciaTestsCMYK: XCTestCase {

func test_ShouldCreateColorFromCMYK() {
let expectedTuple : (r: Float, g:Float, b:Float, a:Float) = (0.5, 0.25, 0.125, 1.0)
let accuracy:Float = 0.005
let expectedTuple : (r: Float, g: Float, b: Float, a: Float) = (0.5, 0.25, 0.125, 1.0)
let accuracy: Float = 0.005

let color = UIColor(cyan: 0, magneta: 0.5, yellow: 0.75, black: 0.498)

Expand All @@ -23,8 +23,8 @@ class FeluciaTestsCMYK: XCTestCase {
}

func test_ShouldReturnTupleWithCMYKCompoments() {
let expectedTuple : (c: Float, m:Float, y:Float, k:Float) = (0, 0.5, 0.75, 0.498)
let accuracy:Float = 0.001
let expectedTuple : (c: Float, m: Float, y: Float, k: Float) = (0, 0.5, 0.75, 0.498)
let accuracy: Float = 0.001

let color = UIColor(cyan: 0, magneta: 0.5, yellow: 0.75, black: 0.498)

Expand All @@ -34,8 +34,8 @@ class FeluciaTestsCMYK: XCTestCase {
}

func test_ShouldReturnTupleWithCMYKCompomentsFromRGBAColor() {
let expectedTuple : (c: Float, m:Float, y:Float, k:Float) = (0.711, 0.533, 0.0, 0.118)
let accuracy:Float = 0.001
let expectedTuple : (c: Float, m: Float, y: Float, k: Float) = (0.711, 0.533, 0.0, 0.118)
let accuracy: Float = 0.001

let color = UIColor(r: 65, g: 105, b: 225, a: 255)

Expand All @@ -45,8 +45,8 @@ class FeluciaTestsCMYK: XCTestCase {
}

func test_ShouldReturnArrayWithCMYKCompoments() {
let expectedArray:[Float] = [0, 0.5, 0.75, 0.498]
let accuracy:Float = 0.001
let expectedArray: [Float] = [0, 0.5, 0.75, 0.498]
let accuracy: Float = 0.001

let color = UIColor(cyan: 0, magneta: 0.5, yellow: 0.75, black: 0.498)

Expand Down
10 changes: 4 additions & 6 deletions FeluciaTests/FeluciaTestsHSL.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@ import XCTest
class FeluciaTestsHSL: XCTestCase {

func test_ShouldCreateColorFromNormalizedHSLCompoents() {

let expectedColor = UIColor(hexARGBString: "#64A089")!
let expectedColor = UIColor(hexARGB: "#64A089")!

let actualColor = UIColor(h: 157.0/360.0, s: 0.24, l: 0.51)

Expand All @@ -25,8 +24,7 @@ class FeluciaTestsHSL: XCTestCase {
}

func test_ShouldCreateColorFromHSLCompoents() {

let expectedColor = UIColor(hexARGBString: "#64A089")!
let expectedColor = UIColor(hexARGB: "#64A089")!

let actualColor = UIColor(h: 157.0, s: 24, l: 51)

Expand All @@ -39,7 +37,7 @@ class FeluciaTestsHSL: XCTestCase {
func test_ShouldReturnHSLComponents() {
let expectedComponents: (Float, Float, Float, Float) = (157.0/360.0, 0.24, 0.51, 1.0)

let actualCompoents = UIColor(hexARGBString: "#64A089")!.hsla()
let actualCompoents = UIColor(hexARGB: "#64A089")!.hsla()

AssertEqualWithAccuracy(actualCompoents, expectedComponents, 0.001, "Should return HSL components")
}
Expand All @@ -48,7 +46,7 @@ class FeluciaTestsHSL: XCTestCase {
func test_ShouldReturnArrayOfHSLComponents() {
let expectedComponents: [Float] = [157.0/360.0, 0.24, 0.51, 1.0]

let actualCompoents = UIColor(hexARGBString: "#64A089")!.hslaArray()
let actualCompoents = UIColor(hexARGB: "#64A089")!.hslaArray()

AssertEqualWithAccuracy(actualCompoents, expectedComponents, 0.001, "Should return HSL components")
}
Expand Down
18 changes: 9 additions & 9 deletions FeluciaTests/FeluciaTestsHexColor.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,37 +14,37 @@ class FeluciaTestsHexColor: XCTestCase {
func test_ShouldCreateColorFromHex3String() {
let expectedColor = UIColor(r: 255, g: 187, b: 204, a: 255)

let actualColor = UIColor(hexARGBString: "#FBC")
let actualColor = UIColor(hexARGB: "#FBC")

XCTAssertEqual(actualColor, expectedColor, "Should create from hex3 ARGB String")
XCTAssertEqual(actualColor, expectedColor, "Should create from hex3 ARGB String")
}

func test_ShouldCreateColorFromHex6String() {
let expectedColor = UIColor(r: 255, g: 128, b: 64, a: 255)

let actualColor = UIColor(hexARGBString: "#FF8040")
let actualColor = UIColor(hexARGB: "#FF8040")

XCTAssertEqual(actualColor, expectedColor, "Should create from hex6 ARGB String")
XCTAssertEqual(actualColor, expectedColor, "Should create from hex6 ARGB String")
}

func test_ShouldCreateColorFromHex8String() {
let expectedColor = UIColor(r: 255, g: 187, b: 204, a: 128)

let actualColor = UIColor(hexARGBString: "#80FFBBCC")
let actualColor = UIColor(hexARGB: "#80FFBBCC")

XCTAssertEqual(actualColor, expectedColor, "Should create from hex8 ARGB String")
XCTAssertEqual(actualColor, expectedColor, "Should create from hex8 ARGB String")
}

func test_ShouldCreateColorForHexWithoutLeadingHash() {
let expectedColor = UIColor(r: 255, g: 187, b: 204, a: 128)

let actualColor = UIColor(hexARGBString: "80FFBBCC")
let actualColor = UIColor(hexARGB: "80FFBBCC")

XCTAssertEqual(actualColor, expectedColor, "Should create color for hex without leading hash")
XCTAssertEqual(actualColor, expectedColor, "Should create color for hex without leading hash")
}

func test_ShouldReturnNilForInvalidHexString() {
let actualColor = UIColor(hexARGBString: "#FBCFBCFBCFCB")
let actualColor = UIColor(hexARGB: "#FBCFBCFBCFCB")

XCTAssertNil(actualColor, "Should return nil for invalid ARGB String")
}
Expand Down
4 changes: 2 additions & 2 deletions FeluciaTests/FeluciaTestsRGBAFloat.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import XCTest
class FeluciaTestsRGBAFloat: XCTestCase {

func test_ShouldReturnTupleWithRGBACompoments() {
let expectedTuple : (r: Float, g:Float, b:Float, a:Float) = (1.0, 0.75, 0.5, 0.25)
let expectedTuple: (r: Float, g: Float, b: Float, a: Float) = (1.0, 0.75, 0.5, 0.25)
let color = UIColor(red: 1.0, green: 0.75, blue: 0.5, alpha: 0.25)

let actualTuple = color.rgbaf()
Expand All @@ -22,7 +22,7 @@ class FeluciaTestsRGBAFloat: XCTestCase {
}

func test_ShouldReturnArrayWithRGBACompoments() {
let expectedArray : [Float] = [1.0, 0.75, 0.5, 0.25]
let expectedArray: [Float] = [1.0, 0.75, 0.5, 0.25]
let color = UIColor(red: 1.0, green: 0.75, blue: 0.5, alpha: 0.25)

let actualArray = color.rgbafArray()
Expand Down
30 changes: 15 additions & 15 deletions FeluciaTests/FeluciaTestsUtils.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import XCTest
class FeluciaTestsUtils: XCTestCase {

func test_ShouldCreateGrayscaleFromOtherColor() {
let expectedComponents: (r:Int, g:Int, b:Int, a:Int) = (106, 106, 106, 255)
let expectedComponents: (r: Int, g: Int, b: Int, a: Int) = (106, 106, 106, 255)

let grayscaleColor = UIColor(r: 67, g: 122, b: 134).grayscale()
let actualComponents = grayscaleColor.rgba()
Expand All @@ -35,39 +35,39 @@ class FeluciaTestsUtils: XCTestCase {
extension FeluciaTestsUtils {

func test_ShouldLightenColorWithDefaultValue() {
let expectedColor = UIColor(hexARGBString: "#ff3333")!
let expectedColor = UIColor(hexARGB: "#ff3333")!

let lightenColor = UIColor(hexARGBString:"#f00")!.lighten()
let lightenColor = UIColor(hexARGB:"#f00")!.lighten()

let areEqual = expectedColor == lightenColor

XCTAssertTrue(areEqual, "Shoud lighten color by default value")
}

func test_ColorLightenBy100PercentShouldBecomeWhite() {
let expectedColor = UIColor.whiteColor()
let expectedColor = UIColor.white

let lightenColor = UIColor(hexARGBString:"#f00")!.lighten(1.0)
let lightenColor = UIColor(hexARGB:"#f00")!.lighten(percentage: 1.0)

let areEqual = expectedColor == lightenColor

XCTAssertTrue(areEqual, "Color lightened by 100% should become white")
}

func test_ShouldDarkenColorWithDefaultValue() {
let expectedColor = UIColor(hexARGBString: "#cc0000")!
let expectedColor = UIColor(hexARGB: "#cc0000")!

let darkenColor = UIColor(hexARGBString:"#f00")!.darken()
let darkenColor = UIColor(hexARGB:"#f00")!.darken()

let areEqual = expectedColor == darkenColor

XCTAssertTrue(areEqual, "Shoud darken color by default value")
}

func test_ColorDarkenBy100PercentShouldBecomeBlack() {
let expectedColor = UIColor.blackColor()
let expectedColor = UIColor.black

let darkenColor = UIColor(hexARGBString:"#f00")!.darken(1.0)
let darkenColor = UIColor(hexARGB:"#f00")!.darken(percentage: 1.0)

let areEqual = expectedColor == darkenColor

Expand All @@ -81,7 +81,7 @@ extension FeluciaTestsUtils {
func test_ShouldReturnWhiteAsComplementaryColorToBlack() {
let expectedComponents = (r: 255, g: 255, b: 255, a: 255) // expected color is white

let invertedColor = UIColor.blackColor().complementaryColor()
let invertedColor = UIColor.black.complementaryColor()
let actualComponents = invertedColor.rgba()

let areTuplesEquels = actualComponents == expectedComponents
Expand All @@ -91,7 +91,7 @@ extension FeluciaTestsUtils {
func test_ShouldReturnBlackAsComplementaryColorToWhite() {
let expectedComponents = (r: 0, g: 0, b: 0, a: 255) // expected color is black

let invertedColor = UIColor.whiteColor().complementaryColor()
let invertedColor = UIColor.white.complementaryColor()
let actualComponents = invertedColor.rgba()

let areTuplesEquels = actualComponents == expectedComponents
Expand All @@ -103,31 +103,31 @@ extension FeluciaTestsUtils {
extension FeluciaTestsUtils {

func test_IsLightShouldReturnTrueForWhiteColor() {
let color = UIColor.whiteColor()
let color = UIColor.white

let actualResult = color.isLight()

XCTAssertTrue(actualResult, "isLight() should return true for white color")
}

func test_IsLightShouldReturnFalseForBlackColor() {
let color = UIColor.blackColor()
let color = UIColor.black

let actualResult = color.isLight()

XCTAssertFalse(actualResult, "isLight() should return false for white color")
}

func test_IsDarkShouldReturnTrueForBlackColor() {
let color = UIColor.blackColor()
let color = UIColor.black

let actualResult = color.isDark()

XCTAssertTrue(actualResult, "isDark() should return true for black color")
}

func test_IsDarkShouldReturnFalseForWhiteColor() {
let color = UIColor.whiteColor()
let color = UIColor.white

let actualResult = color.isDark()

Expand Down
Loading

0 comments on commit 25c8ec5

Please sign in to comment.