]> git.saurik.com Git - wxWidgets.git/blobdiff - tests/font/fonttest.cpp
using ordinary Show for popup windows as on MSW which activates it as well, I'll...
[wxWidgets.git] / tests / font / fonttest.cpp
index e597a5b1b96527fcc1351cbbbb64267610567163..bf1940320700a4179c80e6a052edcc6f13c52a44 100644 (file)
@@ -26,6 +26,8 @@
 
 #include "wx/font.h"
 
+#include "asserthelper.h"
+
 // ----------------------------------------------------------------------------
 // test class
 // ----------------------------------------------------------------------------
@@ -101,9 +103,6 @@ void FontTestCase::Construct()
     // compile because it's easy to introduce ambiguities due to the number of
     // overloaded wxFont ctors.
 
-    CPPUNIT_ASSERT( wxFont(10, wxFONTFAMILY_DEFAULT).IsOk() );
-    CPPUNIT_ASSERT( wxFont(10, wxFONTFAMILY_DEFAULT,
-                               wxFONTFLAG_DEFAULT).IsOk() );
     CPPUNIT_ASSERT( wxFont(10, wxFONTFAMILY_DEFAULT,
                                wxFONTSTYLE_NORMAL,
                                wxFONTWEIGHT_NORMAL).IsOk() );
@@ -204,6 +203,12 @@ void FontTestCase::GetSet()
         CPPUNIT_ASSERT( test.IsOk() );
         CPPUNIT_ASSERT_EQUAL( true, test.GetUnderlined() );
 
+        // test Get/SetStrikethrough()
+
+        test.SetStrikethrough(true);
+        CPPUNIT_ASSERT( test.IsOk() );
+        CPPUNIT_ASSERT_EQUAL( true, test.GetStrikethrough() );
+
 
         // test Get/SetWeight()
 
@@ -245,6 +250,26 @@ void FontTestCase::NativeFontInfo()
 #if !defined(__WXGTK__) && !defined(__WXX11__)
     CPPUNIT_ASSERT( !font.SetNativeFontInfo("bloordyblop") );
 #endif
+
+    // Pango font description doesn't have 'underlined' and 'strikethrough'
+    // attributes, so wxNativeFontInfo implements these itself. Test if these
+    // are properly preserved by wxNativeFontInfo or its string description.
+    font.SetUnderlined(true);
+    font.SetStrikethrough(true);
+    CPPUNIT_ASSERT_EQUAL(font, wxFont(font));
+    CPPUNIT_ASSERT_EQUAL(font, wxFont(*font.GetNativeFontInfo()));
+    CPPUNIT_ASSERT_EQUAL(font, wxFont(font.GetNativeFontInfoDesc()));
+    font.SetUnderlined(false);
+    CPPUNIT_ASSERT_EQUAL(font, wxFont(font));
+    CPPUNIT_ASSERT_EQUAL(font, wxFont(*font.GetNativeFontInfo()));
+    CPPUNIT_ASSERT_EQUAL(font, wxFont(font.GetNativeFontInfoDesc()));
+    font.SetUnderlined(true);
+    font.SetStrikethrough(false);
+    CPPUNIT_ASSERT_EQUAL(font, wxFont(font));
+    CPPUNIT_ASSERT_EQUAL(font, wxFont(*font.GetNativeFontInfo()));
+    CPPUNIT_ASSERT_EQUAL(font, wxFont(font.GetNativeFontInfoDesc()));
+    // note: the GetNativeFontInfoUserDesc() doesn't preserve all attributes
+    // according to docs, so it is not tested.
 }
 
 void FontTestCase::NativeFontInfoUserDesc()