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

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

Closed
mapbox/mapbox-gl-native-ios
#178

Description

@1ec5

#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

Activity

  1. added
    macOS
    upstream
    on Nov 16, 2018
  2. added this to the release-iowaska milestone on Nov 16, 2018
  3. self-assigned this
    on Nov 16, 2018
  4. 1ec5 commented on Nov 16, 2018

    @1ec5
    ContributorAuthor

    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.

  5. removed this from the release-iowaska milestone on Dec 18, 2018
  6. friedbunny commented on Apr 3, 2019

    @friedbunny
    Contributor

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

  7. friedbunny commented on Aug 20, 2019

    @friedbunny
    Contributor

    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. 🤔

  8. added
    iOS
    on Aug 20, 2019
  9. zugaldia commented on Aug 26, 2019

    @zugaldia
    Member

    cc: @julianrex for prioritization.

  10. julianrex commented on Aug 26, 2019

    @julianrex
    Contributor

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

  11. friedbunny commented on Aug 26, 2019

    @friedbunny
    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 join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

iOSmacOSruntime stylingtestsupstream

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions