forked from organicmaps/organicmaps
[new downloader] Storage tests fixes.
This commit is contained in:
parent
cc7f7f9396
commit
169964845f
3 changed files with 50 additions and 8 deletions
|
@ -393,7 +393,8 @@ public:
|
|||
}
|
||||
|
||||
private:
|
||||
friend void UnitTest_StorageTest_DeleteCountry();
|
||||
friend void UnitTest_StorageTest_DeleteCountrySingleMwm();
|
||||
friend void UnitTest_StorageTest_DeleteCountryTwoComponentsMwm();
|
||||
|
||||
TStatus CountryStatusWithoutFailed(TCountryId const & countryId) const;
|
||||
TStatus CountryStatusFull(TCountryId const & countryId, TStatus const status) const;
|
||||
|
|
|
@ -2,9 +2,11 @@
|
|||
|
||||
#include "storage/country_info_getter.hpp"
|
||||
#include "storage/country.hpp"
|
||||
#include "storage/storage.hpp"
|
||||
|
||||
#include "geometry/mercator.hpp"
|
||||
|
||||
#include "platform/mwm_version.hpp"
|
||||
#include "platform/platform.hpp"
|
||||
|
||||
#include "base/logging.hpp"
|
||||
|
@ -57,11 +59,18 @@ UNIT_TEST(CountryInfoGetter_ValidName_Smoke)
|
|||
bool isSingleMwm;
|
||||
storage::LoadCountryFile2CountryInfo(buffer, id2info, isSingleMwm);
|
||||
|
||||
TEST(!IsEmptyName(id2info, "Germany_Baden-Wurttemberg"), ());
|
||||
TEST(!IsEmptyName(id2info, "France_Paris & Ile-de-France"), ());
|
||||
Storage storage;
|
||||
|
||||
TEST(IsEmptyName(id2info, "Russia_Far Eastern"), ());
|
||||
TEST(IsEmptyName(id2info, "UK_Northern Ireland"), ());
|
||||
if (version::IsSingleMwm(storage.GetCurrentDataVersion()))
|
||||
{
|
||||
TEST(!IsEmptyName(id2info, "Belgium_West Flanders"), ());
|
||||
TEST(!IsEmptyName(id2info, "France_Ile-de-France_Paris"), ());
|
||||
}
|
||||
else
|
||||
{
|
||||
TEST(!IsEmptyName(id2info, "Germany_Baden-Wurttemberg"), ());
|
||||
TEST(!IsEmptyName(id2info, "France_Paris & Ile-de-France"), ());
|
||||
}
|
||||
}
|
||||
|
||||
UNIT_TEST(CountryInfoGetter_SomeRects)
|
||||
|
|
|
@ -773,7 +773,7 @@ UNIT_TEST(StorageTest_DownloadTwoCountriesAndDeleteTwoComponentMwm)
|
|||
|
||||
UNIT_TEST(StorageTest_CancelDownloadingWhenAlmostDone)
|
||||
{
|
||||
Storage storage;
|
||||
Storage storage(COUNTRIES_FILE, "map-tests");
|
||||
TaskRunner runner;
|
||||
InitStorage(storage, runner);
|
||||
|
||||
|
@ -792,14 +792,45 @@ UNIT_TEST(StorageTest_CancelDownloadingWhenAlmostDone)
|
|||
TEST(!file, (*file));
|
||||
}
|
||||
|
||||
UNIT_TEST(StorageTest_DeleteCountry)
|
||||
UNIT_TEST(StorageTest_DeleteCountrySingleMwm)
|
||||
{
|
||||
Storage storage(COUNTRIES_MIGRATE_FILE, "map-tests");
|
||||
TaskRunner runner;
|
||||
InitStorage(storage, runner);
|
||||
|
||||
tests_support::ScopedFile map("Wonderland.mwm", "map");
|
||||
LocalCountryFile file = LocalCountryFile::MakeForTesting("Wonderland",
|
||||
version::FOR_TESTING_SINGLE_MWM1);
|
||||
TEST_EQUAL(MapOptions::MapWithCarRouting, file.GetFiles(), ());
|
||||
|
||||
CountryIndexes::PreparePlaceOnDisk(file);
|
||||
string const bitsPath = CountryIndexes::GetPath(file, CountryIndexes::Index::Bits);
|
||||
{
|
||||
FileWriter writer(bitsPath);
|
||||
string const data = "bits";
|
||||
writer.Write(data.data(), data.size());
|
||||
}
|
||||
|
||||
storage.RegisterFakeCountryFiles(file);
|
||||
TEST(map.Exists(), ());
|
||||
TEST(Platform::IsFileExistsByFullPath(bitsPath), (bitsPath));
|
||||
|
||||
storage.DeleteCustomCountryVersion(file);
|
||||
TEST(!map.Exists(), ())
|
||||
TEST(!Platform::IsFileExistsByFullPath(bitsPath), (bitsPath));
|
||||
|
||||
map.Reset();
|
||||
}
|
||||
|
||||
UNIT_TEST(StorageTest_DeleteCountryTwoComponentsMwm)
|
||||
{
|
||||
Storage storage;
|
||||
TaskRunner runner;
|
||||
InitStorage(storage, runner);
|
||||
|
||||
tests_support::ScopedFile map("Wonderland.mwm", "map");
|
||||
LocalCountryFile file = LocalCountryFile::MakeForTesting("Wonderland");
|
||||
LocalCountryFile file = LocalCountryFile::MakeForTesting("Wonderland",
|
||||
version::FOR_TESTING_TWO_COMPONENT_MWM1);
|
||||
TEST_EQUAL(MapOptions::Map, file.GetFiles(), ());
|
||||
|
||||
CountryIndexes::PreparePlaceOnDisk(file);
|
||||
|
@ -821,6 +852,7 @@ UNIT_TEST(StorageTest_DeleteCountry)
|
|||
map.Reset();
|
||||
}
|
||||
|
||||
|
||||
UNIT_TEST(StorageTest_FailedDownloading)
|
||||
{
|
||||
Storage storage;
|
||||
|
|
Loading…
Add table
Reference in a new issue