forked from organicmaps/organicmaps
[search] Add test case for FilterStreetPredictions test.
This commit is contained in:
parent
2c1bb4ea63
commit
0ae6ef2d3b
1 changed files with 17 additions and 0 deletions
|
@ -2540,6 +2540,8 @@ UNIT_CLASS_TEST(ProcessorTest, ViewportFilter)
|
|||
|
||||
UNIT_CLASS_TEST(ProcessorTest, FilterStreetPredictions)
|
||||
{
|
||||
TestCity smallCity(m2::PointD(3.0, 0.0), "SmallCity", "en", 1 /* rank */);
|
||||
|
||||
TestStreet lenina0({m2::PointD(0.0, -1.0), m2::PointD(0.0, 1.0)}, "Lenina", "en");
|
||||
TestStreet lenina1({m2::PointD(1.0, -1.0), m2::PointD(1.0, 1.0)}, "Lenina", "en");
|
||||
TestStreet lenina2({m2::PointD(2.0, -1.0), m2::PointD(2.0, 1.0)}, "Lenina", "en");
|
||||
|
@ -2552,6 +2554,8 @@ UNIT_CLASS_TEST(ProcessorTest, FilterStreetPredictions)
|
|||
builder.Add(lenina3);
|
||||
});
|
||||
|
||||
BuildWorld([&](TestMwmBuilder & builder) { builder.Add(smallCity); });
|
||||
|
||||
SearchParams defaultParams;
|
||||
defaultParams.m_query = "Lenina";
|
||||
defaultParams.m_inputLocale = "en";
|
||||
|
@ -2617,6 +2621,19 @@ UNIT_CLASS_TEST(ProcessorTest, FilterStreetPredictions)
|
|||
request.Run();
|
||||
TEST(ResultsMatch(request.Results(), rules), ());
|
||||
}
|
||||
|
||||
{
|
||||
Rules const rules = {ExactMatch(countryId, lenina0), ExactMatch(countryId, lenina3)};
|
||||
|
||||
auto params = defaultParams;
|
||||
params.m_streetSearchRadiusM =
|
||||
mercator::DistanceOnEarth(params.m_viewport.Center(), m2::PointD(1.0, 0.0)) - 1.0;
|
||||
params.m_query = "SmallCity Lenina";
|
||||
|
||||
TestSearchRequest request(m_engine, params);
|
||||
request.Run();
|
||||
TEST(ResultsMatch(request.Results(), rules), ());
|
||||
}
|
||||
}
|
||||
} // namespace
|
||||
} // namespace search
|
||||
|
|
Loading…
Add table
Reference in a new issue