示例#1
0
UNIT_CLASS_TEST(ProcessorTest, DisableSuggests)
{
  TestCity london1(m2::PointD(1, 1), "London", "en", 100 /* rank */);
  TestCity london2(m2::PointD(-1, -1), "London", "en", 100 /* rank */);

  auto worldId = BuildWorld([&](TestMwmBuilder & builder)
                            {
                              builder.Add(london1);
                              builder.Add(london2);
                            });

  SetViewport(m2::RectD(m2::PointD(0.5, 0.5), m2::PointD(1.5, 1.5)));
  {
    SearchParams params;
    params.m_query = "londo";
    params.m_inputLocale = "en";
    params.SetMode(Mode::World);
    params.SetSuggestsEnabled(false);

    TestSearchRequest request(m_engine, params, m_viewport);
    request.Wait();
    TRules rules = {ExactMatch(worldId, london1), ExactMatch(worldId, london2)};

    TEST(MatchResults(rules, request.Results()), ());
  }
}
示例#2
0
TestSearchRequest::TestSearchRequest(TestSearchEngine & engine, string const & query,
                                     string const & locale, Mode mode, m2::RectD const & viewport)
{
    SearchParams params;
    params.m_query = query;
    params.m_inputLocale = locale;
    params.SetMode(mode);
    SetUpCallbacks(params);
    engine.Search(params, viewport);
}