]> git.saurik.com Git - wxWidgets.git/blobdiff - samples/propgrid/tests.cpp
Use explicit menu item background if it's given under MSW.
[wxWidgets.git] / samples / propgrid / tests.cpp
index 6387b62ba358fa784c1dbad40a9ac60dfae97bec..5d62dbfe81b5e015915f7ecec3b1ee97efc3174e 100644 (file)
@@ -6,7 +6,7 @@
 // Created:     2007-05-16
 // RCS-ID:      $Id$
 // Copyright:   (c) Jaakko Salli
-// Licence:     wxWindows license
+// Licence:     wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
 
 #include "wx/wxprec.h"
@@ -106,7 +106,7 @@ public:
 void FormMain::AddTestProperties( wxPropertyGridPage* pg )
 {
     pg->Append( new MyColourProperty(wxT("CustomColourProperty"), wxPG_LABEL, *wxGREEN) );
-    pg->GetProperty(wxT("CustomColourProperty"))->SetFlag(wxPG_PROP_AUTO_UNSPECIFIED);
+    pg->GetProperty(wxT("CustomColourProperty"))->SetAutoUnspecified(true);
     pg->SetPropertyEditor( wxT("CustomColourProperty"), wxPGEditor_ComboBox );
 
     pg->SetPropertyHelpString(wxT("CustomColourProperty"),
@@ -514,7 +514,7 @@ bool FormMain::RunTests( bool fullTest, bool interactive )
         wxDateTime testTime = wxDateTime::Now();
         any = testTime;
         prop->SetValue(any);
-        if ( prop->GetValue().GetAny().As<wxDateTime>() != testTime )
+        if ( wxANY_AS(prop->GetValue().GetAny(), wxDateTime) != testTime )
             RT_FAILURE();
 #endif
 
@@ -522,10 +522,10 @@ bool FormMain::RunTests( bool fullTest, bool interactive )
         int testInt = 25537983;
         any = testInt;
         prop->SetValue(any);
-        if ( prop->GetValue().GetAny().As<int>() != testInt )
+        if ( wxANY_AS(prop->GetValue().GetAny(), int) != testInt )
             RT_FAILURE();
 #ifdef wxLongLong_t
-        if ( prop->GetValue().GetAny().As<wxLongLong_t>() != testInt )
+        if ( wxANY_AS(prop->GetValue().GetAny(), wxLongLong_t) != testInt )
             RT_FAILURE();
 #endif
 
@@ -533,7 +533,7 @@ bool FormMain::RunTests( bool fullTest, bool interactive )
         wxString testString = "asd934jfyn3";
         any = testString;
         prop->SetValue(any);
-        if ( prop->GetValue().GetAny().As<wxString>() != testString )
+        if ( wxANY_AS(prop->GetValue().GetAny(), wxString) != testString )
             RT_FAILURE();
 
         // Test with a type generated with IMPLEMENT_VARIANT_OBJECT()
@@ -541,7 +541,7 @@ bool FormMain::RunTests( bool fullTest, bool interactive )
         wxColour testCol = *wxCYAN;
         any = testCol;
         prop->SetValue(any);
-        if ( prop->GetValue().GetAny().As<wxColour>() != testCol )
+        if ( wxANY_AS(prop->GetValue().GetAny(), wxColour) != testCol )
             RT_FAILURE();
 
         // Test with a type with custom wxVariantData defined by
@@ -550,7 +550,7 @@ bool FormMain::RunTests( bool fullTest, bool interactive )
         wxPoint testPoint(199, 199);
         any = testPoint;
         prop->SetValue(any);
-        if ( prop->GetValue().GetAny().As<wxPoint>() != testPoint )
+        if ( wxANY_AS(prop->GetValue().GetAny(), wxPoint) != testPoint )
             RT_FAILURE();
     }
 
@@ -1030,13 +1030,17 @@ bool FormMain::RunTests( bool fullTest, bool interactive )
         wxPGProperty* p;
 
         wxPGProperty* origParent =
-            pgman->GetProperty(wxT("Window Styles"))->GetParent();
+            pgman->GetProperty("Window Styles")->GetParent();
 
-        p = pgman->RemoveProperty(wxT("Window Styles"));
+        // For testing purposes, let's set some custom cell colours
+        p = pgman->GetProperty("Window Styles");
+        p->SetCell(2, wxPGCell("style"));
+        p = pgman->RemoveProperty("Window Styles");
         pgman->Refresh();
         pgman->Update();
 
         pgman->AppendIn(origParent, p);
+        wxASSERT( p->GetCell(2).GetText() == "style");
         pgman->Refresh();
         pgman->Update();
     }
@@ -1131,7 +1135,7 @@ bool FormMain::RunTests( bool fullTest, bool interactive )
         InitPanel();
 
         const int trySplitterPos = 50;
-    
+
         int style = wxPG_AUTO_SORT;  // wxPG_SPLITTER_AUTO_CENTER;
         pgman = m_pPropGridManager =
             new wxPropertyGridManager(m_panel, wxID_ANY,