diff options
author | VladiMihaylenko <vxmihaylenko@gmail.com> | 2017-04-06 12:04:10 +0300 |
---|---|---|
committer | VladiMihaylenko <vxmihaylenko@gmail.com> | 2017-04-06 12:30:33 +0300 |
commit | a3c7afe7326d0e397748b621f70fe9a0220bb9b4 (patch) | |
tree | 46bc72cb8bff500135b052472a08c861a2e6e97d | |
parent | c5a2ad8e4efde68f3945125463f5eaaad9edc5b1 (diff) |
Fixed uri tests.
-rw-r--r-- | coding/uri.cpp | 2 | ||||
-rw-r--r-- | map/map_tests/mwm_url_tests.cpp | 34 | ||||
-rw-r--r-- | xcode/map/map.xcodeproj/project.pbxproj | 4 |
3 files changed, 28 insertions, 12 deletions
diff --git a/coding/uri.cpp b/coding/uri.cpp index 46b3b2ef32..1c1dafbf9b 100644 --- a/coding/uri.cpp +++ b/coding/uri.cpp @@ -2,7 +2,6 @@ #include "coding/url_encode.hpp" #include "base/assert.hpp" -#include "base/string_utils.hpp" namespace url_scheme { @@ -77,7 +76,6 @@ bool Uri::ForEachKeyValue(TCallback const & callback) const else key = UrlDecode(m_url.substr(start, end - start)); - strings::AsciiToLower(key); if (!callback(key, value)) return false; } diff --git a/map/map_tests/mwm_url_tests.cpp b/map/map_tests/mwm_url_tests.cpp index 1f36c2b39e..26bab35891 100644 --- a/map/map_tests/mwm_url_tests.cpp +++ b/map/map_tests/mwm_url_tests.cpp @@ -153,6 +153,7 @@ UNIT_TEST(SearchApiInvalidUrl) TEST(IsValid(f, "mapsme://search?query=aaa&cll=1,1,1"), ("If it's wrong lat lon format then just ignore it")); TEST(IsValid(f, "mapsme://search?query=aaa&ignoreThisParam=sure"), ("We shouldn't fail search request if there are some unsupported parameters")); TEST(IsValid(f, "mapsme://search?cll=1,1&locale=ru&query=aaa"), ("Query parameter position doesn't matter")); + TEST(!IsValid(f, "mapsme://search?Query=fff"), ("The parser is case sensitive")); } UNIT_TEST(MapApiInvalidUrl) @@ -164,6 +165,7 @@ UNIT_TEST(MapApiInvalidUrl) TEST(!IsValid(fm, "mapswithme://map?"), ("No longtitude")); TEST(!IsValid(fm, "mapswithme://map?ll=1,2,3"), ("Too many values for ll")); TEST(!IsValid(fm, "mapswithme://fffff://map?ll=1,2"), ()); + TEST(!IsValid(fm, "mapsme://map?LL=1,1"), ("The parser is case sensitive")); } UNIT_TEST(RouteApiInvalidUrl) @@ -204,15 +206,23 @@ UNIT_TEST(MapApiPointNameBeforeLatLon) UNIT_TEST(MapApiPointNameOverwritten) { - ApiTest api("mapswithme://map?ll=1,2&n=A&N=B"); - TEST(api.IsValid(), ()); - TEST_EQUAL(api.GetPointCount(), 1, ()); - TEST(api.TestName(0, "B"), ()); + { + ApiTest api("mapswithme://map?ll=1,2&n=A&N=B"); + TEST(api.IsValid(), ()); + TEST_EQUAL(api.GetPointCount(), 1, ()); + TEST(api.TestName(0, "A"), ()); + } + + { + ApiTest api("mapswithme://map?ll=1,2&n=A&n=B"); + TEST(api.IsValid(), ()); + TEST(api.TestName(0, "B"), ()); + } } UNIT_TEST(MapApiMultiplePoints) { - ApiTest api("mwm://map?ll=1.1,1.2&n=A&LL=2.1,2.2&ll=-3.1,-3.2&n=C"); + ApiTest api("mwm://map?ll=1.1,1.2&n=A&ll=2.1,2.2&ll=-3.1,-3.2&n=C"); TEST(api.IsValid(), ()); TEST_EQUAL(api.GetPointCount(), 3, ()); TEST(api.TestLatLon(2, 1.1, 1.2), ()); @@ -258,7 +268,7 @@ UNIT_TEST(GlobalBackUrl) TEST_EQUAL(api.GetGlobalBackUrl(), "http://mapswithme.com", ()); } { - ApiTest api("mwm://map?ll=1,2&n=PointName&backUrl=someapp://%D0%9C%D0%BE%D0%B1%D0%B8%D0%BB%D1%8C%D0%BD%D1%8B%D0%B5%20%D0%9A%D0%B0%D1%80%D1%82%D1%8B"); + ApiTest api("mwm://map?ll=1,2&n=PointName&backurl=someapp://%D0%9C%D0%BE%D0%B1%D0%B8%D0%BB%D1%8C%D0%BD%D1%8B%D0%B5%20%D0%9A%D0%B0%D1%80%D1%82%D1%8B"); TEST_EQUAL(api.GetGlobalBackUrl(), "someapp://\xd0\x9c\xd0\xbe\xd0\xb1\xd0\xb8\xd0\xbb\xd1\x8c\xd0\xbd\xd1\x8b\xd0\xb5 \xd0\x9a\xd0\xb0\xd1\x80\xd1\x82\xd1\x8b", ()); } { @@ -299,6 +309,10 @@ UNIT_TEST(VersionTest) } { ApiTest api("mwm://map?V=666&ll=1,2&n=PointName"); + TEST_EQUAL(api.GetApiVersion(), 0, ()); + } + { + ApiTest api("mwm://map?v=666&ll=1,2&n=PointName"); TEST_EQUAL(api.GetApiVersion(), 666, ()); } } @@ -310,7 +324,7 @@ UNIT_TEST(AppNameTest) TEST_EQUAL(api.GetAppTitle(), "Google", ()); } { - ApiTest api("mwm://map?ll=1,2&v=1&n=PointName&AppName=%D0%AF%D0%BD%D0%B4%D0%B5%D0%BA%D1%81"); + ApiTest api("mwm://map?ll=1,2&v=1&n=PointName&appname=%D0%AF%D0%BD%D0%B4%D0%B5%D0%BA%D1%81"); TEST_EQUAL(api.GetAppTitle(), "Яндекс", ()); } { @@ -396,15 +410,15 @@ UNIT_TEST(MWMApiBalloonActionDefaultTest) TEST(!api.GoBackOnBalloonClick(), ("")); } { - ApiTest api("mapswithme://map?ll=38.970559,-9.419289&ignoreThisParam=Yes&z=17&n=Point%20Name&balloonAction=false"); + ApiTest api("mapswithme://map?ll=38.970559,-9.419289&ignoreThisParam=Yes&z=17&n=Point%20Name&balloonaction=false"); TEST(api.GoBackOnBalloonClick(), ("")); } { - ApiTest api("mapswithme://map?ll=38.970559,-9.419289&ignoreThisParam=Yes&z=17&n=Point%20Name&balloonAction=true"); + ApiTest api("mapswithme://map?ll=38.970559,-9.419289&ignoreThisParam=Yes&z=17&n=Point%20Name&balloonaction=true"); TEST(api.GoBackOnBalloonClick(), ("")); } { - ApiTest api("mapswithme://map?ll=38.970559,-9.419289&ignoreThisParam=Yes&z=17&n=Point%20Name&balloonAction="); + ApiTest api("mapswithme://map?ll=38.970559,-9.419289&ignoreThisParam=Yes&z=17&n=Point%20Name&balloonaction="); TEST(api.GoBackOnBalloonClick(), ("")); } } diff --git a/xcode/map/map.xcodeproj/project.pbxproj b/xcode/map/map.xcodeproj/project.pbxproj index 78cca016a4..ebbdba905f 100644 --- a/xcode/map/map.xcodeproj/project.pbxproj +++ b/xcode/map/map.xcodeproj/project.pbxproj @@ -97,6 +97,7 @@ F627BFC41E8E89B600B1CBF4 /* librouting_common.a in Frameworks */ = {isa = PBXBuildFile; fileRef = F627BFC31E8E89B600B1CBF4 /* librouting_common.a */; }; F63421F81DF9BF9100A96868 /* reachable_by_taxi_checker.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F63421F61DF9BF9100A96868 /* reachable_by_taxi_checker.cpp */; }; F63421F91DF9BF9100A96868 /* reachable_by_taxi_checker.hpp in Headers */ = {isa = PBXBuildFile; fileRef = F63421F71DF9BF9100A96868 /* reachable_by_taxi_checker.hpp */; }; + F685EB631E955C45003CA3FF /* libicu.a in Frameworks */ = {isa = PBXBuildFile; fileRef = F685EB621E955C45003CA3FF /* libicu.a */; }; F6B283031C1B03320081957A /* gps_track_collection.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F6B282FB1C1B03320081957A /* gps_track_collection.cpp */; }; F6B283041C1B03320081957A /* gps_track_collection.hpp in Headers */ = {isa = PBXBuildFile; fileRef = F6B282FC1C1B03320081957A /* gps_track_collection.hpp */; }; F6B283051C1B03320081957A /* gps_track_filter.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F6B282FD1C1B03320081957A /* gps_track_filter.cpp */; }; @@ -220,6 +221,7 @@ F627BFC31E8E89B600B1CBF4 /* librouting_common.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = librouting_common.a; path = "/Users/v.mikhaylenko/mapsme/omim/xcode/routing_common/../../../omim-build/xcode/Debug/librouting_common.a"; sourceTree = "<absolute>"; }; F63421F61DF9BF9100A96868 /* reachable_by_taxi_checker.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = reachable_by_taxi_checker.cpp; sourceTree = "<group>"; }; F63421F71DF9BF9100A96868 /* reachable_by_taxi_checker.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = reachable_by_taxi_checker.hpp; sourceTree = "<group>"; }; + F685EB621E955C45003CA3FF /* libicu.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libicu.a; path = "/Users/v.mikhaylenko/mapsme/omim/xcode/icu/../../../omim-build/xcode/Debug/libicu.a"; sourceTree = "<absolute>"; }; F6B282FB1C1B03320081957A /* gps_track_collection.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = gps_track_collection.cpp; sourceTree = "<group>"; }; F6B282FC1C1B03320081957A /* gps_track_collection.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = gps_track_collection.hpp; sourceTree = "<group>"; }; F6B282FD1C1B03320081957A /* gps_track_filter.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = gps_track_filter.cpp; sourceTree = "<group>"; }; @@ -242,6 +244,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + F685EB631E955C45003CA3FF /* libicu.a in Frameworks */, F627BFC41E8E89B600B1CBF4 /* librouting_common.a in Frameworks */, 674231CB1DF984F600913FEB /* libtraffic.a in Frameworks */, 34DDA1811DBE5DF40088A609 /* libpartners_api.a in Frameworks */, @@ -294,6 +297,7 @@ 34DDA17E1DBE5DF40088A609 /* Frameworks */ = { isa = PBXGroup; children = ( + F685EB621E955C45003CA3FF /* libicu.a */, F627BFC31E8E89B600B1CBF4 /* librouting_common.a */, 674231CA1DF984F600913FEB /* libtraffic.a */, 34DDA17F1DBE5DF40088A609 /* libpartners_api.a */, |