Fix wxRichTextCtrl test compilation.
Work around broken pre-C++98 for loop scoping rules in VC6. See #15184. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@73951 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -775,7 +775,9 @@ void RichTextCtrlTestCase::Table()
|
|||||||
|
|
||||||
// Run the tests twice: first for the original table, then for a contained one
|
// Run the tests twice: first for the original table, then for a contained one
|
||||||
for (int t = 0; t < 2; ++t)
|
for (int t = 0; t < 2; ++t)
|
||||||
{
|
{
|
||||||
|
size_t n; // FIXME-VC6: outside of the loops for VC6 only.
|
||||||
|
|
||||||
// Undo() and Redo() switch table instances, so invalidating 'table'
|
// Undo() and Redo() switch table instances, so invalidating 'table'
|
||||||
// The containing paragraph isn't altered, and so can be used to find the current object
|
// The containing paragraph isn't altered, and so can be used to find the current object
|
||||||
wxRichTextParagraph* para = wxDynamicCast(table->GetParent(), wxRichTextParagraph);
|
wxRichTextParagraph* para = wxDynamicCast(table->GetParent(), wxRichTextParagraph);
|
||||||
@@ -785,26 +787,26 @@ void RichTextCtrlTestCase::Table()
|
|||||||
CPPUNIT_ASSERT(table->GetRowCount() == 1);
|
CPPUNIT_ASSERT(table->GetRowCount() == 1);
|
||||||
|
|
||||||
// Test adding columns and rows
|
// Test adding columns and rows
|
||||||
for (size_t n = 0; n < 3; ++n)
|
for (n = 0; n < 3; ++n)
|
||||||
{
|
{
|
||||||
m_rich->BeginBatchUndo("Add col and row");
|
m_rich->BeginBatchUndo("Add col and row");
|
||||||
|
|
||||||
table->AddColumns(0, 1);
|
table->AddColumns(0, 1);
|
||||||
table->AddRows(0, 1);
|
table->AddRows(0, 1);
|
||||||
|
|
||||||
m_rich->EndBatchUndo();
|
m_rich->EndBatchUndo();
|
||||||
}
|
}
|
||||||
CPPUNIT_ASSERT(table->GetColumnCount() == 4);
|
CPPUNIT_ASSERT(table->GetColumnCount() == 4);
|
||||||
CPPUNIT_ASSERT(table->GetRowCount() == 4);
|
CPPUNIT_ASSERT(table->GetRowCount() == 4);
|
||||||
|
|
||||||
// Test deleting columns and rows
|
// Test deleting columns and rows
|
||||||
for (size_t n = 0; n < 3; ++n)
|
for (n = 0; n < 3; ++n)
|
||||||
{
|
{
|
||||||
m_rich->BeginBatchUndo("Delete col and row");
|
m_rich->BeginBatchUndo("Delete col and row");
|
||||||
|
|
||||||
table->DeleteColumns(table->GetColumnCount() - 1, 1);
|
table->DeleteColumns(table->GetColumnCount() - 1, 1);
|
||||||
table->DeleteRows(table->GetRowCount() - 1, 1);
|
table->DeleteRows(table->GetRowCount() - 1, 1);
|
||||||
|
|
||||||
m_rich->EndBatchUndo();
|
m_rich->EndBatchUndo();
|
||||||
}
|
}
|
||||||
CPPUNIT_ASSERT(table->GetColumnCount() == 1);
|
CPPUNIT_ASSERT(table->GetColumnCount() == 1);
|
||||||
@@ -812,7 +814,7 @@ void RichTextCtrlTestCase::Table()
|
|||||||
|
|
||||||
// Test undo, first of the deletions...
|
// Test undo, first of the deletions...
|
||||||
CPPUNIT_ASSERT(m_rich->CanUndo());
|
CPPUNIT_ASSERT(m_rich->CanUndo());
|
||||||
for (size_t n = 0; n < 3; ++n)
|
for (n = 0; n < 3; ++n)
|
||||||
{
|
{
|
||||||
m_rich->Undo();
|
m_rich->Undo();
|
||||||
}
|
}
|
||||||
@@ -821,7 +823,7 @@ void RichTextCtrlTestCase::Table()
|
|||||||
CPPUNIT_ASSERT(table->GetRowCount() == 4);
|
CPPUNIT_ASSERT(table->GetRowCount() == 4);
|
||||||
|
|
||||||
// ...then the additions
|
// ...then the additions
|
||||||
for (size_t n = 0; n < 3; ++n)
|
for (n = 0; n < 3; ++n)
|
||||||
{
|
{
|
||||||
m_rich->Undo();
|
m_rich->Undo();
|
||||||
}
|
}
|
||||||
@@ -832,7 +834,7 @@ void RichTextCtrlTestCase::Table()
|
|||||||
|
|
||||||
// Similarly test redo. Additions:
|
// Similarly test redo. Additions:
|
||||||
CPPUNIT_ASSERT(m_rich->CanRedo());
|
CPPUNIT_ASSERT(m_rich->CanRedo());
|
||||||
for (size_t n = 0; n < 3; ++n)
|
for (n = 0; n < 3; ++n)
|
||||||
{
|
{
|
||||||
m_rich->Redo();
|
m_rich->Redo();
|
||||||
}
|
}
|
||||||
@@ -841,7 +843,7 @@ void RichTextCtrlTestCase::Table()
|
|||||||
CPPUNIT_ASSERT(table->GetRowCount() == 4);
|
CPPUNIT_ASSERT(table->GetRowCount() == 4);
|
||||||
|
|
||||||
// Deletions:
|
// Deletions:
|
||||||
for (size_t n = 0; n < 3; ++n)
|
for (n = 0; n < 3; ++n)
|
||||||
{
|
{
|
||||||
m_rich->Redo();
|
m_rich->Redo();
|
||||||
}
|
}
|
||||||
@@ -863,7 +865,7 @@ void RichTextCtrlTestCase::Table()
|
|||||||
CPPUNIT_ASSERT(table->GetColumnCount() == 2);
|
CPPUNIT_ASSERT(table->GetColumnCount() == 2);
|
||||||
CPPUNIT_ASSERT(table->GetRowCount() == 2);
|
CPPUNIT_ASSERT(table->GetRowCount() == 2);
|
||||||
m_rich->EndSuppressUndo();
|
m_rich->EndSuppressUndo();
|
||||||
|
|
||||||
m_rich->GetCommandProcessor()->ClearCommands(); // otherwise the command-history from this loop will cause CPPUNIT_ASSERT failures in the next one
|
m_rich->GetCommandProcessor()->ClearCommands(); // otherwise the command-history from this loop will cause CPPUNIT_ASSERT failures in the next one
|
||||||
|
|
||||||
if (t == 0)
|
if (t == 0)
|
||||||
|
Reference in New Issue
Block a user