diff options
author | Varun <varun.dhall@studentpartner.com> | 2015-07-22 13:58:53 +0530 |
---|---|---|
committer | Michael Stahl <mstahl@redhat.com> | 2015-07-23 13:26:05 +0000 |
commit | bf5d569bb6af90195a339bb3b1a19d763d2210af (patch) | |
tree | 3c3e7e60fac025851d5b167b2240f433734b1bf4 | |
parent | d77947929c7f02cebe3d3e5d79c78642a8a439ba (diff) |
Added test for tdf#57197 table row/column insert undo crash
Change-Id: I143d657239dd983396847eb67019e84a202f0bcb
Reviewed-on: https://gerrit.libreoffice.org/17284
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Michael Stahl <mstahl@redhat.com>
-rw-r--r-- | sw/qa/extras/uiwriter/uiwriter.cxx | 84 |
1 files changed, 84 insertions, 0 deletions
diff --git a/sw/qa/extras/uiwriter/uiwriter.cxx b/sw/qa/extras/uiwriter/uiwriter.cxx index 08158cca6454..16bd01f1e47a 100644 --- a/sw/qa/extras/uiwriter/uiwriter.cxx +++ b/sw/qa/extras/uiwriter/uiwriter.cxx @@ -118,6 +118,7 @@ public: void testUnoParagraph(); void testSearchWithTransliterate(); void testTdf80663(); + void testTdf57197(); void testTdf90808(); void testTdf75137(); void testTdf83798(); @@ -177,6 +178,7 @@ public: CPPUNIT_TEST(testUnoParagraph); CPPUNIT_TEST(testSearchWithTransliterate); CPPUNIT_TEST(testTdf80663); + CPPUNIT_TEST(testTdf57197); CPPUNIT_TEST(testTdf90808); CPPUNIT_TEST(testTdf75137); CPPUNIT_TEST(testTdf83798); @@ -1520,6 +1522,88 @@ void SwUiWriterTest::testTdf80663() CPPUNIT_ASSERT_EQUAL(sal_Int32(2), xTable->getColumns()->getCount()); } +void SwUiWriterTest::testTdf57197() +{ + SwDoc* pDoc = createDoc(); + SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + //Inserting 1x1 Table + sw::UndoManager& rUndoManager = pDoc->GetUndoManager(); + SwInsertTableOptions TableOpt(tabopts::DEFAULT_BORDER, 0); + pWrtShell->InsertTable(TableOpt, 1, 1); + //Checking for the number of rows and columns + uno::Reference<text::XTextTable> xTable(getParagraphOrTable(1), uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xTable->getRows()->getCount()); + CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xTable->getColumns()->getCount()); + //Inserting one row before the existing row + pWrtShell->SttDoc(); //moves the cursor to the start of Doc + pWrtShell->InsertRow(1, false); + 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(1), xTable->getRows()->getCount()); + CPPUNIT_ASSERT_EQUAL(sal_Int32(1), 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(1), xTable->getRows()->getCount()); + CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xTable->getColumns()->getCount()); + //Insering one row after the existing row + pWrtShell->SttDoc(); //moves the cursor to the start of Doc + pWrtShell->InsertRow(1, true); + 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(1), xTable->getRows()->getCount()); + CPPUNIT_ASSERT_EQUAL(sal_Int32(1), 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(1), xTable->getRows()->getCount()); + CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xTable->getColumns()->getCount()); + //Inserting one column before the existing column + pWrtShell->SttDoc(); //moves the cursor to the start of Doc + pWrtShell->InsertCol(1, false); + 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(1), xTable->getRows()->getCount()); + CPPUNIT_ASSERT_EQUAL(sal_Int32(1), 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(1), xTable->getRows()->getCount()); + CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xTable->getColumns()->getCount()); + //Inserting one column after the existing column + pWrtShell->SttDoc(); //moves the cursor to the start of Doc + pWrtShell->InsertCol(1, true); + 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(1), xTable->getRows()->getCount()); + CPPUNIT_ASSERT_EQUAL(sal_Int32(1), 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(1), xTable->getRows()->getCount()); + CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xTable->getColumns()->getCount()); +} + void SwUiWriterTest::testTdf90808() { createDoc(); |