[Libreoffice-commits] core.git: sw/qa

Varun Dhall varun.dhall at studentpartner.com
Tue Nov 17 01:17:22 PST 2015


 sw/qa/extras/uiwriter/uiwriter.cxx |   95 +++++++++++++++++++++++++++++++++++++
 1 file changed, 95 insertions(+)

New commits:
commit 23ea117f1c9f9f1462d56afab81b4fe348e1a4f8
Author: Varun Dhall <varun.dhall at studentpartner.com>
Date:   Tue Nov 17 03:54:34 2015 +0530

    Added Test for tdf#67238 table cell Unprotect
    
    Change-Id: Iaaaaca1bcc5f5b6274f54ef4fcd3f35ffe1a9cd0
    Reviewed-on: https://gerrit.libreoffice.org/20008
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Michael Stahl <mstahl at redhat.com>

diff --git a/sw/qa/extras/uiwriter/uiwriter.cxx b/sw/qa/extras/uiwriter/uiwriter.cxx
index 825c804..8937836 100644
--- a/sw/qa/extras/uiwriter/uiwriter.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter.cxx
@@ -102,6 +102,7 @@ public:
     void testFdo70807();
     void testImportRTF();
     void testExportRTF();
+    void testTdf67238();
     void testFdo75110();
     void testFdo75898();
     void testFdo74981();
@@ -181,6 +182,7 @@ public:
     CPPUNIT_TEST(testFdo70807);
     CPPUNIT_TEST(testImportRTF);
     CPPUNIT_TEST(testExportRTF);
+    CPPUNIT_TEST(testTdf67238);
     CPPUNIT_TEST(testFdo75110);
     CPPUNIT_TEST(testFdo75898);
     CPPUNIT_TEST(testFdo74981);
@@ -382,6 +384,99 @@ void SwUiWriterTest::testBookmarkCopy()
     }
 }
 
