-
-
Notifications
You must be signed in to change notification settings - Fork 18
Expand file tree
/
Copy pathTORoundedButtonExampleTests.m
More file actions
52 lines (41 loc) · 1.4 KB
/
Copy pathTORoundedButtonExampleTests.m
File metadata and controls
52 lines (41 loc) · 1.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
//
// TORoundedButtonExampleTests.m
// TORoundedButtonExampleTests
//
// Created by Tim Oliver on 21/4/19.
// Copyright © 2019 Tim Oliver. All rights reserved.
//
#import <XCTest/XCTest.h>
#import "TORoundedButton.h"
@interface TORoundedButtonExampleTests : XCTestCase
@end
@implementation TORoundedButtonExampleTests
- (void)testDefaultValues
{
TORoundedButton *button = [[TORoundedButton alloc] initWithText:@"Test"];
XCTAssertNotNil(button);
XCTAssertEqual(button.text, @"Test");
XCTAssertEqual(button.textColor, [UIColor whiteColor]);
XCTAssertEqual(button.tappedTextAlpha, 1.0f);
XCTAssertEqual(button.tappedTintColorBrightnessOffset, 0.25f);
XCTAssertEqual(button.tappedButtonScale, 0.97f);
#ifdef __IPHONE_26_0
if (@available(iOS 26.0, *)) {
XCTAssertNotNil(button.cornerConfiguration);
} else {
XCTAssertEqual(button.cornerRadius, 12.0f);
}
#else
XCTAssertEqual(button.cornerRadius, 12.0f);
#endif
}
- (void)testButtonInteraction
{
TORoundedButton *button = [[TORoundedButton alloc] initWithText:@"Long Button Name"];
XCTestExpectation *expectation = [[XCTestExpectation alloc] initWithDescription:@"Button was tapped"];
button.tappedHandler = ^{ [expectation fulfill]; };
// Simulate button tap
[button sendActionsForControlEvents:UIControlEventTouchUpInside];
[self waitForExpectations:@[expectation] timeout:0.5f];
}
@end