]> git.saurik.com Git - wxWidgets.git/commitdiff
Add unit test verifying compilation of various wxFont ctors.
authorVadim Zeitlin <vadim@wxwidgets.org>
Mon, 23 Jan 2012 14:42:56 +0000 (14:42 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Mon, 23 Jan 2012 14:42:56 +0000 (14:42 +0000)
Check that various invocations of wxFont ctor at least compile to avoid
problems like the ones fixed by r70450.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@70451 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

tests/font/fonttest.cpp

index 24a28a790400db9f8b98b27b9f63b29bdb71f6f9..e597a5b1b96527fcc1351cbbbb64267610567163 100644 (file)
@@ -37,11 +37,13 @@ public:
 
 private:
     CPPUNIT_TEST_SUITE( FontTestCase );
+        CPPUNIT_TEST( Construct );
         CPPUNIT_TEST( GetSet );
         CPPUNIT_TEST( NativeFontInfo );
         CPPUNIT_TEST( NativeFontInfoUserDesc );
     CPPUNIT_TEST_SUITE_END();
 
+    void Construct();
     void GetSet();
     void NativeFontInfo();
     void NativeFontInfoUserDesc();
@@ -93,6 +95,26 @@ wxString DumpFont(const wxFont *font)
     return s;
 }
 
+void FontTestCase::Construct()
+{
+    // The main purpose of this test is to verify that the font ctors below
+    // 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() );
+
+#if FUTURE_WXWIN_COMPATIBILITY_3_0
+    // Tests relying on the soon-to-be-deprecated ctor taking ints and not
+    // wxFontXXX enum elements.
+    CPPUNIT_ASSERT( wxFont(10, wxDEFAULT, wxNORMAL, wxNORMAL).IsOk() );
+#endif // FUTURE_WXWIN_COMPATIBILITY_3_0
+}
+
 void FontTestCase::GetSet()
 {
     unsigned numFonts;