[new downloader] Fixing routing tests. Compatability local_country_files with two components mwms.

This commit is contained in:
Vladimir Byko-Ianko 2016-02-03 10:44:23 +03:00 committed by Sergey Yershov
parent 73e84d9c8b
commit aaf72a9864
3 changed files with 15 additions and 3 deletions

View file

@ -33,12 +33,14 @@ void LocalCountryFile::SyncWithDisk()
m_files = MapOptions::Nothing;
m_mapSize = 0;
m_routingSize = 0;
Platform & platform = GetPlatform();
if (platform.GetFileSizeByFullPath(GetPath(MapOptions::Map), m_mapSize))
m_files = SetOptions(m_files, MapOptions::Map);
if (version::IsSingleMwm(GetVersion()))
return;
string const routingPath = GetPath(MapOptions::CarRouting);
if (platform.GetFileSizeByFullPath(routingPath, m_routingSize))
m_files = SetOptions(m_files, MapOptions::CarRouting);
@ -69,8 +71,9 @@ uint32_t LocalCountryFile::GetSize(MapOptions filesMask) const
uint64_t size64 = 0;
if (HasOptions(filesMask, MapOptions::Map))
size64 += m_mapSize;
if (HasOptions(filesMask, MapOptions::CarRouting))
if (!version::IsSingleMwm(GetVersion()) && HasOptions(filesMask, MapOptions::CarRouting))
size64 += m_routingSize;
uint32_t const size32 = static_cast<uint32_t>(size64);
ASSERT_EQUAL(size32, size64, ());
return size32;

View file

@ -62,6 +62,15 @@ RoutingMapping::RoutingMapping(string const & countryFile, MwmSet & index)
return;
LocalCountryFile const & localFile = m_handle.GetInfo()->GetLocalFile();
if (version::IsSingleMwm(localFile.GetVersion()))
{
m_container.Open(localFile.GetPath(MapOptions::Map));
m_mwmId = m_handle.GetId();
m_error = IRouter::ResultCode::NoError;
return;
}
if (!HasOptions(localFile.GetFiles(), MapOptions::MapWithCarRouting))
{
m_error = IRouter::ResultCode::RouteFileNotExist;

View file

@ -36,7 +36,7 @@ public:
m_localFile(GetPlatform().WritableDir(), m_countryFile, 0 /* version */)
{
m_localFile.SyncWithDisk();
TEST(m_localFile.OnDisk(MapOptions::MapWithCarRouting), ());
TEST(m_localFile.OnDisk(MapOptions::Map), ());
GenerateNecessarySections(m_localFile);
m_result = m_testSet.Register(m_localFile);