From aeecbca0598300095af688d630c855eab4a36369 Mon Sep 17 00:00:00 2001 From: Francesco Montorsi Date: Tue, 14 Apr 2009 18:55:41 +0000 Subject: [PATCH] dump all font properties upon failure git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@60147 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- tests/font/fonttest.cpp | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/tests/font/fonttest.cpp b/tests/font/fonttest.cpp index ed8cc2e..c8a60f0 100644 --- a/tests/font/fonttest.cpp +++ b/tests/font/fonttest.cpp @@ -51,6 +51,27 @@ CPPUNIT_TEST_SUITE_REGISTRATION( FontTestCase ); // also include in it's own registry so that these tests can be run alone CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( FontTestCase, "FontTestCase" ); +wxString DumpFont(const wxFont *font) +{ + // dumps the internal properties of a wxFont in the same order they + // are checked by wxFontBase::operator==() + + wxASSERT(font->IsOk()); + + wxString s; + s.Printf(wxS("%d-%d;%d-%d-%d-%d-%d-%s-%d"), + font->GetPointSize(), + font->GetPixelSize().x, + font->GetPixelSize().y, + font->GetFamily(), + font->GetStyle(), + font->GetWeight(), + font->GetUnderlined() ? 1 : 0, + font->GetFaceName(), + font->GetEncoding()); + + return s; +} void FontTestCase::GetSet() { @@ -110,8 +131,8 @@ void FontTestCase::GetSet() CPPUNIT_ASSERT( temp.SetNativeFontInfo(nid) ); CPPUNIT_ASSERT( temp.IsOk() ); WX_ASSERT_MESSAGE( - ("Test #%lu failed; native info desc was \"%s\" for test and \"%s\" for temp", \ - n, nid, temp.GetNativeFontInfoDesc()), + ("Test #%lu failed\ndump of test font: \"%s\"\ndump of temp font: \"%s\"", \ + n, DumpFont(&test), DumpFont(&temp)), temp == test ); -- 2.7.4