diff --git a/platform/node/test/ignores.json b/platform/node/test/ignores.json index 335ca1a53fa..e6ef57bd1e5 100644 --- a/platform/node/test/ignores.json +++ b/platform/node/test/ignores.json @@ -82,8 +82,6 @@ "query-tests/feature-state/default": "skip - port https://github.com/mapbox/mapbox-gl-js/pull/6263 - needs issue", "query-tests/regressions/mapbox-gl-js#6555": "skip - no querySourceFeatures in mbgl-node; needs issue", "render-tests/background-color/transition": "https://github.com/mapbox/mapbox-gl-native/issues/10619", - "render-tests/basic-v9/z0-wide": "https://github.com/mapbox/mapbox-gl-native/pull/12611", - "render-tests/bright-v9/z0-wide": "https://github.com/mapbox/mapbox-gl-native/pull/12611", "render-tests/collator/resolved-locale": "Some test platforms don't resolve 'en' locale", "render-tests/collator/default": "Some test platforms don't resolve 'en' locale", "render-tests/custom-layer-js/null-island": "skip - js specific", @@ -127,7 +125,6 @@ "render-tests/runtime-styling/image-add-sdf": "https://github.com/mapbox/mapbox-gl-native/issues/9847", "render-tests/runtime-styling/paint-property-fill-flat-to-extrude": "https://github.com/mapbox/mapbox-gl-native/issues/6745", "render-tests/runtime-styling/set-style-paint-property-fill-flat-to-extrude": "https://github.com/mapbox/mapbox-gl-native/issues/6745", - "render-tests/satellite-v9/z0-wide": "https://github.com/mapbox/mapbox-gl-native/pull/12611", "render-tests/symbol-cross-fade/chinese": "https://github.com/mapbox/mapbox-gl-native/issues/10619", "render-tests/symbol-placement/line-overscaled": "https://github.com/mapbox/mapbox-gl-js/issues/5654", "render-tests/symbol-visibility/visible": "https://github.com/mapbox/mapbox-gl-native/issues/10409", @@ -160,8 +157,8 @@ "render-tests/combinations/line-translucent--fill-extrusion-translucent": "needs investigation", "render-tests/combinations/raster-translucent--fill-extrusion-translucent": "needs investigation", "render-tests/combinations/symbol-translucent--fill-extrusion-translucent": "needs investigation", - "render-tests/feature-state/composite-expression": "skip - port https://github.com/mapbox/mapbox-gl-js/pull/6263 - needs issue", - "render-tests/feature-state/data-expression": "skip - port https://github.com/mapbox/mapbox-gl-js/pull/6263 - needs issue", + "render-tests/feature-state/composite-expression": "https://github.com/mapbox/mapbox-gl-native/issues/12613", + "render-tests/feature-state/data-expression": "https://github.com/mapbox/mapbox-gl-native/issues/12613", "render-tests/feature-state/set-paint-property": "skip - port https://github.com/mapbox/mapbox-gl-js/pull/6263 - needs issue", - "render-tests/feature-state/vector-source": "skip - port https://github.com/mapbox/mapbox-gl-js/pull/6263 - needs issue" + "render-tests/feature-state/vector-source": "https://github.com/mapbox/mapbox-gl-native/issues/12613" } diff --git a/src/mbgl/map/transform_state.cpp b/src/mbgl/map/transform_state.cpp index 9ff68a1a608..5cbd3076983 100644 --- a/src/mbgl/map/transform_state.cpp +++ b/src/mbgl/map/transform_state.cpp @@ -352,21 +352,26 @@ bool TransformState::rotatedNorth() const { } void TransformState::constrain(double& scale_, double& x_, double& y_) const { - // Constrain minimum scale to avoid zooming out far enough to show off-world areas. - scale_ = util::max(scale_, - static_cast(rotatedNorth() ? size.height : size.width) / util::tileSize, - static_cast(rotatedNorth() ? size.width : size.height) / util::tileSize); + if (constrainMode == ConstrainMode::None) { + return; + } + + const double ratioX = (rotatedNorth() ? size.height : size.width) / util::tileSize; + const double ratioY = (rotatedNorth() ? size.width : size.height) / util::tileSize; + + // Constrain minimum scale to avoid zooming out far enough to show off-world areas on the Y axis. + // If Y axis ratio is too small to be constrained, use X axis ratio instead. + scale_ = util::max(scale_, ratioY < 1.0 ? ratioX : ratioY); + + // Constrain min/max pan to avoid showing off-world areas on the Y axis. + double max_y = (scale_ * util::tileSize - (rotatedNorth() ? size.width : size.height)) / 2; + y_ = std::max(-max_y, std::min(y_, max_y)); - // Constrain min/max pan to avoid showing off-world areas. if (constrainMode == ConstrainMode::WidthAndHeight) { + // Constrain min/max pan to avoid showing off-world areas on the X axis. double max_x = (scale_ * util::tileSize - (rotatedNorth() ? size.height : size.width)) / 2; x_ = std::max(-max_x, std::min(x_, max_x)); } - - if (constrainMode != ConstrainMode::None) { - double max_y = (scale_ * util::tileSize - (rotatedNorth() ? size.width : size.height)) / 2; - y_ = std::max(-max_y, std::min(y_, max_y)); - } } void TransformState::moveLatLng(const LatLng& latLng, const ScreenCoordinate& anchor) { diff --git a/test/fixtures/offline_database/offline_sideload.db b/test/fixtures/offline_database/offline_sideload.db new file mode 100644 index 00000000000..8909c402b22 Binary files /dev/null and b/test/fixtures/offline_database/offline_sideload.db differ diff --git a/test/style/expression/expression.test.cpp b/test/style/expression/expression.test.cpp index 4c2ec5cf92f..bed3d4f0631 100644 --- a/test/style/expression/expression.test.cpp +++ b/test/style/expression/expression.test.cpp @@ -29,18 +29,21 @@ TEST(Expression, IsExpression) { for(auto& entry : allExpressions.GetObject()) { const std::string name { entry.name.GetString(), entry.name.GetStringLength() }; - if (name == "line-progress" || - name == "feature-state" || - name == "interpolate-hcl" || - name == "interpolate-lab" || - name == "format") { - // Not yet implemented - continue; - } JSDocument document; document.Parse<0>(R"([")" + name + R"("])"); - const JSValue* expression = &document; + + // TODO: "feature-state": https://github.com/mapbox/mapbox-gl-native/issues/12613 + // TODO: "interpolate-hcl": https://github.com/mapbox/mapbox-gl-native/issues/8720 + // TODO: "interpolate-lab": https://github.com/mapbox/mapbox-gl-native/issues/8720 + // TODO: "format": https://github.com/mapbox/mapbox-gl-native/issues/12612 + if (name == "feature-state" || name == "interpolate-hcl" || name == "interpolate-lab" || name == "format") { + if (expression::isExpression(conversion::Convertible(expression))) { + ASSERT_TRUE(false) << "Expression name" << name << "is implemented - please update Expression.IsExpression test."; + } + continue; + } + EXPECT_TRUE(expression::isExpression(conversion::Convertible(expression))) << name; } }