Remove more wxT() macros from samples

Also use wxString instead of wxChar* strings.

Closes https://github.com/wxWidgets/wxWidgets/pull/950
This commit is contained in:
Blake Eryx
2018-09-28 21:45:15 -04:00
committed by Vadim Zeitlin
parent 480047ee9a
commit b70ed2d8c8
67 changed files with 1926 additions and 1932 deletions

View File

@@ -45,13 +45,13 @@ public:
: wxColourProperty(label, name, value)
{
wxPGChoices colours;
colours.Add(wxT("White"));
colours.Add(wxT("Black"));
colours.Add(wxT("Red"));
colours.Add(wxT("Green"));
colours.Add(wxT("Blue"));
colours.Add(wxT("Custom"));
colours.Add(wxT("None"));
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;
@@ -106,24 +106,24 @@ public:
void FormMain::AddTestProperties( wxPropertyGridPage* pg )
{
pg->Append( new MyColourProperty(wxT("CustomColourProperty"), wxPG_LABEL, *wxGREEN) );
pg->GetProperty(wxT("CustomColourProperty"))->SetAutoUnspecified(true);
pg->SetPropertyEditor( wxT("CustomColourProperty"), wxPGEditor_ComboBox );
pg->Append( new MyColourProperty("CustomColourProperty", wxPG_LABEL, *wxGREEN) );
pg->GetProperty("CustomColourProperty")->SetAutoUnspecified(true);
pg->SetPropertyEditor( "CustomColourProperty", wxPGEditor_ComboBox );
pg->SetPropertyHelpString(wxT("CustomColourProperty"),
wxT("This is a MyColourProperty from the sample app. ")
wxT("It is built by subclassing wxColourProperty."));
pg->SetPropertyHelpString("CustomColourProperty",
"This is a MyColourProperty from the sample app. "
"It is built by subclassing wxColourProperty.");
}
// -----------------------------------------------------------------------
void FormMain::OnDumpList( wxCommandEvent& WXUNUSED(event) )
{
wxVariant values = m_pPropGridManager->GetPropertyValues(wxT("list"), wxNullProperty, wxPG_INC_ATTRIBUTES);
wxString text = wxT("This only tests that wxVariant related routines do not crash.");
wxVariant values = m_pPropGridManager->GetPropertyValues("list", wxNullProperty, wxPG_INC_ATTRIBUTES);
wxString text = "This only tests that wxVariant related routines do not crash.";
wxString t;
wxDialog* dlg = new wxDialog(this,wxID_ANY,wxT("wxVariant Test"),
wxDialog* dlg = new wxDialog(this,wxID_ANY,"wxVariant Test",
wxDefaultPosition,wxDefaultSize,wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER);
unsigned int i;
@@ -134,26 +134,26 @@ void FormMain::OnDumpList( wxCommandEvent& WXUNUSED(event) )
wxString strValue = v.GetString();
#if wxCHECK_VERSION(2,8,0)
if ( v.GetName().EndsWith(wxT("@attr")) )
if ( v.GetName().EndsWith("@attr") )
#else
if ( v.GetName().Right(5) == wxT("@attr") )
if ( v.GetName().Right(5) == "@attr" )
#endif
{
text += wxString::Format(wxT("Attributes:\n"));
text += wxString::Format("Attributes:\n");
unsigned int n;
for ( n = 0; n < (unsigned int)v.GetCount(); n++ )
{
wxVariant& a = v[n];
t.Printf(wxT(" attribute %i: name=\"%s\" (type=\"%s\" value=\"%s\")\n"),(int)n,
t.Printf(" attribute %i: name=\"%s\" (type=\"%s\" value=\"%s\")\n",(int)n,
a.GetName().c_str(),a.GetType().c_str(),a.GetString().c_str());
text += t;
}
}
else
{
t.Printf(wxT("%i: name=\"%s\" type=\"%s\" value=\"%s\"\n"),(int)i,
t.Printf("%i: name=\"%s\" type=\"%s\" value=\"%s\"\n",(int)i,
v.GetName().c_str(),v.GetType().c_str(),strValue.c_str());
text += t;
}
@@ -169,7 +169,7 @@ void FormMain::OnDumpList( wxCommandEvent& WXUNUSED(event) )
rowsizer->Add( ed, wxSizerFlags(1).Expand().Border(wxALL, spacing));
topsizer->Add( rowsizer, wxSizerFlags(1).Expand());
rowsizer = new wxBoxSizer( wxHORIZONTAL );
rowsizer->Add( new wxButton(dlg,wxID_OK,wxT("Ok")),
rowsizer->Add( new wxButton(dlg,wxID_OK,"Ok"),
wxSizerFlags(0).CentreHorizontal().CentreVertical().Border(wxBOTTOM|wxLEFT|wxRIGHT, spacing));
topsizer->Add( rowsizer, wxSizerFlags().Right() );
@@ -197,8 +197,8 @@ public:
m_preWarnings = wxPGGlobalVars->m_warnings;
#endif
if ( name != wxT("none") )
Msg(name+wxT("\n"));
if ( name != "none" )
Msg(name+"\n");
}
~TestRunner()
@@ -207,7 +207,7 @@ public:
int warningsOccurred = wxPGGlobalVars->m_warnings - m_preWarnings;
if ( warningsOccurred )
{
wxString s = wxString::Format(wxT("%i warnings occurred during test '%s'"), warningsOccurred, m_name.c_str());
wxString s = wxString::Format("%i warnings occurred during test '%s'", warningsOccurred, m_name.c_str());
m_errorMessages->push_back(s);
Msg(s);
}
@@ -219,7 +219,7 @@ public:
if ( m_ed )
{
m_ed->AppendText(text);
m_ed->AppendText(wxT("\n"));
m_ed->AppendText("\n");
}
wxLogDebug(text);
}
@@ -236,14 +236,14 @@ protected:
#define RT_START_TEST(TESTNAME) \
TestRunner tr(wxT(#TESTNAME), pgman, ed, &errorMessages);
TestRunner tr(#TESTNAME, pgman, ed, &errorMessages);
#define RT_MSG(S) \
tr.Msg(S);
#define RT_FAILURE() \
{ \
wxString s1 = wxString::Format(wxT("Test failure in tests.cpp, line %i."),__LINE__-1); \
wxString s1 = wxString::Format("Test failure in tests.cpp, line %i.",__LINE__-1); \
errorMessages.push_back(s1); \
wxLogDebug(s1); \
failures++; \
@@ -255,10 +255,10 @@ protected:
#define RT_FAILURE_MSG(MSG) \
{ \
wxString s1 = wxString::Format(wxT("Test failure in tests.cpp, line %i."),__LINE__-1); \
wxString s1 = wxString::Format("Test failure in tests.cpp, line %i.",__LINE__-1); \
errorMessages.push_back(s1); \
wxLogDebug(s1); \
wxString s2 = wxString::Format(wxT("Message: %s"),MSG.c_str()); \
wxString s2 = wxString::Format("Message: %s",MSG.c_str()); \
errorMessages.push_back(s2); \
wxLogDebug(s2); \
failures++; \
@@ -270,7 +270,7 @@ protected:
unsigned int h2_ = PROPS->GetActualVirtualHeight(); \
if ( h1_ != h2_ ) \
{ \
wxString s_ = wxString::Format(wxT("VirtualHeight = %i, should be %i (%s)"), h1_, h2_, EXTRATEXT.c_str()); \
wxString s_ = wxString::Format("VirtualHeight = %i, should be %i (%s)", h1_, h2_, EXTRATEXT.c_str()); \
RT_FAILURE_MSG(s_); \
_failed_ = true; \
} \
@@ -342,7 +342,7 @@ bool FormMain::RunTests( bool fullTest, bool interactive )
wxArrayString errorMessages;
wxDialog* dlg = NULL;
dlg = new wxDialog(this,wxID_ANY,wxT("wxPropertyGrid Regression Tests"),
dlg = new wxDialog(this,wxID_ANY,"wxPropertyGrid Regression Tests",
wxDefaultPosition,wxDefaultSize,wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER);
// multi-line text editor dialog
@@ -355,7 +355,7 @@ bool FormMain::RunTests( bool fullTest, bool interactive )
rowsizer->Add( ed, wxSizerFlags(1).Expand().Border(wxALL, spacing));
topsizer->Add( rowsizer, wxSizerFlags(1).Expand());
rowsizer = new wxBoxSizer( wxHORIZONTAL );
rowsizer->Add( new wxButton(dlg,wxID_OK,wxT("Ok")),
rowsizer->Add( new wxButton(dlg,wxID_OK,"Ok"),
wxSizerFlags(0).CentreHorizontal().CentreVertical().Border(wxBOTTOM|wxLEFT|wxRIGHT, spacing));
topsizer->Add( rowsizer, wxSizerFlags().Right() );
@@ -382,13 +382,13 @@ bool FormMain::RunTests( bool fullTest, bool interactive )
{
wxPGProperty* p = it.GetProperty();
if ( p->IsCategory() )
RT_FAILURE_MSG(wxString::Format(wxT("'%s' is a category (non-private child property expected)"),p->GetLabel().c_str()))
RT_FAILURE_MSG(wxString::Format("'%s' is a category (non-private child property expected)",p->GetLabel().c_str()))
else if ( p->GetParent()->HasFlag(wxPG_PROP_AGGREGATE) )
RT_FAILURE_MSG(wxString::Format(wxT("'%s' is a private child (non-private child property expected)"),p->GetLabel().c_str()))
RT_FAILURE_MSG(wxString::Format("'%s' is a private child (non-private child property expected)",p->GetLabel().c_str()))
count++;
}
RT_MSG(wxString::Format(wxT("GetVIterator(wxPG_ITERATE_PROPERTIES) -> %i entries"), count));
RT_MSG(wxString::Format("GetVIterator(wxPG_ITERATE_PROPERTIES) -> %i entries", count));
count = 0;
for ( it = pgman->GetVIterator(wxPG_ITERATE_CATEGORIES);
@@ -397,11 +397,11 @@ bool FormMain::RunTests( bool fullTest, bool interactive )
{
wxPGProperty* p = it.GetProperty();
if ( !p->IsCategory() )
RT_FAILURE_MSG(wxString::Format(wxT("'%s' is not a category (only category was expected)"),p->GetLabel().c_str()))
RT_FAILURE_MSG(wxString::Format("'%s' is not a category (only category was expected)",p->GetLabel().c_str()))
count++;
}
RT_MSG(wxString::Format(wxT("GetVIterator(wxPG_ITERATE_CATEGORIES) -> %i entries"), count));
RT_MSG(wxString::Format("GetVIterator(wxPG_ITERATE_CATEGORIES) -> %i entries", count));
count = 0;
for ( it = pgman->GetVIterator(wxPG_ITERATE_PROPERTIES|wxPG_ITERATE_CATEGORIES);
@@ -410,11 +410,11 @@ bool FormMain::RunTests( bool fullTest, bool interactive )
{
wxPGProperty* p = it.GetProperty();
if ( p->GetParent()->HasFlag(wxPG_PROP_AGGREGATE) )
RT_FAILURE_MSG(wxString::Format(wxT("'%s' is a private child (non-private child property or category expected)"),p->GetLabel().c_str()))
RT_FAILURE_MSG(wxString::Format("'%s' is a private child (non-private child property or category expected)",p->GetLabel().c_str()))
count++;
}
RT_MSG(wxString::Format(wxT("GetVIterator(wxPG_ITERATE_PROPERTIES|wxPG_ITERATE_CATEGORIES) -> %i entries"), count));
RT_MSG(wxString::Format("GetVIterator(wxPG_ITERATE_PROPERTIES|wxPG_ITERATE_CATEGORIES) -> %i entries", count));
count = 0;
for ( it = pgman->GetVIterator(wxPG_ITERATE_VISIBLE);
@@ -423,13 +423,13 @@ bool FormMain::RunTests( bool fullTest, bool interactive )
{
wxPGProperty* p = it.GetProperty();
if ( (p->GetParent() != p->GetParentState()->DoGetRoot() && !p->GetParent()->IsExpanded()) )
RT_FAILURE_MSG(wxString::Format(wxT("'%s' had collapsed parent (only visible properties expected)"),p->GetLabel().c_str()))
RT_FAILURE_MSG(wxString::Format("'%s' had collapsed parent (only visible properties expected)",p->GetLabel().c_str()))
else if ( p->HasFlag(wxPG_PROP_HIDDEN) )
RT_FAILURE_MSG(wxString::Format(wxT("'%s' was hidden (only visible properties expected)"),p->GetLabel().c_str()))
RT_FAILURE_MSG(wxString::Format("'%s' was hidden (only visible properties expected)",p->GetLabel().c_str()))
count++;
}
RT_MSG(wxString::Format(wxT("GetVIterator(wxPG_ITERATE_VISIBLE) -> %i entries"), count));
RT_MSG(wxString::Format("GetVIterator(wxPG_ITERATE_VISIBLE) -> %i entries", count));
}
if ( fullTest )
@@ -476,7 +476,7 @@ bool FormMain::RunTests( bool fullTest, bool interactive )
for ( it2 = array.rbegin(); it2 != array.rend(); ++it2 )
{
wxPGProperty* p = (wxPGProperty*)*it2;
RT_MSG(wxString::Format(wxT("Deleting '%s' ('%s')"),p->GetLabel().c_str(),p->GetName().c_str()));
RT_MSG(wxString::Format("Deleting '%s' ('%s')",p->GetLabel().c_str(),p->GetName().c_str()));
pgman->DeleteProperty(p);
}
@@ -521,7 +521,7 @@ bool FormMain::RunTests( bool fullTest, bool interactive )
wxAny any;
#if wxUSE_DATETIME
prop = pgman->GetProperty(wxT("DateProperty"));
prop = pgman->GetProperty("DateProperty");
wxDateTime testTime = wxDateTime::Now();
any = testTime;
prop->SetValue(any);
@@ -529,7 +529,7 @@ bool FormMain::RunTests( bool fullTest, bool interactive )
RT_FAILURE();
#endif
prop = pgman->GetProperty(wxT("IntProperty"));
prop = pgman->GetProperty("IntProperty");
int testInt = 25537983;
any = testInt;
prop->SetValue(any);
@@ -540,15 +540,15 @@ bool FormMain::RunTests( bool fullTest, bool interactive )
RT_FAILURE();
#endif
prop = pgman->GetProperty(wxT("StringProperty"));
wxString testString = wxT("asd934jfyn3");
prop = pgman->GetProperty("StringProperty");
wxString testString = "asd934jfyn3";
any = testString;
prop->SetValue(any);
if ( prop->GetValue().GetAny().As<wxString>() != testString )
RT_FAILURE();
// Test with a type generated with IMPLEMENT_VARIANT_OBJECT()
prop = pgman->GetProperty(wxT("ColourProperty"));
prop = pgman->GetProperty("ColourProperty");
wxColour testCol = *wxCYAN;
any = testCol;
prop->SetValue(any);
@@ -557,7 +557,7 @@ bool FormMain::RunTests( bool fullTest, bool interactive )
// Test with a type with custom wxVariantData defined by
// wxPG headers.
prop = pgman->GetProperty(wxT("Position"));
prop = pgman->GetProperty("Position");
wxPoint testPoint(199, 199);
any = testPoint;
prop->SetValue(any);
@@ -580,7 +580,7 @@ bool FormMain::RunTests( bool fullTest, bool interactive )
{
wxVariant& v = values[j];
t.Printf(wxT("%i: name=\"%s\" type=\"%s\"\n"),(int)j,
t.Printf("%i: name=\"%s\" type=\"%s\"\n",(int)j,
v.GetName().c_str(),v.GetType().c_str());
text += t;
@@ -592,21 +592,21 @@ bool FormMain::RunTests( bool fullTest, bool interactive )
{
RT_START_TEST(SetPropertyValue_and_GetPropertyValue)
// In this section, mixed up usage of wxT("propname") and "propname"
// In this section, mixed up usage of "propname" and "propname"
// in wxPropertyGridInterface functions is intentional.
// Purpose is to test wxPGPropArgCls ctors.
//pg = (wxPropertyGrid*) NULL;
wxArrayString test_arrstr_1;
test_arrstr_1.Add(wxT("Apple"));
test_arrstr_1.Add(wxT("Orange"));
test_arrstr_1.Add(wxT("Lemon"));
test_arrstr_1.Add("Apple");
test_arrstr_1.Add("Orange");
test_arrstr_1.Add("Lemon");
wxArrayString test_arrstr_2;
test_arrstr_2.Add(wxT("Potato"));
test_arrstr_2.Add(wxT("Cabbage"));
test_arrstr_2.Add(wxT("Cucumber"));
test_arrstr_2.Add("Potato");
test_arrstr_2.Add("Cabbage");
test_arrstr_2.Add("Cucumber");
wxArrayInt test_arrint_1;
test_arrint_1.Add(1);
@@ -632,117 +632,117 @@ bool FormMain::RunTests( bool fullTest, bool interactive )
#define FLAG_TEST_SET1 (wxCAPTION|wxCLOSE_BOX|wxSYSTEM_MENU|wxRESIZE_BORDER)
#define FLAG_TEST_SET2 (wxSTAY_ON_TOP|wxCAPTION|wxICONIZE|wxSYSTEM_MENU)
pgman->SetPropertyValue(wxT("StringProperty"),wxT("Text1"));
pgman->SetPropertyValue(wxT("IntProperty"),1024);
pgman->SetPropertyValue(wxT("FloatProperty"),1024.0000000001);
pgman->SetPropertyValue(wxT("BoolProperty"),false);
pgman->SetPropertyValue(wxT("EnumProperty"),120);
pgman->SetPropertyValue(wxT("ArrayStringProperty"),test_arrstr_1);
pgman->SetPropertyValue("StringProperty","Text1");
pgman->SetPropertyValue("IntProperty",1024);
pgman->SetPropertyValue("FloatProperty",1024.0000000001);
pgman->SetPropertyValue("BoolProperty",false);
pgman->SetPropertyValue("EnumProperty",120);
pgman->SetPropertyValue("ArrayStringProperty",test_arrstr_1);
wxColour emptyCol;
pgman->SetPropertyValue(wxT("ColourProperty"),emptyCol);
pgman->SetPropertyValue(wxT("ColourProperty"),(wxObject*)wxBLACK);
pgman->SetPropertyValue(wxT("Size"),WXVARIANT(wxSize(150,150)));
pgman->SetPropertyValue(wxT("Position"),WXVARIANT(wxPoint(150,150)));
pgman->SetPropertyValue(wxT("MultiChoiceProperty"),test_arrint_1);
pgman->SetPropertyValue("ColourProperty",emptyCol);
pgman->SetPropertyValue("ColourProperty",(wxObject*)wxBLACK);
pgman->SetPropertyValue("Size",WXVARIANT(wxSize(150,150)));
pgman->SetPropertyValue("Position",WXVARIANT(wxPoint(150,150)));
pgman->SetPropertyValue("MultiChoiceProperty",test_arrint_1);
#if wxUSE_DATETIME
pgman->SetPropertyValue(wxT("DateProperty"),dt1);
pgman->SetPropertyValue("DateProperty",dt1);
#endif
pgman->SelectPage(2);
pg = pgman->GetGrid();
if ( pg->GetPropertyValueAsString(wxT("StringProperty")) != wxT("Text1") )
if ( pg->GetPropertyValueAsString("StringProperty") != "Text1" )
RT_FAILURE();
if ( pg->GetPropertyValueAsInt(wxT("IntProperty")) != 1024 )
if ( pg->GetPropertyValueAsInt("IntProperty") != 1024 )
RT_FAILURE();
if ( pg->GetPropertyValueAsDouble(wxT("FloatProperty")) != 1024.0000000001 )
if ( pg->GetPropertyValueAsDouble("FloatProperty") != 1024.0000000001 )
RT_FAILURE();
if ( pg->GetPropertyValueAsBool(wxT("BoolProperty")) != false )
if ( pg->GetPropertyValueAsBool("BoolProperty") != false )
RT_FAILURE();
if ( pg->GetPropertyValueAsLong(wxT("EnumProperty")) != 120 )
if ( pg->GetPropertyValueAsLong("EnumProperty") != 120 )
RT_FAILURE();
if ( pg->GetPropertyValueAsArrayString(wxT("ArrayStringProperty")) != test_arrstr_1 )
if ( pg->GetPropertyValueAsArrayString("ArrayStringProperty") != test_arrstr_1 )
RT_FAILURE();
wxColour col;
col << pgman->GetPropertyValue(wxT("ColourProperty"));
col << pgman->GetPropertyValue("ColourProperty");
if ( col != *wxBLACK )
RT_FAILURE();
wxVariant varSize(pg->GetPropertyValue(wxT("Size")));
wxVariant varSize(pg->GetPropertyValue("Size"));
if ( wxSizeRefFromVariant(varSize) != wxSize(150,150) )
RT_FAILURE();
wxVariant varPos(pg->GetPropertyValue(wxT("Position")));
wxVariant varPos(pg->GetPropertyValue("Position"));
if ( wxPointRefFromVariant(varPos) != wxPoint(150,150) )
RT_FAILURE();
if ( !(pg->GetPropertyValueAsArrayInt(wxT("MultiChoiceProperty")) == test_arrint_1) )
if ( !(pg->GetPropertyValueAsArrayInt("MultiChoiceProperty") == test_arrint_1) )
RT_FAILURE();
#if wxUSE_DATETIME
if ( !(pg->GetPropertyValueAsDateTime(wxT("DateProperty")) == dt1) )
if ( !(pg->GetPropertyValueAsDateTime("DateProperty") == dt1) )
RT_FAILURE();
#endif
#if wxUSE_LONGLONG && defined(wxLongLong_t)
pgman->SetPropertyValue(wxT("IntProperty"),wxLL(10000000000));
if ( pg->GetPropertyValueAsLongLong(wxT("IntProperty")) != wxLL(10000000000) )
pgman->SetPropertyValue("IntProperty",wxLL(10000000000));
if ( pg->GetPropertyValueAsLongLong("IntProperty") != wxLL(10000000000) )
RT_FAILURE();
#else
pgman->SetPropertyValue(wxT("IntProperty"),1000000000);
if ( pg->GetPropertyValueAsLong(wxT("IntProperty")) != 1000000000 )
pgman->SetPropertyValue("IntProperty",1000000000);
if ( pg->GetPropertyValueAsLong("IntProperty") != 1000000000 )
RT_FAILURE();
#endif
pg->SetPropertyValue(wxT("StringProperty"),wxT("Text2"));
pg->SetPropertyValue(wxT("IntProperty"),512);
pg->SetPropertyValue(wxT("FloatProperty"),512.0);
pg->SetPropertyValue(wxT("BoolProperty"),true);
pg->SetPropertyValue(wxT("EnumProperty"),80);
pg->SetPropertyValue(wxT("ArrayStringProperty"),test_arrstr_2);
pg->SetPropertyValue(wxT("ColourProperty"),(wxObject*)wxWHITE);
pg->SetPropertyValue(wxT("Size"),WXVARIANT(wxSize(300,300)));
pg->SetPropertyValue(wxT("Position"),WXVARIANT(wxPoint(300,300)));
pg->SetPropertyValue(wxT("MultiChoiceProperty"),test_arrint_2);
pg->SetPropertyValue("StringProperty","Text2");
pg->SetPropertyValue("IntProperty",512);
pg->SetPropertyValue("FloatProperty",512.0);
pg->SetPropertyValue("BoolProperty",true);
pg->SetPropertyValue("EnumProperty",80);
pg->SetPropertyValue("ArrayStringProperty",test_arrstr_2);
pg->SetPropertyValue("ColourProperty",(wxObject*)wxWHITE);
pg->SetPropertyValue("Size",WXVARIANT(wxSize(300,300)));
pg->SetPropertyValue("Position",WXVARIANT(wxPoint(300,300)));
pg->SetPropertyValue("MultiChoiceProperty",test_arrint_2);
#if wxUSE_DATETIME
pg->SetPropertyValue(wxT("DateProperty"),dt2);
pg->SetPropertyValue("DateProperty",dt2);
#endif
//pg = (wxPropertyGrid*) NULL;
pgman->SelectPage(0);
if ( pgman->GetPropertyValueAsString(wxT("StringProperty")) != wxT("Text2") )
if ( pgman->GetPropertyValueAsString("StringProperty") != "Text2" )
RT_FAILURE();
if ( pgman->GetPropertyValueAsInt(wxT("IntProperty")) != 512 )
if ( pgman->GetPropertyValueAsInt("IntProperty") != 512 )
RT_FAILURE();
if ( pgman->GetPropertyValueAsDouble(wxT("FloatProperty")) != 512.0 )
if ( pgman->GetPropertyValueAsDouble("FloatProperty") != 512.0 )
RT_FAILURE();
if ( pgman->GetPropertyValueAsBool(wxT("BoolProperty")) != true )
if ( pgman->GetPropertyValueAsBool("BoolProperty") != true )
RT_FAILURE();
if ( pgman->GetPropertyValueAsLong(wxT("EnumProperty")) != 80 )
if ( pgman->GetPropertyValueAsLong("EnumProperty") != 80 )
RT_FAILURE();
if ( pgman->GetPropertyValueAsArrayString(wxT("ArrayStringProperty")) != test_arrstr_2 )
if ( pgman->GetPropertyValueAsArrayString("ArrayStringProperty") != test_arrstr_2 )
RT_FAILURE();
col << pgman->GetPropertyValue(wxT("ColourProperty"));
col << pgman->GetPropertyValue("ColourProperty");
if ( col != *wxWHITE )
RT_FAILURE();
varSize = pgman->GetPropertyValue(wxT("Size"));
varSize = pgman->GetPropertyValue("Size");
if ( wxSizeRefFromVariant(varSize) != wxSize(300,300) )
RT_FAILURE();
varPos = pgman->GetPropertyValue(wxT("Position"));
varPos = pgman->GetPropertyValue("Position");
if ( wxPointRefFromVariant(varPos) != wxPoint(300,300) )
RT_FAILURE();
if ( !(pgman->GetPropertyValueAsArrayInt(wxT("MultiChoiceProperty")) == test_arrint_2) )
if ( !(pgman->GetPropertyValueAsArrayInt("MultiChoiceProperty") == test_arrint_2) )
RT_FAILURE();
#if wxUSE_DATETIME
if ( !(pgman->GetPropertyValueAsDateTime(wxT("DateProperty")) == dt2) )
if ( !(pgman->GetPropertyValueAsDateTime("DateProperty") == dt2) )
RT_FAILURE();
#endif
#if wxUSE_LONGLONG && defined(wxLongLong_t)
pgman->SetPropertyValue(wxT("IntProperty"),wxLL(-80000000000));
if ( pgman->GetPropertyValueAsLongLong(wxT("IntProperty")) != wxLL(-80000000000) )
pgman->SetPropertyValue("IntProperty",wxLL(-80000000000));
if ( pgman->GetPropertyValueAsLongLong("IntProperty") != wxLL(-80000000000) )
RT_FAILURE();
#else
pgman->SetPropertyValue(wxT("IntProperty"),-1000000000);
if ( pgman->GetPropertyValueAsLong(wxT("IntProperty")) != -1000000000 )
pgman->SetPropertyValue("IntProperty",-1000000000);
if ( pgman->GetPropertyValueAsLong("IntProperty") != -1000000000 )
RT_FAILURE();
#endif
@@ -751,46 +751,46 @@ bool FormMain::RunTests( bool fullTest, bool interactive )
//
// This updates children as well
wxString nvs = wxT("Lamborghini Diablo XYZ; 5707; [100; 3.9; 8.6] 3000002; Convertible");
wxString nvs = "Lamborghini Diablo XYZ; 5707; [100; 3.9; 8.6] 3000002; Convertible";
pgman->SetPropertyValue("Car", nvs);
if ( pgman->GetPropertyValueAsString(wxT("Car.Model")) != wxT("Lamborghini Diablo XYZ") )
if ( pgman->GetPropertyValueAsString("Car.Model") != "Lamborghini Diablo XYZ" )
{
RT_FAILURE_MSG(wxString::Format(wxS("Did not match: Car.Model=%s"), pgman->GetPropertyValueAsString(wxS("Car.Model")).c_str()));
}
if ( pgman->GetPropertyValueAsInt(wxT("Car.Speeds.Max. Speed (mph)")) != 100 )
if ( pgman->GetPropertyValueAsInt("Car.Speeds.Max. Speed (mph)") != 100 )
{
RT_FAILURE_MSG(wxString::Format(wxS("Did not match: Car.Speeds.Max. Speed (mph)=%s"), pgman->GetPropertyValueAsString(wxS("Car.Speeds.Max. Speed (mph)")).c_str()));
RT_FAILURE_MSG(wxString::Format("Did not match: Car.Speeds.Max. Speed (mph)=%s", pgman->GetPropertyValueAsString(wxS("Car.Speeds.Max. Speed (mph)")).c_str()));
}
if ( pgman->GetPropertyValueAsInt(wxT("Car.Price ($)")) != 3000002 )
if ( pgman->GetPropertyValueAsInt("Car.Price ($)") != 3000002 )
{
RT_FAILURE_MSG(wxString::Format(wxS("Did not match: Car.Price ($)=%s"), pgman->GetPropertyValueAsString(wxS("Car.Price ($)")).c_str()));
}
if ( !pgman->GetPropertyValueAsBool(wxT("Car.Convertible")) )
if ( !pgman->GetPropertyValueAsBool("Car.Convertible") )
{
RT_FAILURE_MSG(wxString::Format(wxS("Did not match: Car.Convertible=%s"), pgman->GetPropertyValueAsString(wxS("Car.Convertible")).c_str()));
RT_FAILURE_MSG(wxString::Format("Did not match: Car.Convertible=%s", pgman->GetPropertyValueAsString(wxS("Car.Convertible")).c_str()));
}
// SetPropertyValueString for special cases such as wxColour
pgman->SetPropertyValueString(wxT("ColourProperty"), wxT("(123,4,255)"));
col << pgman->GetPropertyValue(wxT("ColourProperty"));
pgman->SetPropertyValueString("ColourProperty", "(123,4,255)");
col << pgman->GetPropertyValue("ColourProperty");
if ( col != wxColour(123, 4, 255) )
RT_FAILURE();
pgman->SetPropertyValueString(wxT("ColourProperty"), wxT("#FE860B"));
col << pgman->GetPropertyValue(wxT("ColourProperty"));
pgman->SetPropertyValueString("ColourProperty", "#FE860B");
col << pgman->GetPropertyValue("ColourProperty");
if ( col != wxColour(254, 134, 11) )
RT_FAILURE();
pgman->SetPropertyValueString(wxT("ColourPropertyWithAlpha"),
wxT("(10, 20, 30, 128)"));
col << pgman->GetPropertyValue(wxT("ColourPropertyWithAlpha"));
pgman->SetPropertyValueString("ColourPropertyWithAlpha",
"(10, 20, 30, 128)");
col << pgman->GetPropertyValue("ColourPropertyWithAlpha");
if ( col != wxColour(10, 20, 30, 128) )
RT_FAILURE();
if ( pgman->GetPropertyValueAsString(wxT("ColourPropertyWithAlpha"))
!= wxT("(10,20,30,128)") )
if ( pgman->GetPropertyValueAsString("ColourPropertyWithAlpha")
!= "(10,20,30,128)" )
RT_FAILURE();
}
@@ -798,18 +798,18 @@ bool FormMain::RunTests( bool fullTest, bool interactive )
RT_START_TEST(SetPropertyValueUnspecified)
// Null variant setter tests
pgman->SetPropertyValueUnspecified(wxT("StringProperty"));
pgman->SetPropertyValueUnspecified(wxT("IntProperty"));
pgman->SetPropertyValueUnspecified(wxT("FloatProperty"));
pgman->SetPropertyValueUnspecified(wxT("BoolProperty"));
pgman->SetPropertyValueUnspecified(wxT("EnumProperty"));
pgman->SetPropertyValueUnspecified(wxT("ArrayStringProperty"));
pgman->SetPropertyValueUnspecified(wxT("ColourProperty"));
pgman->SetPropertyValueUnspecified(wxT("Size"));
pgman->SetPropertyValueUnspecified(wxT("Position"));
pgman->SetPropertyValueUnspecified(wxT("MultiChoiceProperty"));
pgman->SetPropertyValueUnspecified("StringProperty");
pgman->SetPropertyValueUnspecified("IntProperty");
pgman->SetPropertyValueUnspecified("FloatProperty");
pgman->SetPropertyValueUnspecified("BoolProperty");
pgman->SetPropertyValueUnspecified("EnumProperty");
pgman->SetPropertyValueUnspecified("ArrayStringProperty");
pgman->SetPropertyValueUnspecified("ColourProperty");
pgman->SetPropertyValueUnspecified("Size");
pgman->SetPropertyValueUnspecified("Position");
pgman->SetPropertyValueUnspecified("MultiChoiceProperty");
#if wxUSE_DATETIME
pgman->SetPropertyValueUnspecified(wxT("DateProperty"));
pgman->SetPropertyValueUnspecified("DateProperty");
#endif
}
@@ -823,10 +823,10 @@ bool FormMain::RunTests( bool fullTest, bool interactive )
pg = pgman->GetGrid();
wxPGProperty* prop1 = pg->GetProperty(wxT("Label"));
wxPGProperty* prop2 = pg->GetProperty(wxT("Cell Text Colour"));
wxPGProperty* prop3 = pg->GetProperty(wxT("Height"));
wxPGProperty* catProp = pg->GetProperty(wxT("Appearance"));
wxPGProperty* prop1 = pg->GetProperty("Label");
wxPGProperty* prop2 = pg->GetProperty("Cell Text Colour");
wxPGProperty* prop3 = pg->GetProperty("Height");
wxPGProperty* catProp = pg->GetProperty("Appearance");
RT_ASSERT( prop1 && prop2 && prop3 );
@@ -882,7 +882,7 @@ bool FormMain::RunTests( bool fullTest, bool interactive )
pg->MakeColumnEditable(2, true);
pg->MakeColumnEditable(0, false);
pg->MakeColumnEditable(2, false);
pg->SelectProperty(wxT("Height"));
pg->SelectProperty("Height");
pg->BeginLabelEdit(0);
pg->BeginLabelEdit(0);
pg->EndLabelEdit(0);
@@ -896,15 +896,15 @@ bool FormMain::RunTests( bool fullTest, bool interactive )
{
RT_START_TEST(Attributes)
wxPGProperty* prop = pgman->GetProperty(wxT("StringProperty"));
prop->SetAttribute(wxT("Dummy Attribute"), (long)15);
wxPGProperty* prop = pgman->GetProperty("StringProperty");
prop->SetAttribute("Dummy Attribute", (long)15);
if ( prop->GetAttribute(wxT("Dummy Attribute")).GetLong() != 15 )
if ( prop->GetAttribute("Dummy Attribute").GetLong() != 15 )
RT_FAILURE();
prop->SetAttribute(wxT("Dummy Attribute"), wxVariant());
prop->SetAttribute("Dummy Attribute", wxVariant());
if ( !prop->GetAttribute(wxT("Dummy Attribute")).IsNull() )
if ( !prop->GetAttribute("Dummy Attribute").IsNull() )
RT_FAILURE();
}
@@ -913,20 +913,20 @@ bool FormMain::RunTests( bool fullTest, bool interactive )
RT_START_TEST(DoubleToString)
// Locale-specific decimal separator
wxString sep = wxString::Format(wxT("%g"), 1.1)[1];
wxString sep = wxString::Format("%g", 1.1)[1];
wxString s;
if ( wxPropertyGrid::DoubleToString(s, 123.123, 2, true) !=
wxString::Format(wxT("123%s12"), sep.c_str()) )
wxString::Format("123%s12", sep.c_str()) )
RT_FAILURE();
if ( wxPropertyGrid::DoubleToString(s, -123.123, 4, false) !=
wxString::Format(wxT("-123%s1230"), sep.c_str()) )
wxString::Format("-123%s1230", sep.c_str()) )
RT_FAILURE();
if ( wxPropertyGrid::DoubleToString(s, -0.02, 1, false) !=
wxString::Format(wxT("0%s0"), sep) )
wxString::Format("0%s0", sep) )
RT_FAILURE();
if ( wxPropertyGrid::DoubleToString(s, -0.000123, 3, true) != wxT("0") )
if ( wxPropertyGrid::DoubleToString(s, -0.000123, 3, true) != "0" )
RT_FAILURE();
}
#endif
@@ -943,11 +943,11 @@ bool FormMain::RunTests( bool fullTest, bool interactive )
RT_START_TEST(GetPropertyValues)
page1 = pgman->GetPage(0);
pg1_values = page1->GetPropertyValues(wxT("Page1"),NULL,wxPG_KEEP_STRUCTURE);
pg1_values = page1->GetPropertyValues("Page1",NULL,wxPG_KEEP_STRUCTURE);
page2 = pgman->GetPage(1);
pg2_values = page2->GetPropertyValues(wxT("Page2"),NULL,wxPG_KEEP_STRUCTURE);
pg2_values = page2->GetPropertyValues("Page2",NULL,wxPG_KEEP_STRUCTURE);
page3 = pgman->GetPage(2);
pg3_values = page3->GetPropertyValues(wxT("Page3"),NULL,wxPG_KEEP_STRUCTURE);
pg3_values = page3->GetPropertyValues("Page3",NULL,wxPG_KEEP_STRUCTURE);
}
{
@@ -980,7 +980,7 @@ bool FormMain::RunTests( bool fullTest, bool interactive )
page->Collapse( p );
t.Printf(wxT("Collapsing: %s\n"),page->GetPropertyLabel(p).c_str());
t.Printf("Collapsing: %s\n",page->GetPropertyLabel(p).c_str());
ed->AppendText(t);
}
}
@@ -1021,7 +1021,7 @@ bool FormMain::RunTests( bool fullTest, bool interactive )
page->Expand( p );
t.Printf(wxT("Expand: %s\n"),page->GetPropertyLabel(p).c_str());
t.Printf("Expand: %s\n",page->GetPropertyLabel(p).c_str());
ed->AppendText(t);
}
}
@@ -1030,14 +1030,14 @@ bool FormMain::RunTests( bool fullTest, bool interactive )
{
RT_START_TEST(Choice_Manipulation)
wxPGProperty* enumProp = pgman->GetProperty(wxT("EnumProperty"));
wxPGProperty* enumProp = pgman->GetProperty("EnumProperty");
pgman->SelectPage(2);
pgman->SelectProperty(enumProp);
wxASSERT(pgman->GetGrid()->GetSelection() == enumProp);
const wxPGChoices& choices = enumProp->GetChoices();
int ind = enumProp->InsertChoice(wxT("New Choice"), choices.GetCount()/2);
int ind = enumProp->InsertChoice("New Choice", choices.GetCount()/2);
enumProp->DeleteChoice(ind);
// Recreate the original grid
@@ -1084,7 +1084,7 @@ bool FormMain::RunTests( bool fullTest, bool interactive )
{
RT_START_TEST(EnsureVisible)
pgman->EnsureVisible(wxT("Cell Colour"));
pgman->EnsureVisible("Cell Colour");
}
{
@@ -1093,17 +1093,17 @@ bool FormMain::RunTests( bool fullTest, bool interactive )
wxPGProperty* p;
wxPGProperty* origParent =
pgman->GetProperty(wxT("Window Styles"))->GetParent();
pgman->GetProperty("Window Styles")->GetParent();
// For testing purposes, let's set some custom cell colours
p = pgman->GetProperty(wxT("Window Styles"));
p = pgman->GetProperty("Window Styles");
p->SetCell(2, wxPGCell("style"));
p = pgman->RemoveProperty(wxT("Window Styles"));
p = pgman->RemoveProperty("Window Styles");
pgman->Refresh();
pgman->Update();
pgman->AppendIn(origParent, p);
wxASSERT( p->GetCell(2).GetText() == wxT("style"));
wxASSERT( p->GetCell(2).GetText() == "style");
pgman->Refresh();
pgman->Update();
}
@@ -1115,40 +1115,40 @@ bool FormMain::RunTests( bool fullTest, bool interactive )
// Make sure indexes are as supposed
p = pgman->GetProperty(wxT("User Name"));
p = pgman->GetProperty("User Name");
if ( p->GetIndexInParent() != 3 )
RT_FAILURE();
p = pgman->GetProperty(wxT("User Id"));
p = pgman->GetProperty("User Id");
if ( p->GetIndexInParent() != 2 )
RT_FAILURE();
p = pgman->GetProperty(wxT("User Home"));
p = pgman->GetProperty("User Home");
if ( p->GetIndexInParent() != 1 )
RT_FAILURE();
p = pgman->GetProperty(wxT("Operating System"));
p = pgman->GetProperty("Operating System");
if ( p->GetIndexInParent() != 0 )
RT_FAILURE();
pgman->GetGrid()->SetSortFunction(MyPropertySortFunction);
pgman->GetGrid()->SortChildren(wxT("Environment"));
pgman->GetGrid()->SortChildren("Environment");
// Make sure indexes have been reversed
p = pgman->GetProperty(wxT("User Name"));
p = pgman->GetProperty("User Name");
if ( p->GetIndexInParent() != 0 )
RT_FAILURE();
p = pgman->GetProperty(wxT("User Id"));
p = pgman->GetProperty("User Id");
if ( p->GetIndexInParent() != 1 )
RT_FAILURE();
p = pgman->GetProperty(wxT("User Home"));
p = pgman->GetProperty("User Home");
if ( p->GetIndexInParent() != 2 )
RT_FAILURE();
p = pgman->GetProperty(wxT("Operating System"));
p = pgman->GetProperty("Operating System");
if ( p->GetIndexInParent() != 3 )
RT_FAILURE();
}
@@ -1166,7 +1166,7 @@ bool FormMain::RunTests( bool fullTest, bool interactive )
RT_START_TEST(Clear)
// Manager clear
pgman->SelectProperty(wxT("Label"));
pgman->SelectProperty("Label");
pgman->Clear();
if ( pgman->GetPageCount() )
@@ -1180,7 +1180,7 @@ bool FormMain::RunTests( bool fullTest, bool interactive )
pgman = m_pPropGridManager;
// Grid clear
pgman->SelectProperty(wxT("Label"));
pgman->SelectProperty("Label");
pgman->GetGrid()->Clear();
if ( pgman->GetGrid()->GetRoot()->GetChildCount() )
@@ -1209,7 +1209,7 @@ bool FormMain::RunTests( bool fullTest, bool interactive )
pgman->SetSplitterPosition(trySplitterPos);
if ( pgman->GetGrid()->GetSplitterPosition() != trySplitterPos )
RT_FAILURE_MSG(wxString::Format(wxT("Splitter position was %i (should have been %i)"),(int)pgman->GetGrid()->GetSplitterPosition(),trySplitterPos));
RT_FAILURE_MSG(wxString::Format("Splitter position was %i (should have been %i)",(int)pgman->GetGrid()->GetSplitterPosition(),trySplitterPos));
m_topSizer->Add( m_pPropGridManager, wxSizerFlags(1).Expand());
FinalizePanel();
@@ -1221,7 +1221,7 @@ bool FormMain::RunTests( bool fullTest, bool interactive )
SetSize(sz);
if ( pgman->GetGrid()->GetSplitterPosition() != trySplitterPos )
RT_FAILURE_MSG(wxString::Format(wxT("Splitter position was %i (should have been %i)"),(int)pgman->GetGrid()->GetSplitterPosition(),trySplitterPos));
RT_FAILURE_MSG(wxString::Format("Splitter position was %i (should have been %i)",(int)pgman->GetGrid()->GetSplitterPosition(),trySplitterPos));
SetSize(origSz);
@@ -1246,7 +1246,7 @@ bool FormMain::RunTests( bool fullTest, bool interactive )
wxPGProperty* p = arr1[i];
page->HideProperty(p, true);
wxString s = wxString::Format(wxT("HideProperty(%i, %s)"), (int)i, p->GetLabel().c_str());
wxString s = wxString::Format("HideProperty(%i, %s)", (int)i, p->GetLabel().c_str());
RT_VALIDATE_VIRTUAL_HEIGHT(page, s)
if ( _failed_ )
break;
@@ -1262,7 +1262,7 @@ bool FormMain::RunTests( bool fullTest, bool interactive )
wxPGProperty* p = arr2[i];
page->HideProperty(p, false);
wxString s = wxString::Format(wxT("ShowProperty(%i, %s)"), (int)i, p->GetLabel().c_str());
wxString s = wxString::Format("ShowProperty(%i, %s)", (int)i, p->GetLabel().c_str());
RT_VALIDATE_VIRTUAL_HEIGHT(page, s)
if ( _failed_ )
break;
@@ -1280,7 +1280,7 @@ bool FormMain::RunTests( bool fullTest, bool interactive )
wxPGProperty* p = arr1[i];
page->HideProperty(p, true);
wxString s = wxString::Format(wxT("HideProperty(%i, %s)"), (int)i, p->GetLabel().c_str());
wxString s = wxString::Format("HideProperty(%i, %s)", (int)i, p->GetLabel().c_str());
RT_VALIDATE_VIRTUAL_HEIGHT(page, s)
if ( _failed_ )
break;
@@ -1296,7 +1296,7 @@ bool FormMain::RunTests( bool fullTest, bool interactive )
wxPGProperty* p = arr2[i];
page->HideProperty(p, false);
wxString s = wxString::Format(wxT("ShowProperty(%i, %s)"), (int)i, p->GetLabel().c_str());
wxString s = wxString::Format("ShowProperty(%i, %s)", (int)i, p->GetLabel().c_str());
RT_VALIDATE_VIRTUAL_HEIGHT(page, s)
if ( _failed_ )
break;
@@ -1315,7 +1315,7 @@ bool FormMain::RunTests( bool fullTest, bool interactive )
wxPGProperty* p = arr1[i];
page->HideProperty(p, true);
wxString s = wxString::Format(wxT("HideProperty(%i, %s)"), (int)i, p->GetLabel().c_str());
wxString s = wxString::Format("HideProperty(%i, %s)", (int)i, p->GetLabel().c_str());
RT_VALIDATE_VIRTUAL_HEIGHT(page, s)
if ( _failed_ )
break;
@@ -1331,7 +1331,7 @@ bool FormMain::RunTests( bool fullTest, bool interactive )
wxPGProperty* p = arr2[i];
page->HideProperty(p, false);
wxString s = wxString::Format(wxT("ShowProperty(%i, %s)"), (int)i, p->GetLabel().c_str());
wxString s = wxString::Format("ShowProperty(%i, %s)", (int)i, p->GetLabel().c_str());
RT_VALIDATE_VIRTUAL_HEIGHT(page, s)
if ( _failed_ )
break;
@@ -1592,7 +1592,7 @@ bool FormMain::RunTests( bool fullTest, bool interactive )
pgman = m_pPropGridManager;
for ( i=3; i<12; i+=2 )
{
RT_MSG(wxString::Format(wxT("%i columns"),(int)i));
RT_MSG(wxString::Format("%i columns",(int)i));
pgman->SetColumnCount(i);
Refresh();
Update();
@@ -1610,7 +1610,7 @@ bool FormMain::RunTests( bool fullTest, bool interactive )
for ( i=4; i<16; i++ )
{
int flag = 1<<i;
RT_MSG(wxString::Format(wxT("Style: 0x%X"),flag));
RT_MSG(wxString::Format("Style: 0x%X",flag));
CreateGrid( flag, -1 );
pgman = m_pPropGridManager;
Update();
@@ -1622,7 +1622,7 @@ bool FormMain::RunTests( bool fullTest, bool interactive )
for ( i=12; i<27; i++ )
{
int flag = 1<<i;
RT_MSG(wxString::Format(wxT("ExStyle: 0x%X"),flag));
RT_MSG(wxString::Format("ExStyle: 0x%X",flag));
CreateGrid( -1, flag );
pgman = m_pPropGridManager;
Update();
@@ -1649,19 +1649,19 @@ bool FormMain::RunTests( bool fullTest, bool interactive )
#ifdef __WXDEBUG__
if ( failures )
#endif
s = wxString::Format(wxT("%i tests failed!!!"), failures);
s = wxString::Format("%i tests failed!!!", failures);
#ifdef __WXDEBUG__
else
s = wxString::Format(wxT("All tests were successful, but there were %i warnings!"), wxPGGlobalVars->m_warnings);
s = wxString::Format("All tests were successful, but there were %i warnings!", wxPGGlobalVars->m_warnings);
#endif
RT_MSG(s)
for ( i=0; i<errorMessages.size(); i++ )
RT_MSG(errorMessages[i])
wxMessageBox(s, wxT("Some Tests Failed"));
wxMessageBox(s, "Some Tests Failed");
}
else
{
RT_MSG(wxT("All tests successful"))
RT_MSG("All tests successful")
retVal = true;
if ( !interactive )