Kaydet (Commit) 41134983 authored tarafından Michael Stahl's avatar Michael Stahl

sw_redlinehide_2: add unit test with table

Change-Id: Ia0334e08fb70e04e75c1bb6fe1f00a451d4567e3
Reviewed-on: https://gerrit.libreoffice.org/61374
Tested-by: Jenkins
Reviewed-by: 's avatarMichael Stahl <Michael.Stahl@cib.de>
üst 1a0d9d68
This diff is collapsed.
...@@ -36,6 +36,7 @@ public: ...@@ -36,6 +36,7 @@ public:
void testRedlineFlysInFlys(); void testRedlineFlysInFlys();
void testRedlineFlysAtFlys(); void testRedlineFlysAtFlys();
void testRedlineSections(); void testRedlineSections();
void testRedlineTables();
void testTdf116830(); void testTdf116830();
void testTdf116925(); void testTdf116925();
void testTdf117028(); void testTdf117028();
...@@ -64,6 +65,7 @@ public: ...@@ -64,6 +65,7 @@ public:
CPPUNIT_TEST(testRedlineFlysInFlys); CPPUNIT_TEST(testRedlineFlysInFlys);
CPPUNIT_TEST(testRedlineFlysAtFlys); CPPUNIT_TEST(testRedlineFlysAtFlys);
CPPUNIT_TEST(testRedlineSections); CPPUNIT_TEST(testRedlineSections);
CPPUNIT_TEST(testRedlineTables);
CPPUNIT_TEST(testTdf116830); CPPUNIT_TEST(testTdf116830);
CPPUNIT_TEST(testTdf116925); CPPUNIT_TEST(testTdf116925);
CPPUNIT_TEST(testTdf117028); CPPUNIT_TEST(testTdf117028);
...@@ -2008,6 +2010,82 @@ void SwLayoutWriter::testRedlineSections() ...@@ -2008,6 +2010,82 @@ void SwLayoutWriter::testRedlineSections()
CheckRedlineSectionsHidden(); CheckRedlineSectionsHidden();
} }
void SwLayoutWriter::testRedlineTables()
{
// currently need experimental mode
Resetter _([]() {
std::shared_ptr<comphelper::ConfigurationChanges> pBatch(
comphelper::ConfigurationChanges::create());
officecfg::Office::Common::Misc::ExperimentalMode::set(false, pBatch);
return pBatch->commit();
});
std::shared_ptr<comphelper::ConfigurationChanges> pBatch(
comphelper::ConfigurationChanges::create());
officecfg::Office::Common::Misc::ExperimentalMode::set(true, pBatch);
pBatch->commit();
createDoc("redline_table.fodt");
SwXTextDocument* pTextDoc = dynamic_cast<SwXTextDocument*>(mxComponent.get());
CPPUNIT_ASSERT(pTextDoc);
SwDoc* pDoc(pTextDoc->GetDocShell()->GetDoc());
SwRootFrame* pLayout(pDoc->getIDocumentLayoutAccess().GetCurrentLayout());
CPPUNIT_ASSERT(pLayout->IsHideRedlines());
// verify after load
discardDumpedLayout();
xmlDocPtr pXmlDoc = parseLayoutDump();
assertXPath(pXmlDoc, "/root/page[1]/body/txt[1]/merged", "paraPropsNodeIndex", "12");
assertXPath(pXmlDoc, "/root/page[1]/body/txt[1]/Text[1]", "nType", "POR_PARA");
assertXPath(pXmlDoc, "/root/page[1]/body/txt[1]/Text[1]", "Portion", "foar");
lcl_dispatchCommand(mxComponent, ".uno:ShowTrackedChanges", {});
CPPUNIT_ASSERT(!pLayout->IsHideRedlines());
// why is this needed explicitly?
pDoc->getIDocumentLayoutAccess().GetCurrentViewShell()->CalcLayout();
discardDumpedLayout();
pXmlDoc = parseLayoutDump();
// show: nothing is merged
xmlXPathObjectPtr pXmlObj = getXPathNode(pXmlDoc, "//merged");
xmlNodeSetPtr pXmlNodes = pXmlObj->nodesetval;
CPPUNIT_ASSERT_EQUAL(0, xmlXPathNodeSetGetLength(pXmlNodes));
xmlXPathFreeObject(pXmlObj);
assertXPath(pXmlDoc, "/root/page[1]/body/txt[1]/Text[1]", "nType", "POR_TXT");
assertXPath(pXmlDoc, "/root/page[1]/body/txt[1]/Text[1]", "Portion", "fo");
assertXPath(pXmlDoc, "/root/page[1]/body/txt[1]/Text[2]", "nType", "POR_TXT");
assertXPath(pXmlDoc, "/root/page[1]/body/txt[1]/Text[2]", "Portion", "o");
assertXPath(pXmlDoc,
"/root/page[1]/body/tab[1]/row[1]/cell[1]/txt[1]/anchored/fly[1]/txt[1]/Text[1]",
"nType", "POR_PARA");
assertXPath(pXmlDoc,
"/root/page[1]/body/tab[1]/row[1]/cell[1]/txt[1]/anchored/fly[1]/txt[1]/Text[1]",
"Portion", "FRAME");
assertXPath(pXmlDoc, "/root/page[1]/body/tab[1]/row[1]/cell[1]/txt[1]/Text[1]", "nType",
"POR_PARA");
assertXPath(pXmlDoc, "/root/page[1]/body/tab[1]/row[1]/cell[1]/txt[1]/Text[1]", "Portion",
"aaa");
assertXPath(pXmlDoc, "/root/page[1]/body/tab[1]/row[2]/cell[2]/txt[1]/Text[1]", "nType",
"POR_PARA");
assertXPath(pXmlDoc, "/root/page[1]/body/tab[1]/row[2]/cell[2]/txt[1]/Text[1]", "Portion",
"ddd");
assertXPath(pXmlDoc, "/root/page[1]/body/txt[2]/Text[1]", "nType", "POR_TXT");
assertXPath(pXmlDoc, "/root/page[1]/body/txt[2]/Text[1]", "Portion", "b");
assertXPath(pXmlDoc, "/root/page[1]/body/txt[2]/Text[2]", "nType", "POR_TXT");
assertXPath(pXmlDoc, "/root/page[1]/body/txt[2]/Text[2]", "Portion", "ar");
// verify after hide
lcl_dispatchCommand(mxComponent, ".uno:ShowTrackedChanges", {});
CPPUNIT_ASSERT(pLayout->IsHideRedlines());
// why is this needed explicitly?
pDoc->getIDocumentLayoutAccess().GetCurrentViewShell()->CalcLayout();
discardDumpedLayout();
pXmlDoc = parseLayoutDump();
assertXPath(pXmlDoc, "/root/page[1]/body/txt[1]/merged", "paraPropsNodeIndex", "12");
assertXPath(pXmlDoc, "/root/page[1]/body/txt[1]/Text[1]", "nType", "POR_PARA");
assertXPath(pXmlDoc, "/root/page[1]/body/txt[1]/Text[1]", "Portion", "foar");
}
void SwLayoutWriter::testTdf116830() void SwLayoutWriter::testTdf116830()
{ {
SwDoc* pDoc = createDoc("tdf116830.odt"); SwDoc* pDoc = createDoc("tdf116830.odt");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment