summaryrefslogtreecommitdiff
path: root/platform/macos/test/MGLAttributionButtonTests.m
diff options
context:
space:
mode:
Diffstat (limited to 'platform/macos/test/MGLAttributionButtonTests.m')
-rw-r--r--platform/macos/test/MGLAttributionButtonTests.m31
1 files changed, 31 insertions, 0 deletions
diff --git a/platform/macos/test/MGLAttributionButtonTests.m b/platform/macos/test/MGLAttributionButtonTests.m
new file mode 100644
index 0000000000..f5c0aac856
--- /dev/null
+++ b/platform/macos/test/MGLAttributionButtonTests.m
@@ -0,0 +1,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