+
+ // Test the functions with some other DC kinds also.
+#if wxUSE_PRINTING_ARCHITECTURE && wxUSE_POSTSCRIPT
+ wxPostScriptDC psdc;
+ // wxPostScriptDC doesn't have any font set by default but its
+ // GetTextExtent() requires one to be set. This is probably a bug and we
+ // should set the default font in it implicitly but for now just work
+ // around it.
+ psdc.SetFont(*wxNORMAL_FONT);
+ GetTextExtentTester<wxPostScriptDC> testPS(psdc);
+#endif
+
+#if wxUSE_ENH_METAFILE
+ wxEnhMetaFileDC metadc;
+ GetTextExtentTester<wxEnhMetaFileDC> testMF(metadc);
+#endif
+}
+
+void MeasuringTextTestCase::LeadingAndDescent()
+{
+ wxClientDC dc(wxTheApp->GetTopWindow());
+
+ // Retrieving just the descent should work.
+ int descent = -17;
+ dc.GetTextExtent("foo", NULL, NULL, &descent);
+ CPPUNIT_ASSERT( descent != -17 );
+
+ // Same for external leading.
+ int leading = -289;
+ dc.GetTextExtent("foo", NULL, NULL, NULL, &leading);
+ CPPUNIT_ASSERT( leading != -289 );
+
+ // And both should also work for the empty string as they retrieve the
+ // values valid for the entire font and not just this string.
+ int descent2,
+ leading2;
+ dc.GetTextExtent("", NULL, NULL, &descent2, &leading2);
+
+ CPPUNIT_ASSERT_EQUAL( descent, descent2 );
+ CPPUNIT_ASSERT_EQUAL( leading, leading2 );