]> git.saurik.com Git - wxWidgets.git/commitdiff
Don't test for DC validity in wxX11 wxDC text extent functions.
authorVadim Zeitlin <vadim@wxwidgets.org>
Wed, 10 Nov 2010 13:52:59 +0000 (13:52 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Wed, 10 Nov 2010 13:52:59 +0000 (13:52 +0000)
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

src/x11/dcclient.cpp

index 945b8d5e6cc8ef9a9966918a235a3a0dc46908be..3f127c442b8cadd29f1543ef6b2601a49e2dfe9a 100644 (file)
@@ -1658,7 +1658,9 @@ void wxWindowDCImpl::DoGetTextExtent( const wxString &string, wxCoord *width, wx
                                 wxCoord *descent, wxCoord *externalLeading,
                                 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())
     {
@@ -1721,7 +1723,8 @@ void wxWindowDCImpl::DoGetTextExtent( const wxString &string, wxCoord *width, wx
 
 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
     PangoLayout *layout = pango_layout_new( m_context );
@@ -1755,7 +1758,8 @@ wxCoord wxWindowDCImpl::GetCharWidth() 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
     PangoLayout *layout = pango_layout_new( m_context );