@@ -66,6 +66,28 @@ final class FontRepresentableTests: XCTestCase {
6666 XCTAssertEqual ( font. pointSize, systemFont. pointSize)
6767 XCTAssertEqual ( font. lineHeight, systemFont. lineHeight)
6868 }
69+
70+ func testIsBoldTextEnabled( ) {
71+ let ( sut, _, _) = makeSUT ( )
72+
73+ // given a traitCollection with legibilityWeight == .bold, it should return `true`
74+ XCTAssertTrue ( sut. isBoldTextEnabled ( compatibleWith: UITraitCollection ( legibilityWeight: . bold) ) )
75+ XCTAssertTrue ( sut. isBoldTextEnabled ( compatibleWith: UITraitCollection ( traitsFrom: [
76+ UITraitCollection ( preferredContentSizeCategory: . extraLarge) ,
77+ UITraitCollection ( legibilityWeight: . bold)
78+ ] ) ) )
79+
80+ // given a traitCollection with legibilityWeight != .bold, it should return `false`
81+ XCTAssertFalse ( sut. isBoldTextEnabled ( compatibleWith: UITraitCollection ( legibilityWeight: . regular) ) )
82+ XCTAssertFalse ( sut. isBoldTextEnabled ( compatibleWith: UITraitCollection ( legibilityWeight: . unspecified) ) )
83+
84+ // given a traitCollection without legibilityWeight trait, it should return `false`
85+ XCTAssertFalse ( sut. isBoldTextEnabled ( compatibleWith: UITraitCollection ( ) ) )
86+ XCTAssertFalse ( sut. isBoldTextEnabled ( compatibleWith: UITraitCollection ( preferredContentSizeCategory: . small) ) )
87+
88+ // given traitCollection is nil, it should return the system setting
89+ XCTAssertEqual ( sut. isBoldTextEnabled ( compatibleWith: nil ) , UIAccessibility . isBoldTextEnabled)
90+ }
6991}
7092
7193// We use large tuples in makeSUT()
0 commit comments