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:
authorvng <viktor.govako@gmail.com>2015-08-17 19:44:21 +0300
committerAlex Zolotarev <alex@maps.me>2015-09-23 03:01:28 +0300
commit57921f1e7c4f2932b41d423f381bf630ff705b34 (patch)
tree4ef0c07bbaef00659556f52d84085f7e02caff46 /map/map_tests
parent57348dfe53cf966399b48070bf0b73865341583f (diff)
[bookmarks] Fixed some tests.
Diffstat (limited to 'map/map_tests')
-rw-r--r--map/map_tests/bookmarks_test.cpp34
1 files changed, 12 insertions, 22 deletions
diff --git a/map/map_tests/bookmarks_test.cpp b/map/map_tests/bookmarks_test.cpp
index f8f40ec2a3..36673b2670 100644
--- a/map/map_tests/bookmarks_test.cpp
+++ b/map/map_tests/bookmarks_test.cpp
@@ -195,7 +195,7 @@ UNIT_TEST(Bookmarks_ExportKML)
unique_ptr<BookmarkCategory> cat2(BookmarkCategory::CreateFromKMLFile(BOOKMARKS_FILE_NAME, framework));
CheckBookmarks(*cat2);
- cat2->SaveToKMLFile();
+ TEST(cat2->SaveToKMLFile(), ());
// old file should be deleted if we save bookmarks with new category name
uint64_t dummy;
TEST(!my::GetFileSize(BOOKMARKS_FILE_NAME, dummy), ());
@@ -266,27 +266,20 @@ UNIT_TEST(Bookmarks_Timestamp)
char const * arrCat[] = { "cat", "cat1" };
BookmarkData b1("name", "type");
- fm.AddCategory(arrCat[0]);
- fm.AddBookmark(0, orgPoint, b1);
+ TEST_EQUAL(fm.AddCategory(arrCat[0]), 0, ());
+ TEST_EQUAL(fm.AddBookmark(0, orgPoint, b1), 0, ());
Bookmark const * pBm = GetBookmark(fm, orgPoint);
- time_t const timeStamp = pBm->GetTimeStamp();
- TEST_NOT_EQUAL(timeStamp, my::INVALID_TIME_STAMP, ());
+ TEST_NOT_EQUAL(pBm->GetTimeStamp(), my::INVALID_TIME_STAMP, ());
BookmarkData b3("newName", "newType");
- b3.SetTimeStamp(12345);
- TEST_NOT_EQUAL(b3.GetTimeStamp(), timeStamp, ());
-
- fm.AddBookmark(0, orgPoint, b3);
-
- pBm = GetBookmark(fm, orgPoint);
- TEST_EQUAL(pBm->GetTimeStamp(), timeStamp, ());
-
- b3.SetTimeStamp(12345);
- TEST_NOT_EQUAL(b3.GetTimeStamp(), timeStamp, ());
+ TEST_EQUAL(fm.AddBookmark(0, orgPoint, b3), 0, ());
fm.AddCategory(arrCat[1]);
- fm.AddBookmark(1, orgPoint, b3);
+ TEST_EQUAL(fm.AddBookmark(1, orgPoint, b3), 0, ());
+
+ // Check bookmarks order here. First added should be in the bottom of the list.
+ TEST_EQUAL(fm.GetBmCategory(0)->GetBookmark(1), pBm, ());
TEST_EQUAL(fm.GetBmCategory(0)->GetBookmark(1)->GetName(), "name", ());
TEST_EQUAL(fm.GetBmCategory(0)->GetBookmark(1)->GetType(), "type", ());
@@ -300,9 +293,6 @@ UNIT_TEST(Bookmarks_Timestamp)
TEST_EQUAL(fm.GetBmCategory(0)->GetBookmarksCount(), 2, ());
TEST_EQUAL(fm.GetBmCategory(1)->GetBookmarksCount(), 1, ());
- pBm = GetBookmark(fm, orgPoint);
- TEST_EQUAL(pBm->GetTimeStamp(), timeStamp, ());
-
DeleteCategoryFiles(arrCat);
}
@@ -569,11 +559,11 @@ UNIT_TEST(BookmarkCategory_EmptyName)
{
Framework framework;
unique_ptr<BookmarkCategory> pCat(new BookmarkCategory("", framework));
- pCat->AddBookmark(m2::PointD(0, 0), BookmarkData("", "placemark-red"));
- pCat->SaveToKMLFile();
+ TEST(pCat->AddBookmark(m2::PointD(0, 0), BookmarkData("", "placemark-red")), ());
+ TEST(pCat->SaveToKMLFile(), ());
pCat->SetName("xxx");
- pCat->SaveToKMLFile();
+ TEST(pCat->SaveToKMLFile(), ());
char const * arrFiles[] = { "Bookmarks", "xxx" };
DeleteCategoryFiles(arrFiles);