Skip to content

Commit

Permalink
fix tests build
Browse files Browse the repository at this point in the history
  • Loading branch information
krzyzanowskim committed Aug 23, 2024
1 parent f61e63a commit 0aed46e
Show file tree
Hide file tree
Showing 5 changed files with 72 additions and 72 deletions.
3 changes: 2 additions & 1 deletion Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ let package = Package(
dependencies: [
.target(name: "STTextViewCommon"),
.target(name: "STObjCLandShim", condition: .when(platforms: [.macOS])),
.product(name: "STTextKitPlus", package: "STTextKitPlus")
.product(name: "STTextKitPlus", package: "STTextKitPlus"),
.product(name: "CoreTextSwift", package: "CoreTextSwift")
]
),
.target(
Expand Down
29 changes: 14 additions & 15 deletions Tests/STTextViewAppKitTests/ContentTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,35 +6,35 @@ class ContentTests : XCTestCase {

func testContentUpdate() {
let textView = STTextView()
XCTAssertTrue(textView.string.isEmpty)
XCTAssertTrue(textView.text!.isEmpty)
XCTAssertEqual(textView.attributedString().length, 0)

textView.string = "1234"
XCTAssertEqual(textView.string.count, 4)
textView.text = "1234"
XCTAssertEqual(textView.text!.count, 4)
XCTAssertEqual(textView.attributedString().length, 4)

textView.string = "5678"
XCTAssertEqual(textView.string.count, 4)
textView.text = "5678"
XCTAssertEqual(textView.text!.count, 4)
XCTAssertEqual(textView.attributedString().length, 4)

textView.setAttributedString(NSAttributedString(string: "12345"))
XCTAssertEqual(textView.string.count, 5)
textView.attributedText = NSAttributedString(string: "12345")
XCTAssertEqual(textView.text!.count, 5)
XCTAssertEqual(textView.attributedString().length, 5)

textView.setAttributedString(NSAttributedString(string: "6789"))
XCTAssertEqual(textView.string.count, 4)
textView.attributedText = NSAttributedString(string: "6789")
XCTAssertEqual(textView.text!.count, 4)
XCTAssertEqual(textView.attributedString().length, 4)

textView.string = ""
XCTAssertEqual(textView.string.count, 0)
textView.text = ""
XCTAssertEqual(textView.text!.count, 0)
XCTAssertEqual(textView.attributedString().length, 0)
}

func testContentUpdateStringAfterAttributedString() {
let textView = STTextView()
textView.setAttributedString(NSAttributedString(string: "1234"))
textView.string = ""
XCTAssertEqual(textView.string.count, 0)
textView.attributedText = NSAttributedString(string: "1234")
textView.text = ""
XCTAssertEqual(textView.text!.count, 0)
XCTAssertEqual(textView.attributedString().length, 0)
}

Expand All @@ -54,7 +54,6 @@ class ContentTests : XCTestCase {
XCTAssertEqual(textView.typingAttributes[.font] as! NSFont, NSFont.systemFont(ofSize: 96))

XCTExpectFailure("nil NSFont given")
textView.font = nil
XCTAssertNotNil(textView.font)
XCTAssertNotNil(textView.typingAttributes[.font])
}
Expand Down
Loading

0 comments on commit 0aed46e

Please sign in to comment.