Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYuri Gorshenin <y@maps.me>2016-08-22 13:47:56 +0300
committerYuri Gorshenin <y@maps.me>2016-08-26 16:21:13 +0300
commitafc3d20264e8fcd99dc3cd465ce1770d0b3246d0 (patch)
tree67d2bcd855340555d742181e467cc987bd70a332 /indexer/indexer_tests_support
parent336c137d59c12d0de9fd292bcf3db9b453670567 (diff)
[search] Added matching of edited features by type.
Diffstat (limited to 'indexer/indexer_tests_support')
-rw-r--r--indexer/indexer_tests_support/helpers.cpp19
-rw-r--r--indexer/indexer_tests_support/helpers.hpp30
-rw-r--r--indexer/indexer_tests_support/indexer_tests_support.pro13
3 files changed, 62 insertions, 0 deletions
diff --git a/indexer/indexer_tests_support/helpers.cpp b/indexer/indexer_tests_support/helpers.cpp
new file mode 100644
index 0000000000..05392903de
--- /dev/null
+++ b/indexer/indexer_tests_support/helpers.cpp
@@ -0,0 +1,19 @@
+#include "indexer/indexer_tests_support/helpers.hpp"
+
+#include "editor/editor_storage.hpp"
+
+#include "std/unique_ptr.hpp"
+
+namespace indexer
+{
+namespace tests_support
+{
+void SetUpEditorForTesting(Index & index)
+{
+ auto & editor = osm::Editor::Instance();
+ editor.SetIndex(index);
+ editor.SetStorageForTesting(make_unique<editor::InMemoryStorage>());
+ editor.ClearAllLocalEdits();
+}
+} // namespace tests_support
+} // namespace indexer
diff --git a/indexer/indexer_tests_support/helpers.hpp b/indexer/indexer_tests_support/helpers.hpp
new file mode 100644
index 0000000000..fd3018ffcf
--- /dev/null
+++ b/indexer/indexer_tests_support/helpers.hpp
@@ -0,0 +1,30 @@
+#pragma once
+
+#include "indexer/editable_map_object.hpp"
+#include "indexer/osm_editor.hpp"
+
+#include "base/assert.hpp"
+
+class Index;
+
+namespace indexer
+{
+namespace tests_support
+{
+void SetUpEditorForTesting(Index & index);
+
+template <typename TFn>
+void EditFeature(FeatureType const & ft, TFn && fn)
+{
+ auto & editor = osm::Editor::Instance();
+
+ osm::EditableMapObject emo;
+ emo.SetFromFeatureType(ft);
+ emo.SetEditableProperties(editor.GetEditableProperties(ft));
+
+ fn(emo);
+
+ CHECK_EQUAL(editor.SaveEditedFeature(emo), osm::Editor::SaveResult::SavedSuccessfully, ());
+}
+} // namespace tests_support
+} // namespace indexer
diff --git a/indexer/indexer_tests_support/indexer_tests_support.pro b/indexer/indexer_tests_support/indexer_tests_support.pro
new file mode 100644
index 0000000000..9f7d6ee79e
--- /dev/null
+++ b/indexer/indexer_tests_support/indexer_tests_support.pro
@@ -0,0 +1,13 @@
+TARGET = indexer_tests_support
+TEMPLATE = lib
+CONFIG += staticlib warn_on
+
+ROOT_DIR = ../..
+
+include($$ROOT_DIR/common.pri)
+
+SOURCES += \
+ helpers.cpp \
+
+HEADERS += \
+ helpers.hpp \