]> git.saurik.com Git - wxWidgets.git/blobdiff - tests/font/fonttest.cpp
Basque translations update from Xabier Aramendi.
[wxWidgets.git] / tests / font / fonttest.cpp
index e597a5b1b96527fcc1351cbbbb64267610567163..cdcb7ea8f4327df2b8641fd82090f3475f90942d 100644 (file)
@@ -3,7 +3,6 @@
 // Purpose:     wxFont unit test
 // Author:      Francesco Montorsi
 // Created:     16.3.09
 // Purpose:     wxFont unit test
 // Author:      Francesco Montorsi
 // Created:     16.3.09
-// RCS-ID:      $Id$
 // Copyright:   (c) 2009 Francesco Montorsi
 // Licence:     wxWindows licence
 ///////////////////////////////////////////////////////////////////////////////
 // Copyright:   (c) 2009 Francesco Montorsi
 // Licence:     wxWindows licence
 ///////////////////////////////////////////////////////////////////////////////
@@ -26,6 +25,8 @@
 
 #include "wx/font.h"
 
 
 #include "wx/font.h"
 
+#include "asserthelper.h"
+
 // ----------------------------------------------------------------------------
 // test class
 // ----------------------------------------------------------------------------
 // ----------------------------------------------------------------------------
 // test class
 // ----------------------------------------------------------------------------
@@ -101,9 +102,6 @@ void FontTestCase::Construct()
     // compile because it's easy to introduce ambiguities due to the number of
     // overloaded wxFont ctors.
 
     // 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() );
     CPPUNIT_ASSERT( wxFont(10, wxFONTFAMILY_DEFAULT,
                                wxFONTSTYLE_NORMAL,
                                wxFONTWEIGHT_NORMAL).IsOk() );
@@ -204,6 +202,15 @@ void FontTestCase::GetSet()
         CPPUNIT_ASSERT( test.IsOk() );
         CPPUNIT_ASSERT_EQUAL( true, test.GetUnderlined() );
 
         CPPUNIT_ASSERT( test.IsOk() );
         CPPUNIT_ASSERT_EQUAL( true, test.GetUnderlined() );
 
+        // test Get/SetStrikethrough()
+
+        // Strike through support not implemented in wxOSX currently.
+#ifndef __WXOSX__
+        test.SetStrikethrough(true);
+        CPPUNIT_ASSERT( test.IsOk() );
+        CPPUNIT_ASSERT_EQUAL( true, test.GetStrikethrough() );
+#endif // !__WXOSX__
+
 
         // test Get/SetWeight()
 
 
         // test Get/SetWeight()
 
@@ -245,6 +252,26 @@ void FontTestCase::NativeFontInfo()
 #if !defined(__WXGTK__) && !defined(__WXX11__)
     CPPUNIT_ASSERT( !font.SetNativeFontInfo("bloordyblop") );
 #endif
 #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()
 }
 
 void FontTestCase::NativeFontInfoUserDesc()