diff --git a/routing/index_graph.cpp b/routing/index_graph.cpp index 094feb3243..b1d8ac1f06 100644 --- a/routing/index_graph.cpp +++ b/routing/index_graph.cpp @@ -241,8 +241,6 @@ void IndexGraph::GetSegmentCandidateForRoadPoint(RoadPoint const & rp, NumMwmId if (!road.IsValid()) return; - // Note. Flag |useRoutingOptions| is not passed to this place because it's true - // for all cases in current code. So if below should be checked anyway. if (!road.SuitableForOptions(m_avoidRoutingOptions)) return; diff --git a/routing/routing_integration_tests/route_test.cpp b/routing/routing_integration_tests/route_test.cpp index 883f4baafc..1d4dedf5c4 100644 --- a/routing/routing_integration_tests/route_test.cpp +++ b/routing/routing_integration_tests/route_test.cpp @@ -1,6 +1,7 @@ #include "testing/testing.hpp" #include "routing/routing_callbacks.hpp" +#include "routing/routing_options.hpp" #include "routing/routing_integration_tests/routing_test_tools.hpp" @@ -13,6 +14,28 @@ using namespace std; namespace { + class RoutingOptionSetter + { + public: + RoutingOptionSetter(RoutingOptions::Road road) + { + m_formerRoutingOptions.LoadCarOptionsFromSettings(); + + RoutingOptions routingOptions; + routingOptions.Add(road); + RoutingOptions::SaveCarOptionsToSettings(routingOptions); + } + + ~RoutingOptionSetter() + { + RoutingOptions::SaveCarOptionsToSettings(m_formerRoutingOptions); + } + + private: + RoutingOptions m_formerRoutingOptions; + }; + + UNIT_TEST(StrangeCaseInAfrica) { integration::CalculateRouteAndTestRouteLength( @@ -505,4 +528,27 @@ namespace MercatorBounds::FromLatLon(51.603582, 0.266995), {0., 0.}, MercatorBounds::FromLatLon(51.606785, 0.264055), 416.8); } + + // Test that toll road is not crossed by a fake edge if RouingOptions are set to Road::Toll. + UNIT_TEST(RussiaMoscowNotCrossingTollRoadTest) + { + auto & vehicleComponents = integration::GetVehicleComponents(VehicleType::Car); + RoutingOptionSetter routingOptionSetter(RoutingOptions::Road::Toll); + + integration::CalculateRouteAndTestRouteLength( + vehicleComponents, MercatorBounds::FromLatLon(55.93934, 37.406), {0.0, 0.0}, + MercatorBounds::FromLatLon(55.93952, 37.45089), 8987.7); + } + + // Test on necessity calling RectCoversPolyline() after DataSource::ForEachInRect() + // while looking for fake edges. + UNIT_TEST(RussiaMoscowNecessityRectCoversPolylineTest) + { + auto & vehicleComponents = integration::GetVehicleComponents(VehicleType::Car); + RoutingOptionSetter routingOptionSetter(RoutingOptions::Road::Toll); + + integration::CalculateRouteAndTestRouteLength( + vehicleComponents, MercatorBounds::FromLatLon(55.93885, 37.40588), {0.0, 0.0}, + MercatorBounds::FromLatLon(55.93706, 37.45339), 10270.2); + } } // namespace