Skip to content

Commit

Permalink
Update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
status302 committed Feb 14, 2019
1 parent e1acf11 commit 5aba047
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 15 deletions.
20 changes: 10 additions & 10 deletions FontAwesomeKitTests/FontAwesomeKitTests.swift
Expand Up @@ -13,33 +13,33 @@ import UIKit
class FontAwesomeKitTests: XCTestCase {

func testBarButton() {
let barButton = UIBarButtonItem(awesomeType: .fa_align_left, size: 100, style: .plain, target: nil, action: nil)
let barButton = UIBarButtonItem(awesomeType: .alignLeft, size: 100, style: .plain, target: nil, action: nil)
XCTAssert((barButton.image != nil), "BarButtonItem should not be nil.")
}

func testBarButtonItemTitle() {
let barItem = UIBarButtonItem()
let attrs = [NSAttributedString.Key.font: UIFont.fa?.fontSize(100)]
barItem.setTitleTextAttributes((attrs as Any as! [NSAttributedString.Key : Any]) , for: .normal)
barItem.title = String.fa.fontAwesome(.fa_git)
barItem.title = String.fa.fontAwesome(.git)
XCTAssertEqual(barItem.title, String(format: "%C", 0xf1d3))
}

func testTitleWithUnicode() {
let str = String.fa.fontAwesome(undefined: 0xf042)
let adjustStr = String.fa.fontAwesome(.fa_adjust)
let adjustStr = String.fa.fontAwesome(.adjust)
XCTAssertEqual(str, adjustStr)
}

func testBarItem() {
let barItem = UIBarButtonItem(awesomeType: .fa_android, size: 100, style: .plain, target: nil, action: nil)
let barItem = UIBarButtonItem(awesomeType: .android, size: 100, style: .plain, target: nil, action: nil)
XCTAssert(barItem.image != nil, "barItem image should not be nil.")
}

func testFontAwesomeLabel() {
let label = FontAwesomeLabel()
label.unicode = "0xf26e"
XCTAssertTrue(label.text == String.fa.fontAwesome(.fa_500px), "label text should be .fa_500px.")
XCTAssertTrue(label.text == String.fa.fontAwesome(.fa500px), "label text should be .500px.")
}

func testFontAwesomeButton() {
Expand All @@ -49,15 +49,15 @@ class FontAwesomeKitTests: XCTestCase {
button.selectedUnicode = "0xf036"
button.highlightedUnicode = "0xf038"

XCTAssertTrue(button.title(for: .disabled) == String.fa.fontAwesome(.fa_align_center), "button disable string should be .fa_align_center")
XCTAssertTrue(button.title(for: .normal) == String.fa.fontAwesome(.fa_align_justify), "button normal string should be .fa_align_justify")
XCTAssertTrue(button.title(for: .selected) == String.fa.fontAwesome(.fa_align_left), "button selected string should be .fa_align_left")
XCTAssertTrue(button.title(for: .highlighted) == String.fa.fontAwesome(.fa_align_right), "button highlighted string should be .fa_align_right")
XCTAssertTrue(button.title(for: .disabled) == String.fa.fontAwesome(.alignCenter), "button disable string should be .align_center")
XCTAssertTrue(button.title(for: .normal) == String.fa.fontAwesome(.alignJustify), "button normal string should be .align_justify")
XCTAssertTrue(button.title(for: .selected) == String.fa.fontAwesome(.alignLeft), "button selected string should be .align_left")
XCTAssertTrue(button.title(for: .highlighted) == String.fa.fontAwesome(.alignRight), "button highlighted string should be .align_right")
}

func test470() {
let label = UILabel()
label.fa.text = .fa_address_book
label.fa.text = .addressBook
label.font = UIFont.fa?.fontSize(50)
XCTAssert(label.text == String.fa.fontAwesome(undefined: 0xf2b9), "label for 4.7.0 will be correctly.")
}
Expand Down
2 changes: 1 addition & 1 deletion FontAwesomeKitTests/StringTests.swift
Expand Up @@ -22,7 +22,7 @@ class StringTests: XCTestCase {
}

func testFontAwesomeEqualable() {
let android = FontAwesomeType.fa_android
let android = FontAwesomeType.android
let typeStr = String.fa.fontAwesome(android)
let androidUnicode = String(format: "%C", 0xf17b)
assert(typeStr == androidUnicode)
Expand Down
2 changes: 1 addition & 1 deletion FontAwesomeKitTests/UIButtonTests.swift
Expand Up @@ -14,7 +14,7 @@ import XCTest
class UIButtonTests: XCTestCase {
func testButtonTitle() {
let button = UIButton()
button.fa.setTitle(.fa_apple, for: .normal)
button.fa.setTitle(.apple, for: .normal)
XCTAssert((button.titleLabel?.text != nil), "button titleLabel should not be nil.")
}

Expand Down
2 changes: 1 addition & 1 deletion FontAwesomeKitTests/UIImageTests.swift
Expand Up @@ -22,7 +22,7 @@ class UIImageTests: XCTestCase {
}

func testFontAwesomeImage() {
let image = UIImage(awesomeType: .fa_500px, size: 20, textColor: UIColor.red)
let image = UIImage(awesomeType: .fa500px, size: 20, textColor: UIColor.red)
assert(image != nil)
}
}
4 changes: 2 additions & 2 deletions FontAwesomeKitTests/UILabelTests.swift
Expand Up @@ -19,8 +19,8 @@ class UILabelTests: XCTestCase {

func testLabelText() {
let label = UILabel()
label.fa.text = .fa_android
XCTAssert(label.fa.text == .fa_android, "label fa text should be fa_android")
label.fa.text = .android
XCTAssert(label.fa.text == .android, "label fa text should be fa_android")
XCTAssert((label.text != nil ), "Icon text should not be nil.")
}
}

0 comments on commit 5aba047

Please sign in to comment.