forked from organicmaps/organicmaps
Review fixes.
This commit is contained in:
parent
e8a77fb0fb
commit
68b48c5c26
5 changed files with 19 additions and 4 deletions
|
@ -27,7 +27,7 @@ int8_t const CategoriesHolder::kUnsupportedLocaleCode = -1;
|
|||
// translation to categories.txt. When editing, keep in mind to check
|
||||
// CategoriesHolder::MapLocaleToInteger() and
|
||||
// CategoriesHolder::MapIntegerToLocale() as their implementations
|
||||
// highly depend on the contents of the variable.
|
||||
// strongly depend on the contents of the variable.
|
||||
vector<CategoriesHolder::Mapping> const CategoriesHolder::kLocaleMapping = {{"en", 1},
|
||||
{"ru", 2},
|
||||
{"uk", 3},
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
#include "std/shared_ptr.hpp"
|
||||
#include "std/string.hpp"
|
||||
#include "std/unique_ptr.hpp"
|
||||
#include "std/unordered_map.hpp"
|
||||
#include "std/vector.hpp"
|
||||
|
||||
|
||||
|
@ -129,7 +130,7 @@ public:
|
|||
}
|
||||
|
||||
// Converts any language |locale| from UI to the corresponding
|
||||
// internal integer code
|
||||
// internal integer code.
|
||||
static int8_t MapLocaleToInteger(string const & locale);
|
||||
|
||||
// Returns corresponding string representation for an internal
|
||||
|
|
|
@ -107,6 +107,18 @@ UNIT_TEST(LoadCategories)
|
|||
TEST_EQUAL(count, 3, ());
|
||||
}
|
||||
|
||||
UNIT_TEST(CategoriesHolder_Smoke)
|
||||
{
|
||||
auto const & mappings = CategoriesHolder::kLocaleMapping;
|
||||
for (size_t i = 0; i < mappings.size(); ++i)
|
||||
{
|
||||
auto const & mapping = mappings[i];
|
||||
TEST_EQUAL(i + 1, mapping.m_code, ());
|
||||
TEST_EQUAL(i + 1, CategoriesHolder::MapLocaleToInteger(mapping.m_name), ());
|
||||
TEST_EQUAL(CategoriesHolder::MapIntegerToLocale(i + 1), mapping.m_name, ());
|
||||
}
|
||||
}
|
||||
|
||||
UNIT_TEST(CategoriesIndex_Smoke)
|
||||
{
|
||||
classificator::Load();
|
||||
|
|
|
@ -120,8 +120,8 @@ protected:
|
|||
|
||||
model::FeaturesFetcher m_model;
|
||||
|
||||
// The order matters here: DisplayedCategories may be used only when
|
||||
// classificator is loaded (by |m_model|).
|
||||
// The order matters here: DisplayedCategories may be used only
|
||||
// after classificator is loaded by |m_model|.
|
||||
unique_ptr<search::DisplayedCategories> m_displayedCategories;
|
||||
|
||||
// The order matters here: storage::CountryInfoGetter and
|
||||
|
|
|
@ -18,6 +18,8 @@ public:
|
|||
// of resources ids.
|
||||
static vector<string> const & GetKeys();
|
||||
|
||||
// Calls |fn| on each pair (synonym name, synonym locale) for the
|
||||
// |key|.
|
||||
template <typename Fn>
|
||||
void ForEachSynonym(string const & key, Fn && fn) const
|
||||
{
|
||||
|
|
Loading…
Add table
Reference in a new issue