Added Test for tdf#67238 table cell Unprotect
Change-Id: Iaaaaca1bcc5f5b6274f54ef4fcd3f35ffe1a9cd0 Reviewed-on: https://gerrit.libreoffice.org/20008 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Michael Stahl <mstahl@redhat.com>
This commit is contained in:
parent
5fc51f8d25
commit
23ea117f1c
@ -102,6 +102,7 @@ public:
|
|||||||
void testFdo70807();
|
void testFdo70807();
|
||||||
void testImportRTF();
|
void testImportRTF();
|
||||||
void testExportRTF();
|
void testExportRTF();
|
||||||
|
void testTdf67238();
|
||||||
void testFdo75110();
|
void testFdo75110();
|
||||||
void testFdo75898();
|
void testFdo75898();
|
||||||
void testFdo74981();
|
void testFdo74981();
|
||||||
@ -181,6 +182,7 @@ public:
|
|||||||
CPPUNIT_TEST(testFdo70807);
|
CPPUNIT_TEST(testFdo70807);
|
||||||
CPPUNIT_TEST(testImportRTF);
|
CPPUNIT_TEST(testImportRTF);
|
||||||
CPPUNIT_TEST(testExportRTF);
|
CPPUNIT_TEST(testExportRTF);
|
||||||
|
CPPUNIT_TEST(testTdf67238);
|
||||||
CPPUNIT_TEST(testFdo75110);
|
CPPUNIT_TEST(testFdo75110);
|
||||||
CPPUNIT_TEST(testFdo75898);
|
CPPUNIT_TEST(testFdo75898);
|
||||||
CPPUNIT_TEST(testFdo74981);
|
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()
|
void SwUiWriterTest::testFdo75110()
|
||||||
{
|
{
|
||||||
SwDoc* pDoc = createDoc("fdo75110.odt");
|
SwDoc* pDoc = createDoc("fdo75110.odt");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user