mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-22 22:25:57 +00:00
Disable Text Node Fast Path (#2581)
* Disable text node fast path * Actually commit the test change
This commit is contained in:
@@ -205,12 +205,15 @@ static NSCharacterSet *_defaultAvoidTruncationCharacterSet()
|
|||||||
|
|
||||||
- (BOOL)canUseFastPath
|
- (BOOL)canUseFastPath
|
||||||
{
|
{
|
||||||
return self.isScaled == NO
|
return NO;
|
||||||
&& self.usesCustomTruncation == NO
|
// Fast path is temporarily disabled, because it's crashing in production.
|
||||||
&& self.usesExclusionPaths == NO
|
// NOTE: Remember to re-enable testFastPathTruncation when we re-enable this.
|
||||||
// NSAttributedString drawing methods ignore usesLineFragmentOrigin if max line count 1,
|
// return self.isScaled == NO
|
||||||
// rendering them useless:
|
// && self.usesCustomTruncation == NO
|
||||||
&& (_attributes.maximumNumberOfLines != 1 || isinf(_constrainedSize.width));
|
// && self.usesExclusionPaths == NO
|
||||||
|
// // NSAttributedString drawing methods ignore usesLineFragmentOrigin if max line count 1,
|
||||||
|
// // rendering them useless:
|
||||||
|
// && (_attributes.maximumNumberOfLines != 1 || isinf(_constrainedSize.width));
|
||||||
}
|
}
|
||||||
|
|
||||||
#pragma mark - Drawing
|
#pragma mark - Drawing
|
||||||
|
|||||||
@@ -75,7 +75,8 @@
|
|||||||
ASSnapshotVerifyView(backgroundView, nil);
|
ASSnapshotVerifyView(backgroundView, nil);
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)testThatFastPathTruncationWorks
|
// This test is disabled because the fast-path is disabled.
|
||||||
|
- (void)DISABLED_testThatFastPathTruncationWorks
|
||||||
{
|
{
|
||||||
ASTextNode *textNode = [[ASTextNode alloc] init];
|
ASTextNode *textNode = [[ASTextNode alloc] init];
|
||||||
textNode.attributedText = [[NSAttributedString alloc] initWithString:@"Quality is Important" attributes:@{ NSForegroundColorAttributeName: [UIColor blueColor], NSFontAttributeName: [UIFont italicSystemFontOfSize:24] }];
|
textNode.attributedText = [[NSAttributedString alloc] initWithString:@"Quality is Important" attributes:@{ NSForegroundColorAttributeName: [UIColor blueColor], NSFontAttributeName: [UIFont italicSystemFontOfSize:24] }];
|
||||||
@@ -87,8 +88,9 @@
|
|||||||
{
|
{
|
||||||
ASTextNode *textNode = [[ASTextNode alloc] init];
|
ASTextNode *textNode = [[ASTextNode alloc] init];
|
||||||
textNode.attributedText = [[NSAttributedString alloc] initWithString:@"Quality is Important" attributes:@{ NSForegroundColorAttributeName: [UIColor blueColor], NSFontAttributeName: [UIFont italicSystemFontOfSize:24] }];
|
textNode.attributedText = [[NSAttributedString alloc] initWithString:@"Quality is Important" attributes:@{ NSForegroundColorAttributeName: [UIColor blueColor], NSFontAttributeName: [UIFont italicSystemFontOfSize:24] }];
|
||||||
[textNode layoutThatFits:ASSizeRangeMake(CGSizeZero, CGSizeMake(100, 50))];
|
// Set exclusion paths to trigger slow path
|
||||||
textNode.exclusionPaths = @[ [UIBezierPath bezierPath] ];
|
textNode.exclusionPaths = @[ [UIBezierPath bezierPath] ];
|
||||||
|
[textNode layoutThatFits:ASSizeRangeMake(CGSizeZero, CGSizeMake(100, 50))];
|
||||||
ASSnapshotVerifyNode(textNode, nil);
|
ASSnapshotVerifyNode(textNode, nil);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Binary file not shown.
|
Before Width: | Height: | Size: 3.9 KiB After Width: | Height: | Size: 3.4 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 3.9 KiB After Width: | Height: | Size: 3.4 KiB |
Reference in New Issue
Block a user