Replaced magic number by FLT_EPSILON

This commit is contained in:
Raphaël Mor 2014-09-05 07:55:22 +02:00
parent 99fb196407
commit 06e3f1e062

View File

@ -81,7 +81,7 @@
CGRect boundingBox = [_layoutManagerDelegate layoutManager:_components.layoutManager boundingBoxForControlGlyphAtIndex:0 forTextContainer:_components.textContainer proposedLineFragment:CGRectZero glyphPosition:CGPointZero characterIndex:0];
XCTAssertEqualWithAccuracy(boundingBox.size.width, expectedWidth, 0.000001, @"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
@ -97,7 +97,7 @@
CGFloat expectedWidth = [@" " sizeWithAttributes:@{ NSFontAttributeName : font }].width + kernValue;
CGRect boundingBox = [_layoutManagerDelegate layoutManager:_components.layoutManager boundingBoxForControlGlyphAtIndex:0 forTextContainer:_components.textContainer proposedLineFragment:CGRectZero glyphPosition:CGPointZero characterIndex:0];
XCTAssertEqualWithAccuracy(boundingBox.size.width, expectedWidth, 0.000001, @"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