Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaxim Pimenov <m@maps.me>2016-09-20 20:24:53 +0300
committerMaxim Pimenov <m@maps.me>2016-09-26 13:20:19 +0300
commitf3be6799ba37fa766dfdd5ec263603ba3cd45006 (patch)
treeffb025f27cdfe2e2a6fcee34ec67ffde3c9a0bc7 /search/search_integration_tests
parent48bfcabc59ae2f4e68baaeb97add7f4b789d6342 (diff)
Added a test.
Diffstat (limited to 'search/search_integration_tests')
-rw-r--r--search/search_integration_tests/search_edited_features_test.cpp59
1 files changed, 59 insertions, 0 deletions
diff --git a/search/search_integration_tests/search_edited_features_test.cpp b/search/search_integration_tests/search_edited_features_test.cpp
index bd3ed5c7f0..a4f4014fa1 100644
--- a/search/search_integration_tests/search_edited_features_test.cpp
+++ b/search/search_integration_tests/search_edited_features_test.cpp
@@ -59,4 +59,63 @@ UNIT_CLASS_TEST(SearchEditedFeaturesTest, Smoke)
TEST(ResultsMatch("wifi bar quahog", rules), ());
}
}
+
+UNIT_CLASS_TEST(SearchEditedFeaturesTest, SearchInViewport)
+{
+ TestCity city(m2::PointD(0, 0), "Canterlot", "default", 100 /* rank */);
+ TestPOI bakery0(m2::PointD(0, 0), "Bakery 0", "default");
+ TestPOI cornerPost(m2::PointD(100, 100), "Corner Post", "default");
+ auto & editor = osm::Editor::Instance();
+
+ BuildWorld([&](TestMwmBuilder & builder) { builder.Add(city); });
+
+ auto const countryId = BuildCountry("Equestria", [&](TestMwmBuilder & builder) {
+ builder.Add(bakery0);
+ builder.Add(cornerPost);
+ });
+
+ FeatureID id1, id2, id3;
+ auto bakery1 = TestPOI::AddWithEditor(editor, countryId, "bakery1", {1.0, 1.0}, id1);
+ auto bakery2 = TestPOI::AddWithEditor(editor, countryId, "bakery2", {2.0, 2.0}, id2);
+ auto bakery3 = TestPOI::AddWithEditor(editor, countryId, "bakery3", {3.0, 3.0}, id3);
+
+ SetViewport(m2::RectD(-1.0, -1.0, 4.0, 4.0));
+ {
+ TRules const rules = {ExactMatch(countryId, bakery0), ExactMatch(countryId, bakery1),
+ ExactMatch(countryId, bakery2), ExactMatch(countryId, bakery3)};
+
+ TEST(ResultsMatch("bakery", Mode::Viewport, rules), ());
+ }
+
+ SetViewport(m2::RectD(-2.0, -2.0, -1.0, -1.0));
+ {
+ TRules const rules = {};
+
+ TEST(ResultsMatch("bakery", Mode::Viewport, rules), ());
+ }
+
+ SetViewport(m2::RectD(-1.0, -1.0, 1.5, 1.5));
+ {
+ TRules const rules = {ExactMatch(countryId, bakery0), ExactMatch(countryId, bakery1)};
+
+ TEST(ResultsMatch("bakery", Mode::Viewport, rules), ());
+ }
+
+ SetViewport(m2::RectD(1.5, 1.5, 4.0, 4.0));
+ {
+ TRules const rules = {ExactMatch(countryId, bakery2), ExactMatch(countryId, bakery3)};
+
+ TEST(ResultsMatch("bakery", Mode::Viewport, rules), ());
+ }
+
+ editor.DeleteFeature(id1);
+ editor.DeleteFeature(id3);
+
+ SetViewport(m2::RectD(-1.0, -1.0, 4.0, 4.0));
+ {
+ TRules const rules = {ExactMatch(countryId, bakery0), ExactMatch(countryId, bakery2)};
+
+ TEST(ResultsMatch("bakery", Mode::Viewport, rules), ());
+ }
+}
} // namespace