diff options
author | Arsentiy Milchakov <milcars@mapswithme.com> | 2017-05-05 19:46:40 +0300 |
---|---|---|
committer | Arsentiy Milchakov <milcars@mapswithme.com> | 2017-05-05 19:46:40 +0300 |
commit | e9ceb406130ca0befbe7e079af09a11f9141ded4 (patch) | |
tree | db112fb1a91204dab7d0226ccc5a80deb84dab76 | |
parent | 6a20809d0b5a46138b0cb182cede2801f7b7ef4e (diff) |
test addedbeta-824
-rw-r--r-- | editor/editor_tests/osm_feature_matcher_test.cpp | 63 |
1 files changed, 59 insertions, 4 deletions
diff --git a/editor/editor_tests/osm_feature_matcher_test.cpp b/editor/editor_tests/osm_feature_matcher_test.cpp index 8299ca4754..c9023027bb 100644 --- a/editor/editor_tests/osm_feature_matcher_test.cpp +++ b/editor/editor_tests/osm_feature_matcher_test.cpp @@ -261,7 +261,6 @@ char const * const osmRawResponseRelation = R"SEP( </relation> </osm> )SEP"; -} // namespace // Note: Geometry should not contain duplicates. @@ -355,8 +354,6 @@ UNIT_TEST(GetBestOsmRealtion_Test) TEST_EQUAL(bestWay.attribute("id").value(), string("365808"), ()); } -namespace -{ char const * const osmResponseBuildingMiss = R"SEP( <osm version="0.6" generator="CGImap 0.4.0 (8662 thorn-01.openstreetmap.org)"> <bounds minlat="51.5342700" minlon="-0.2047000" maxlat="51.5343200" maxlon="-0.2046300"/> @@ -399,7 +396,6 @@ char const * const osmResponseBuildingMiss = R"SEP( </way> </osm> )SEP"; -} // namespace UNIT_TEST(HouseBuildingMiss_test) { @@ -415,3 +411,62 @@ UNIT_TEST(HouseBuildingMiss_test) auto const bestWay = osm::GetBestOsmWayOrRelation(osmResponse, geometry); TEST_EQUAL(bestWay.attribute("id").value(), string("345630019"), ()); } + +string const kHouseWithSeveralEntrances = R"xxx(" +<osm version="0.6" generator="CGImap 0.6.0 (3589 thorn-03.openstreetmap.org)" copyright="OpenStreetMap and contributors" attribution="http://www.openstreetmap.org/copyright" license="http://opendatacommons.org/licenses/odbl/1-0/"> + <node id="339283610" visible="true" version="6" changeset="33699414" timestamp="2015-08-31T09:53:02Z" user="Lazy Ranma" uid="914471" lat="55.8184397" lon="37.5700770"/> + <node id="339283612" visible="true" version="6" changeset="33699414" timestamp="2015-08-31T09:53:02Z" user="Lazy Ranma" uid="914471" lat="55.8184655" lon="37.5702599"/> + <node id="339283614" visible="true" version="6" changeset="33699414" timestamp="2015-08-31T09:53:02Z" user="Lazy Ranma" uid="914471" lat="55.8190524" lon="37.5698027"/> + <node id="339283615" visible="true" version="6" changeset="33699414" timestamp="2015-08-31T09:53:02Z" user="Lazy Ranma" uid="914471" lat="55.8190782" lon="37.5699856"/> + <node id="1131238558" visible="true" version="7" changeset="33699414" timestamp="2015-08-31T09:52:50Z" user="Lazy Ranma" uid="914471" lat="55.8188226" lon="37.5699055"> + <tag k="entrance" v="yes"/> + <tag k="ref" v="2"/> + </node> + <node id="1131238581" visible="true" version="7" changeset="33699414" timestamp="2015-08-31T09:52:51Z" user="Lazy Ranma" uid="914471" lat="55.8185163" lon="37.5700427"> + <tag k="entrance" v="yes"/> + <tag k="ref" v="4"/> + </node> + <node id="1131238623" visible="true" version="7" changeset="33699414" timestamp="2015-08-31T09:52:51Z" user="Lazy Ranma" uid="914471" lat="55.8189758" lon="37.5698370"> + <tag k="entrance" v="yes"/> + <tag k="ref" v="1"/> + </node> + <node id="1131238704" visible="true" version="7" changeset="33699414" timestamp="2015-08-31T09:52:52Z" user="Lazy Ranma" uid="914471" lat="55.8186694" lon="37.5699741"> + <tag k="entrance" v="yes"/> + <tag k="ref" v="3"/> + </node> + <way id="30680719" visible="true" version="10" changeset="25301783" timestamp="2014-09-08T07:52:43Z" user="Felis Pimeja" uid="260756"> + <nd ref="339283614"/> + <nd ref="339283615"/> + <nd ref="339283612"/> + <nd ref="339283610"/> + <nd ref="1131238581"/> + <nd ref="1131238704"/> + <nd ref="1131238558"/> + <nd ref="1131238623"/> + <nd ref="339283614"/> + <tag k="addr:city" v="Москва"/> + <tag k="addr:country" v="RU"/> + <tag k="addr:housenumber" v="14 к1"/> + <tag k="addr:street" v="Ивановская улица"/> + <tag k="building" v="yes"/> + </way> +</osm> +)xxx"; + +UNIT_TEST(HouseWithSeveralEntrances) +{ + pugi::xml_document osmResponse; + TEST(osmResponse.load_buffer(kHouseWithSeveralEntrances.c_str(), + kHouseWithSeveralEntrances.size()), ()); + + vector<m2::PointD> const geometry = { + {37.569802534355233, 67.575570401367315}, + {37.56998492456961, 67.57561599892091}, + {37.570076119676798, 67.574481424499169}, + {37.570258509891175, 67.574527022052763} + }; + + auto const bestWay = osm::GetBestOsmWayOrRelation(osmResponse, geometry); + TEST_EQUAL(bestWay.attribute("id").value(), string("30680719"), ()); +} +} // namespace |