From 385916562244a04af73b893a0d598b34cc0369bb Mon Sep 17 00:00:00 2001 From: Constantin Shalnev Date: Mon, 25 Jan 2016 15:05:04 +0300 Subject: [PATCH] [old-map-downloader] Fixed platform test: LocalCountryFile_DiskFiles --- .../local_country_file_tests.cpp | 49 ++++++++++++------- 1 file changed, 32 insertions(+), 17 deletions(-) diff --git a/platform/platform_tests/local_country_file_tests.cpp b/platform/platform_tests/local_country_file_tests.cpp index e0689f7ee5..939f7c35e8 100644 --- a/platform/platform_tests/local_country_file_tests.cpp +++ b/platform/platform_tests/local_country_file_tests.cpp @@ -3,6 +3,7 @@ #include "platform/country_file.hpp" #include "platform/local_country_file.hpp" #include "platform/local_country_file_utils.hpp" +#include "platform/mwm_version.hpp" #include "platform/platform.hpp" #include "platform/platform_tests_support/scoped_dir.hpp" #include "platform/platform_tests_support/scoped_file.hpp" @@ -109,27 +110,41 @@ UNIT_TEST(LocalCountryFile_DiskFiles) ScopedFile testMapFile(countryFile.GetNameWithExt(MapOptions::Map), "map"); localFile.SyncWithDisk(); - TEST(localFile.OnDisk(MapOptions::Map), ()); - TEST(!localFile.OnDisk(MapOptions::CarRouting), ()); - TEST(!localFile.OnDisk(MapOptions::MapWithCarRouting), ()); - TEST_EQUAL(3, localFile.GetSize(MapOptions::Map), ()); + if (version::IsSingleMwm(localFile.GetVersion())) + { + TEST(localFile.OnDisk(MapOptions::Map), ()); + TEST(localFile.OnDisk(MapOptions::CarRouting), ()); + TEST(localFile.OnDisk(MapOptions::MapWithCarRouting), ()); + TEST_EQUAL(3, localFile.GetSize(MapOptions::Map), ()); - ScopedFile testRoutingFile(countryFile.GetNameWithExt(MapOptions::CarRouting), "routing"); + localFile.DeleteFromDisk(MapOptions::MapWithCarRouting); + TEST(!testMapFile.Exists(), (testMapFile, "wasn't deleted by LocalCountryFile.")); + testMapFile.Reset(); + } + else + { + TEST(localFile.OnDisk(MapOptions::Map), ()); + TEST(!localFile.OnDisk(MapOptions::CarRouting), ()); + TEST(!localFile.OnDisk(MapOptions::MapWithCarRouting), ()); + TEST_EQUAL(3, localFile.GetSize(MapOptions::Map), ()); - localFile.SyncWithDisk(); - TEST(localFile.OnDisk(MapOptions::Map), ()); - TEST(localFile.OnDisk(MapOptions::CarRouting), ()); - TEST(localFile.OnDisk(MapOptions::MapWithCarRouting), ()); - TEST_EQUAL(3, localFile.GetSize(MapOptions::Map), ()); - TEST_EQUAL(7, localFile.GetSize(MapOptions::CarRouting), ()); - TEST_EQUAL(10, localFile.GetSize(MapOptions::MapWithCarRouting), ()); + ScopedFile testRoutingFile(countryFile.GetNameWithExt(MapOptions::CarRouting), "routing"); - localFile.DeleteFromDisk(MapOptions::MapWithCarRouting); - TEST(!testMapFile.Exists(), (testMapFile, "wasn't deleted by LocalCountryFile.")); - testMapFile.Reset(); + localFile.SyncWithDisk(); + TEST(localFile.OnDisk(MapOptions::Map), ()); + TEST(localFile.OnDisk(MapOptions::CarRouting), ()); + TEST(localFile.OnDisk(MapOptions::MapWithCarRouting), ()); + TEST_EQUAL(3, localFile.GetSize(MapOptions::Map), ()); + TEST_EQUAL(7, localFile.GetSize(MapOptions::CarRouting), ()); + TEST_EQUAL(10, localFile.GetSize(MapOptions::MapWithCarRouting), ()); - TEST(!testRoutingFile.Exists(), (testRoutingFile, "wasn't deleted by LocalCountryFile.")); - testRoutingFile.Reset(); + localFile.DeleteFromDisk(MapOptions::MapWithCarRouting); + TEST(!testMapFile.Exists(), (testMapFile, "wasn't deleted by LocalCountryFile.")); + testMapFile.Reset(); + + TEST(!testRoutingFile.Exists(), (testRoutingFile, "wasn't deleted by LocalCountryFile.")); + testRoutingFile.Reset(); + } } UNIT_TEST(LocalCountryFile_CleanupMapFiles)