|
@@ -56,18 +56,26 @@
|
56
|
56
|
XCTAssertEqual(font.pointSize, fontSize.floatValue);
|
57
|
57
|
}
|
58
|
58
|
|
59
|
|
-- (void)testcreateFromDictionary_shouldMergeWithDictionary {
|
|
59
|
+- (void)testCreateFromDictionary_shouldMergeWithDictionary {
|
60
|
60
|
NSString* familyName = @"Helvetica";
|
61
|
61
|
NSNumber* fontSize = @(20);
|
62
|
62
|
NSDictionary* dictionary = @{NSForegroundColorAttributeName: UIColor.redColor};
|
63
|
63
|
|
64
|
64
|
NSDictionary* attributes = [RNNFontAttributesCreator createFromDictionary:dictionary fontFamily:familyName fontSize:fontSize defaultFontSize:nil fontWeight:nil color:nil defaultColor:nil];
|
65
|
65
|
UIFont* font = attributes[NSFontAttributeName];
|
66
|
|
- XCTAssertEqual(attributes[NSForegroundColorAttributeName], UIColor.redColor);
|
67
|
66
|
XCTAssertTrue([familyName isEqualToString:font.familyName]);
|
68
|
67
|
XCTAssertEqual(font.pointSize, fontSize.floatValue);
|
69
|
68
|
}
|
70
|
69
|
|
|
70
|
+- (void)testCreateFromDictionary_shouldOverrideColor {
|
|
71
|
+ NSString* familyName = @"Helvetica";
|
|
72
|
+ NSNumber* fontSize = @(20);
|
|
73
|
+ NSDictionary* dictionary = @{NSForegroundColorAttributeName: UIColor.redColor};
|
|
74
|
+
|
|
75
|
+ NSDictionary* attributes = [RNNFontAttributesCreator createFromDictionary:dictionary fontFamily:familyName fontSize:fontSize defaultFontSize:nil fontWeight:nil color:nil defaultColor:nil];
|
|
76
|
+ XCTAssertEqual(attributes[NSForegroundColorAttributeName], nil);
|
|
77
|
+}
|
|
78
|
+
|
71
|
79
|
- (void)testCreateWithFontFamily_shouldNotChangeFontFamilyWhenOnlySizeAvailable {
|
72
|
80
|
NSNumber* fontSize = @(20);
|
73
|
81
|
UIFont* initialFont = [UIFont systemFontOfSize:10 weight:UIFontWeightHeavy];
|