]> git.saurik.com Git - wxWidgets.git/blobdiff - tests/misc/guifuncs.cpp
support wxFD_MULTIPLE
[wxWidgets.git] / tests / misc / guifuncs.cpp
index 886769aa511faad4a7d619d63a4aff69d4fb4637..184675051d72e9d35a580d8721caa2bef71de8b1 100644 (file)
     #pragma hdrstop
 #endif
 
+#ifndef WX_PRECOMP
+    #include "wx/gdicmn.h"
+#endif // !PCH
+
 #include "wx/defs.h"
+#include "wx/clipbrd.h"
+#include "wx/dataobj.h"
 
 // ----------------------------------------------------------------------------
 // test class
@@ -31,9 +37,11 @@ public:
 private:
     CPPUNIT_TEST_SUITE( MiscGUIFuncsTestCase );
         CPPUNIT_TEST( DisplaySize );
+        CPPUNIT_TEST( URLDataObject );
     CPPUNIT_TEST_SUITE_END();
 
     void DisplaySize();
+    void URLDataObject();
 
     DECLARE_NO_COPY_CLASS(MiscGUIFuncsTestCase)
 };
@@ -67,3 +75,16 @@ void MiscGUIFuncsTestCase::DisplaySize()
     CPPUNIT_ASSERT( sz.x < 1000 && sz.y < 1000 );
 }
 
+void MiscGUIFuncsTestCase::URLDataObject()
+{
+    // this tests for buffer overflow, see #11102
+    const char * const
+        url = "http://something.long.to.overwrite.plenty.memory.example.com";
+    wxURLDataObject * const dobj = new wxURLDataObject(url);
+    CPPUNIT_ASSERT_EQUAL( url, dobj->GetURL() );
+
+    wxClipboardLocker lockClip;
+    CPPUNIT_ASSERT( wxTheClipboard->SetData(dobj) );
+    wxTheClipboard->Flush();
+}
+