MCPcopy Create free account
hub / github.com/comaps/comaps / GetFeatureStatusTest

Method GetFeatureStatusTest

libs/editor/editor_tests/osm_editor_test.cpp:369–407  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

367}
368
369void EditorTest::GetFeatureStatusTest()
370{
371 auto & editor = osm::Editor::Instance();
372
373 auto const mwmId = ConstructTestMwm([](TestMwmBuilder & builder)
374 {
375 TestCafe cafe(m2::PointD(1.0, 1.0), "London Cafe", "en");
376 TestCafe unnamedCafe(m2::PointD(2.0, 2.0), "", "en");
377
378 builder.Add(cafe);
379 builder.Add(unnamedCafe);
380 });
381
382 ForEachCafeAtPoint(m_dataSource, m2::PointD(1.0, 1.0), [&editor](FeatureType & ft)
383 {
384 TEST_EQUAL(editor.GetFeatureStatus(ft.GetID()), FeatureStatus::Untouched, ());
385
386 osm::EditableMapObject emo;
387 FillEditableMapObject(editor, ft, emo);
388 SetBuildingLevels(emo, "1");
389 TEST_EQUAL(editor.SaveEditedFeature(emo), osm::Editor::SaveResult::SavedSuccessfully, ());
390
391 TEST_EQUAL(editor.GetFeatureStatus(ft.GetID()), FeatureStatus::Modified, ());
392 editor.MarkFeatureAsObsolete(emo.GetID());
393 TEST_EQUAL(editor.GetFeatureStatus(emo.GetID()), FeatureStatus::Obsolete, ());
394 });
395
396 ForEachCafeAtPoint(m_dataSource, m2::PointD(2.0, 2.0), [&editor](FeatureType & ft)
397 {
398 TEST_EQUAL(editor.GetFeatureStatus(ft.GetID()), FeatureStatus::Untouched, ());
399 editor.DeleteFeature(ft.GetID());
400 TEST_EQUAL(editor.GetFeatureStatus(ft.GetID()), FeatureStatus::Deleted, ());
401 });
402
403 osm::EditableMapObject emo;
404 CreateCafeAtPoint({1.5, 1.5}, mwmId, emo);
405
406 TEST_EQUAL(editor.GetFeatureStatus(emo.GetID()), FeatureStatus::Created, ());
407}
408
409void EditorTest::AreSomeFeatureChangesUploadedTest()
410{

Callers

nothing calls this directly

Calls 10

ForEachCafeAtPointFunction · 0.85
FillEditableMapObjectFunction · 0.85
SetBuildingLevelsFunction · 0.85
CreateCafeAtPointFunction · 0.85
SaveEditedFeatureMethod · 0.80
MarkFeatureAsObsoleteMethod · 0.80
AddMethod · 0.45
GetFeatureStatusMethod · 0.45
GetIDMethod · 0.45
DeleteFeatureMethod · 0.45

Tested by

no test coverage detected