diff options
author | Yuri Gorshenin <y@maps.me> | 2015-02-04 11:24:30 +0300 |
---|---|---|
committer | Alex Zolotarev <alex@maps.me> | 2015-09-23 02:37:10 +0300 |
commit | 994873c081cf1a0e37f19d3544c2487f2ee13ab8 (patch) | |
tree | d81c7f5335c3f0f580b255afc065b1cd616c4135 /map/map_tests | |
parent | 7fd7b95f35f9720c8636b8959f056d6d2f6f9ec7 (diff) |
Fixed bookmarks order: least recently added bookmark is displayed first in the list.
Diffstat (limited to 'map/map_tests')
-rw-r--r-- | map/map_tests/bookmarks_test.cpp | 32 | ||||
-rw-r--r-- | map/map_tests/kmz_unarchive_test.cpp | 4 | ||||
-rw-r--r-- | map/map_tests/mwm_url_tests.cpp | 15 |
3 files changed, 27 insertions, 24 deletions
diff --git a/map/map_tests/bookmarks_test.cpp b/map/map_tests/bookmarks_test.cpp index a179ae4e2a..6b0b75f8e0 100644 --- a/map/map_tests/bookmarks_test.cpp +++ b/map/map_tests/bookmarks_test.cpp @@ -120,19 +120,19 @@ char const * kmlString = { TEST_EQUAL(cat.GetBookmarksCount(), 4, ()); - Bookmark const * bm = cat.GetBookmark(0); + Bookmark const * bm = cat.GetBookmark(3); TEST_EQUAL(bm->GetName(), "Nebraska", ()); TEST_EQUAL(bm->GetType(), "placemark-red", ()); TEST_EQUAL(bm->GetDescription(), "", ()); TEST_EQUAL(bm->GetTimeStamp(), my::INVALID_TIME_STAMP, ()); - bm = cat.GetBookmark(1); + bm = cat.GetBookmark(2); TEST_EQUAL(bm->GetName(), "Monongahela National Forest", ()); TEST_EQUAL(bm->GetType(), "placemark-pink", ()); TEST_EQUAL(bm->GetDescription(), "Huttonsville, WV 26273<br>", ()); TEST_EQUAL(bm->GetTimeStamp(), 524214643, ()); - bm = cat.GetBookmark(2); + bm = cat.GetBookmark(1); m2::PointD org = bm->GetOrg(); TEST_ALMOST_EQUAL(MercatorBounds::XToLon(org.x), 27.566765, ()); TEST_ALMOST_EQUAL(MercatorBounds::YToLat(org.y), 53.900047, ()); @@ -141,7 +141,7 @@ char const * kmlString = TEST_EQUAL(bm->GetDescription(), "", ()); TEST_EQUAL(bm->GetTimeStamp(), 888888888, ()); - bm = cat.GetBookmark(3); + bm = cat.GetBookmark(0); org = bm->GetOrg(); TEST_ALMOST_EQUAL(MercatorBounds::XToLon(org.x), 27.551532, ()); TEST_ALMOST_EQUAL(MercatorBounds::YToLat(org.y), 53.89306, ()); @@ -286,11 +286,11 @@ UNIT_TEST(Bookmarks_Timestamp) fm.AddCategory(arrCat[1]); fm.AddBookmark(1, orgPoint, b3); - TEST_EQUAL(fm.GetBmCategory(0)->GetBookmark(0)->GetName(), "name", ()); - TEST_EQUAL(fm.GetBmCategory(0)->GetBookmark(0)->GetType(), "type", ()); + TEST_EQUAL(fm.GetBmCategory(0)->GetBookmark(1)->GetName(), "name", ()); + TEST_EQUAL(fm.GetBmCategory(0)->GetBookmark(1)->GetType(), "type", ()); - TEST_EQUAL(fm.GetBmCategory(0)->GetBookmark(1)->GetName(), "newName", ()); - TEST_EQUAL(fm.GetBmCategory(0)->GetBookmark(1)->GetType(), "newType", ()); + TEST_EQUAL(fm.GetBmCategory(0)->GetBookmark(0)->GetName(), "newName", ()); + TEST_EQUAL(fm.GetBmCategory(0)->GetBookmark(0)->GetType(), "newType", ()); TEST_EQUAL(fm.GetBmCategory(1)->GetBookmark(0)->GetName(), "newName", ()); TEST_EQUAL(fm.GetBmCategory(1)->GetBookmark(0)->GetType(), "newType", ()); @@ -356,9 +356,11 @@ UNIT_TEST(Bookmarks_Getting) mark = GetBookmark(fm, m2::PointD(41, 40)); cat = GetCategory(mark); - //should find first valid result, there two results with the same coordinates 3 and 4 - TEST_EQUAL(mark->GetName(), "3", ()); - TEST_EQUAL(mark->GetType(), "placemark-red", ()); + + // Should find last added valid result, there two results with the + // same coordinates 3 and 4, but 4 was added later. + TEST_EQUAL(mark->GetName(), "4", ()); + TEST_EQUAL(mark->GetType(), "placemark-blue", ()); TEST_EQUAL(cat->GetBookmarksCount(), 2, ()); @@ -504,8 +506,8 @@ UNIT_TEST(Bookmarks_AddingMoving) mark = GetBookmarkPxPoint(fm, pixelPoint); cat = GetCategory(mark); TEST_EQUAL(cat->GetName(), arrCat[0], ()); - TEST_EQUAL(mark->GetName(), "name", ()); - TEST_EQUAL(mark->GetType(), "placemark-red", ()); + TEST_EQUAL(mark->GetName(), "name2", ()); + TEST_EQUAL(mark->GetType(), "placemark-blue", ()); // Edit name, type and category of bookmark bm = BookmarkData("name3", "placemark-green"); @@ -518,8 +520,8 @@ UNIT_TEST(Bookmarks_AddingMoving) TEST_EQUAL(cat->GetName(), arrCat[0], ()); TEST_EQUAL(fm.GetBmCategory(0)->GetBookmarksCount(), 2, ("Bookmark wasn't moved from one category to another")); - TEST_EQUAL(mark->GetName(), "name", ()); - TEST_EQUAL(mark->GetType(), "placemark-red", ()); + TEST_EQUAL(mark->GetName(), "name2", ()); + TEST_EQUAL(mark->GetType(), "placemark-blue", ()); DeleteCategoryFiles(arrCat); } diff --git a/map/map_tests/kmz_unarchive_test.cpp b/map/map_tests/kmz_unarchive_test.cpp index f3c5a0d408..879c7fb3f6 100644 --- a/map/map_tests/kmz_unarchive_test.cpp +++ b/map/map_tests/kmz_unarchive_test.cpp @@ -40,7 +40,7 @@ UNIT_TEST(Open_KMZ_Test) TEST_EQUAL(cat.GetBookmarksCount(), 6, ("Category wrong number of bookmarks")); { - Bookmark const * bm = cat.GetBookmark(0); + Bookmark const * bm = cat.GetBookmark(5); TEST_EQUAL(bm->GetName(), ("Lahaina Breakwall"), ("KML wrong name!")); TEST_EQUAL(bm->GetType(), "placemark-red", ("KML wrong type!")); TEST_ALMOST_EQUAL(bm->GetOrg().x, -156.6777046791284, ("KML wrong org x!")); @@ -48,7 +48,7 @@ UNIT_TEST(Open_KMZ_Test) TEST_EQUAL(bm->GetScale(), -1, ("KML wrong scale!")); } { - Bookmark const * bm = cat.GetBookmark(1); + Bookmark const * bm = cat.GetBookmark(4); TEST_EQUAL(bm->GetName(), ("Seven Sacred Pools, Kipahulu"), ("KML wrong name!")); TEST_EQUAL(bm->GetType(), "placemark-red", ("KML wrong type!")); TEST_ALMOST_EQUAL(bm->GetOrg().x, -156.0405130750025, ("KML wrong org x!")); diff --git a/map/map_tests/mwm_url_tests.cpp b/map/map_tests/mwm_url_tests.cpp index 260552328d..162ecd40a0 100644 --- a/map/map_tests/mwm_url_tests.cpp +++ b/map/map_tests/mwm_url_tests.cpp @@ -142,12 +142,12 @@ 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"); TEST(api.IsValid(), ()); TEST_EQUAL(api.GetPointCount(), 3, ()); - TEST(api.TestLatLon(0, 1.1, 1.2), ()); - TEST(api.TestName(0, "A"), ()); + TEST(api.TestLatLon(2, 1.1, 1.2), ()); + TEST(api.TestName(2, "A"), ()); TEST(api.TestLatLon(1, 2.1, 2.2), ()); TEST(api.TestName(1, ""), ()); - TEST(api.TestLatLon(2, -3.1, -3.2), ()); - TEST(api.TestName(2, "C"), ()); + TEST(api.TestLatLon(0, -3.1, -3.2), ()); + TEST(api.TestName(0, "C"), ()); } UNIT_TEST(MapApiInvalidPointLatLonButValidOtherParts) @@ -298,9 +298,10 @@ void generateRandomTest(size_t numberOfPoints, size_t stringLength) double lat = vect[i].m_lat; double lon = vect[i].m_lon; ToMercatoToLatLon(lat, lon); - TEST(api.TestLatLon(i, lat, lon), ()); - TEST(api.TestName(i, vect[i].m_name), ()); - TEST(api.TestID(i, vect[i].m_id), ()); + size_t const ix = vect.size() - i - 1; + TEST(api.TestLatLon(ix, lat, lon), ()); + TEST(api.TestName(ix, vect[i].m_name), ()); + TEST(api.TestID(ix, vect[i].m_id), ()); } TEST_EQUAL(api.GetApiVersion(), 1, ()); } |