Implement wxVLogTrace() accidentally removed by recent changes.

Also change the unit test to test wxVLogTrace() as well as wxLogTrace.

Closes #11011.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@61505 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2009-07-23 13:40:44 +00:00
parent 2839804c35
commit 89d62794e4
2 changed files with 36 additions and 3 deletions

View File

@@ -273,22 +273,40 @@ void LogTestCase::Component()
#if wxDEBUG_LEVEL
namespace
{
const char *TEST_MASK = "test";
// this is a test vararg function (a real one, not a variadic-template-like as
// wxVLogTrace(), so care should be taken with its arguments)
void TraceTest(const char *format, ...)
{
va_list argptr;
va_start(argptr, format);
wxVLogTrace(TEST_MASK, format, argptr);
va_end(argptr);
}
} // anonymous namespace
void LogTestCase::Trace()
{
static const char *TEST_MASK = "test";
// we use wxLogTrace() or wxVLogTrace() from inside TraceTest()
// interchangeably here, it shouldn't make any difference
wxLogTrace(TEST_MASK, "Not shown");
CPPUNIT_ASSERT_EQUAL( "", m_log->GetLog(wxLOG_Trace) );
wxLog::AddTraceMask(TEST_MASK);
wxLogTrace(TEST_MASK, "Shown");
TraceTest("Shown");
CPPUNIT_ASSERT_EQUAL( wxString::Format("(%s) Shown", TEST_MASK),
m_log->GetLog(wxLOG_Trace) );
wxLog::RemoveTraceMask(TEST_MASK);
m_log->Clear();
wxLogTrace(TEST_MASK, "Not shown again");
TraceTest("Not shown again");
CPPUNIT_ASSERT_EQUAL( "", m_log->GetLog(wxLOG_Trace) );
}