Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Bart Louwers <bart@emeel.net>
32 lines
1.2 KiB
Objective-C
32 lines
1.2 KiB
Objective-C
#import <Mapbox/Mapbox.h>
|
|
#import <XCTest/XCTest.h>
|
|
|
|
#import "MLNAttributionButton.h"
|
|
#import "MLNAttributionInfo.h"
|
|
|
|
@interface MLNAttributionButtonTests : XCTestCase
|
|
|
|
@end
|
|
|
|
@implementation MLNAttributionButtonTests
|
|
|
|
- (void)testPlainSymbol {
|
|
NSAttributedString *title = [[NSAttributedString alloc] initWithString:@"® & ™ Mapbox" attributes:@{
|
|
NSUnderlineStyleAttributeName: @(NSUnderlineStyleSingle),
|
|
}];
|
|
MLNAttributionInfo *info = [[MLNAttributionInfo alloc] initWithTitle:title URL:nil];
|
|
MLNAttributionButton *button = [[MLNAttributionButton alloc] initWithAttributionInfo:info];
|
|
|
|
NSRange symbolUnderlineRange;
|
|
NSNumber *symbolUnderline = [button.attributedTitle attribute:NSUnderlineStyleAttributeName atIndex:0 effectiveRange:&symbolUnderlineRange];
|
|
XCTAssertNil(symbolUnderline);
|
|
XCTAssertEqual(symbolUnderlineRange.length, 6);
|
|
|
|
NSRange wordUnderlineRange;
|
|
NSNumber *wordUnderline = [button.attributedTitle attribute:NSUnderlineStyleAttributeName atIndex:6 effectiveRange:&wordUnderlineRange];
|
|
XCTAssertEqualObjects(wordUnderline, @(NSUnderlineStyleSingle));
|
|
XCTAssertEqual(wordUnderlineRange.length, 6);
|
|
}
|
|
|
|
@end
|