@@ -27,6 +27,16 @@ final class TypographyMutatorsTests: XCTestCase {
2727 return styles
2828 } ( )
2929
30+ func testFamilyName( ) {
31+ types. forEach {
32+ let familyName = " AppleSDGothicNeo "
33+ let typography = $0. familyName ( familyName)
34+ _test ( original: $0, modified: typography, familyName: familyName)
35+ let layout = typography. generateLayout ( compatibleWith: UITraitCollection ( legibilityWeight: . regular) )
36+ XCTAssertEqual ( layout. font. familyName. removeSpaces ( ) , familyName)
37+ }
38+ }
39+
3040 func testRegular( ) {
3141 types. forEach {
3242 _test ( original: $0, modified: $0. regular, weight: . regular)
@@ -94,6 +104,7 @@ final class TypographyMutatorsTests: XCTestCase {
94104 private func _test(
95105 original: Typography ,
96106 modified: Typography ,
107+ familyName: String ? = nil ,
97108 weight: Typography . FontWeight ? = nil ,
98109 fontSize: CGFloat ? = nil ,
99110 lineHeight: CGFloat ? = nil ,
@@ -102,6 +113,7 @@ final class TypographyMutatorsTests: XCTestCase {
102113 textCase: Typography . TextCase ? = nil ,
103114 textDecoration: Typography . TextDecoration ? = nil
104115 ) {
116+ let familyName = familyName ?? original. fontFamily. familyName
105117 let weight = weight ?? original. fontWeight
106118 let fontSize = fontSize ?? original. fontSize
107119 let lineHeight = lineHeight ?? original. lineHeight
@@ -110,7 +122,9 @@ final class TypographyMutatorsTests: XCTestCase {
110122 let textCase = textCase ?? original. textCase
111123 let textDecoration = textDecoration ?? original. textDecoration
112124
113- // fontWeight, fontSize, lineHeight, isFixed, letterSpacing, textCase, and textDecoration should be as expected
125+ // familyName, fontWeight, fontSize, lineHeight, isFixed,
126+ // letterSpacing, textCase, and textDecoration should be as expected
127+ XCTAssertEqual ( modified. fontFamily. familyName, familyName)
114128 XCTAssertEqual ( modified. fontWeight, weight)
115129 XCTAssertEqual ( modified. fontSize, fontSize)
116130 XCTAssertEqual ( modified. lineHeight, lineHeight)
@@ -120,7 +134,6 @@ final class TypographyMutatorsTests: XCTestCase {
120134 XCTAssertEqual ( modified. textDecoration, textDecoration)
121135
122136 // the other variables should be the same
123- XCTAssertEqual ( modified. fontFamily. familyName, original. fontFamily. familyName)
124137 XCTAssertEqual ( modified. textStyle, original. textStyle)
125138 XCTAssertEqual ( modified. paragraphIndent, original. paragraphIndent)
126139 XCTAssertEqual ( modified. paragraphSpacing, original. paragraphSpacing)
0 commit comments