+void SwUiWriterTest::testTdf67238()
+{
+    //create a new writer document
+    SwDoc* pDoc = createDoc();
+    SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
+    sw::UndoManager& rUndoManager = pDoc->GetUndoManager();
+    //insert a 3X3 table in the newly created document
+    SwInsertTableOptions TableOpt(tabopts::DEFAULT_BORDER, 0);
+    const SwTable& rTbl = pWrtShell->InsertTable(TableOpt, 3, 3);
+    //checking for the rows and columns
+    uno::Reference<text::XTextTable> xTable(getParagraphOrTable(1), uno::UNO_QUERY);
+    CPPUNIT_ASSERT_EQUAL(sal_Int32(3), xTable->getRows()->getCount());
+    CPPUNIT_ASSERT_EQUAL(sal_Int32(3), xTable->getColumns()->getCount());
+    //selecting the table
+    pWrtShell->SttDoc();
+    pWrtShell->SelTable();
+    //making the table protected
+    pWrtShell->ProtectCells();
+    //checking each cell's protection, it should be protected
+    CPPUNIT_ASSERT(((rTbl.GetTableBox("A1"))->GetFrameFormat()->GetProtect()).IsContentProtected());
+    CPPUNIT_ASSERT(((rTbl.GetTableBox("A2"))->GetFrameFormat()->GetProtect()).IsContentProtected());
+    CPPUNIT_ASSERT(((rTbl.GetTableBox("A3"))->GetFrameFormat()->GetProtect()).IsContentProtected());
+    CPPUNIT_ASSERT(((rTbl.GetTableBox("B1"))->GetFrameFormat()->GetProtect()).IsContentProtected());
+    CPPUNIT_ASSERT(((rTbl.GetTableBox("B2"))->GetFrameFormat()->GetProtect()).IsContentProtected());
+    CPPUNIT_ASSERT(((rTbl.GetTableBox("B3"))->GetFrameFormat()->GetProtect()).IsContentProtected());
+    CPPUNIT_ASSERT(((rTbl.GetTableBox("C1"))->GetFrameFormat()->GetProtect()).IsContentProtected());
+    CPPUNIT_ASSERT(((rTbl.GetTableBox("C2"))->GetFrameFormat()->GetProtect()).IsContentProtected());
+    CPPUNIT_ASSERT(((rTbl.GetTableBox("C3"))->GetFrameFormat()->GetProtect()).IsContentProtected());
+    //undo the changes, make cells [un]protected
+    rUndoManager.Undo();
+    //checking each cell's protection, it should be [un]protected
+    CPPUNIT_ASSERT(!((rTbl.GetTableBox("A1"))->GetFrameFormat()->GetProtect()).IsContentProtected());
+    CPPUNIT_ASSERT(!((rTbl.GetTableBox("A2"))->GetFrameFormat()->GetProtect()).IsContentProtected());
+    CPPUNIT_ASSERT(!((rTbl.GetTableBox("A3"))->GetFrameFormat()->GetProtect()).IsContentProtected());
+    CPPUNIT_ASSERT(!((rTbl.GetTableBox("B1"))->GetFrameFormat()->GetProtect()).IsContentProtected());
+    CPPUNIT_ASSERT(!((rTbl.GetTableBox("B2"))->GetFrameFormat()->GetProtect()).IsContentProtected());
+    CPPUNIT_ASSERT(!((rTbl.GetTableBox("B3"))->GetFrameFormat()->GetProtect()).IsContentProtected());
+    CPPUNIT_ASSERT(!((rTbl.GetTableBox("C1"))->GetFrameFormat()->GetProtect()).IsContentProtected());
+    CPPUNIT_ASSERT(!((rTbl.GetTableBox("C2"))->GetFrameFormat()->GetProtect()).IsContentProtected());
+    CPPUNIT_ASSERT(!((rTbl.GetTableBox("C3"))->GetFrameFormat()->GetProtect()).IsContentProtected());
+    //redo the changes, make cells protected
+    rUndoManager.Redo();
+    //checking each cell's protection, it should be protected
+    CPPUNIT_ASSERT(((rTbl.GetTableBox("A1"))->GetFrameFormat()->GetProtect()).IsContentProtected());
+    CPPUNIT_ASSERT(((rTbl.GetTableBox("A2"))->GetFrameFormat()->GetProtect()).IsContentProtected());
+    CPPUNIT_ASSERT(((rTbl.GetTableBox("A3"))->GetFrameFormat()->GetProtect()).IsContentProtected());
+    CPPUNIT_ASSERT(((rTbl.GetTableBox("B1"))->GetFrameFormat()->GetProtect()).IsContentProtected());
+    CPPUNIT_ASSERT(((rTbl.GetTableBox("B2"))->GetFrameFormat()->GetProtect()).IsContentProtected());
+    CPPUNIT_ASSERT(((rTbl.GetTableBox("B3"))->GetFrameFormat()->GetProtect()).IsContentProtected());
+    CPPUNIT_ASSERT(((rTbl.GetTableBox("C1"))->GetFrameFormat()->GetProtect()).IsContentProtected());
+    CPPUNIT_ASSERT(((rTbl.GetTableBox("C2"))->GetFrameFormat()->GetProtect()).IsContentProtected());
+    CPPUNIT_ASSERT(((rTbl.GetTableBox("C3"))->GetFrameFormat()->GetProtect()).IsContentProtected());
+    //moving the cursor to the starting of the document
+    pWrtShell->SttDoc();
+    //making the table [un]protected
+    pWrtShell->SelTable();
+    pWrtShell->UnProtectCells();
+    //checking each cell's protection, it should be [un]protected
+    CPPUNIT_ASSERT(!((rTbl.GetTableBox("A1"))->GetFrameFormat()->GetProtect()).IsContentProtected());
+    CPPUNIT_ASSERT(!((rTbl.GetTableBox("A2"))->GetFrameFormat()->GetProtect()).IsContentProtected());
+    CPPUNIT_ASSERT(!((rTbl.GetTableBox("A3"))->GetFrameFormat()->GetProtect()).IsContentProtected());
+    CPPUNIT_ASSERT(!((rTbl.GetTableBox("B1"))->GetFrameFormat()->GetProtect()).IsContentProtected());
+    CPPUNIT_ASSERT(!((rTbl.GetTableBox("B2"))->GetFrameFormat()->GetProtect()).IsContentProtected());
+    CPPUNIT_ASSERT(!((rTbl.GetTableBox("B3"))->GetFrameFormat()->GetProtect()).IsContentProtected());
+    CPPUNIT_ASSERT(!((rTbl.GetTableBox("C1"))->GetFrameFormat()->GetProtect()).IsContentProtected());
+    CPPUNIT_ASSERT(!((rTbl.GetTableBox("C2"))->GetFrameFormat()->GetProtect()).IsContentProtected());
+    CPPUNIT_ASSERT(!((rTbl.GetTableBox("C3"))->GetFrameFormat()->GetProtect()).IsContentProtected());
+    //undo the changes, make cells protected
+    rUndoManager.Undo();
+    //checking each cell's protection, it should be protected
+    CPPUNIT_ASSERT(((rTbl.GetTableBox("A1"))->GetFrameFormat()->GetProtect()).IsContentProtected());
+    CPPUNIT_ASSERT(((rTbl.GetTableBox("A2"))->GetFrameFormat()->GetProtect()).IsContentProtected());
+    CPPUNIT_ASSERT(((rTbl.GetTableBox("A3"))->GetFrameFormat()->GetProtect()).IsContentProtected());
+    CPPUNIT_ASSERT(((rTbl.GetTableBox("B1"))->GetFrameFormat()->GetProtect()).IsContentProtected());
+    CPPUNIT_ASSERT(((rTbl.GetTableBox("B2"))->GetFrameFormat()->GetProtect()).IsContentProtected());
+    CPPUNIT_ASSERT(((rTbl.GetTableBox("B3"))->GetFrameFormat()->GetProtect()).IsContentProtected());
+    CPPUNIT_ASSERT(((rTbl.GetTableBox("C1"))->GetFrameFormat()->GetProtect()).IsContentProtected());
+    CPPUNIT_ASSERT(((rTbl.GetTableBox("C2"))->GetFrameFormat()->GetProtect()).IsContentProtected());
+    CPPUNIT_ASSERT(((rTbl.GetTableBox("C3"))->GetFrameFormat()->GetProtect()).IsContentProtected());
+    //redo the changes, make cells [un]protected
+    rUndoManager.Redo();
+    //checking each cell's protection, it should be [un]protected
+    CPPUNIT_ASSERT(!((rTbl.GetTableBox("A1"))->GetFrameFormat()->GetProtect()).IsContentProtected());
+    CPPUNIT_ASSERT(!((rTbl.GetTableBox("A2"))->GetFrameFormat()->GetProtect()).IsContentProtected());
+    CPPUNIT_ASSERT(!((rTbl.GetTableBox("A3"))->GetFrameFormat()->GetProtect()).IsContentProtected());
+    CPPUNIT_ASSERT(!((rTbl.GetTableBox("B1"))->GetFrameFormat()->GetProtect()).IsContentProtected());
+    CPPUNIT_ASSERT(!((rTbl.GetTableBox("B2"))->GetFrameFormat()->GetProtect()).IsContentProtected());
+    CPPUNIT_ASSERT(!((rTbl.GetTableBox("B3"))->GetFrameFormat()->GetProtect()).IsContentProtected());
+    CPPUNIT_ASSERT(!((rTbl.GetTableBox("C1"))->GetFrameFormat()->GetProtect()).IsContentProtected());
+    CPPUNIT_ASSERT(!((rTbl.GetTableBox("C2"))->GetFrameFormat()->GetProtect()).IsContentProtected());
+    CPPUNIT_ASSERT(!((rTbl.GetTableBox("C3"))->GetFrameFormat()->GetProtect()).IsContentProtected());
+}
+
 void SwUiWriterTest::testFdo75110()
 {
     SwDoc* pDoc = createDoc("fdo75110.odt");


More information about the Libreoffice-commits mailing list