mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-17 03:40:18 +00:00
[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:
parent
f99dd68a9f
commit
6f1d2d1f1d
@ -177,6 +177,7 @@ static ASTextKitRenderer *rendererForAttributes(ASTextKitAttributes attributes,
|
|||||||
NSArray *_exclusionPaths;
|
NSArray *_exclusionPaths;
|
||||||
|
|
||||||
NSAttributedString *_attributedText;
|
NSAttributedString *_attributedText;
|
||||||
|
NSAttributedString *_truncationAttributedText;
|
||||||
NSAttributedString *_composedTruncationText;
|
NSAttributedString *_composedTruncationText;
|
||||||
|
|
||||||
NSString *_highlightedLinkAttributeName;
|
NSString *_highlightedLinkAttributeName;
|
||||||
@ -1189,6 +1190,12 @@ static NSAttributedString *DefaultTruncationAttributedString()
|
|||||||
return defaultTruncationAttributedString;
|
return defaultTruncationAttributedString;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (NSAttributedString *)truncationAttributedText
|
||||||
|
{
|
||||||
|
ASDN::MutexLocker l(__instanceLock__);
|
||||||
|
return _truncationAttributedText;
|
||||||
|
}
|
||||||
|
|
||||||
- (void)setTruncationAttributedText:(NSAttributedString *)truncationAttributedText
|
- (void)setTruncationAttributedText:(NSAttributedString *)truncationAttributedText
|
||||||
{
|
{
|
||||||
{
|
{
|
||||||
|
|||||||
@ -120,4 +120,21 @@
|
|||||||
ASSnapshotVerifyNode(textNode, nil);
|
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
|
@end
|
||||||
|
|||||||
Binary file not shown.
|
After Width: | Height: | Size: 2.3 KiB |
Loading…
x
Reference in New Issue
Block a user