File tree Expand file tree Collapse file tree
rn-tester/RNTesterUnitTests Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -24,6 +24,7 @@ RCTFontWeight RCTGetFontWeight(UIFont *font)
2424 weightSuffixes = @[
2525 @" normal" ,
2626 @" ultralight" ,
27+ @" extralight" ,
2728 @" thin" ,
2829 @" light" ,
2930 @" regular" ,
@@ -39,6 +40,7 @@ RCTFontWeight RCTGetFontWeight(UIFont *font)
3940 fontWeights = @[
4041 @(UIFontWeightRegular),
4142 @(UIFontWeightUltraLight),
43+ @(UIFontWeightUltraLight),
4244 @(UIFontWeightThin),
4345 @(UIFontWeightLight),
4446 @(UIFontWeightRegular),
Original file line number Diff line number Diff line change @@ -49,6 +49,25 @@ - (void)testWeight
4949 }
5050}
5151
52+ - (void )testWeightFromFontName
53+ {
54+ // "ExtraLight" and "UltraLight" name the same weight (OpenType usWeightClass 200).
55+ {
56+ UIFont *font = [UIFont fontWithName: @" HelveticaNeue-UltraLight" size: 14 ];
57+ XCTAssertEqual (RCTGetFontWeight (font), UIFontWeightUltraLight);
58+ }
59+ #if !TARGET_OS_TV
60+ {
61+ UIFont *font = [UIFont fontWithName: @" Seravek-ExtraLight" size: 14 ];
62+ XCTAssertEqual (RCTGetFontWeight (font), UIFontWeightUltraLight);
63+ }
64+ {
65+ UIFont *font = [UIFont fontWithName: @" Seravek-Light" size: 14 ];
66+ XCTAssertEqual (RCTGetFontWeight (font), UIFontWeightLight);
67+ }
68+ #endif
69+ }
70+
5271- (void )testSize
5372{
5473 {
You can’t perform that action at this time.
0 commit comments