summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sw/qa/extras/uiwriter/uiwriter.cxx89
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();