diff options
author | Arsentiy Milchakov <milcars@mapswithme.com> | 2018-03-01 16:06:16 +0300 |
---|---|---|
committer | Aleksandr Zatsepin <alexzatsepin@users.noreply.github.com> | 2018-03-05 12:02:52 +0300 |
commit | 953ff937f39d4a8f5c114545a4b7809690a0a5e2 (patch) | |
tree | ec9d6806e58c649032e71001f37d757b4ec8b431 /indexer | |
parent | 65c404f0dcd6716aedae8adf4dc18a799f103858 (diff) |
[editor] getting rid of osm::Editor::OriginalFeatureHasDeaultName method
Diffstat (limited to 'indexer')
-rw-r--r-- | indexer/indexer_tests/osm_editor_test.cpp | 46 | ||||
-rw-r--r-- | indexer/indexer_tests/osm_editor_test.hpp | 1 | ||||
-rw-r--r-- | indexer/osm_editor.cpp | 18 | ||||
-rw-r--r-- | indexer/osm_editor.hpp | 1 |
4 files changed, 0 insertions, 66 deletions
diff --git a/indexer/indexer_tests/osm_editor_test.cpp b/indexer/indexer_tests/osm_editor_test.cpp index dc0a7b8f19..c27e9bcac2 100644 --- a/indexer/indexer_tests/osm_editor_test.cpp +++ b/indexer/indexer_tests/osm_editor_test.cpp @@ -332,47 +332,6 @@ void EditorTest::GetEditedFeatureStreetTest() }); } -void EditorTest::OriginalFeatureHasDefaultNameTest() -{ - auto & editor = osm::Editor::Instance(); - - auto const mwmId = ConstructTestMwm([](TestMwmBuilder & builder) - { - TestCafe cafe(m2::PointD(1.0, 1.0), "London Cafe", "en"); - TestCafe unnamedCafe(m2::PointD(2.0, 2.0), "", "en"); - TestCafe secondUnnamedCafe(m2::PointD(3.0, 3.0), "", "en"); - - builder.Add(cafe); - builder.Add(unnamedCafe); - builder.Add(secondUnnamedCafe); - }); - - ForEachCafeAtPoint(m_index, m2::PointD(1.0, 1.0), [&editor](FeatureType & ft) - { - TEST(editor.OriginalFeatureHasDefaultName(ft.GetID()), ()); - }); - - ForEachCafeAtPoint(m_index, m2::PointD(2.0, 2.0), [&editor](FeatureType & ft) - { - TEST(!editor.OriginalFeatureHasDefaultName(ft.GetID()), ()); - }); - - ForEachCafeAtPoint(m_index, m2::PointD(3.0, 3.0), [&editor](FeatureType & ft) - { - osm::EditableMapObject emo; - FillEditableMapObject(editor, ft, emo); - - StringUtf8Multilang names; - names.AddString(StringUtf8Multilang::GetLangIndex("en"), "Eng name"); - names.AddString(StringUtf8Multilang::GetLangIndex("default"), "Default name"); - emo.SetName(names); - - TEST_EQUAL(editor.SaveEditedFeature(emo), osm::Editor::SaveResult::SavedSuccessfully, ()); - - TEST(!editor.OriginalFeatureHasDefaultName(ft.GetID()), ()); - }); -} - void EditorTest::GetFeatureStatusTest() { auto & editor = osm::Editor::Instance(); @@ -1073,11 +1032,6 @@ UNIT_CLASS_TEST(EditorTest, GetFeatureTypeInfoTest) EditorTest::GetFeatureTypeInfoTest(); } -UNIT_CLASS_TEST(EditorTest, OriginalFeatureHasDefaultNameTest) -{ - EditorTest::OriginalFeatureHasDefaultNameTest(); -} - UNIT_CLASS_TEST(EditorTest, SetIndexTest) { EditorTest::SetIndexTest(); diff --git a/indexer/indexer_tests/osm_editor_test.hpp b/indexer/indexer_tests/osm_editor_test.hpp index fe2b62e71d..39817ab431 100644 --- a/indexer/indexer_tests/osm_editor_test.hpp +++ b/indexer/indexer_tests/osm_editor_test.hpp @@ -25,7 +25,6 @@ public: void GetEditedFeatureTest(); void SetIndexTest(); void GetEditedFeatureStreetTest(); - void OriginalFeatureHasDefaultNameTest(); void GetFeatureStatusTest(); void IsFeatureUploadedTest(); void DeleteFeatureTest(); diff --git a/indexer/osm_editor.cpp b/indexer/osm_editor.cpp index 03cf10ffdb..cdf2f3312d 100644 --- a/indexer/osm_editor.cpp +++ b/indexer/osm_editor.cpp @@ -371,24 +371,6 @@ bool Editor::IsCreatedFeature(FeatureID const & fid) return feature::FakeFeatureIds::IsEditorCreatedFeature(fid.m_index); } -bool Editor::OriginalFeatureHasDefaultName(FeatureID const & fid) const -{ - if (IsCreatedFeature(fid)) - return false; - - auto const originalFeaturePtr = GetOriginalFeature(fid); - if (!originalFeaturePtr) - { - LOG(LERROR, ("A feature with id", fid, "cannot be loaded.")); - alohalytics::LogEvent("Editor_MissingFeature_Error"); - return false; - } - - auto const & names = originalFeaturePtr->GetNames(); - - return names.HasString(StringUtf8Multilang::kDefaultCode); -} - /// Several cases should be handled while saving changes: /// 1) a feature is not in editor's cache /// I. a feature was created diff --git a/indexer/osm_editor.hpp b/indexer/osm_editor.hpp index 9384a1fed3..ecd6ce3036 100644 --- a/indexer/osm_editor.hpp +++ b/indexer/osm_editor.hpp @@ -199,7 +199,6 @@ public: // not yet saved and we have to know if it was modified or created. static bool IsCreatedFeature(FeatureID const & fid); // Returns true if the original feature has default name. - bool OriginalFeatureHasDefaultName(FeatureID const & fid) const; private: // TODO(AlexZ): Synchronize Save call/make it on a separate thread. |