From 1777f9c76622fb253d6116ec90a82f0f6e4fce90 Mon Sep 17 00:00:00 2001 From: Arsentiy Milchakov Date: Wed, 22 Jan 2020 15:36:13 +0300 Subject: [PATCH] [core] tips tests are fixed --- map/map_tests/tips_tests.cpp | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/map/map_tests/tips_tests.cpp b/map/map_tests/tips_tests.cpp index 161e5dd99b..e0e6d0bf5e 100644 --- a/map/map_tests/tips_tests.cpp +++ b/map/map_tests/tips_tests.cpp @@ -17,7 +17,7 @@ using namespace eye; namespace { -class TipsApiDelegate : public TipsApi::Delegate +class TipsApiDelegateForTesting : public TipsApi::Delegate { public: void SetLastBackgroundTime(double lastBackgroundTime) @@ -34,8 +34,13 @@ public: double GetLastBackgroundTime() const override { return m_lastBackgroundTime; } + m2::PointD const & GetViewportCenter() const override { return m_point; } + storage::CountryId GetCountryId(m2::PointD const & pt) const override { return ""; } + int64_t GetCountryVersion(storage::CountryId const & countryId) const override { return 0; } + private: double m_lastBackgroundTime = 0.0; + m2::PointD m_point; }; void MakeLastShownTipAvailableByTime() @@ -48,9 +53,9 @@ void MakeLastShownTipAvailableByTime() EyeForTesting::SetInfo(editableInfo); } -std::optional GetTipForTesting(TipsApi::Duration showAnyTipPeriod, - TipsApi::Duration showSameTipPeriod, - TipsApiDelegate const & delegate) +boost::optional GetTipForTesting(TipsApi::Duration showAnyTipPeriod, + TipsApi::Duration showSameTipPeriod, + TipsApiDelegateForTesting const & delegate) { // Do not use additional conditions for testing. TipsApi::Conditions conditions = @@ -62,6 +67,8 @@ std::optional GetTipForTesting(TipsApi::Duration showAnyTipPerio // Condition for Tips::Type::DiscoverButton type. [] (eye::Info const & info) { return true; }, // Condition for Tips::Type::PublicTransport type. + [] (eye::Info const & info) { return true; }, + // Condition for Tips::Type::Isolines type. [] (eye::Info const & info) { return true; } }}; return TipsApi::GetTipForTesting(showAnyTipPeriod, showSameTipPeriod, delegate, conditions); @@ -172,7 +179,7 @@ UNIT_CLASS_TEST(ScopedEyeForTesting, ShowTipAndGotitClicked_Test) UNIT_CLASS_TEST(ScopedEyeForTesting, ShowTipAfterWarmStart) { - TipsApiDelegate d; + TipsApiDelegateForTesting d; d.SetLastBackgroundTime(base::Timer::LocalTime()); auto tip = GetTipForTesting({}, TipsApi::GetShowSameTipPeriod(), d); TEST(!tip.has_value(), ());