8000 Merge pull request #7406 from plotly/cam/7334/switch-geodata-provider… · plotly/plotly.js@6356355 · GitHub
[go: up one dir, main page]

Skip to content

Commit 6356355

Browse files
authored
Merge pull request #7406 from plotly/cam/7334/switch-geodata-providers-emilykl-2
Updating baselines for new geodata
2 parents da44084 + bb8377b commit 6356355
  • jasmine/tests
  • Some content is hidden

    Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

    62 files changed

    +29
    -4
    lines changed

    src/lib/geo_location_utils.js

    Lines changed: 13 additions & 1 deletion
    Original file line numberDiff line numberDiff line change
    @@ -62,7 +62,7 @@ function locationToFeature(locationmode, location, features) {
    6262

    6363
    for(i = 0; i < filteredFeatures.length; i++) {
    6464
    f = filteredFeatures[i];
    65-
    if(f.id === locationId) return f;
    65+
    if(f.id === locationId && isMainCountryFeature(f)) return f;
    6666
    }
    6767

    6868
    loggers.log([
    @@ -74,6 +74,18 @@ function locationToFeature(locationmode, location, features) {
    7474
    return false;
    7575
    }
    7676

    77+
    function isMainCountryFeature(feature) {
    78+
    // Returns false for certain features which are not the main region of their country
    79+
    if(feature.id === 'USA') {
    80+
    if(feature.properties && feature.properties.ct && feature.properties.ct[0] == -155.5 &&
    81+
    feature.properties.ct[1] == 19.6) {
    82+
    // Hawaii
    83+
    return false;
    84+
    }
    85+
    }
    86+
    return true;
    87+
    }
    88+
    7789
    function feature2polygons(feature) {
    7890
    var geometry = feature.geometry;
    7991
    var coords = geometry.coordinates;

    src/lib/topojson_utils.js

    Lines changed: 5 additions & 1 deletion
    Original file line numberDiff line numberDiff line change
    @@ -13,7 +13,11 @@ topojsonUtils.getTopojsonName = function(geoLayout) {
    1313
    };
    1414

    1515
    topojsonUtils.getTopojsonPath = function(topojsonURL, topojsonName) {
    16-
    return topojsonURL + topojsonName + '.json';
    16+
    if (topojsonURL.endsWith('/')) {
    17+
    return topojsonURL + topojsonName + '.json';
    18+
    } else {
    19+
    return topojsonURL + '/' + topojsonName + '.json';
    20+
    }
    1721
    };
    1822

    1923
    topojsonUtils.getTopojsonFeatures = function(trace, topojson) {
    -1.82 KB
    4.39 KB
    131 Bytes
    3.33 KB

    test/image/baselines/geo_bg-color.png

    10.1 KB
    6.04 KB
    5.34 KB
    4.94 KB
    2.76 KB
    3.9 KB
    5.05 KB
    6.39 KB
    703 Bytes
    4.98 KB
    3.92 KB
    12.1 KB
    3.35 KB
    5.88 KB
    1.79 KB
    -1 Bytes

    test/image/baselines/geo_fill.png

    2.81 KB

    test/image/baselines/geo_first.png

    4.97 KB
    541 Bytes
    57.4 KB
    3.59 KB
    5.69 KB
    25.5 KB
    6.48 KB
    5.37 KB
    6.48 KB
    8.02 KB

    test/image/baselines/geo_second.png

    4.21 KB

    test/image/baselines/geo_skymap.png

    -4 Bytes
    4.26 KB
    13.2 KB

    test/image/baselines/geo_tick0.png

    10.5 KB
    521 Bytes
    6.69 KB
    705 Bytes
    1.25 KB

    test/image/baselines/plot_types.png

    1.75 KB
    3.49 KB

    test/image/compare_pixels_test.js

    Lines changed: 4 additions & 0 deletions
    Original file line numberDiff line numberDiff line change
    @@ -63,6 +63,10 @@ argv._.forEach(function(pattern) {
    6363
    var blacklist = [
    6464
    'map_angles',
    6565
    'map_stamen-style',
    66+
    'map_predefined-styles2',
    67+
    'map_scattercluster',
    68+
    'map_fonts-supported-open-sans',
    69+
    'map_fonts-supported-open-sans-weight',
    6670
    ];
    6771

    6872
    if(virtualWebgl) {

    test/image/make_baseline.py

    Lines changed: 5 additions & 0 deletions
    Original file line numberDiff line numberDiff line change
    @@ -53,6 +53,7 @@
    5353
    plotlyjs = plotlyjs_with_virtual_webgl
    5454

    5555
    pio.kaleido.scope.plotlyjs = plotlyjs
    56+
    pio.kaleido.scope.topojson = "file://" + os.path.join(root, 'dist', 'topojson')
    5657
    pio.templates.default = 'none'
    5758

    5859
    ALL_MOCKS = [os.path.splitext(a)[0] for a in os.listdir(dirIn) if a.endswith('.json')]
    @@ -66,6 +67,10 @@
    6667
    # unable to generate baselines for the following mocks
    6768
    blacklist = [
    6869
    'map_stamen-style',
    70+
    'map_predefined-styles2',
    71+
    'map_scattercluster',
    72+
    'map_fonts-supported-open-sans',
    73+
    'map_fonts-supported-open-sans-weight',
    6974
    ]
    7075
    allNames = [a for a in allNames if a not in blacklist]
    7176

    test/jasmine/tests/geo_test.js

    Lines changed: 2 additions & 2 deletions
    Original file line numberDiff line numberDiff line change
    @@ -2759,10 +2759,10 @@ describe('Test geo interactions update marker angles:', function() {
    27592759
    })
    27602760
    .then(function() {
    27612761
    newPath = getPath();
    2762-
    expect(newPath).toEqual('M0,0L18.22327727600463,8.240883770679762L19.586810955756498,-4.044358612123453Z');
    2762+
    expect(newPath).toEqual('M0,0L18.223277273610172,8.24088377597469L19.58681095693162,-4.04435860643234Z');
    27632763

    27642764
    expect(newPath).not.toEqual(initialPath);
    2765-
    expect(newPath).toEqual('M0,0L18.22327727600463,8.240883770679762L19.586810955756498,-4.044358612123453Z');
    2765+
    expect(newPath).toEqual('M0,0L18.223277273610172,8.24088377597469L19.58681095693162,-4.04435860643234Z');
    27662766
    expect(initialPath).toEqual('M0,0L-1.5100144203478312,19.942914943667123L10.500523963798084,17.021721313830223Z');
    27672767
    })
    27682768
    .then(done, done.fail);

    0 commit comments

    Comments
     (0)
    0