[Libreoffice-commits] core.git: sw/qa
Varun
varun.dhall at studentpartner.com
Fri Jul 10 04:09:36 PDT 2015
sw/qa/extras/uiwriter/uiwriter.cxx | 89 +++++++++++++++++++++++++++++++++++++
1 file changed, 89 insertions(+)
New commits:
commit 6a0efa9873b1a5cae4ae0719a7ae1eee97838168
Author: Varun <varun.dhall at studentpartner.com>
Date: Thu Jul 9 23:33:24 2015 +0530
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 at redhat.com>
Tested-by: Michael Stahl <mstahl at redhat.com>
diff --git a/sw/qa/extras/uiwriter/uiwriter.cxx b/sw/qa/extras/uiwriter/uiwriter.cxx
index 0bf5636..92300c8 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();
More information about the Libreoffice-commits
mailing list