diff --git a/LayoutKitTests/LabelLayoutTests.swift b/LayoutKitTests/LabelLayoutTests.swift index f7eed7c2..309371c9 100644 --- a/LayoutKitTests/LabelLayoutTests.swift +++ b/LayoutKitTests/LabelLayoutTests.swift @@ -60,6 +60,17 @@ class LabelLayoutTests: XCTestCase { XCTAssertEqual(arrangement.makeViews().frame.size, label.intrinsicContentSize) } + + func testAsyncAttributedLabel() { + DispatchQueue.global(qos: .userInitiated).async { + let attributedText = NSAttributedString(string: "Async", attributes: [NSAttributedStringKey.font: UIFont.helvetica(size: 42)]) + let arrangement = LabelLayout(attributedText: attributedText).arrangement() + DispatchQueue.main.async { + let label = UILabel(attributedText: attributedText, font: UIFont.helvetica(size: 42)) + XCTAssertEqual(arrangement.makeViews().frame.size, label.intrinsicContentSize) + } + } + } func testTwoLineLabel() { let text = "Nick Snyder" diff --git a/Sources/Layouts/LabelLayout.swift b/Sources/Layouts/LabelLayout.swift index b1fa4ccb..8c383acc 100644 --- a/Sources/Layouts/LabelLayout.swift +++ b/Sources/Layouts/LabelLayout.swift @@ -112,7 +112,7 @@ open class LabelLayout: BaseLayout