diff options
author | Maxim Pimenov <m@maps.me> | 2016-09-20 20:24:53 +0300 |
---|---|---|
committer | Maxim Pimenov <m@maps.me> | 2016-09-26 13:20:19 +0300 |
commit | f3be6799ba37fa766dfdd5ec263603ba3cd45006 (patch) | |
tree | ffb025f27cdfe2e2a6fcee34ec67ffde3c9a0bc7 /generator | |
parent | 48bfcabc59ae2f4e68baaeb97add7f4b789d6342 (diff) |
Added a test.
Diffstat (limited to 'generator')
-rw-r--r-- | generator/generator_tests_support/test_feature.cpp | 23 | ||||
-rw-r--r-- | generator/generator_tests_support/test_feature.hpp | 11 |
2 files changed, 34 insertions, 0 deletions
diff --git a/generator/generator_tests_support/test_feature.cpp b/generator/generator_tests_support/test_feature.cpp index ea8f24329f..eaaebc0d46 100644 --- a/generator/generator_tests_support/test_feature.cpp +++ b/generator/generator_tests_support/test_feature.cpp @@ -3,10 +3,14 @@ #include "generator/feature_builder.hpp" #include "indexer/classificator.hpp" +#include "indexer/editable_map_object.hpp" #include "indexer/feature.hpp" #include "indexer/feature_algo.hpp" +#include "indexer/feature_decl.hpp" #include "indexer/feature_meta.hpp" #include "indexer/ftypes_matcher.hpp" +#include "indexer/mwm_set.hpp" +#include "indexer/osm_editor.hpp" #include "coding/multilang_utf8_string.hpp" @@ -162,6 +166,25 @@ TestPOI::TestPOI(m2::PointD const & center, string const & name, string const & m_types = {{"railway", "station"}}; } +// static +TestPOI TestPOI::AddWithEditor(osm::Editor & editor, MwmSet::MwmId const & mwmId, + string const & name, m2::PointD const & pt, FeatureID & tmp) +{ + TestPOI poi(pt, name, "en"); + + osm::EditableMapObject emo; + editor.CreatePoint(classif().GetTypeByPath({"shop", "bakery"}), pt, mwmId, emo); + + StringUtf8Multilang names; + names.AddString(StringUtf8Multilang::GetLangIndex("en"), name); + emo.SetName(names); + emo.SetTestId(poi.GetId()); + + editor.SaveEditedFeature(emo); + tmp = emo.GetID(); + return poi; +} + void TestPOI::Serialize(FeatureBuilder1 & fb) const { TestFeature::Serialize(fb); diff --git a/generator/generator_tests_support/test_feature.hpp b/generator/generator_tests_support/test_feature.hpp index fb345505ed..b617c2e796 100644 --- a/generator/generator_tests_support/test_feature.hpp +++ b/generator/generator_tests_support/test_feature.hpp @@ -1,5 +1,8 @@ #pragma once +#include "indexer/feature_decl.hpp" +#include "indexer/mwm_set.hpp" + #include "geometry/point2d.hpp" #include "std/string.hpp" @@ -8,6 +11,11 @@ class FeatureBuilder1; class FeatureType; +namespace osm +{ +class Editor; +} // namespace osm + namespace generator { namespace tests_support @@ -91,6 +99,9 @@ class TestPOI : public TestFeature public: TestPOI(m2::PointD const & center, string const & name, string const & lang); + static TestPOI AddWithEditor(osm::Editor & editor, MwmSet::MwmId const & mwmId, + string const & name, m2::PointD const & pt, FeatureID & tmp); + // TestFeature overrides: void Serialize(FeatureBuilder1 & fb) const override; string ToString() const override; |