[ASTextNode] Fix locking, add test for issue #trivial (#825)

* A few small fixes plus a failing test for ASTextNode

* Change the approach

* Update changelog

* Eh screw null_resettable

* No need for changelog now
This commit is contained in:
Adlai Holler 2018-03-09 14:23:27 -08:00 committed by GitHub
parent f99dd68a9f
commit 6f1d2d1f1d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 24 additions and 0 deletions

View File

@ -177,6 +177,7 @@ static ASTextKitRenderer *rendererForAttributes(ASTextKitAttributes attributes,
NSArray *_exclusionPaths;
NSAttributedString *_attributedText;
NSAttributedString *_truncationAttributedText;
NSAttributedString *_composedTruncationText;
NSString *_highlightedLinkAttributeName;
@ -1189,6 +1190,12 @@ static NSAttributedString *DefaultTruncationAttributedString()
return defaultTruncationAttributedString;
}
- (NSAttributedString *)truncationAttributedText
{
ASDN::MutexLocker l(__instanceLock__);
return _truncationAttributedText;
}
- (void)setTruncationAttributedText:(NSAttributedString *)truncationAttributedText
{
{

View File

@ -120,4 +120,21 @@
ASSnapshotVerifyNode(textNode, nil);
}
/**
* https://github.com/TextureGroup/Texture/issues/822
*/
- (void)DISABLED_testThatTruncationTokenAttributesPrecedeThoseInheritedFromTextWhenTruncateTailMode
{
ASTextNode *textNode = [[ASTextNode alloc] init];
textNode.style.maxSize = CGSizeMake(20, 80);
NSMutableAttributedString *mas = [[NSMutableAttributedString alloc] initWithString:@"Quality is an important "];
[mas appendAttributedString:[[NSAttributedString alloc] initWithString:@"thing" attributes:@{ NSBackgroundColorAttributeName : UIColor.yellowColor}]];
textNode.attributedText = mas;
textNode.truncationMode = NSLineBreakByTruncatingTail;
textNode.truncationAttributedText = [[NSAttributedString alloc] initWithString:@"\u2026" attributes:@{ NSBackgroundColorAttributeName: UIColor.greenColor }];
ASDisplayNodeSizeToFitSizeRange(textNode, ASSizeRangeMake(CGSizeZero, CGSizeMake(INFINITY, INFINITY)));
ASSnapshotVerifyNode(textNode, nil);
}
@end