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:
committed by
Vadim Zeitlin
parent
480047ee9a
commit
b70ed2d8c8
@@ -76,12 +76,12 @@ ItemContainerWidgetsPage::ItemContainerWidgetsPage(WidgetsBookCtrl *book,
|
||||
#endif // __WXMSW__ || __WXGTK__
|
||||
, m_trackedDataObjects(0)
|
||||
{
|
||||
m_items.Add(wxT("This"));
|
||||
m_items.Add(wxT("is"));
|
||||
m_items.Add(wxT("a"));
|
||||
m_items.Add(wxT("List"));
|
||||
m_items.Add(wxT("of"));
|
||||
m_items.Add(wxT("strings"));
|
||||
m_items.Add("This");
|
||||
m_items.Add("is");
|
||||
m_items.Add("a");
|
||||
m_items.Add("List");
|
||||
m_items.Add("of");
|
||||
m_items.Add("strings");
|
||||
m_itemsSorted = m_items;
|
||||
}
|
||||
|
||||
@@ -108,11 +108,11 @@ bool ItemContainerWidgetsPage::VerifyAllClientDataDestroyed()
|
||||
{
|
||||
if ( m_trackedDataObjects )
|
||||
{
|
||||
wxString message = wxT("Bug in managing wxClientData: ");
|
||||
wxString message = "Bug in managing wxClientData: ";
|
||||
if ( m_trackedDataObjects > 0 )
|
||||
message << m_trackedDataObjects << wxT(" lost objects");
|
||||
message << m_trackedDataObjects << " lost objects";
|
||||
else
|
||||
message << (-m_trackedDataObjects) << wxT(" extra deletes");
|
||||
message << (-m_trackedDataObjects) << " extra deletes";
|
||||
wxFAIL_MSG(message);
|
||||
return false;
|
||||
}
|
||||
@@ -123,7 +123,7 @@ bool ItemContainerWidgetsPage::VerifyAllClientDataDestroyed()
|
||||
void ItemContainerWidgetsPage::StartTest(const wxString& label)
|
||||
{
|
||||
m_container->Clear();
|
||||
wxLogMessage(wxT("Test - %s:"), label.c_str());
|
||||
wxLogMessage("Test - %s:", label.c_str());
|
||||
}
|
||||
|
||||
void ItemContainerWidgetsPage::EndTest(const wxArrayString& items)
|
||||
@@ -133,7 +133,7 @@ void ItemContainerWidgetsPage::EndTest(const wxArrayString& items)
|
||||
bool ok = count == items.GetCount();
|
||||
if ( !ok )
|
||||
{
|
||||
wxFAIL_MSG(wxT("Item count does not match."));
|
||||
wxFAIL_MSG("Item count does not match.");
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -143,7 +143,7 @@ void ItemContainerWidgetsPage::EndTest(const wxArrayString& items)
|
||||
if ( str != items[i] )
|
||||
{
|
||||
wxFAIL_MSG(wxString::Format(
|
||||
wxT("Wrong string \"%s\" at position %d (expected \"%s\")"),
|
||||
"Wrong string \"%s\" at position %d (expected \"%s\")",
|
||||
str.c_str(), i, items[i].c_str()));
|
||||
ok = false;
|
||||
break;
|
||||
@@ -178,19 +178,19 @@ void ItemContainerWidgetsPage::EndTest(const wxArrayString& items)
|
||||
m_container->Clear();
|
||||
ok &= VerifyAllClientDataDestroyed();
|
||||
|
||||
wxLogMessage(wxT("...%s"), ok ? wxT("passed") : wxT("failed"));
|
||||
wxLogMessage("...%s", ok ? "passed" : "failed");
|
||||
}
|
||||
|
||||
wxString
|
||||
ItemContainerWidgetsPage::DumpContainerData(const wxArrayString& expected) const
|
||||
{
|
||||
wxString str;
|
||||
str << wxT("Current content:\n");
|
||||
str << "Current content:\n";
|
||||
|
||||
unsigned i;
|
||||
for ( i = 0; i < m_container->GetCount(); ++i )
|
||||
{
|
||||
str << wxT(" - ") << m_container->GetString(i) << wxT(" [");
|
||||
str << " - " << m_container->GetString(i) << " [";
|
||||
if ( m_container->HasClientObjectData() )
|
||||
{
|
||||
TrackedClientData *
|
||||
@@ -204,20 +204,20 @@ ItemContainerWidgetsPage::DumpContainerData(const wxArrayString& expected) const
|
||||
if ( data )
|
||||
str << (wxUIntPtr)data;
|
||||
}
|
||||
str << wxT("]\n");
|
||||
str << "]\n";
|
||||
}
|
||||
|
||||
str << wxT("Expected content:\n");
|
||||
str << "Expected content:\n";
|
||||
for ( i = 0; i < expected.GetCount(); ++i )
|
||||
{
|
||||
const wxString& item = expected[i];
|
||||
str << wxT(" - ") << item << wxT("[");
|
||||
str << " - " << item << "[";
|
||||
for( unsigned j = 0; j < m_items.GetCount(); ++j )
|
||||
{
|
||||
if ( m_items[j] == item )
|
||||
str << j;
|
||||
}
|
||||
str << wxT("]\n");
|
||||
str << "]\n";
|
||||
}
|
||||
|
||||
return str;
|
||||
@@ -227,7 +227,7 @@ bool ItemContainerWidgetsPage::VerifyClientData(wxUIntPtr i, const wxString& str
|
||||
{
|
||||
if ( i > m_items.GetCount() || m_items[i] != str )
|
||||
{
|
||||
wxLogMessage(wxT("Client data for '%s' does not match."), str.c_str());
|
||||
wxLogMessage("Client data for '%s' does not match.", str.c_str());
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -251,9 +251,9 @@ ItemContainerWidgetsPage::MakeArray(const wxSortedArrayString& sorted)
|
||||
void ItemContainerWidgetsPage::OnButtonTestItemContainer(wxCommandEvent&)
|
||||
{
|
||||
m_container = GetContainer();
|
||||
wxASSERT_MSG(m_container, wxT("Widget must have a test widget"));
|
||||
wxASSERT_MSG(m_container, "Widget must have a test widget");
|
||||
|
||||
wxLogMessage(wxT("wxItemContainer test for %s, %s:"),
|
||||
wxLogMessage("wxItemContainer test for %s, %s:",
|
||||
GetWidget()->GetClassInfo()->GetClassName(),
|
||||
(m_container->IsSorted() ? "Sorted" : "Unsorted"));
|
||||
|
||||
@@ -261,16 +261,16 @@ void ItemContainerWidgetsPage::OnButtonTestItemContainer(wxCommandEvent&)
|
||||
expected_result = m_container->IsSorted() ? MakeArray(m_itemsSorted)
|
||||
: m_items;
|
||||
|
||||
StartTest(wxT("Append one item"));
|
||||
StartTest("Append one item");
|
||||
wxString item = m_items[0];
|
||||
m_container->Append(item);
|
||||
EndTest(wxArrayString(1, &item));
|
||||
|
||||
StartTest(wxT("Append some items"));
|
||||
StartTest("Append some items");
|
||||
m_container->Append(m_items);
|
||||
EndTest(expected_result);
|
||||
|
||||
StartTest(wxT("Append some items with data objects"));
|
||||
StartTest("Append some items with data objects");
|
||||
wxClientData **objects = new wxClientData *[m_items.GetCount()];
|
||||
for ( unsigned i = 0; i < m_items.GetCount(); ++i )
|
||||
objects[i] = CreateClientData(i);
|
||||
@@ -278,7 +278,7 @@ void ItemContainerWidgetsPage::OnButtonTestItemContainer(wxCommandEvent&)
|
||||
EndTest(expected_result);
|
||||
delete[] objects;
|
||||
|
||||
StartTest(wxT("Append some items with data"));
|
||||
StartTest("Append some items with data");
|
||||
void **data = new void *[m_items.GetCount()];
|
||||
for ( unsigned i = 0; i < m_items.GetCount(); ++i )
|
||||
data[i] = wxUIntToPtr(i);
|
||||
@@ -286,19 +286,19 @@ void ItemContainerWidgetsPage::OnButtonTestItemContainer(wxCommandEvent&)
|
||||
EndTest(expected_result);
|
||||
delete[] data;
|
||||
|
||||
StartTest(wxT("Append some items with data, one by one"));
|
||||
StartTest("Append some items with data, one by one");
|
||||
for ( unsigned i = 0; i < m_items.GetCount(); ++i )
|
||||
m_container->Append(m_items[i], wxUIntToPtr(i));
|
||||
EndTest(expected_result);
|
||||
|
||||
StartTest(wxT("Append some items with data objects, one by one"));
|
||||
StartTest("Append some items with data objects, one by one");
|
||||
for ( unsigned i = 0; i < m_items.GetCount(); ++i )
|
||||
m_container->Append(m_items[i], CreateClientData(i));
|
||||
EndTest(expected_result);
|
||||
|
||||
if ( !m_container->IsSorted() )
|
||||
{
|
||||
StartTest(wxT("Insert in reverse order with data, one by one"));
|
||||
StartTest("Insert in reverse order with data, one by one");
|
||||
for ( unsigned i = m_items.GetCount(); i; --i )
|
||||
m_container->Insert(m_items[i - 1], 0, wxUIntToPtr(i - 1));
|
||||
EndTest(expected_result);
|
||||
|
Reference in New Issue
Block a user