sw/qa/extras/layout/layout.cxx |  756 +++++++++++++++++++++++++++++++++++++++++
 1 file changed, 756 insertions(+)

New commits:
commit 4018508f7a3fbcf811fa337188ef530e30e2114e
Author:     Michael Stahl <michael.st...@cib.de>
AuthorDate: Tue Oct 2 18:16:53 2018 +0200
Commit:     Michael Stahl <michael.st...@cib.de>
CommitDate: Fri Oct 5 10:26:04 2018 +0200

    sw_redlinehide_2: add unit tests with fly frames in flys
    
    Change-Id: Iaf56bfc92fe3628c53d2426c9b955610d7dc4c5a
    Reviewed-on: https://gerrit.libreoffice.org/61261
    Tested-by: Jenkins
    Reviewed-by: Michael Stahl <michael.st...@cib.de>

diff --git a/sw/qa/extras/layout/layout.cxx b/sw/qa/extras/layout/layout.cxx
index 79211e1c4007..5a0197a66c8a 100644
--- a/sw/qa/extras/layout/layout.cxx
+++ b/sw/qa/extras/layout/layout.cxx
@@ -17,6 +17,7 @@
 #include <unotools/syslocaleoptions.hxx>
 #include <fmtanchr.hxx>
 #include <fmtfsize.hxx>
+#include <fmtcntnt.hxx>
 #include <wrtsh.hxx>
 
 static char const DATA_DIRECTORY[] = "/sw/qa/extras/layout/data/";
@@ -31,6 +32,8 @@ public:
     void testRedlineFlysInBody();
     void testRedlineFlysInHeader();
     void testRedlineFlysInFootnote();
+    void testRedlineFlysInFlys();
+    void testRedlineFlysAtFlys();
     void testTdf116830();
     void testTdf116925();
     void testTdf117028();
@@ -56,6 +59,8 @@ public:
     CPPUNIT_TEST(testRedlineFlysInBody);
     CPPUNIT_TEST(testRedlineFlysInHeader);
     CPPUNIT_TEST(testRedlineFlysInFootnote);
+    CPPUNIT_TEST(testRedlineFlysInFlys);
+    CPPUNIT_TEST(testRedlineFlysAtFlys);
     CPPUNIT_TEST(testTdf116830);
     CPPUNIT_TEST(testTdf116925);
     CPPUNIT_TEST(testTdf117028);
@@ -1164,6 +1169,757 @@ void SwLayoutWriter::testRedlineFlysInFootnote()
     }
 }
 
