Skip to content
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.

-[MGLTileSetTests testTileSetFromTileURLTemplates] fails on High Sierra and above #13386

Closed
1ec5 opened this issue Nov 16, 2018 · 6 comments · Fixed by mapbox/mapbox-gl-native-ios#178
Assignees
Labels
iOS Mapbox Maps SDK for iOS macOS Mapbox Maps SDK for macOS runtime styling tests upstream Blocked by an issue in a dependency

Comments

@1ec5
Copy link
Contributor

1ec5 commented Nov 16, 2018

#11391 didn’t completely fix #11289: on macOS 10.14 High Sierra and above, -[MGLTileSetTests testTileSetFromTileURLTemplates] still fails on the following assertion:

Test Suite 'MGLTileSetTests' started at 2018-11-15 18:24:15.215
Test Case '-[MGLTileSetTests testTileSetFromTileURLTemplates]' started.
/path/to/mapbox-gl-native/platform/darwin/test/MGLTileSetTests.mm:95: error: -[MGLTileSetTests testTileSetFromTileURLTemplates] : ((@(tileSet.attribution.c_str())) equal to (html)) failed: ("<font face="Helvetica" size="3" style="font: 12.0px Helvetica"><a href="https://www.mapbox.com/">Mapbox</a> </font><font face="Helvetica" size="3" style="font: 12.0px Helvetica; background-color: #fb0007">GL</font>
") is not equal to ("<font face="Helvetica" size="3" style="font: 12.0px Helvetica"><a href="https://www.mapbox.com/">Mapbox</a> </font><font face="Helvetica" size="3" style="font: 12.0px Helvetica; background-color: #ff0000">GL</font>
")
Test Case '-[MGLTileSetTests testTileSetFromTileURLTemplates]' failed (4.425 seconds).
Test Suite 'MGLTileSetTests' failed at 2018-11-15 18:24:19.642.

The problem is that -[NSAttributedString dataFromRange:documentAttributes:error:] exports HTML that expresses colors in the generic RGB (aka calibrated RGB) color space instead of sRGB, which is a violation of the CSS specification. I’ve opened rdar://problem/46115233 (lionheart/openradar-mirror#20722) to track the issue upstream in the (Apple) macOS SDK. In the meantime, we can work around the issue by expressing the test’s initial color in calibrated RGB:

NSColor *redColor = [NSColor colorWithSRGBRed:1 green:0 blue:0 alpha:1];

This test is the only place in the codebase where we generate HTML from an attributed string, so the issue and workaround don’t impact production code. It also doesn’t affect builds on CircleCI, which still runs macOS 10.13 Sierra.

/cc @mapbox/maps-ios

@1ec5 1ec5 added build macOS Mapbox Maps SDK for macOS tests runtime styling upstream Blocked by an issue in a dependency labels Nov 16, 2018
@1ec5 1ec5 added this to the release-iowaska milestone Nov 16, 2018
@1ec5 1ec5 self-assigned this Nov 16, 2018
@1ec5 1ec5 removed the build label Nov 16, 2018
@1ec5
Copy link
Contributor Author

1ec5 commented Nov 16, 2018

This test is the only place in the codebase where we generate HTML from an attributed string, so the issue and workaround don’t impact production code.

Actually, this issue does affect production code, specifically the use of MGLTileSourceOptionAttributionInfos in -[MGLVectorTileSource initWithIdentifier:tileURLTemplates:options:].

It also doesn’t affect builds on CircleCI, which still runs macOS 10.13 Sierra.

CircleCI builds run on macOS 10.14 High Sierra these days, which accounts for the failures I’m seeing in #13387. So the difference between running locally and on CI must be related to the system color profile or something.

@1ec5 1ec5 removed this from the release-iowaska milestone Dec 18, 2018
@friedbunny
Copy link
Contributor

This is still an issue locally, running macOS 10.14.5b1 and Xcode 10.2.

@friedbunny
Copy link
Contributor

friedbunny commented Aug 20, 2019

Now seeing a similar failure on CircleCI (and here) for iOS jobs with Xcode 11b5:

MGLTileSetTests
  testTileSetFromTileURLTemplates, ((@(tileSet.attribution.c_str())) equal to (html)) failed: ("<font style="font-family: 'Helvetica'; font-weight: normal; font-style: normal; font-size: 12.00px"><a href="https://www.mapbox.com/">Mapbox</a> </font><font style="font-family: 'Helvetica'; font-weight: normal; font-style: normal; font-size: 12.00px; background-color: #ff0000">GL</font>
  /Users/distiller/project/platform/darwin/test/MGLTileSetTests.mm:95

> #endif
>    XCTAssertEqualObjects(@(tileSet.attribution.c_str()), html);

... it seems the font size has changed from points to pixels. 🤔

@zugaldia
Copy link
Member

cc: @julianrex for prioritization.

@julianrex
Copy link
Contributor

@friedbunny can we close this due to #15432? Or has this now mutated into a change-the-test issue?

@friedbunny
Copy link
Contributor

#15432 merely silenced the failure by adding a case for the new result, but we don’t know if there’s more to do to address the issue yet.

The original issue in this PR is related but not the same — it’s the same test, but colors (and not text sizes) changing, and it evidently only happens on macOS.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
iOS Mapbox Maps SDK for iOS macOS Mapbox Maps SDK for macOS runtime styling tests upstream Blocked by an issue in a dependency
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants