summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMinh Nguyễn <mxn@1ec5.org>2018-11-15 23:13:10 -0800
committerMinh Nguyễn <mxn@1ec5.org>2018-11-15 23:13:10 -0800
commit7dcbe23b7aa9e9fbc34051142ce8553fc3b8077c (patch)
tree0b4b9dc50739cdc3196a28a23e0360f9eb85425c
parent425a3ade9ebbd874fc7172afdbfa91d861b49f92 (diff)
downloadqtlocation-mapboxgl-7dcbe23b7aa9e9fbc34051142ce8553fc3b8077c.tar.gz
[macos] Fixed attribution round-tripping test
-rw-r--r--platform/darwin/test/MGLTileSetTests.mm14
1 files changed, 10 insertions, 4 deletions
diff --git a/platform/darwin/test/MGLTileSetTests.mm b/platform/darwin/test/MGLTileSetTests.mm
index 2319f66447..848a42bf33 100644
--- a/platform/darwin/test/MGLTileSetTests.mm
+++ b/platform/darwin/test/MGLTileSetTests.mm
@@ -69,10 +69,16 @@
#if TARGET_OS_IPHONE
UIColor *redColor = [UIColor redColor];
#else
- // CSS uses the sRGB color space. In macOS 10.12 Sierra and below,
- // -[NSColor redColor] is in the calibrated RGB space and has a slightly
- // different sRGB value than on iOS and macOS 10.13 High Sierra.
- NSColor *redColor = [NSColor colorWithSRGBRed:1 green:0 blue:0 alpha:1];
+ NSColor *redColor;
+ if ([NSColor redColor].colorSpaceName == NSCalibratedRGBColorSpace) {
+ // CSS uses the sRGB color space.
+ redColor = [NSColor colorWithSRGBRed:1 green:0 blue:0 alpha:1];
+ } else {
+ // AppKit incorrectly uses calibrated RGB when exporting HTML, so input
+ // calibrated RGB to ensure round-tripping.
+ // <rdar://problem/46115233> <http://www.openradar.me/46115233>
+ redColor = [NSColor colorWithCalibratedRed:1 green:0 blue:0 alpha:1];
+ }
#endif
NSAttributedString *gl = [[NSAttributedString alloc] initWithString:@"GL" attributes:@{
NSBackgroundColorAttributeName: redColor,