+void SwLayoutWriter::testRedlineFlysInFlys()
+{
+    // 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();
+
+    loadURL("private:factory/swriter", nullptr);
+    SwXTextDocument* pTextDoc = 
dynamic_cast<SwXTextDocument*>(mxComponent.get());
+    CPPUNIT_ASSERT(pTextDoc);
+    SwDoc* pDoc(pTextDoc->GetDocShell()->GetDoc());
+    SwWrtShell* pWrtShell = pTextDoc->GetDocShell()->GetWrtShell();
+    SwRootFrame* pLayout(pWrtShell->GetLayout());
+    CPPUNIT_ASSERT(!pLayout->IsHideRedlines());
+    pWrtShell->Insert("foo");
+    pWrtShell->SplitNode(false);
+    pWrtShell->Insert("bar");
+    pWrtShell->SplitNode(false);
+    pWrtShell->Insert("baz");
+    SfxItemSet flySet(pDoc->GetAttrPool(),
+                      svl::Items<RES_FRM_SIZE, RES_FRM_SIZE, RES_ANCHOR, 
RES_ANCHOR>{});
+    SwFormatFrameSize size(ATT_MIN_SIZE, 1000, 1000);
+    flySet.Put(size); // set a size, else we get 1 char per line...
+    pWrtShell->SttDoc(false);
+    pWrtShell->Right(CRSR_SKIP_CHARS, /*bSelect=*/false, 1, 
/*bBasicCall=*/false);
+    SwFormatAnchor anchor1(RndStdIds::FLY_AT_CHAR);
+    anchor1.SetAnchor(pWrtShell->GetCursor()->GetPoint());
+    flySet.Put(anchor1);
+    SwFrameFormat const* pFly1 = pWrtShell->NewFlyFrame(flySet, 
/*bAnchValid=*/true);
+    CPPUNIT_ASSERT(pFly1 != nullptr);
+    // move inside fly1
+    pWrtShell->GotoFly(pFly1->GetName(), FLYCNTTYPE_FRM, /*bSelFrame=*/false);
+    pWrtShell->Insert("abc");
+    pWrtShell->SplitNode(false);
+    pWrtShell->Insert("def");
+    pWrtShell->SplitNode(false);
+    pWrtShell->Insert("ghi");
+
+    SwFormatAnchor anchor2(RndStdIds::FLY_AT_CHAR);
+    pWrtShell->SttDoc(false); // start of fly...
+    anchor2.SetAnchor(pWrtShell->GetCursor()->GetPoint());
+    flySet.Put(anchor2);
+    SwFrameFormat const* pFly2 = pWrtShell->NewFlyFrame(flySet, 
/*bAnchValid=*/true);
+    CPPUNIT_ASSERT(pFly2 != nullptr);
+    // move inside fly2
+    pWrtShell->GotoFly(pFly2->GetName(), FLYCNTTYPE_FRM, /*bSelFrame=*/false);
+    pWrtShell->Insert("jkl");
+    pWrtShell->SplitNode(false);
+    pWrtShell->Insert("mno");
+    pWrtShell->SplitNode(false);
+    pWrtShell->Insert("pqr");
+
+    lcl_dispatchCommand(mxComponent, ".uno:TrackChanges", {});
+    // delete redline inside fly2
+    pWrtShell->Left(CRSR_SKIP_CHARS, /*bSelect=*/false, 2, 
/*bBasicCall=*/false);
+    pWrtShell->Left(CRSR_SKIP_CHARS, /*bSelect=*/true, 8, 
/*bBasicCall=*/false);
+    pWrtShell->Delete();
+
+    // delete redline inside fly1
+    pWrtShell->GotoFly(pFly1->GetName(), FLYCNTTYPE_FRM, /*bSelFrame=*/false);
+    pWrtShell->Right(CRSR_SKIP_CHARS, /*bSelect=*/false, 2, 
/*bBasicCall=*/false);
+    pWrtShell->Right(CRSR_SKIP_CHARS, /*bSelect=*/true, 7, 
/*bBasicCall=*/false);
+    pWrtShell->Delete();
+
+    pWrtShell->ClearMark(); // otherwise it refuses to leave the fly...
+    pWrtShell->SttEndDoc(true); // note: SttDoc actually moves to start of fly?
+    pWrtShell->Right(CRSR_SKIP_CHARS, /*bSelect=*/false, 2, 
/*bBasicCall=*/false);
+    pWrtShell->Right(CRSR_SKIP_CHARS, /*bSelect=*/true, 7, 
/*bBasicCall=*/false);
+    pWrtShell->Delete();
+
+    for (int i = 0; i < 2; ++i)
+    {
+        if (i == 1) // secondly, try with different anchor type
+        {
+            anchor1.SetType(RndStdIds::FLY_AT_PARA);
+            SwPosition pos(*anchor1.GetContentAnchor());
+            pos.nContent.Assign(nullptr, 0);
+            anchor1.SetAnchor(&pos);
+            pDoc->SetAttr(anchor1, *const_cast<SwFrameFormat*>(pFly1));
+            anchor2.SetType(RndStdIds::FLY_AT_PARA);
+            pos.nNode = anchor2.GetContentAnchor()->nNode;
+            anchor2.SetAnchor(&pos);
+            pDoc->SetAttr(anchor2, *const_cast<SwFrameFormat*>(pFly2));
+        }
+
+        lcl_dispatchCommand(mxComponent, ".uno:ShowTrackedChanges", {});
+        CPPUNIT_ASSERT(pLayout->IsHideRedlines());
+        discardDumpedLayout();
+        xmlDocPtr pXmlDoc = parseLayoutDump();
+        assertXPath(pXmlDoc, "/root/page[1]/body/txt[1]/merged", 
"paraPropsNodeIndex", "19");
+        assertXPath(pXmlDoc, 
"/root/page[1]/body/txt[1]/anchored/fly[1]/txt[1]/merged",
+                    "paraPropsNodeIndex", "6");
+        assertXPath(
+            pXmlDoc,
+            
"/root/page[1]/body/txt[1]/anchored/fly[1]/txt[1]/anchored[1]/fly[1]/txt[1]/merged",
+            "paraPropsNodeIndex", "11");
+        assertXPath(
+            pXmlDoc,
+            
"/root/page[1]/body/txt[1]/anchored/fly[1]/txt[1]/anchored[1]/fly[1]/txt[1]/Text[1]",
+            "nType", "POR_PARA");
+        assertXPath(
+            pXmlDoc,
+            
"/root/page[1]/body/txt[1]/anchored/fly[1]/txt[1]/anchored[1]/fly[1]/txt[1]/Text[1]",
+            "Portion", "jqr");
+        assertXPath(pXmlDoc, 
"/root/page[1]/body/txt[1]/anchored/fly[1]/txt[1]/Special[1]", "nType",
+                    "POR_FLY"); // remove???
+        assertXPath(pXmlDoc, 
"/root/page[1]/body/txt[1]/anchored/fly[1]/txt[1]/Text[1]", "nType",
+                    "POR_LAY");
+        assertXPath(pXmlDoc, 
"/root/page[1]/body/txt[1]/anchored/fly[1]/txt[1]/Text[1]", "Portion",
+                    "abhi");
+        assertXPath(pXmlDoc, "/root/page[1]/body/txt[1]/Text[1]", "nType", 
"POR_PARA");
+        assertXPath(pXmlDoc, "/root/page[1]/body/txt[1]/Text[1]", "Portion", 
"foaz");
+
+        lcl_dispatchCommand(mxComponent, ".uno:ShowTrackedChanges", {});
+        CPPUNIT_ASSERT(!pLayout->IsHideRedlines());
+        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]/anchored/fly[1]/txt[1]/anchored[1]/fly[1]/txt[1]/Text[1]",
+            "nType", "POR_TXT");
+        assertXPath(
+            pXmlDoc,
+            
"/root/page[1]/body/txt[1]/anchored/fly[1]/txt[1]/anchored[1]/fly[1]/txt[1]/Text[1]",
+            "Portion", "j");
+        assertXPath(
+            pXmlDoc,
+            
"/root/page[1]/body/txt[1]/anchored/fly[1]/txt[1]/anchored[1]/fly[1]/txt[1]/Text[2]",
+            "nType", "POR_TXT");
+        assertXPath(
+            pXmlDoc,
+            
"/root/page[1]/body/txt[1]/anchored/fly[1]/txt[1]/anchored[1]/fly[1]/txt[1]/Text[2]",
+            "Portion", "kl");
+        assertXPath(
+            pXmlDoc,
+            
"/root/page[1]/body/txt[1]/anchored/fly[1]/txt[1]/anchored[1]/fly[1]/txt[2]/Text[1]",
+            "nType", "POR_PARA");
+        assertXPath(
+            pXmlDoc,
+            
"/root/page[1]/body/txt[1]/anchored/fly[1]/txt[1]/anchored[1]/fly[1]/txt[2]/Text[1]",
+            "Portion", "mno");
+        assertXPath(
+            pXmlDoc,
+            
"/root/page[1]/body/txt[1]/anchored/fly[1]/txt[1]/anchored[1]/fly[1]/txt[3]/Text[1]",
+            "nType", "POR_TXT");
+        assertXPath(
+            pXmlDoc,
+            
"/root/page[1]/body/txt[1]/anchored/fly[1]/txt[1]/anchored[1]/fly[1]/txt[3]/Text[1]",
+            "Portion", "p");
+        assertXPath(
+            pXmlDoc,
+            
"/root/page[1]/body/txt[1]/anchored/fly[1]/txt[1]/anchored[1]/fly[1]/txt[3]/Text[2]",
+            "nType", "POR_TXT");
+        assertXPath(
+            pXmlDoc,
+            
"/root/page[1]/body/txt[1]/anchored/fly[1]/txt[1]/anchored[1]/fly[1]/txt[3]/Text[2]",
+            "Portion", "qr");
+        assertXPath(pXmlDoc, 
"/root/page[1]/body/txt[1]/anchored/fly[1]/txt[1]/Special[1]", "nType",
+                    "POR_FLY"); // remove???
+        assertXPath(pXmlDoc, 
"/root/page[1]/body/txt[1]/anchored/fly[1]/txt[1]/Text[1]", "nType",
+                    "POR_TXT");
+        assertXPath(pXmlDoc, 
"/root/page[1]/body/txt[1]/anchored/fly[1]/txt[1]/Text[1]", "Portion",
+                    "ab");
+        assertXPath(pXmlDoc, 
"/root/page[1]/body/txt[1]/anchored/fly[1]/txt[1]/Text[2]", "nType",
+                    "POR_TXT");
+        assertXPath(pXmlDoc, 
"/root/page[1]/body/txt[1]/anchored/fly[1]/txt[1]/Text[2]", "Portion",
+                    "c");
+        assertXPath(pXmlDoc, 
"/root/page[1]/body/txt[1]/anchored/fly[1]/txt[2]/Text[1]", "nType",
+                    "POR_PARA");
+        assertXPath(pXmlDoc, 
"/root/page[1]/body/txt[1]/anchored/fly[1]/txt[2]/Text[1]", "Portion",
+                    "def");
+        assertXPath(pXmlDoc, 
"/root/page[1]/body/txt[1]/anchored/fly[1]/txt[3]/Text[1]", "nType",
+                    "POR_TXT");
+        assertXPath(pXmlDoc, 
"/root/page[1]/body/txt[1]/anchored/fly[1]/txt[3]/Text[1]", "Portion",
+                    "g");
+        assertXPath(pXmlDoc, 
"/root/page[1]/body/txt[1]/anchored/fly[1]/txt[3]/Text[2]", "nType",
+                    "POR_TXT");
+        assertXPath(pXmlDoc, 
"/root/page[1]/body/txt[1]/anchored/fly[1]/txt[3]/Text[2]", "Portion",
+                    "hi");
+        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/txt[2]/Text[1]", "nType", 
"POR_PARA");
+        assertXPath(pXmlDoc, "/root/page[1]/body/txt[2]/Text[1]", "Portion", 
"bar");
+        assertXPath(pXmlDoc, "/root/page[1]/body/txt[3]/Text[1]", "nType", 
"POR_TXT");
+        assertXPath(pXmlDoc, "/root/page[1]/body/txt[3]/Text[1]", "Portion", 
"b");
+        assertXPath(pXmlDoc, "/root/page[1]/body/txt[3]/Text[2]", "nType", 
"POR_TXT");
+        assertXPath(pXmlDoc, "/root/page[1]/body/txt[3]/Text[2]", "Portion", 
"az");
+    }
+
+    // anchor to 2nd (deleted) paragraph
+    // also, switch the in-fly anchoring to the other fly, for additional fun!
+    pWrtShell->SttDoc();
+    pWrtShell->Down(false, 1);
+    anchor2.SetType(RndStdIds::FLY_AT_CHAR);
+    anchor2.SetAnchor(pWrtShell->GetCursor()->GetPoint());
+    pDoc->SetAttr(anchor2, *const_cast<SwFrameFormat*>(pFly2));
+    pWrtShell->GotoFly(pFly2->GetName(), FLYCNTTYPE_FRM, /*bSelFrame=*/false);
+    pWrtShell->Down(false, 1);
+    anchor1.SetType(RndStdIds::FLY_AT_CHAR);
+    anchor1.SetAnchor(pWrtShell->GetCursor()->GetPoint());
+    pDoc->SetAttr(anchor1, *const_cast<SwFrameFormat*>(pFly1));
+
+    for (int i = 0; i < 2; ++i)
+    {
+        if (i == 1) // secondly, try with different anchor type
+        {
+            anchor1.SetType(RndStdIds::FLY_AT_PARA);
+            SwPosition pos(*anchor1.GetContentAnchor());
+            pos.nContent.Assign(nullptr, 0);
+            anchor1.SetAnchor(&pos);
+            pDoc->SetAttr(anchor1, *const_cast<SwFrameFormat*>(pFly1));
+            anchor2.SetType(RndStdIds::FLY_AT_PARA);
+            pos.nNode = anchor2.GetContentAnchor()->nNode;
+            anchor2.SetAnchor(&pos);
+            pDoc->SetAttr(anchor2, *const_cast<SwFrameFormat*>(pFly2));
+        }
+
+        lcl_dispatchCommand(mxComponent, ".uno:ShowTrackedChanges", {});
+        CPPUNIT_ASSERT(pLayout->IsHideRedlines());
+        discardDumpedLayout();
+        xmlDocPtr pXmlDoc = parseLayoutDump();
+        assertXPath(pXmlDoc, "/root/page[1]/body/txt[1]/merged", 
"paraPropsNodeIndex", "19");
+        assertXPath(pXmlDoc, "/root/page[1]/body/txt[1]/Text[1]", "nType", 
"POR_PARA");
+        assertXPath(pXmlDoc, "/root/page[1]/body/txt[1]/Text[1]", "Portion", 
"foaz");
+
+        { // hide: no anchored object shown
+            xmlXPathObjectPtr pXmlObj = getXPathNode(pXmlDoc, "//anchored");
+            xmlNodeSetPtr pXmlNodes = pXmlObj->nodesetval;
+            CPPUNIT_ASSERT_EQUAL(0, xmlXPathNodeSetGetLength(pXmlNodes));
+            xmlXPathFreeObject(pXmlObj);
+        }
+
+        lcl_dispatchCommand(mxComponent, ".uno:ShowTrackedChanges", {});
+        CPPUNIT_ASSERT(!pLayout->IsHideRedlines());
+        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/txt[2]/anchored/fly[1]/txt[1]/Text[1]", "nType",
+                    "POR_TXT");
+        assertXPath(pXmlDoc, 
"/root/page[1]/body/txt[2]/anchored/fly[1]/txt[1]/Text[1]", "Portion",
+                    "j");
+        assertXPath(pXmlDoc, 
"/root/page[1]/body/txt[2]/anchored/fly[1]/txt[1]/Text[2]", "nType",
+                    "POR_TXT");
+        assertXPath(pXmlDoc, 
"/root/page[1]/body/txt[2]/anchored/fly[1]/txt[1]/Text[2]", "Portion",
+                    "kl");
+        assertXPath(
+            pXmlDoc,
+            
"/root/page[1]/body/txt[2]/anchored/fly[1]/txt[2]/anchored[1]/fly[1]/txt[1]/Text[1]",
+            "nType", "POR_TXT");
+        assertXPath(
+            pXmlDoc,
+            
"/root/page[1]/body/txt[2]/anchored/fly[1]/txt[2]/anchored[1]/fly[1]/txt[1]/Text[1]",
+            "Portion", "ab");
+        assertXPath(
+            pXmlDoc,
+            
"/root/page[1]/body/txt[2]/anchored/fly[1]/txt[2]/anchored[1]/fly[1]/txt[1]/Text[2]",
+            "nType", "POR_TXT");
+        assertXPath(
+            pXmlDoc,
+            
"/root/page[1]/body/txt[2]/anchored/fly[1]/txt[2]/anchored[1]/fly[1]/txt[1]/Text[2]",
+            "Portion", "c");
+        assertXPath(
+            pXmlDoc,
+            
"/root/page[1]/body/txt[2]/anchored/fly[1]/txt[2]/anchored[1]/fly[1]/txt[2]/Text[1]",
+            "nType", "POR_PARA");
+        assertXPath(
+            pXmlDoc,
+            
"/root/page[1]/body/txt[2]/anchored/fly[1]/txt[2]/anchored[1]/fly[1]/txt[2]/Text[1]",
+            "Portion", "def");
+        assertXPath(
+            pXmlDoc,
+            
"/root/page[1]/body/txt[2]/anchored/fly[1]/txt[2]/anchored[1]/fly[1]/txt[3]/Text[1]",
+            "nType", "POR_TXT");
+        assertXPath(
+            pXmlDoc,
+            
"/root/page[1]/body/txt[2]/anchored/fly[1]/txt[2]/anchored[1]/fly[1]/txt[3]/Text[1]",
+            "Portion", "g");
+        assertXPath(
+            pXmlDoc,
+            
"/root/page[1]/body/txt[2]/anchored/fly[1]/txt[2]/anchored[1]/fly[1]/txt[3]/Text[2]",
+            "nType", "POR_TXT");
+        assertXPath(
+            pXmlDoc,
+            
"/root/page[1]/body/txt[2]/anchored/fly[1]/txt[2]/anchored[1]/fly[1]/txt[3]/Text[2]",
+            "Portion", "hi");
+        assertXPath(pXmlDoc, 
"/root/page[1]/body/txt[2]/anchored/fly[1]/txt[2]/Special[1]", "nType",
+                    "POR_FLY"); // remove???
+        assertXPath(pXmlDoc, 
"/root/page[1]/body/txt[2]/anchored/fly[1]/txt[2]/Text[1]", "nType",
+                    "POR_LAY");
+        assertXPath(pXmlDoc, 
"/root/page[1]/body/txt[2]/anchored/fly[1]/txt[2]/Text[1]", "Portion",
+                    "mno");
+        assertXPath(pXmlDoc, 
"/root/page[1]/body/txt[2]/anchored/fly[1]/txt[3]/Text[1]", "nType",
+                    "POR_TXT");
+        assertXPath(pXmlDoc, 
"/root/page[1]/body/txt[2]/anchored/fly[1]/txt[3]/Text[1]", "Portion",
+                    "p");
+        assertXPath(pXmlDoc, 
"/root/page[1]/body/txt[2]/anchored/fly[1]/txt[3]/Text[2]", "nType",
+                    "POR_TXT");
+        assertXPath(pXmlDoc, 
"/root/page[1]/body/txt[2]/anchored/fly[1]/txt[3]/Text[2]", "Portion",
+                    "qr");
+        assertXPath(pXmlDoc, "/root/page[1]/body/txt[2]/Text[1]", "nType", 
"POR_PARA");
+        assertXPath(pXmlDoc, "/root/page[1]/body/txt[2]/Text[1]", "Portion", 
"bar");
+        assertXPath(pXmlDoc, "/root/page[1]/body/txt[3]/Text[1]", "nType", 
"POR_TXT");
+        assertXPath(pXmlDoc, "/root/page[1]/body/txt[3]/Text[1]", "Portion", 
"b");
+        assertXPath(pXmlDoc, "/root/page[1]/body/txt[3]/Text[2]", "nType", 
"POR_TXT");
+        assertXPath(pXmlDoc, "/root/page[1]/body/txt[3]/Text[2]", "Portion", 
"az");
+    }
+
+    // anchor to 3rd paragraph
+    pWrtShell->SttEndDoc(false);
+    anchor1.SetType(RndStdIds::FLY_AT_CHAR);
+    anchor1.SetAnchor(pWrtShell->GetCursor()->GetPoint());
+    pDoc->SetAttr(anchor1, *const_cast<SwFrameFormat*>(pFly1));
+    pWrtShell->GotoFly(pFly1->GetName(), FLYCNTTYPE_FRM, /*bSelFrame=*/false);
+    pWrtShell->EndDoc();
+    anchor2.SetType(RndStdIds::FLY_AT_CHAR);
+    anchor2.SetAnchor(pWrtShell->GetCursor()->GetPoint());
+    pDoc->SetAttr(anchor2, *const_cast<SwFrameFormat*>(pFly2));
+
+    for (int i = 0; i < 2; ++i)
+    {
+        if (i == 1) // secondly, try with different anchor type
+        {
+            anchor1.SetType(RndStdIds::FLY_AT_PARA);
+            SwPosition pos(*anchor1.GetContentAnchor());
+            pos.nContent.Assign(nullptr, 0);
+            anchor1.SetAnchor(&pos);
+            pDoc->SetAttr(anchor1, *const_cast<SwFrameFormat*>(pFly1));
+            anchor2.SetType(RndStdIds::FLY_AT_PARA);
+            pos.nNode = anchor2.GetContentAnchor()->nNode;
+            anchor2.SetAnchor(&pos);
+            pDoc->SetAttr(anchor2, *const_cast<SwFrameFormat*>(pFly2));
+        }
+
+        lcl_dispatchCommand(mxComponent, ".uno:ShowTrackedChanges", {});
+        CPPUNIT_ASSERT(pLayout->IsHideRedlines());
+        discardDumpedLayout();
+        xmlDocPtr pXmlDoc = parseLayoutDump();
+        assertXPath(pXmlDoc, "/root/page[1]/body/txt[1]/merged", 
"paraPropsNodeIndex", "19");
+        assertXPath(pXmlDoc, 
"/root/page[1]/body/txt[1]/anchored/fly[1]/txt[1]/merged",
+                    "paraPropsNodeIndex", "6");
+        assertXPath(
+            pXmlDoc,
+            
"/root/page[1]/body/txt[1]/anchored/fly[1]/txt[1]/anchored[1]/fly[1]/txt[1]/merged",
+            "paraPropsNodeIndex", "11");
+        assertXPath(
+            pXmlDoc,
+            
"/root/page[1]/body/txt[1]/anchored/fly[1]/txt[1]/anchored[1]/fly[1]/txt[1]/Text[1]",
+            "nType", "POR_PARA");
+        assertXPath(
+            pXmlDoc,
+            
"/root/page[1]/body/txt[1]/anchored/fly[1]/txt[1]/anchored[1]/fly[1]/txt[1]/Text[1]",
+            "Portion", "jqr");
+        assertXPath(pXmlDoc, 
"/root/page[1]/body/txt[1]/anchored/fly[1]/txt[1]/Special[1]", "nType",
+                    "POR_FLY"); // remove???
+        assertXPath(pXmlDoc, 
"/root/page[1]/body/txt[1]/anchored/fly[1]/txt[1]/Text[1]", "nType",
+                    "POR_LAY");
+        assertXPath(pXmlDoc, 
"/root/page[1]/body/txt[1]/anchored/fly[1]/txt[1]/Text[1]", "Portion",
+                    "abhi");
+        assertXPath(pXmlDoc, "/root/page[1]/body/txt[1]/Text[1]", "nType", 
"POR_PARA");
+        assertXPath(pXmlDoc, "/root/page[1]/body/txt[1]/Text[1]", "Portion", 
"foaz");
+
+        lcl_dispatchCommand(mxComponent, ".uno:ShowTrackedChanges", {});
+        CPPUNIT_ASSERT(!pLayout->IsHideRedlines());
+        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/txt[2]/Text[1]", "nType", 
"POR_PARA");
+        assertXPath(pXmlDoc, "/root/page[1]/body/txt[2]/Text[1]", "Portion", 
"bar");
+        assertXPath(pXmlDoc, 
"/root/page[1]/body/txt[3]/anchored/fly[1]/txt[1]/Text[1]", "nType",
+                    "POR_TXT");
+        assertXPath(pXmlDoc, 
"/root/page[1]/body/txt[3]/anchored/fly[1]/txt[1]/Text[1]", "Portion",
+                    "ab");
+        assertXPath(pXmlDoc, 
"/root/page[1]/body/txt[3]/anchored/fly[1]/txt[1]/Text[2]", "nType",
+                    "POR_TXT");
+        assertXPath(pXmlDoc, 
"/root/page[1]/body/txt[3]/anchored/fly[1]/txt[1]/Text[2]", "Portion",
+                    "c");
+        assertXPath(pXmlDoc, 
"/root/page[1]/body/txt[3]/anchored/fly[1]/txt[2]/Text[1]", "nType",
+                    "POR_PARA");
+        assertXPath(pXmlDoc, 
"/root/page[1]/body/txt[3]/anchored/fly[1]/txt[2]/Text[1]", "Portion",
+                    "def");
+        assertXPath(
+            pXmlDoc,
+            
"/root/page[1]/body/txt[3]/anchored/fly[1]/txt[3]/anchored[1]/fly[1]/txt[1]/Text[1]",
+            "nType", "POR_TXT");
+        assertXPath(
+            pXmlDoc,
+            
"/root/page[1]/body/txt[3]/anchored/fly[1]/txt[3]/anchored[1]/fly[1]/txt[1]/Text[1]",
+            "Portion", "j");
+        assertXPath(
+            pXmlDoc,
+            
"/root/page[1]/body/txt[3]/anchored/fly[1]/txt[3]/anchored[1]/fly[1]/txt[1]/Text[2]",
+            "nType", "POR_TXT");
+        assertXPath(
+            pXmlDoc,
+            
"/root/page[1]/body/txt[3]/anchored/fly[1]/txt[3]/anchored[1]/fly[1]/txt[1]/Text[2]",
+            "Portion", "kl");
+        assertXPath(
+            pXmlDoc,
+            
"/root/page[1]/body/txt[3]/anchored/fly[1]/txt[3]/anchored[1]/fly[1]/txt[2]/Text[1]",
+            "nType", "POR_PARA");
+        assertXPath(
+            pXmlDoc,
+            
"/root/page[1]/body/txt[3]/anchored/fly[1]/txt[3]/anchored[1]/fly[1]/txt[2]/Text[1]",
+            "Portion", "mno");
+        assertXPath(
+            pXmlDoc,
+            
"/root/page[1]/body/txt[3]/anchored/fly[1]/txt[3]/anchored[1]/fly[1]/txt[3]/Text[1]",
+            "nType", "POR_TXT");
+        assertXPath(
+            pXmlDoc,
+            
"/root/page[1]/body/txt[3]/anchored/fly[1]/txt[3]/anchored[1]/fly[1]/txt[3]/Text[1]",
+            "Portion", "p");
+        assertXPath(
+            pXmlDoc,
+            
"/root/page[1]/body/txt[3]/anchored/fly[1]/txt[3]/anchored[1]/fly[1]/txt[3]/Text[2]",
+            "nType", "POR_TXT");
+        assertXPath(
+            pXmlDoc,
+            
"/root/page[1]/body/txt[3]/anchored/fly[1]/txt[3]/anchored[1]/fly[1]/txt[3]/Text[2]",
+            "Portion", "qr");
+        assertXPath(pXmlDoc, 
"/root/page[1]/body/txt[3]/anchored/fly[1]/txt[3]/Text[1]", "nType",
+                    "POR_TXT");
+        assertXPath(pXmlDoc, 
"/root/page[1]/body/txt[3]/anchored/fly[1]/txt[3]/Special[1]", "nType",
+                    "POR_FLY"); // remove???
+        assertXPath(pXmlDoc, 
"/root/page[1]/body/txt[3]/anchored/fly[1]/txt[3]/Text[1]", "Portion",
+                    "g");
+        assertXPath(pXmlDoc, 
"/root/page[1]/body/txt[3]/anchored/fly[1]/txt[3]/Text[2]", "nType",
+                    "POR_TXT");
+        assertXPath(pXmlDoc, 
"/root/page[1]/body/txt[3]/anchored/fly[1]/txt[3]/Text[2]", "Portion",
+                    "hi");
+        assertXPath(pXmlDoc, "/root/page[1]/body/txt[3]/Text[1]", "nType", 
"POR_TXT");
+        assertXPath(pXmlDoc, "/root/page[1]/body/txt[3]/Text[1]", "Portion", 
"b");
+        assertXPath(pXmlDoc, "/root/page[1]/body/txt[3]/Text[2]", "nType", 
"POR_TXT");
+        assertXPath(pXmlDoc, "/root/page[1]/body/txt[3]/Text[2]", "Portion", 
"az");
+    }
+}
+
+void SwLayoutWriter::testRedlineFlysAtFlys()
+{
+    // 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();
+
+    loadURL("private:factory/swriter", nullptr);
+    SwXTextDocument* pTextDoc = 
dynamic_cast<SwXTextDocument*>(mxComponent.get());
+    CPPUNIT_ASSERT(pTextDoc);
+    SwDoc* pDoc(pTextDoc->GetDocShell()->GetDoc());
+    SwWrtShell* pWrtShell = pTextDoc->GetDocShell()->GetWrtShell();
+    SwRootFrame* pLayout(pWrtShell->GetLayout());
+    CPPUNIT_ASSERT(!pLayout->IsHideRedlines());
+    pWrtShell->Insert("foo");
+    pWrtShell->SplitNode(false);
+    pWrtShell->Insert("bar");
+    pWrtShell->SplitNode(false);
+    pWrtShell->Insert("baz");
+    SfxItemSet flySet(pDoc->GetAttrPool(),
+                      svl::Items<RES_FRM_SIZE, RES_FRM_SIZE, RES_ANCHOR, 
RES_ANCHOR>{});
+    SwFormatFrameSize size(ATT_MIN_SIZE, 1000, 1000);
+    flySet.Put(size); // set a size, else we get 1 char per line...
+    pWrtShell->SttDoc(false);
+    pWrtShell->Right(CRSR_SKIP_CHARS, /*bSelect=*/false, 1, 
/*bBasicCall=*/false);
+    SwFormatAnchor anchor1(RndStdIds::FLY_AT_CHAR);
+    anchor1.SetAnchor(pWrtShell->GetCursor()->GetPoint());
+    flySet.Put(anchor1);
+    SwFrameFormat const* pFly1 = pWrtShell->NewFlyFrame(flySet, 
/*bAnchValid=*/true);
+    CPPUNIT_ASSERT(pFly1 != nullptr);
+    // move inside fly1
+    pWrtShell->GotoFly(pFly1->GetName(), FLYCNTTYPE_FRM, /*bSelFrame=*/false);
+    pWrtShell->Insert("abc");
+    pWrtShell->SplitNode(false);
+    pWrtShell->Insert("def");
+    pWrtShell->SplitNode(false);
+    pWrtShell->Insert("ghi");
+
+    SwFormatAnchor anchor2(RndStdIds::FLY_AT_FLY);
+    SwPosition pos(*pFly1->GetContent().GetContentIdx());
+    anchor2.SetAnchor(&pos);
+    flySet.Put(anchor2);
+    SwFrameFormat const* pFly2 = pWrtShell->NewFlyFrame(flySet, 
/*bAnchValid=*/true);
+    CPPUNIT_ASSERT(pFly2 != nullptr);
+    // move inside fly2
+    pWrtShell->GotoFly(pFly2->GetName(), FLYCNTTYPE_FRM, /*bSelFrame=*/false);
+    pWrtShell->Insert("jkl");
+    pWrtShell->SplitNode(false);
+    pWrtShell->Insert("mno");
+    pWrtShell->SplitNode(false);
+    pWrtShell->Insert("pqr");
+
+    lcl_dispatchCommand(mxComponent, ".uno:TrackChanges", {});
+    // delete redline inside fly2
+    pWrtShell->Left(CRSR_SKIP_CHARS, /*bSelect=*/false, 2, 
/*bBasicCall=*/false);
+    pWrtShell->Left(CRSR_SKIP_CHARS, /*bSelect=*/true, 8, 
/*bBasicCall=*/false);
+    pWrtShell->Delete();
+
+    // delete redline inside fly1
+    pWrtShell->GotoFly(pFly1->GetName(), FLYCNTTYPE_FRM, /*bSelFrame=*/false);
+    pWrtShell->Right(CRSR_SKIP_CHARS, /*bSelect=*/false, 2, 
/*bBasicCall=*/false);
+    pWrtShell->Right(CRSR_SKIP_CHARS, /*bSelect=*/true, 7, 
/*bBasicCall=*/false);
+    pWrtShell->Delete();
+
+    pWrtShell->ClearMark(); // otherwise it refuses to leave the fly...
+    pWrtShell->SttEndDoc(true); // note: SttDoc actually moves to start of fly?
+    pWrtShell->Right(CRSR_SKIP_CHARS, /*bSelect=*/false, 2, 
/*bBasicCall=*/false);
+    pWrtShell->Right(CRSR_SKIP_CHARS, /*bSelect=*/true, 7, 
/*bBasicCall=*/false);
+    pWrtShell->Delete();
+
+    lcl_dispatchCommand(mxComponent, ".uno:ShowTrackedChanges", {});
+    CPPUNIT_ASSERT(pLayout->IsHideRedlines());
+    discardDumpedLayout();
+    xmlDocPtr pXmlDoc = parseLayoutDump();
+    assertXPath(pXmlDoc, "/root/page[1]/body/txt[1]/merged", 
"paraPropsNodeIndex", "19");
+    assertXPath(pXmlDoc, 
"/root/page[1]/body/txt[1]/anchored/fly[1]/txt[1]/merged",
+                "paraPropsNodeIndex", "6");
+    assertXPath(pXmlDoc,
+                
"/root/page[1]/body/txt[1]/anchored/fly[1]/anchored[1]/fly[1]/txt[1]/merged",
+                "paraPropsNodeIndex", "11");
+    assertXPath(pXmlDoc,
+                
"/root/page[1]/body/txt[1]/anchored/fly[1]/anchored[1]/fly[1]/txt[1]/Text[1]",
+                "nType", "POR_PARA");
+    assertXPath(pXmlDoc,
+                
"/root/page[1]/body/txt[1]/anchored/fly[1]/anchored[1]/fly[1]/txt[1]/Text[1]",
+                "Portion", "jqr");
+    assertXPath(pXmlDoc, 
"/root/page[1]/body/txt[1]/anchored/fly[1]/txt[1]/Special[1]", "nType",
+                "POR_FLY"); // remove???
+    assertXPath(pXmlDoc, 
"/root/page[1]/body/txt[1]/anchored/fly[1]/txt[1]/Text[1]", "nType",
+                "POR_LAY");
+    assertXPath(pXmlDoc, 
"/root/page[1]/body/txt[1]/anchored/fly[1]/txt[1]/Text[1]", "Portion",
+                "abhi");
+    assertXPath(pXmlDoc, "/root/page[1]/body/txt[1]/Text[1]", "nType", 
"POR_PARA");
+    assertXPath(pXmlDoc, "/root/page[1]/body/txt[1]/Text[1]", "Portion", 
"foaz");
+
+    lcl_dispatchCommand(mxComponent, ".uno:ShowTrackedChanges", {});
+    CPPUNIT_ASSERT(!pLayout->IsHideRedlines());
+    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]/anchored/fly[1]/anchored[1]/fly[1]/txt[1]/Text[1]",
+                "nType", "POR_TXT");
+    assertXPath(pXmlDoc,
+                
"/root/page[1]/body/txt[1]/anchored/fly[1]/anchored[1]/fly[1]/txt[1]/Text[1]",
+                "Portion", "j");
+    assertXPath(pXmlDoc,
+                
"/root/page[1]/body/txt[1]/anchored/fly[1]/anchored[1]/fly[1]/txt[1]/Text[2]",
+                "nType", "POR_TXT");
+    assertXPath(pXmlDoc,
+                
"/root/page[1]/body/txt[1]/anchored/fly[1]/anchored[1]/fly[1]/txt[1]/Text[2]",
+                "Portion", "kl");
+    assertXPath(pXmlDoc,
+                
"/root/page[1]/body/txt[1]/anchored/fly[1]/anchored[1]/fly[1]/txt[2]/Text[1]",
+                "nType", "POR_PARA");
+    assertXPath(pXmlDoc,
+                
"/root/page[1]/body/txt[1]/anchored/fly[1]/anchored[1]/fly[1]/txt[2]/Text[1]",
+                "Portion", "mno");
+    assertXPath(pXmlDoc,
+                
"/root/page[1]/body/txt[1]/anchored/fly[1]/anchored[1]/fly[1]/txt[3]/Text[1]",
+                "nType", "POR_TXT");
+    assertXPath(pXmlDoc,
+                
"/root/page[1]/body/txt[1]/anchored/fly[1]/anchored[1]/fly[1]/txt[3]/Text[1]",
+                "Portion", "p");
+    assertXPath(pXmlDoc,
+                
"/root/page[1]/body/txt[1]/anchored/fly[1]/anchored[1]/fly[1]/txt[3]/Text[2]",
+                "nType", "POR_TXT");
+    assertXPath(pXmlDoc,
+                
"/root/page[1]/body/txt[1]/anchored/fly[1]/anchored[1]/fly[1]/txt[3]/Text[2]",
+                "Portion", "qr");
+    assertXPath(pXmlDoc, 
"/root/page[1]/body/txt[1]/anchored/fly[1]/txt[1]/Special[1]", "nType",
+                "POR_FLY"); // remove???
+    assertXPath(pXmlDoc, 
"/root/page[1]/body/txt[1]/anchored/fly[1]/txt[1]/Text[1]", "nType",
+                "POR_TXT");
+    assertXPath(pXmlDoc, 
"/root/page[1]/body/txt[1]/anchored/fly[1]/txt[1]/Text[1]", "Portion",
+                "ab");
+    assertXPath(pXmlDoc, 
"/root/page[1]/body/txt[1]/anchored/fly[1]/txt[1]/Text[2]", "nType",
+                "POR_TXT");
+    assertXPath(pXmlDoc, 
"/root/page[1]/body/txt[1]/anchored/fly[1]/txt[1]/Text[2]", "Portion",
+                "c");
+    assertXPath(pXmlDoc, 
"/root/page[1]/body/txt[1]/anchored/fly[1]/txt[2]/Text[1]", "nType",
+                "POR_PARA");
+    assertXPath(pXmlDoc, 
"/root/page[1]/body/txt[1]/anchored/fly[1]/txt[2]/Text[1]", "Portion",
+                "def");
+    assertXPath(pXmlDoc, 
"/root/page[1]/body/txt[1]/anchored/fly[1]/txt[3]/Text[1]", "nType",
+                "POR_TXT");
+    assertXPath(pXmlDoc, 
"/root/page[1]/body/txt[1]/anchored/fly[1]/txt[3]/Text[1]", "Portion",
+                "g");
+    assertXPath(pXmlDoc, 
"/root/page[1]/body/txt[1]/anchored/fly[1]/txt[3]/Text[2]", "nType",
+                "POR_TXT");
+    assertXPath(pXmlDoc, 
"/root/page[1]/body/txt[1]/anchored/fly[1]/txt[3]/Text[2]", "Portion",
+                "hi");
+    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/txt[2]/Text[1]", "nType", 
"POR_PARA");
+    assertXPath(pXmlDoc, "/root/page[1]/body/txt[2]/Text[1]", "Portion", 
"bar");
+    assertXPath(pXmlDoc, "/root/page[1]/body/txt[3]/Text[1]", "nType", 
"POR_TXT");
+    assertXPath(pXmlDoc, "/root/page[1]/body/txt[3]/Text[1]", "Portion", "b");
+    assertXPath(pXmlDoc, "/root/page[1]/body/txt[3]/Text[2]", "nType", 
"POR_TXT");
+    assertXPath(pXmlDoc, "/root/page[1]/body/txt[3]/Text[2]", "Portion", "az");
+
+    // anchor to 2nd (deleted) paragraph
+    pWrtShell->SttDoc();
+    pWrtShell->Down(false, 1);
+    anchor1.SetType(RndStdIds::FLY_AT_CHAR);
+    anchor1.SetAnchor(pWrtShell->GetCursor()->GetPoint());
+    pDoc->SetAttr(anchor1, *const_cast<SwFrameFormat*>(pFly1));
+
+    lcl_dispatchCommand(mxComponent, ".uno:ShowTrackedChanges", {});
+    CPPUNIT_ASSERT(pLayout->IsHideRedlines());
+    discardDumpedLayout();
+    pXmlDoc = parseLayoutDump();
+    assertXPath(pXmlDoc, "/root/page[1]/body/txt[1]/merged", 
"paraPropsNodeIndex", "19");
+    assertXPath(pXmlDoc, "/root/page[1]/body/txt[1]/Text[1]", "nType", 
"POR_PARA");
+    assertXPath(pXmlDoc, "/root/page[1]/body/txt[1]/Text[1]", "Portion", 
"foaz");
+
+    { // hide: no anchored object shown
+        xmlXPathObjectPtr pXmlObj = getXPathNode(pXmlDoc, "//anchored");
+        xmlNodeSetPtr pXmlNodes = pXmlObj->nodesetval;
+        CPPUNIT_ASSERT_EQUAL(0, xmlXPathNodeSetGetLength(pXmlNodes));
+        xmlXPathFreeObject(pXmlObj);
+    }
+
+    lcl_dispatchCommand(mxComponent, ".uno:ShowTrackedChanges", {});
+    CPPUNIT_ASSERT(!pLayout->IsHideRedlines());
+    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/txt[2]/anchored/fly[1]/anchored[1]/fly[1]/txt[1]/Text[1]",
+                "nType", "POR_TXT");
+    assertXPath(pXmlDoc,
+                
"/root/page[1]/body/txt[2]/anchored/fly[1]/anchored[1]/fly[1]/txt[1]/Text[1]",
+                "Portion", "j");
+    assertXPath(pXmlDoc,
+                
"/root/page[1]/body/txt[2]/anchored/fly[1]/anchored[1]/fly[1]/txt[1]/Text[2]",
+                "nType", "POR_TXT");
+    assertXPath(pXmlDoc,
+                
"/root/page[1]/body/txt[2]/anchored/fly[1]/anchored[1]/fly[1]/txt[1]/Text[2]",
+                "Portion", "kl");
+    assertXPath(pXmlDoc,
+                
"/root/page[1]/body/txt[2]/anchored/fly[1]/anchored[1]/fly[1]/txt[2]/Text[1]",
+                "nType", "POR_PARA");
+    assertXPath(pXmlDoc,
+                
"/root/page[1]/body/txt[2]/anchored/fly[1]/anchored[1]/fly[1]/txt[2]/Text[1]",
+                "Portion", "mno");
+    assertXPath(pXmlDoc,
+                
"/root/page[1]/body/txt[2]/anchored/fly[1]/anchored[1]/fly[1]/txt[3]/Text[1]",
+                "nType", "POR_TXT");
+    assertXPath(pXmlDoc,
+                
"/root/page[1]/body/txt[2]/anchored/fly[1]/anchored[1]/fly[1]/txt[3]/Text[1]",
+                "Portion", "p");
+    assertXPath(pXmlDoc,
+                
"/root/page[1]/body/txt[2]/anchored/fly[1]/anchored[1]/fly[1]/txt[3]/Text[2]",
+                "nType", "POR_TXT");
+    assertXPath(pXmlDoc,
+                
"/root/page[1]/body/txt[2]/anchored/fly[1]/anchored[1]/fly[1]/txt[3]/Text[2]",
+                "Portion", "qr");
+    assertXPath(pXmlDoc, 
"/root/page[1]/body/txt[2]/anchored/fly[1]/txt[1]/Text[1]", "nType",
+                "POR_TXT");
+    assertXPath(pXmlDoc, 
"/root/page[1]/body/txt[2]/anchored/fly[1]/txt[1]/Special[1]", "nType",
+                "POR_FLY"); // remove???
+    assertXPath(pXmlDoc, 
"/root/page[1]/body/txt[2]/anchored/fly[1]/txt[1]/Text[1]", "Portion",
+                "ab");
+    assertXPath(pXmlDoc, 
"/root/page[1]/body/txt[2]/anchored/fly[1]/txt[1]/Text[2]", "nType",
+                "POR_TXT");
+    assertXPath(pXmlDoc, 
"/root/page[1]/body/txt[2]/anchored/fly[1]/txt[1]/Text[2]", "Portion",
+                "c");
+    assertXPath(pXmlDoc, 
"/root/page[1]/body/txt[2]/anchored/fly[1]/txt[2]/Text[1]", "nType",
+                "POR_PARA");
+    assertXPath(pXmlDoc, 
"/root/page[1]/body/txt[2]/anchored/fly[1]/txt[2]/Text[1]", "Portion",
+                "def");
+    assertXPath(pXmlDoc, 
"/root/page[1]/body/txt[2]/anchored/fly[1]/txt[3]/Text[1]", "nType",
+                "POR_TXT");
+    assertXPath(pXmlDoc, 
"/root/page[1]/body/txt[2]/anchored/fly[1]/txt[3]/Text[1]", "Portion",
+                "g");
+    assertXPath(pXmlDoc, 
"/root/page[1]/body/txt[2]/anchored/fly[1]/txt[3]/Text[2]", "nType",
+                "POR_TXT");
+    assertXPath(pXmlDoc, 
"/root/page[1]/body/txt[2]/anchored/fly[1]/txt[3]/Text[2]", "Portion",
+                "hi");
+    assertXPath(pXmlDoc, "/root/page[1]/body/txt[2]/Text[1]", "nType", 
"POR_PARA");
+    assertXPath(pXmlDoc, "/root/page[1]/body/txt[2]/Text[1]", "Portion", 
"bar");
+    assertXPath(pXmlDoc, "/root/page[1]/body/txt[3]/Text[1]", "nType", 
"POR_TXT");
+    assertXPath(pXmlDoc, "/root/page[1]/body/txt[3]/Text[1]", "Portion", "b");
+    assertXPath(pXmlDoc, "/root/page[1]/body/txt[3]/Text[2]", "nType", 
"POR_TXT");
+    assertXPath(pXmlDoc, "/root/page[1]/body/txt[3]/Text[2]", "Portion", "az");
+}
+
 void SwLayoutWriter::testTdf116830()
 {
     SwDoc* pDoc = createDoc("tdf116830.odt");
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to