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:
authorSergey Yershov <yershov@corp.mail.ru>2016-01-23 17:20:47 +0300
committerSergey Yershov <yershov@corp.mail.ru>2016-03-23 16:15:17 +0300
commit12b2911271ad1ac4346ad707a51b9093bee4bbc3 (patch)
tree7065b7b15d0bbdaef3e26141295a8cf0d06b8021 /storage
parent60b16b8067c926c30ad81c50ee8ba20ff5ebdb2a (diff)
[Old map downloader] Migration tests
Diffstat (limited to 'storage')
-rw-r--r--storage/storage_tests/migrate_tests.cpp84
-rw-r--r--storage/storage_tests/storage_tests.cpp5
-rw-r--r--storage/storage_tests/storage_tests.pro8
3 files changed, 95 insertions, 2 deletions
diff --git a/storage/storage_tests/migrate_tests.cpp b/storage/storage_tests/migrate_tests.cpp
new file mode 100644
index 0000000000..8a234aa895
--- /dev/null
+++ b/storage/storage_tests/migrate_tests.cpp
@@ -0,0 +1,84 @@
+#include "testing/testing.hpp"
+
+#include "map/framework.hpp"
+
+#include <QtCore/QCoreApplication>
+
+using namespace platform;
+
+UNIT_TEST(StorageTest_FastMigrate)
+{
+ // Set clear state
+ {
+ Settings::Clear();
+ Framework f;
+ auto & s = f.Storage();
+ s.DeleteAllLocalMaps();
+ Settings::Clear();
+ }
+
+ Framework f;
+ auto & s = f.Storage();
+
+ uint32_t version;
+ Settings::Get("LastMigration", version);
+
+ TEST_GREATER_OR_EQUAL(s.GetCurrentDataVersion(), version, ());
+ Settings::Clear();
+}
+
+UNIT_TEST(StorageTests_Migrate)
+{
+ Settings::Clear();
+ Settings::Set("DisableFastMigrate", true);
+
+ Framework f;
+ auto & s = f.Storage();
+ s.DeleteAllLocalMaps();
+
+ vector<storage::TIndex> const kOldCountries = { s.FindIndexByFile("Estonia")};
+
+ auto stateChanged = [&](storage::TIndex const & id)
+ {
+ if (!f.Storage().IsDownloadInProgress())
+ {
+ LOG_SHORT(LINFO, ("All downloaded. Check consistency."));
+ QCoreApplication::exit();
+ }
+ };
+
+ auto progressChanged = [&](storage::TIndex const & id, storage::LocalAndRemoteSizeT const & sz)
+ {
+ LOG_SHORT(LINFO, (f.GetCountryName(id), "downloading progress:", sz));
+ };
+
+ s.Subscribe(stateChanged, progressChanged);
+
+ for (auto const & countryId : kOldCountries)
+// s.DownloadCountry(countryId, MapOptions::MapWithCarRouting);
+ f.GetCountryTree().GetActiveMapLayout().DownloadMap(countryId, MapOptions::MapWithCarRouting);
+
+ // Wait for downloading complete.
+ QCoreApplication::exec();
+
+ TEST_EQUAL(s.GetDownloadedFilesCount(), kOldCountries.size(), ());
+ for (auto const & countryId : kOldCountries)
+ TEST_EQUAL(storage::TStatus::EOnDisk, s.CountryStatusEx(countryId), (countryId));
+
+ f.Migrate();
+
+ vector<storage::TIndex> const kNewCountries = {s.FindIndexByFile("Estonia_East"), s.FindIndexByFile("Estonia_West")};
+
+ for (auto const & countryId : kNewCountries)
+ f.GetCountryTree().GetActiveMapLayout().DownloadMap(countryId, MapOptions::Map);
+
+ // Wait for downloading complete.
+ QCoreApplication::exec();
+
+ TEST_EQUAL(s.GetDownloadedFilesCount(), kNewCountries.size(), ());
+ for (auto const & countryId : kNewCountries)
+ TEST_EQUAL(storage::TStatus::EOnDisk, s.CountryStatusEx(countryId), (countryId));
+
+ s.DeleteAllLocalMaps();
+ Settings::Clear();
+}
diff --git a/storage/storage_tests/storage_tests.cpp b/storage/storage_tests/storage_tests.cpp
index 53917198f7..f3afe0ca1f 100644
--- a/storage/storage_tests/storage_tests.cpp
+++ b/storage/storage_tests/storage_tests.cpp
@@ -399,6 +399,7 @@ UNIT_TEST(StorageTest_TwoCountriesDownloading)
uruguayChecker->StartDownload();
venezuelaChecker->StartDownload();
runner.Run();
+ cout << "sdfsdf";
}
UNIT_TEST(StorageTest_DeleteTwoVersionsOfTheSameCountry)
@@ -444,6 +445,10 @@ UNIT_TEST(StorageTest_DeleteTwoVersionsOfTheSameCountry)
UNIT_TEST(StorageTest_DownloadCountryAndDeleteRoutingOnly)
{
Storage storage;
+
+ if (version::IsSingleMwm(storage.GetCurrentDataVersion()))
+ return;
+
TaskRunner runner;
InitStorage(storage, runner);
diff --git a/storage/storage_tests/storage_tests.pro b/storage/storage_tests/storage_tests.pro
index cf06b52f20..d322e0b4b8 100644
--- a/storage/storage_tests/storage_tests.pro
+++ b/storage/storage_tests/storage_tests.pro
@@ -6,7 +6,10 @@ CONFIG -= app_bundle
TEMPLATE = app
ROOT_DIR = ../..
-DEPENDENCIES = storage indexer platform_tests_support platform geometry coding base jansson tomcrypt stats_client succinct
+#DEPENDENCIES = storage indexer platform_tests_support platform geometry coding base jansson tomcrypt stats_client succinct
+DEPENDENCIES = map drape_frontend routing search storage indexer drape platform_tests_support platform editor opening_hours geometry \
+ coding base freetype expat fribidi tomcrypt jansson protobuf osrm stats_client \
+ minizip succinct pugixml oauthcpp
include($$ROOT_DIR/common.pri)
@@ -16,7 +19,7 @@ QT *= core
macx-* {
QT *= gui widgets # needed for QApplication with event loop, to test async events (downloader, etc.)
- LIBS *= "-framework IOKit" "-framework QuartzCore"
+ LIBS *= "-framework IOKit" "-framework QuartzCore" "-framework SystemConfiguration"
}
win32*|linux* {
QT *= network
@@ -36,3 +39,4 @@ SOURCES += \
storage_tests.cpp \
task_runner.cpp \
test_map_files_downloader.cpp \
+ migrate_tests.cpp \