mirror of
https://github.com/HackPlan/AsyncDisplayKit.git
synced 2026-04-29 12:15:36 +08:00
Merge pull request #18 from raphaelmor/fix-failing-unit-tests
Use XCTAssertEqualWithAccuracy in ASTextNodeWordKernerTests.
This commit is contained in:
@@ -80,7 +80,8 @@
|
|||||||
CGFloat expectedWidth = [@" " sizeWithAttributes:@{ NSFontAttributeName : font }].width;
|
CGFloat expectedWidth = [@" " sizeWithAttributes:@{ NSFontAttributeName : font }].width;
|
||||||
|
|
||||||
CGRect boundingBox = [_layoutManagerDelegate layoutManager:_components.layoutManager boundingBoxForControlGlyphAtIndex:0 forTextContainer:_components.textContainer proposedLineFragment:CGRectZero glyphPosition:CGPointZero characterIndex:0];
|
CGRect boundingBox = [_layoutManagerDelegate layoutManager:_components.layoutManager boundingBoxForControlGlyphAtIndex:0 forTextContainer:_components.textContainer proposedLineFragment:CGRectZero glyphPosition:CGPointZero characterIndex:0];
|
||||||
XCTAssertTrue(boundingBox.size.width == expectedWidth, @"Word kerning shouldn't alter the default width of %f. Encountered space width was %f", expectedWidth, boundingBox.size.width);
|
|
||||||
|
XCTAssertEqualWithAccuracy(boundingBox.size.width, expectedWidth, FLT_EPSILON, @"Word kerning shouldn't alter the default width of %f. Encountered space width was %f", expectedWidth, boundingBox.size.width);
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)testSpaceBoundingBoxForWordKerning
|
- (void)testSpaceBoundingBoxForWordKerning
|
||||||
@@ -96,7 +97,7 @@
|
|||||||
CGFloat expectedWidth = [@" " sizeWithAttributes:@{ NSFontAttributeName : font }].width + kernValue;
|
CGFloat expectedWidth = [@" " sizeWithAttributes:@{ NSFontAttributeName : font }].width + kernValue;
|
||||||
|
|
||||||
CGRect boundingBox = [_layoutManagerDelegate layoutManager:_components.layoutManager boundingBoxForControlGlyphAtIndex:0 forTextContainer:_components.textContainer proposedLineFragment:CGRectZero glyphPosition:CGPointZero characterIndex:0];
|
CGRect boundingBox = [_layoutManagerDelegate layoutManager:_components.layoutManager boundingBoxForControlGlyphAtIndex:0 forTextContainer:_components.textContainer proposedLineFragment:CGRectZero glyphPosition:CGPointZero characterIndex:0];
|
||||||
XCTAssertTrue(boundingBox.size.width == expectedWidth, @"Word kerning shouldn't alter the default width of %f. Encountered space width was %f", expectedWidth, boundingBox.size.width);
|
XCTAssertEqualWithAccuracy(boundingBox.size.width, expectedWidth, FLT_EPSILON, @"Word kerning shouldn't alter the default width of %f. Encountered space width was %f", expectedWidth, boundingBox.size.width);
|
||||||
}
|
}
|
||||||
|
|
||||||
- (NSInteger)_layoutManagerShouldGenerateGlyphs
|
- (NSInteger)_layoutManagerShouldGenerateGlyphs
|
||||||
|
|||||||
Reference in New Issue
Block a user