Files
comaps/search/search_tests_support/test_with_custom_mwms.hpp
Konstantin Pastbin e3e4a1985a Organic Maps sources as of 02.04.2025 (fad26bbf22ac3da75e01e62aa01e5c8e11861005)
To expand with full Organic Maps and Maps.ME commits history run:
  git remote add om-historic [om-historic.git repo url]
  git fetch --tags om-historic
  git replace squashed-history historic-commits
2025-05-08 21:10:51 +07:00

42 lines
1.0 KiB
C++

#pragma once
#include "editor/editable_data_source.hpp"
#include "editor/editor_tests_support/helpers.hpp"
#include "generator/generator_tests_support/test_with_custom_mwms.hpp"
#include "search/editor_delegate.hpp"
#include "indexer/feature.hpp"
#include "base/assert.hpp"
#include <memory>
#include <utility>
namespace search
{
namespace tests_support
{
class TestWithCustomMwms : public generator::tests_support::TestWithCustomMwms
{
public:
TestWithCustomMwms()
{
editor::tests_support::SetUpEditorForTesting(std::make_unique<EditorDelegate>(m_dataSource));
}
~TestWithCustomMwms() override { editor::tests_support::TearDownEditorForTesting(); }
template <typename EditorFn>
void EditFeature(FeatureID const & id, EditorFn && fn)
{
FeaturesLoaderGuard loader(m_dataSource, id.m_mwmId);
auto ft = loader.GetFeatureByIndex(id.m_index);
CHECK(ft, ());
editor::tests_support::EditFeature(*ft, std::forward<EditorFn>(fn));
}
};
} // namespace tests_support
} // namespace search