diff --git a/common/reporter.cpp b/common/reporter.cpp index 7a97938e9d..1231f9e603 100644 --- a/common/reporter.cpp +++ b/common/reporter.cpp @@ -65,12 +65,6 @@ REPORTER& WX_TEXT_CTRL_REPORTER::Report( const wxString& aText, SEVERITY aSeveri } -bool WX_TEXT_CTRL_REPORTER::HasMessage() const -{ - return !m_textCtrl->IsEmpty(); -} - - REPORTER& WX_STRING_REPORTER::Report( const wxString& aText, SEVERITY aSeverity ) { REPORTER::Report( aText, aSeverity ); @@ -93,12 +87,6 @@ void WX_STRING_REPORTER::Clear() } -bool WX_STRING_REPORTER::HasMessage() const -{ - return !m_string.IsEmpty(); -} - - REPORTER& NULL_REPORTER::Report( const wxString& aText, SEVERITY aSeverity ) { return REPORTER::Report( aText, aSeverity ); @@ -231,12 +219,3 @@ REPORTER& STATUSBAR_REPORTER::Report( const wxString& aText, SEVERITY aSeverity return *this; } - - -bool STATUSBAR_REPORTER::HasMessage() const -{ - if( m_statusBar ) - return !m_statusBar->GetStatusText( m_position ).IsEmpty(); - - return false; -} diff --git a/include/reporter.h b/include/reporter.h index 7cdd86efd6..2ecc5982c0 100644 --- a/include/reporter.h +++ b/include/reporter.h @@ -73,7 +73,7 @@ class KICOMMON_API REPORTER { public: REPORTER() : - m_severityMask( 0 ) + m_reportedSeverityMask( 0 ) { } virtual ~REPORTER() @@ -102,7 +102,7 @@ public: virtual REPORTER& Report( const wxString& aText, SEVERITY aSeverity = RPT_SEVERITY_UNDEFINED ) { - m_severityMask |= aSeverity; + m_reportedSeverityMask |= aSeverity; return *this; } @@ -129,11 +129,11 @@ public: REPORTER& operator <<( const wxString& aText ) { return Report( aText ); } /** - * Returns true if the reporter client is non-empty. + * Returns true if any messages were reported. */ virtual bool HasMessage() const { - return m_severityMask != 0; + return m_reportedSeverityMask != 0; } /** @@ -142,7 +142,7 @@ public: */ virtual bool HasMessageOfSeverity( int aSeverityMask ) const { - return ( m_severityMask & aSeverityMask ) != 0; + return ( m_reportedSeverityMask & aSeverityMask ) != 0; } virtual EDA_UNITS GetUnits() const @@ -152,11 +152,11 @@ public: virtual void Clear() { - m_severityMask = 0; + m_reportedSeverityMask = 0; } private: - int m_severityMask; + int m_reportedSeverityMask; }; @@ -179,8 +179,6 @@ public: REPORTER& Report( const wxString& aText, SEVERITY aSeverity = RPT_SEVERITY_UNDEFINED ) override; - bool HasMessage() const override; - private: wxTextCtrl* m_textCtrl; }; @@ -201,8 +199,6 @@ public: REPORTER& Report( const wxString& aText, SEVERITY aSeverity = RPT_SEVERITY_UNDEFINED ) override; - bool HasMessage() const override; - const wxString& GetMessages() const; void Clear() override; @@ -308,8 +304,6 @@ public: REPORTER& Report( const wxString& aText, SEVERITY aSeverity = RPT_SEVERITY_UNDEFINED ) override; - bool HasMessage() const override; - private: wxStatusBar* m_statusBar; int m_position; diff --git a/qa/tests/common/test_reporting.cpp b/qa/tests/common/test_reporting.cpp index 7be573461c..068e76fdd0 100644 --- a/qa/tests/common/test_reporting.cpp +++ b/qa/tests/common/test_reporting.cpp @@ -337,17 +337,6 @@ BOOST_AUTO_TEST_CASE( NullReporter_Singleton ) BOOST_CHECK_EQUAL( &reporter1, &reporter2 ); } -BOOST_AUTO_TEST_CASE( NullReporter_NoMessages ) -{ - REPORTER& reporter = NULL_REPORTER::GetInstance(); - - BOOST_CHECK( !reporter.HasMessage() ); - - reporter.Report( wxT("Test message"), RPT_SEVERITY_INFO ); - - BOOST_CHECK( !reporter.HasMessage() ); // Should still report no messages -} - BOOST_AUTO_TEST_CASE( NullReporter_SeverityMask ) { REPORTER& reporter = NULL_REPORTER::GetInstance(); @@ -368,17 +357,6 @@ BOOST_AUTO_TEST_CASE( CliReporter_Singleton ) BOOST_CHECK_EQUAL( &reporter1, &reporter2 ); } -BOOST_AUTO_TEST_CASE( CliReporter_NoMessages ) -{ - REPORTER& reporter = CLI_REPORTER::GetInstance(); - - BOOST_CHECK( !reporter.HasMessage() ); - - reporter.Report( wxT("Test message"), RPT_SEVERITY_INFO ); - - BOOST_CHECK( !reporter.HasMessage() ); // Should not store messages -} - BOOST_AUTO_TEST_CASE( StdoutReporter_Singleton ) { REPORTER& reporter1 = STDOUT_REPORTER::GetInstance(); @@ -387,17 +365,6 @@ BOOST_AUTO_TEST_CASE( StdoutReporter_Singleton ) BOOST_CHECK_EQUAL( &reporter1, &reporter2 ); } -BOOST_AUTO_TEST_CASE( StdoutReporter_NoMessages ) -{ - REPORTER& reporter = STDOUT_REPORTER::GetInstance(); - - BOOST_CHECK( !reporter.HasMessage() ); - - reporter.Report( wxT("Test message"), RPT_SEVERITY_INFO ); - - BOOST_CHECK( !reporter.HasMessage() ); // Should not store messages -} - BOOST_AUTO_TEST_CASE( WxLogReporter_Singleton ) { REPORTER& reporter1 = WXLOG_REPORTER::GetInstance(); @@ -406,17 +373,6 @@ BOOST_AUTO_TEST_CASE( WxLogReporter_Singleton ) BOOST_CHECK_EQUAL( &reporter1, &reporter2 ); } -BOOST_AUTO_TEST_CASE( WxLogReporter_NoMessages ) -{ - REPORTER& reporter = WXLOG_REPORTER::GetInstance(); - - BOOST_CHECK( !reporter.HasMessage() ); - - reporter.Report( wxT("Test message"), RPT_SEVERITY_INFO ); - - BOOST_CHECK( !reporter.HasMessage() ); // Should not store messages -} - // Note: WX_TEXT_CTRL_REPORTER and STATUSBAR_REPORTER tests would require // actual wxWidgets objects or more sophisticated mocking @@ -428,14 +384,9 @@ BOOST_AUTO_TEST_CASE( ReporterInterface_Polymorphism ) for( auto& reporter : reporters ) { - reporter->Report( wxT("Polymorphic test"), RPT_SEVERITY_INFO ); + reporter->Report( wxT( "Polymorphic test" ), RPT_SEVERITY_INFO ); - // WX_STRING_REPORTER and TEST_REPORTER should both store messages - if( dynamic_cast( reporter.get() ) || - dynamic_cast( reporter.get() ) ) - { - BOOST_CHECK( reporter->HasMessage() ); - } + BOOST_CHECK( reporter->HasMessage() ); } }