Don't test for DC validity in wxX11 wxDC text extent functions.
The code in GetTextExtent() and GetChar{Width,Height}() works fine even for non-initialized wxMemoryDC and the ellipsization unit test relies on this working so simply remove the asserts which resulted in the test failures. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@66096 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
bb1b20f1a9
commit
5f480c0bf1
@ -1658,7 +1658,9 @@ void wxWindowDCImpl::DoGetTextExtent( const wxString &string, wxCoord *width, wx
|
|||||||
wxCoord *descent, wxCoord *externalLeading,
|
wxCoord *descent, wxCoord *externalLeading,
|
||||||
const wxFont *font ) const
|
const wxFont *font ) const
|
||||||
{
|
{
|
||||||
wxCHECK_RET( IsOk(), wxT("invalid dc") );
|
// Do not test for DC validity here, querying text extents is supposed to
|
||||||
|
// work even with a non-initialized wxMemoryDC. And the code below does
|
||||||
|
// actually work in this case.
|
||||||
|
|
||||||
if (string.empty())
|
if (string.empty())
|
||||||
{
|
{
|
||||||
@ -1721,7 +1723,8 @@ void wxWindowDCImpl::DoGetTextExtent( const wxString &string, wxCoord *width, wx
|
|||||||
|
|
||||||
wxCoord wxWindowDCImpl::GetCharWidth() const
|
wxCoord wxWindowDCImpl::GetCharWidth() const
|
||||||
{
|
{
|
||||||
wxCHECK_MSG( IsOk(), 0, wxT("invalid dc") );
|
// Do not test for DC validity here for the same reasons as in
|
||||||
|
// DoGetTextExtent() above.
|
||||||
|
|
||||||
#if wxUSE_UNICODE
|
#if wxUSE_UNICODE
|
||||||
PangoLayout *layout = pango_layout_new( m_context );
|
PangoLayout *layout = pango_layout_new( m_context );
|
||||||
@ -1755,7 +1758,8 @@ wxCoord wxWindowDCImpl::GetCharWidth() const
|
|||||||
|
|
||||||
wxCoord wxWindowDCImpl::GetCharHeight() const
|
wxCoord wxWindowDCImpl::GetCharHeight() const
|
||||||
{
|
{
|
||||||
wxCHECK_MSG( IsOk(), 0, wxT("invalid dc") );
|
// Do not test for DC validity here for the same reasons as in
|
||||||
|
// DoGetTextExtent() above.
|
||||||
|
|
||||||
#if wxUSE_UNICODE
|
#if wxUSE_UNICODE
|
||||||
PangoLayout *layout = pango_layout_new( m_context );
|
PangoLayout *layout = pango_layout_new( m_context );
|
||||||
|
Loading…
Reference in New Issue
Block a user