]> git.saurik.com Git - wxWidgets.git/commitdiff
Reset row and columns count in wxRichTextTable::ClearTable().
authorVadim Zeitlin <vadim@wxwidgets.org>
Sun, 26 May 2013 13:14:48 +0000 (13:14 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Sun, 26 May 2013 13:14:48 +0000 (13:14 +0000)
No real changes, just update the internal variables in ClearTable() to avoid
inconsistent internal state, even if this doesn't seem to result in any
problems for now.

Closes #15190.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@74057 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/richtext/richtextbuffer.cpp
tests/controls/richtextctrltest.cpp

index 19f5452f88ab6233c2a0c1927a5bb3263ba2552d..dfcc768eea2fc7aecb9605f0323d8880d814cc00 100644 (file)
@@ -10087,6 +10087,8 @@ void wxRichTextTable::ClearTable()
 {
     m_cells.Clear();
     DeleteChildren();
+    m_rowCount = 0;
+    m_colCount = 0;
 }
 
 bool wxRichTextTable::CreateTable(int rows, int cols)
index e30c91d0853d9c784893e79d1719980977b90e6f..a01cf7a6119b6f22202c70f2c0319ca86eb8eb55 100644 (file)
@@ -881,6 +881,12 @@ void RichTextCtrlTestCase::Table()
         }
     }
 
+    // Test ClearTable()
+    table->ClearTable();
+    CPPUNIT_ASSERT_EQUAL(0, table->GetCells().GetCount());
+    CPPUNIT_ASSERT_EQUAL(0, table->GetColumnCount());
+    CPPUNIT_ASSERT_EQUAL(0, table->GetRowCount());
+
     m_rich->Clear();
     m_rich->SetFocusObject(NULL);
 }