| 715 | } |
| 716 | |
| 717 | void EditorTest::GetStatsTest() |
| 718 | { |
| 719 | auto & editor = osm::Editor::Instance(); |
| 720 | |
| 721 | auto const mwmId = ConstructTestMwm([](TestMwmBuilder & builder) |
| 722 | { |
| 723 | builder.Add(TestCafe(m2::PointD(1.0, 1.0), "London Cafe", "en")); |
| 724 | builder.Add(TestCafe(m2::PointD(2.0, 2.0), "London Cafe", "en")); |
| 725 | builder.Add(TestCafe(m2::PointD(3.0, 3.0), "London Cafe", "en")); |
| 726 | builder.Add(TestCafe(m2::PointD(4.0, 4.0), "London Cafe", "en")); |
| 727 | builder.Add(TestCafe(m2::PointD(5.0, 5.0), "London Cafe", "en")); |
| 728 | |
| 729 | builder.Add(TestPOI(m2::PointD(10, 10), "Corner Post", "default")); |
| 730 | }); |
| 731 | |
| 732 | auto stats = editor.GetStats(); |
| 733 | |
| 734 | TEST(stats.m_edits.empty(), ()); |
| 735 | TEST_EQUAL(stats.m_uploadedCount, 0, ()); |
| 736 | TEST_EQUAL(stats.m_lastUploadTimestamp, base::INVALID_TIME_STAMP, ()); |
| 737 | |
| 738 | ForEachCafeAtPoint(m_dataSource, m2::PointD(1.0, 1.0), [](FeatureType & ft) { SetBuildingLevelsToOne(ft); }); |
| 739 | |
| 740 | stats = editor.GetStats(); |
| 741 | TEST_EQUAL(stats.m_edits.size(), 1, ()); |
| 742 | |
| 743 | ForEachCafeAtPoint(m_dataSource, m2::PointD(4.0, 4.0), [](FeatureType & ft) { SetBuildingLevelsToOne(ft); }); |
| 744 | |
| 745 | stats = editor.GetStats(); |
| 746 | TEST_EQUAL(stats.m_edits.size(), 2, ()); |
| 747 | |
| 748 | ForEachCafeAtPoint(m_dataSource, m2::PointD(5.0, 5.0), [](FeatureType & ft) { SetBuildingLevelsToOne(ft); }); |
| 749 | |
| 750 | stats = editor.GetStats(); |
| 751 | TEST_EQUAL(stats.m_edits.size(), 3, ()); |
| 752 | TEST_EQUAL(stats.m_uploadedCount, 0, ()); |
| 753 | TEST_EQUAL(stats.m_lastUploadTimestamp, base::INVALID_TIME_STAMP, ()); |
| 754 | |
| 755 | osm::EditableMapObject emo; |
| 756 | CreateCafeAtPoint({6.0, 6.0}, mwmId, emo); |
| 757 | pugi::xml_document doc; |
| 758 | GenerateUploadedFeature(mwmId, emo, doc); |
| 759 | editor.m_storage->Save(doc); |
| 760 | editor.LoadEdits(); |
| 761 | |
| 762 | stats = editor.GetStats(); |
| 763 | TEST_EQUAL(stats.m_edits.size(), 1, ()); |
| 764 | TEST_EQUAL(stats.m_uploadedCount, 1, ()); |
| 765 | TEST_NOT_EQUAL(stats.m_lastUploadTimestamp, base::INVALID_TIME_STAMP, ()); |
| 766 | } |
| 767 | |
| 768 | void EditorTest::IsCreatedFeatureTest() |
| 769 | { |
nothing calls this directly
no test coverage detected