|
14 | 14 |
|
15 | 15 | #if TARGET_OS_IPHONE |
16 | 16 | #define IS_IOS7 ([[[UIDevice currentDevice] systemVersion] compare:@"7.0" options:NSNumericSearch] == NSOrderedDescending) |
17 | | -#elif TARGET_OS_MAC |
| 17 | +#else |
18 | 18 | #define IS_IOS7 YES |
19 | 19 | #endif |
20 | 20 |
|
|
59 | 59 | NSMutableParagraphStyle *testParagraphStyle = [[NSMutableParagraphStyle alloc] init]; |
60 | 60 | #if TARGET_OS_IPHONE |
61 | 61 | testParagraphStyle.alignment = NSTextAlignmentCenter; |
62 | | -#elif TARGET_OS_MAC |
| 62 | +#else |
63 | 63 | testParagraphStyle.alignment = NSCenterTextAlignment; |
64 | 64 | #endif |
65 | 65 | testParagraphStyle.lineBreakMode = NSLineBreakByTruncatingMiddle; |
|
316 | 316 |
|
317 | 317 | expect(result).to.equal(testAttributedString); |
318 | 318 | }); |
| 319 | +#if !TARGET_OS_IPHONE |
| 320 | + it( @"superscript should change", ^{ |
| 321 | + NSNumber *testSuperscript = @(2); |
| 322 | + NSAttributedString *result = [_testString makeString:^(BOStringMaker *make) { |
| 323 | + make.superscript(testSuperscript); |
| 324 | + }]; |
| 325 | + |
| 326 | + NSAttributedString *testAttributedString = [[NSAttributedString alloc] initWithString:_testString attributes:@{NSSuperscriptAttributeName: testSuperscript}]; |
| 327 | + |
| 328 | + expect(result).to.equal(testAttributedString); |
| 329 | + }); |
| 330 | + |
| 331 | + it( @"cursor should change", ^{ |
| 332 | + NSCursor *testCursor = [NSCursor resizeRightCursor]; |
| 333 | + NSAttributedString *result = [_testString makeString:^(BOStringMaker *make) { |
| 334 | + make.cursor(testCursor); |
| 335 | + }]; |
| 336 | + |
| 337 | + NSAttributedString *testAttributedString = [[NSAttributedString alloc] initWithString:_testString attributes:@{NSCursorAttributeName: testCursor}]; |
| 338 | + |
| 339 | + expect(result).to.equal(testAttributedString); |
| 340 | + }); |
| 341 | + |
| 342 | + it( @"toolTip should change", ^{ |
| 343 | + NSString *testToolTip = @"Test tooltip"; |
| 344 | + NSAttributedString *result = [_testString makeString:^(BOStringMaker *make) { |
| 345 | + make.toolTip(testToolTip); |
| 346 | + }]; |
| 347 | + |
| 348 | + NSAttributedString *testAttributedString = [[NSAttributedString alloc] initWithString:_testString attributes:@{NSToolTipAttributeName: testToolTip}]; |
| 349 | + |
| 350 | + expect(result).to.equal(testAttributedString); |
| 351 | + }); |
| 352 | + |
| 353 | + it( @"characterShape should change", ^{ |
| 354 | + NSNumber *testCharacterShape = @(kTraditionalAltTwoSelector); |
| 355 | + NSAttributedString *result = [_testString makeString:^(BOStringMaker *make) { |
| 356 | + make.characterShape(testCharacterShape); |
| 357 | + }]; |
| 358 | + |
| 359 | + NSAttributedString *testAttributedString = [[NSAttributedString alloc] initWithString:_testString attributes:@{NSCharacterShapeAttributeName: testCharacterShape}]; |
| 360 | + |
| 361 | + expect(result).to.equal(testAttributedString); |
| 362 | + }); |
| 363 | + |
| 364 | + it( @"glyphInfo should change", ^{ |
| 365 | + NSString* baseString = [NSString stringWithFormat:@"%C", (unichar)0xFFFD]; |
| 366 | + NSGlyphInfo* testGlyphInfo = [NSGlyphInfo glyphInfoWithGlyphName:@"copyright" |
| 367 | + forFont:[NSFont systemFontOfSize:10] |
| 368 | + baseString:baseString]; |
| 369 | + NSAttributedString *result = [_testString makeString:^(BOStringMaker *make) { |
| 370 | + make.glyphInfo(testGlyphInfo); |
| 371 | + }]; |
| 372 | + |
| 373 | + NSAttributedString *testAttributedString = [[NSAttributedString alloc] initWithString:_testString attributes:@{NSGlyphInfoAttributeName: testGlyphInfo}]; |
| 374 | + |
| 375 | + expect(result).to.equal(testAttributedString); |
| 376 | + }); |
| 377 | + |
| 378 | + it( @"markedClauseSegment should change", ^{ |
| 379 | + NSNumber *testMarkedClauseSegment = @(1); |
| 380 | + NSAttributedString *result = [_testString makeString:^(BOStringMaker *make) { |
| 381 | + make.markedClauseSegment(testMarkedClauseSegment); |
| 382 | + }]; |
| 383 | + |
| 384 | + NSAttributedString *testAttributedString = [[NSAttributedString alloc] initWithString:_testString attributes:@{NSMarkedClauseSegmentAttributeName: testMarkedClauseSegment}]; |
| 385 | + |
| 386 | + expect(result).to.equal(testAttributedString); |
| 387 | + }); |
| 388 | + |
| 389 | + it( @"textAlternatives should change", ^{ |
| 390 | + NSTextAlternatives *testTextAlternatives = [[NSTextAlternatives alloc] initWithPrimaryString:_testString alternativeStrings:@[@"Alternative 1", @"Alternative 2"]]; |
| 391 | + NSAttributedString *result = [_testString makeString:^(BOStringMaker *make) { |
| 392 | + make.textAlternatives(testTextAlternatives); |
| 393 | + }]; |
| 394 | + |
| 395 | + NSAttributedString *testAttributedString = [[NSAttributedString alloc] initWithString:_testString attributes:@{NSTextAlternativesAttributeName: testTextAlternatives}]; |
| 396 | + |
| 397 | + expect(result).to.equal(testAttributedString); |
| 398 | + }); |
| 399 | + |
| 400 | +#endif |
319 | 401 | }); |
320 | 402 |
|
321 | 403 | describe(@"Ranged attributes", ^{ |
|
0 commit comments