| 488 | } |
| 489 | |
| 490 | void EditorTest::GetFeaturesByStatusTest() |
| 491 | { |
| 492 | auto & editor = osm::Editor::Instance(); |
| 493 | |
| 494 | { |
| 495 | MwmSet::MwmId mwmId; |
| 496 | auto const features = editor.GetFeaturesByStatus(mwmId, FeatureStatus::Untouched); |
| 497 | TEST(features.empty(), ()); |
| 498 | } |
| 499 | |
| 500 | auto const mwmId = ConstructTestMwm([](TestMwmBuilder & builder) |
| 501 | { |
| 502 | TestCafe cafe(m2::PointD(1.0, 1.0), "London Cafe", "en"); |
| 503 | TestCafe unnamedCafe(m2::PointD(2.0, 2.0), "", "en"); |
| 504 | TestCafe someCafe(m2::PointD(3.0, 3.0), "Some cafe", "en"); |
| 505 | |
| 506 | builder.Add(cafe); |
| 507 | builder.Add(unnamedCafe); |
| 508 | builder.Add(someCafe); |
| 509 | |
| 510 | builder.Add(TestPOI(m2::PointD(10, 10), "Corner Post", "default")); |
| 511 | }); |
| 512 | |
| 513 | FeatureID modifiedId, deletedId, obsoleteId, createdId; |
| 514 | |
| 515 | ForEachCafeAtPoint(m_dataSource, m2::PointD(1.0, 1.0), [&editor, &modifiedId](FeatureType & ft) |
| 516 | { |
| 517 | osm::EditableMapObject emo; |
| 518 | FillEditableMapObject(editor, ft, emo); |
| 519 | SetBuildingLevels(emo, "1"); |
| 520 | TEST_EQUAL(editor.SaveEditedFeature(emo), osm::Editor::SaveResult::SavedSuccessfully, ()); |
| 521 | |
| 522 | modifiedId = emo.GetID(); |
| 523 | }); |
| 524 | |
| 525 | ForEachCafeAtPoint(m_dataSource, m2::PointD(2.0, 2.0), [&editor, &deletedId](FeatureType & ft) |
| 526 | { |
| 527 | editor.DeleteFeature(ft.GetID()); |
| 528 | deletedId = ft.GetID(); |
| 529 | }); |
| 530 | |
| 531 | ForEachCafeAtPoint(m_dataSource, m2::PointD(3.0, 3.0), [&editor, &obsoleteId](FeatureType & ft) |
| 532 | { |
| 533 | editor.MarkFeatureAsObsolete(ft.GetID()); |
| 534 | obsoleteId = ft.GetID(); |
| 535 | }); |
| 536 | |
| 537 | osm::EditableMapObject emo; |
| 538 | CreateCafeAtPoint({4.0, 4.0}, mwmId, emo); |
| 539 | createdId = emo.GetID(); |
| 540 | |
| 541 | auto const modified = editor.GetFeaturesByStatus(mwmId, FeatureStatus::Modified); |
| 542 | auto const deleted = editor.GetFeaturesByStatus(mwmId, FeatureStatus::Deleted); |
| 543 | auto const obsolete = editor.GetFeaturesByStatus(mwmId, FeatureStatus::Obsolete); |
| 544 | auto const created = editor.GetFeaturesByStatus(mwmId, FeatureStatus::Created); |
| 545 | |
| 546 | TEST_EQUAL(modified.size(), 1, ()); |
| 547 | TEST_EQUAL(deleted.size(), 1, ()); |
nothing calls this directly
no test coverage detected