Execute automated tests for wxPropertyGrid

Move existing manually executed tests in propgrid sample to the test
suite executed automatically.
This commit is contained in:
Artur Wieczorek
2023-01-30 17:28:17 +01:00
committed by AW
parent 93c6551364
commit ec25a5c83c
22 changed files with 2005 additions and 1997 deletions
+64
View File
@@ -656,3 +656,67 @@ bool wxArrayDoubleProperty::ValidateValue(wxVariant& value,
return true;
}
// -----------------------------------------------------------------------
// MyColourProperty
// -----------------------------------------------------------------------
// Test customizing wxColourProperty via subclassing
// * Includes custom colour entry.
// * Includes extra custom entry.
MyColourProperty::MyColourProperty(const wxString& label,
const wxString& name,
const wxColour& value)
: wxColourProperty(label, name, value)
{
wxPGChoices colours;
colours.Add("White");
colours.Add("Black");
colours.Add("Red");
colours.Add("Green");
colours.Add("Blue");
colours.Add("Custom");
colours.Add("None");
m_choices = colours;
SetIndex(0);
wxVariant variant;
variant << value;
SetValue(variant);
}
wxColour MyColourProperty::GetColour(int index) const
{
switch ( index )
{
case 0: return *wxWHITE;
case 1: return *wxBLACK;
case 2: return *wxRED;
case 3: return *wxGREEN;
case 4: return *wxBLUE;
case 5:
// Return current colour for the custom entry
wxColour col;
if ( GetIndex() == GetCustomColourIndex() )
{
if ( m_value.IsNull() )
return col;
col << m_value;
return col;
}
return *wxWHITE;
}
return wxColour();
}
wxString MyColourProperty::ColourToString(const wxColour& col, int index, int argFlags) const
{
if ( index == (int)(m_choices.GetCount() - 1) )
return wxEmptyString;
return wxColourProperty::ColourToString(col, index, argFlags);
}
int MyColourProperty::GetCustomColourIndex() const
{
return m_choices.GetCount() - 2;
}