-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for tintColor on ASImageNode and ASButtonNode
- Loading branch information
1 parent
7aba287
commit f45a502
Showing
17 changed files
with
195 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
// | ||
// ASButtonSnapshotTests.m | ||
// AsyncDisplayKitTests | ||
// | ||
// Created by Rahul Malik on 7/26/19. | ||
// Copyright © 2019 Pinterest. All rights reserved. | ||
// | ||
|
||
#import <AsyncDisplayKit/AsyncDisplayKit.h> | ||
#import "ASSnapshotTestCase.h" | ||
|
||
@interface ASButtonSnapshotTests : ASSnapshotTestCase | ||
|
||
@end | ||
|
||
|
||
@implementation ASButtonSnapshotTests | ||
|
||
- (UIImage *)testImage | ||
{ | ||
NSString *path = [[NSBundle bundleForClass:[self class]] pathForResource:@"logo-square" | ||
ofType:@"png" | ||
inDirectory:@"TestResources"]; | ||
return [UIImage imageWithContentsOfFile:path]; | ||
} | ||
|
||
|
||
- (void)testTintColor | ||
{git | ||
ASButtonNode *node = [[ASButtonNode alloc] init]; | ||
node.tintColor = UIColor.redColor; | ||
[node setImage:[self testImage] forState:UIControlStateNormal]; | ||
[node setTitle:@"Press Me" | ||
withFont:[UIFont systemFontOfSize:48] | ||
withColor:nil | ||
forState:UIControlStateNormal]; | ||
node.imageNode.style.width = ASDimensionMake(200); | ||
node.imageNode.style.height = ASDimensionMake(200); | ||
ASDisplayNodeSizeToFitSize(node, CGSizeMake(1000, 1000)); | ||
ASSnapshotVerifyNode(node, nil); | ||
} | ||
|
||
- (void)testTintColorWithForegroundColorSet | ||
{ | ||
ASButtonNode *node = [[ASButtonNode alloc] init]; | ||
node.tintColor = UIColor.redColor; | ||
[node setImage:[self testImage] forState:UIControlStateNormal]; | ||
[node setTitle:@"Press Me" | ||
withFont:[UIFont systemFontOfSize:48] | ||
withColor:[UIColor blueColor] | ||
forState:UIControlStateNormal]; | ||
node.imageNode.style.width = ASDimensionMake(200); | ||
node.imageNode.style.height = ASDimensionMake(200); | ||
ASDisplayNodeSizeToFitSize(node, CGSizeMake(1000, 1000)); | ||
ASSnapshotVerifyNode(node, nil); | ||
} | ||
|
||
@end |
Oops, something went wrong.