Skip to content
This repository has been archived by the owner on Feb 2, 2023. It is now read-only.

Fix unit tests in ASTextNodeWordKernerTests #18

Merged
merged 2 commits into from
Sep 5, 2014
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions AsyncDisplayKitTests/ASTextNodeWordKernerTests.mm
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,8 @@ - (void)testSpaceBoundingBoxForNoWordKerning
CGFloat expectedWidth = [@" " sizeWithAttributes:@{ NSFontAttributeName : font }].width;

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
Expand All @@ -96,7 +97,7 @@ - (void)testSpaceBoundingBoxForWordKerning
CGFloat expectedWidth = [@" " sizeWithAttributes:@{ NSFontAttributeName : font }].width + kernValue;

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
Expand Down