blob: f5c0aac8566dbab91d9bbfb422568032fb4de998 (
plain)
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
|
#import <Mapbox/Mapbox.h>
#import <XCTest/XCTest.h>
#import "MGLAttributionButton.h"
#import "MGLAttributionInfo.h"
@interface MGLAttributionButtonTests : XCTestCase
@end
@implementation MGLAttributionButtonTests
- (void)testPlainSymbol {
NSAttributedString *title = [[NSAttributedString alloc] initWithString:@"® & ™ Mapbox" attributes:@{
NSUnderlineStyleAttributeName: @(NSUnderlineStyleSingle),
}];
MGLAttributionInfo *info = [[MGLAttributionInfo alloc] initWithTitle:title URL:nil];
MGLAttributionButton *button = [[MGLAttributionButton 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
|