diff options
author | Varun <varun.dhall@studentpartner.com> | 2015-07-09 23:33:24 +0530 |
---|---|---|
committer | Michael Stahl <mstahl@redhat.com> | 2015-07-10 11:09:12 +0000 |
commit | 6a0efa9873b1a5cae4ae0719a7ae1eee97838168 (patch) | |
tree | cad8f628d94622bdb7b279d722c19cf567294f00 | |
parent | 7eef63bb2a4d14cb35201f84f38855910f468e20 (diff) |
Added Test for tdf#80663 table row/column delete undo crash
Change-Id: Ica62926486831f126cce54d651e230cee3360074
Reviewed-on: https://gerrit.libreoffice.org/16901
Reviewed-by: Michael Stahl <mstahl@redhat.com>
Tested-by: Michael Stahl <mstahl@redhat.com>
-rw-r--r-- | sw/qa/extras/uiwriter/uiwriter.cxx | 89 |
1 files changed, 89 insertions, 0 deletions
diff --git a/sw/qa/extras/uiwriter/uiwriter.cxx b/sw/qa/extras/uiwriter/uiwriter.cxx index 0bf5636a14a8..92300c86cfa3 100644 --- a/sw/qa/extras/uiwriter/uiwriter.cxx +++ b/sw/qa/extras/uiwriter/uiwriter.cxx @@ -110,6 +110,7 @@ public: void testTdf69282(); void testTdf69282WithMirror(); void testSearchWithTransliterate(); + void testTdf80663(); void testTdf90808(); void testTdf75137(); void testTdf83798(); @@ -164,6 +165,7 @@ public: CPPUNIT_TEST(testTdf69282); CPPUNIT_TEST(testTdf69282WithMirror); CPPUNIT_TEST(testSearchWithTransliterate); + CPPUNIT_TEST(testTdf80663); CPPUNIT_TEST(testTdf90808); CPPUNIT_TEST(testTdf75137); CPPUNIT_TEST(testTdf83798); @@ -1259,6 +1261,93 @@ void SwUiWriterTest::testSearchWithTransliterate() CPPUNIT_ASSERT_EQUAL(1,(int)case2); } +void SwUiWriterTest::testTdf80663() +{ + SwDoc* pDoc = createDoc(); + SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + //Inserting 2x2 Table + sw::UndoManager& rUndoManager = pDoc->GetUndoManager(); + SwInsertTableOptions TableOpt(tabopts::DEFAULT_BORDER, 0); + pWrtShell->InsertTable(TableOpt, 2, 2); + //Checking for the number of rows and columns + uno::Reference<text::XTextTable> xTable(getParagraphOrTable(1), uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(sal_Int32(2), xTable->getRows()->getCount()); + CPPUNIT_ASSERT_EQUAL(sal_Int32(2), xTable->getColumns()->getCount()); + //Deleting the first row + pWrtShell->SttDoc(); //moves the cursor to the start of Doc + pWrtShell->SelTableRow(); //selects the first row + pWrtShell->DeleteRow(); + CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xTable->getRows()->getCount()); + CPPUNIT_ASSERT_EQUAL(sal_Int32(2), xTable->getColumns()->getCount()); + //Undo changes + rUndoManager.Undo(); + CPPUNIT_ASSERT_EQUAL(sal_Int32(2), xTable->getRows()->getCount()); + CPPUNIT_ASSERT_EQUAL(sal_Int32(2), xTable->getColumns()->getCount()); + //Redo changes + rUndoManager.Redo(); + CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xTable->getRows()->getCount()); + CPPUNIT_ASSERT_EQUAL(sal_Int32(2), xTable->getColumns()->getCount()); + //Undo changes + rUndoManager.Undo(); + CPPUNIT_ASSERT_EQUAL(sal_Int32(2), xTable->getRows()->getCount()); + CPPUNIT_ASSERT_EQUAL(sal_Int32(2), xTable->getColumns()->getCount()); + //Deleting the second row + pWrtShell->GoNextCell(); //moves the cursor to next cell + pWrtShell->SelTableRow(); //selects the second row + pWrtShell->DeleteRow(); + CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xTable->getRows()->getCount()); + CPPUNIT_ASSERT_EQUAL(sal_Int32(2), xTable->getColumns()->getCount()); + //Undo changes + rUndoManager.Undo(); + CPPUNIT_ASSERT_EQUAL(sal_Int32(2), xTable->getRows()->getCount()); + CPPUNIT_ASSERT_EQUAL(sal_Int32(2), xTable->getColumns()->getCount()); + //Redo changes + rUndoManager.Redo(); + CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xTable->getRows()->getCount()); + CPPUNIT_ASSERT_EQUAL(sal_Int32(2), xTable->getColumns()->getCount()); + //Undo changes + rUndoManager.Undo(); + CPPUNIT_ASSERT_EQUAL(sal_Int32(2), xTable->getRows()->getCount()); + CPPUNIT_ASSERT_EQUAL(sal_Int32(2), xTable->getColumns()->getCount()); + //Deleting the first column + pWrtShell->SttDoc(); //moves the cursor to the start of Doc + pWrtShell->SelTableCol(); //selects first column + pWrtShell->DeleteCol(); + CPPUNIT_ASSERT_EQUAL(sal_Int32(2), xTable->getRows()->getCount()); + CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xTable->getColumns()->getCount()); + //Undo changes + rUndoManager.Undo(); + CPPUNIT_ASSERT_EQUAL(sal_Int32(2), xTable->getRows()->getCount()); + CPPUNIT_ASSERT_EQUAL(sal_Int32(2), xTable->getColumns()->getCount()); + //Redo changes + rUndoManager.Redo(); + CPPUNIT_ASSERT_EQUAL(sal_Int32(2), xTable->getRows()->getCount()); + CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xTable->getColumns()->getCount()); + //Undo changes + rUndoManager.Undo(); + CPPUNIT_ASSERT_EQUAL(sal_Int32(2), xTable->getRows()->getCount()); + CPPUNIT_ASSERT_EQUAL(sal_Int32(2), xTable->getColumns()->getCount()); + //Deleting the second column + pWrtShell->SttDoc(); //moves the cursor to the start of Doc + pWrtShell->GoNextCell(); //moves the cursor to next cell + pWrtShell->SelTableCol(); //selects second column + pWrtShell->DeleteCol(); + CPPUNIT_ASSERT_EQUAL(sal_Int32(2), xTable->getRows()->getCount()); + CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xTable->getColumns()->getCount()); + //Undo changes + rUndoManager.Undo(); + CPPUNIT_ASSERT_EQUAL(sal_Int32(2), xTable->getRows()->getCount()); + CPPUNIT_ASSERT_EQUAL(sal_Int32(2), xTable->getColumns()->getCount()); + //Redo changes + rUndoManager.Redo(); + CPPUNIT_ASSERT_EQUAL(sal_Int32(2), xTable->getRows()->getCount()); + CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xTable->getColumns()->getCount()); + //Undo changes + rUndoManager.Undo(); + CPPUNIT_ASSERT_EQUAL(sal_Int32(2), xTable->getRows()->getCount()); + CPPUNIT_ASSERT_EQUAL(sal_Int32(2), xTable->getColumns()->getCount()); +} + void SwUiWriterTest::testTdf90808() { createDoc(); |