diff options
author | Minh Nguyễn <mxn@1ec5.org> | 2017-01-09 15:26:03 -0800 |
---|---|---|
committer | Minh Nguyễn <mxn@1ec5.org> | 2017-01-10 07:56:06 -0800 |
commit | dea1a3033256b9932fe4b0314f0e5533857b8b53 (patch) | |
tree | debaf4bb035fcf87d8ead3e9dbd7e105786c684f /platform/darwin/test/MGLNSStringAdditionsTests.m | |
parent | 9d55c0f479aad655566f3a9e7841d155463d51a1 (diff) | |
download | qtlocation-mapboxgl-dea1a3033256b9932fe4b0314f0e5533857b8b53.tar.gz |
[ios, macos] Title case attribution buttons
Also added a category method on NSString for title casing the string, plus tests.
Diffstat (limited to 'platform/darwin/test/MGLNSStringAdditionsTests.m')
-rw-r--r-- | platform/darwin/test/MGLNSStringAdditionsTests.m | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/platform/darwin/test/MGLNSStringAdditionsTests.m b/platform/darwin/test/MGLNSStringAdditionsTests.m new file mode 100644 index 0000000000..0c8a9f8143 --- /dev/null +++ b/platform/darwin/test/MGLNSStringAdditionsTests.m @@ -0,0 +1,42 @@ +#import <XCTest/XCTest.h> + +#import "NSString+MGLAdditions.h" + +@interface MGLNSStringAdditionsTests : XCTestCase + +@end + +@implementation MGLNSStringAdditionsTests + +- (void)testTitleCasedString { + NSLocale *locale = [NSLocale currentLocale]; + + XCTAssertEqualObjects([@"© OpenStreetMap" mgl_titleCasedStringWithLocale:locale], @"© OpenStreetMap"); + XCTAssertEqualObjects([@"© OSM" mgl_titleCasedStringWithLocale:locale], @"© OSM"); + + XCTAssertEqualObjects([@"Improve this map" mgl_titleCasedStringWithLocale:locale], @"Improve This Map"); + XCTAssertEqualObjects([@"Improve This Map" mgl_titleCasedStringWithLocale:locale], @"Improve This Map"); + + XCTAssertEqualObjects([@"Improve the map" mgl_titleCasedStringWithLocale:locale], @"Improve the Map"); + XCTAssertEqualObjects([@"Improve The Map" mgl_titleCasedStringWithLocale:locale], @"Improve The Map"); + + XCTAssertEqualObjects([@"Improve a map" mgl_titleCasedStringWithLocale:locale], @"Improve a Map"); + XCTAssertEqualObjects([@"Improve A Map" mgl_titleCasedStringWithLocale:locale], @"Improve A Map"); + + XCTAssertEqualObjects([@"Improve for the map" mgl_titleCasedStringWithLocale:locale], @"Improve for the Map"); + XCTAssertEqualObjects([@"Improve For The Map" mgl_titleCasedStringWithLocale:locale], @"Improve For The Map"); + + XCTAssertEqualObjects([@"Improve and map" mgl_titleCasedStringWithLocale:locale], @"Improve and Map"); + XCTAssertEqualObjects([@"Improve And Map" mgl_titleCasedStringWithLocale:locale], @"Improve And Map"); + + XCTAssertEqualObjects([@"Improve while mapping" mgl_titleCasedStringWithLocale:locale], @"Improve While Mapping"); + XCTAssertEqualObjects([@"Improve While Mapping" mgl_titleCasedStringWithLocale:locale], @"Improve While Mapping"); + + XCTAssertEqualObjects([@"Improve with the map" mgl_titleCasedStringWithLocale:locale], @"Improve With the Map"); + XCTAssertEqualObjects([@"Improve With The Map" mgl_titleCasedStringWithLocale:locale], @"Improve With The Map"); + + XCTAssertEqualObjects([@"Improve this iPhone" mgl_titleCasedStringWithLocale:locale], @"Improve This iPhone"); + XCTAssertEqualObjects([@"Improve This iPhone" mgl_titleCasedStringWithLocale:locale], @"Improve This iPhone"); +} + +@end |