diff options
author | Alex Zolotarev <alex@mapswithme.com> | 2013-06-25 17:35:31 +0400 |
---|---|---|
committer | Alex Zolotarev <alex@maps.me> | 2015-09-23 01:56:56 +0300 |
commit | 668536cd740838c3057803bd7ccde4d69e9d979e (patch) | |
tree | e8a5840d08cfc732a2e80e0b5ce858027b7c131b /map | |
parent | adbc00b0ca795b8ff6260808fb6052fee16e1f5c (diff) |
[api] Renamed u parameter to id
Diffstat (limited to 'map')
-rw-r--r-- | map/framework.cpp | 3 | ||||
-rw-r--r-- | map/map_tests/mwm_url_tests.cpp | 12 | ||||
-rw-r--r-- | map/mwm_url.cpp | 4 | ||||
-rw-r--r-- | map/mwm_url.hpp | 2 |
4 files changed, 11 insertions, 10 deletions
diff --git a/map/framework.cpp b/map/framework.cpp index 0bb715380f..1821375f95 100644 --- a/map/framework.cpp +++ b/map/framework.cpp @@ -1469,7 +1469,8 @@ bool Framework::SetViewportByURL(string const & url, url_api::Request & request) request.m_viewportLat = point.m_lat = apiPoint.m_lat; request.m_viewportLon = point.m_lon = apiPoint.m_lon; - point.m_name = apiPoint.m_title; point.m_id = apiPoint.m_url; + point.m_name = apiPoint.m_title; + point.m_id = apiPoint.m_id; request.m_points.push_back(point); } diff --git a/map/map_tests/mwm_url_tests.cpp b/map/map_tests/mwm_url_tests.cpp index d2b339c503..cb619de1fa 100644 --- a/map/map_tests/mwm_url_tests.cpp +++ b/map/map_tests/mwm_url_tests.cpp @@ -20,7 +20,7 @@ UNIT_TEST(MapApiSmoke) TEST_EQUAL(api.GetPoints()[0].m_lat, 38.970559, ()); TEST_EQUAL(api.GetPoints()[0].m_lon, -9.419289, ()); TEST_EQUAL(api.GetPoints()[0].m_title, "Point Name", ()); - TEST_EQUAL(api.GetPoints()[0].m_url, "", ()); + TEST_EQUAL(api.GetPoints()[0].m_id, "", ()); TEST_EQUAL(api.GetGlobalBackUrl(), "", ()); } @@ -86,11 +86,11 @@ UNIT_TEST(MapApiInvalidPointLatLonButValidOtherParts) UNIT_TEST(MapApiPointURLEncoded) { - ParsedMapApi api(Uri("mwm://map?ll=1,2&n=%D0%9C%D0%B8%D0%BD%D1%81%D0%BA&u=http%3A%2F%2Fmap%3Fll%3D1%2C2%26n%3Dtest")); + ParsedMapApi api(Uri("mwm://map?ll=1,2&n=%D0%9C%D0%B8%D0%BD%D1%81%D0%BA&id=http%3A%2F%2Fmap%3Fll%3D1%2C2%26n%3Dtest")); TEST(api.IsValid(), ()); TEST_EQUAL(api.GetPoints().size(), 1, ()); TEST_EQUAL(api.GetPoints()[0].m_title, "\xd0\x9c\xd0\xb8\xd0\xbd\xd1\x81\xd0\xba", ()); - TEST_EQUAL(api.GetPoints()[0].m_url, "http://map?ll=1,2&n=test", ()); + TEST_EQUAL(api.GetPoints()[0].m_id, "http://map?ll=1,2&n=test", ()); } UNIT_TEST(GlobalBackUrl) @@ -217,7 +217,7 @@ string generatePartOfUrl(url_scheme::ApiPoint const & point) stringstream stream; stream << "&ll=" << strings::ToString(point.m_lat) << "," << strings::ToString(point.m_lon) << "&n=" << point.m_title - << "&u=" << point.m_title; + << "&id=" << point.m_id; return stream.str(); } @@ -242,7 +242,7 @@ void generateRandomTest(size_t numberOfPoints, size_t stringLength) point.m_lon = random.Generate() % 180; point.m_lon *= random.Generate() % 2 == 0 ? 1 : -1; point.m_title = randomString(stringLength, i); - point.m_url = randomString(stringLength, i); + point.m_id = randomString(stringLength, i); vect[i] = point; } string result = "mapswithme://map?v=1"; @@ -257,7 +257,7 @@ void generateRandomTest(size_t numberOfPoints, size_t stringLength) TEST_EQUAL(points[i].m_lat, vect[i].m_lat, ()); TEST_EQUAL(points[i].m_lon, vect[i].m_lon, ()); TEST_EQUAL(points[i].m_title, vect[i].m_title, ()); - TEST_EQUAL(points[i].m_url, vect[i].m_url, ()); + TEST_EQUAL(points[i].m_id, vect[i].m_id, ()); } TEST_EQUAL(api.GetApiVersion(), 1, ()); } diff --git a/map/mwm_url.cpp b/map/mwm_url.cpp index 306b7f7686..a50391e8c0 100644 --- a/map/mwm_url.cpp +++ b/map/mwm_url.cpp @@ -107,10 +107,10 @@ void ParsedMapApi::AddKeyValue(string key, string const & value) else LOG(LWARNING, ("Map API: Point name with no point. 'll' should come first!")); } - else if (key == "u") + else if (key == "id") { if (!m_points.empty()) - m_points.back().m_url = value; + m_points.back().m_id = value; else LOG(LWARNING, ("Map API: Point url with no point. 'll' should come first!")); } diff --git a/map/mwm_url.hpp b/map/mwm_url.hpp index 1e999daed8..a427e93f5e 100644 --- a/map/mwm_url.hpp +++ b/map/mwm_url.hpp @@ -11,7 +11,7 @@ struct ApiPoint double m_lat; double m_lon; string m_title; - string m_url; + string m_id; }; /// Handles [mapswithme|mwm]://map?params - everything related to displaying info on a map |