-
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
- Adding the ability to specify a tintColor for images / buttons that behave similarly to how they would under UIKit
- Loading branch information
1 parent
7aba287
commit 5bed56d
Showing
16 changed files
with
182 additions
and
16 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
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 | ||
{ | ||
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 |
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+11.9 KB
.../ReferenceImages_iOS_10/ASImageNodeSnapshotTests/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+11.9 KB
Tests/ReferenceImages_iOS_10/ASImageNodeSnapshotTests/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+7.16 KB
...s/ReferenceImages_iOS_10/ASImageNodeSnapshotTests/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+409 KB
Tests/ReferenceImages_iOS_10/ASImageNodeSnapshotTests/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.