Skip to content

Commit

Permalink
Really fix new unit test on OS X this time
Browse files Browse the repository at this point in the history
- Unit test failed to take in to account that ___useiOS6Attributes is used and set for OS X targets
  • Loading branch information
logicality77 committed Mar 25, 2015
1 parent ee486a1 commit 84a8603
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions Test/Source/NSMutableAttributedStringHTMLTest.m
Original file line number Diff line number Diff line change
Expand Up @@ -187,12 +187,14 @@ - (void)testForegroundColorAttributeNameAtEndOfParagraph

NSRange entireString = NSMakeRange(0, [attributedString length]);

BOOL defaultValueForUseiOS6Attributes = ___useiOS6Attributes;
___useiOS6Attributes = NO;

// add a foreground color using the Core Text attribute name
CGFloat components[4] = {1.0, 0.0, 0.0, 1.0};
CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB();
CGColorRef redColorRef = CGColorCreate(colorSpace, components);
[testingString addAttribute:(id)kCTForegroundColorAttributeName value:(id)CFBridgingRelease(redColorRef) range:entireString];
CGColorSpaceRelease(colorSpace);

// append the end of a paragraph tag
[testingString appendEndOfParagraph];
Expand All @@ -207,6 +209,8 @@ - (void)testForegroundColorAttributeNameAtEndOfParagraph

XCTAssertTrue(CGColorEqualToColor(redColorRef, (CGColorRef)stringColorRef), @"Foreground color should be red");

CGColorSpaceRelease(colorSpace);

#if TARGET_OS_IPHONE && DTCORETEXT_SUPPORT_NS_ATTRIBUTES
[testingString setAttributedString:attributedString];

Expand All @@ -226,9 +230,9 @@ - (void)testForegroundColorAttributeNameAtEndOfParagraph
} else {
XCTAssertTrue(CGColorEqualToColor([[UIColor redColor] CGColor], [nsAttributesStringColor CGColor]), @"Foreground color should be red");
}

___useiOS6Attributes = NO;
#endif

___useiOS6Attributes = defaultValueForUseiOS6Attributes;
}

@end

0 comments on commit 84a8603

Please sign in to comment.