+void LogTestCase::Component()
+{
+ wxLogMessage("Message");
+ CPPUNIT_ASSERT_EQUAL( wxLOG_COMPONENT,
+ m_log->GetInfo(wxLOG_Message).component );
+
+ // completely disable logging for this component
+ wxLog::SetComponentLevel("test/ignore", wxLOG_FatalError);
+
+ // but enable it for one of its subcomponents
+ wxLog::SetComponentLevel("test/ignore/not", wxLOG_Max);
+
+ #undef wxLOG_COMPONENT
+ #define wxLOG_COMPONENT "test/ignore"
+
+ // this shouldn't be output as this component is ignored
+ wxLogError("Error");
+ CPPUNIT_ASSERT_EQUAL( "", m_log->GetLog(wxLOG_Error) );
+
+ // and so are its subcomponents
+ #undef wxLOG_COMPONENT
+ #define wxLOG_COMPONENT "test/ignore/sub/subsub"
+ wxLogError("Error");
+ CPPUNIT_ASSERT_EQUAL( "", m_log->GetLog(wxLOG_Error) );
+
+ // but one subcomponent is not
+ #undef wxLOG_COMPONENT
+ #define wxLOG_COMPONENT "test/ignore/not"
+ wxLogError("Error");
+ CPPUNIT_ASSERT_EQUAL( "Error", m_log->GetLog(wxLOG_Error) );
+
+ // restore the original value
+ #undef wxLOG_COMPONENT
+ #define wxLOG_COMPONENT "test"
+}
+