Give more information if wxFont unit tests fail
Use INFO() to provide extra information instead of the ugly WX_ASSERT_MESSAGE().
This commit is contained in:
parent
6afd2e8f87
commit
61e24f6be0
@ -263,14 +263,13 @@ TEST_CASE("wxFont::GetSet", "[font][getters]")
|
|||||||
static const char *knownGoodFaceName = "Monospace";
|
static const char *knownGoodFaceName = "Monospace";
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
WX_ASSERT_MESSAGE
|
INFO("Testing font #" << n);
|
||||||
(
|
|
||||||
("failed to set face name \"%s\" for test font #%u\n"
|
{
|
||||||
"(this failure is harmless if this face name is not "
|
INFO("setting face name to " << knownGoodFaceName);
|
||||||
"available on this system)", knownGoodFaceName, n),
|
CHECK( test.SetFaceName(knownGoodFaceName) );
|
||||||
test.SetFaceName(knownGoodFaceName)
|
CHECK( test.IsOk() );
|
||||||
);
|
}
|
||||||
CHECK( test.IsOk() );
|
|
||||||
|
|
||||||
|
|
||||||
// test Get/SetFamily()
|
// test Get/SetFamily()
|
||||||
@ -364,10 +363,12 @@ TEST_CASE("wxFont::NativeFontInfo", "[font][fontinfo]")
|
|||||||
wxFont temp;
|
wxFont temp;
|
||||||
CHECK( temp.SetNativeFontInfo(nid) );
|
CHECK( temp.SetNativeFontInfo(nid) );
|
||||||
CHECK( temp.IsOk() );
|
CHECK( temp.IsOk() );
|
||||||
WX_ASSERT_MESSAGE(
|
|
||||||
("Test #%u failed\ndump of test font: \"%s\"\ndump of temp font: \"%s\"", \
|
INFO("Testing font #" << n);
|
||||||
n, DumpFont(&test), DumpFont(&temp)),
|
INFO("original font user description: " << DumpFont(&test));
|
||||||
temp == test );
|
INFO("the other font description: " << DumpFont(&temp));
|
||||||
|
|
||||||
|
CHECK( temp == test );
|
||||||
}
|
}
|
||||||
|
|
||||||
// test that clearly invalid font info strings do not work
|
// test that clearly invalid font info strings do not work
|
||||||
@ -409,22 +410,25 @@ TEST_CASE("wxFont::NativeFontInfoUserDesc", "[font][fontinfo]")
|
|||||||
const wxFont *pf = GetTestFonts(numFonts);
|
const wxFont *pf = GetTestFonts(numFonts);
|
||||||
for ( unsigned n = 0; n < numFonts; n++ )
|
for ( unsigned n = 0; n < numFonts; n++ )
|
||||||
{
|
{
|
||||||
|
INFO("Testing font #" << n);
|
||||||
|
|
||||||
wxFont test(*pf++);
|
wxFont test(*pf++);
|
||||||
|
|
||||||
const wxString& niud = test.GetNativeFontInfoUserDesc();
|
const wxString& niud = test.GetNativeFontInfoUserDesc();
|
||||||
CHECK( !niud.empty() );
|
CHECK( !niud.empty() );
|
||||||
// documented to be never empty
|
// documented to be never empty
|
||||||
|
|
||||||
|
INFO("original font user description: " << niud);
|
||||||
|
|
||||||
wxFont temp2;
|
wxFont temp2;
|
||||||
CHECK( temp2.SetNativeFontInfoUserDesc(niud) );
|
CHECK( temp2.SetNativeFontInfoUserDesc(niud) );
|
||||||
CHECK( temp2.IsOk() );
|
CHECK( temp2.IsOk() );
|
||||||
|
|
||||||
|
INFO("the other font description: " << niud);
|
||||||
|
|
||||||
#ifdef __WXGTK__
|
#ifdef __WXGTK__
|
||||||
// Pango saves/restores all font info in the user-friendly string:
|
// Pango saves/restores all font info in the user-friendly string:
|
||||||
WX_ASSERT_MESSAGE(
|
CHECK( temp2 == test );
|
||||||
("Test #%u failed; native info user desc was \"%s\" for test and \"%s\" for temp2", \
|
|
||||||
n, niud, temp2.GetNativeFontInfoUserDesc()),
|
|
||||||
temp2 == test );
|
|
||||||
#else
|
#else
|
||||||
// NOTE: as documented GetNativeFontInfoUserDesc/SetNativeFontInfoUserDesc
|
// NOTE: as documented GetNativeFontInfoUserDesc/SetNativeFontInfoUserDesc
|
||||||
// are not granted to save/restore all font info.
|
// are not granted to save/restore all font info.
|
||||||
|
Loading…
Reference in New Issue
Block a user