sw/qa/extras/uiwriter/data/testTdf106663.odt |binary
 sw/qa/extras/uiwriter/uiwriter6.cxx          |   20 ++++++++++++++++++++
 2 files changed, 20 insertions(+)

New commits:
commit 486ae5db6987411d5e394de94b2b077099d03856
Author:     Andreas Heinisch <andreas.heini...@yahoo.de>
AuthorDate: Tue Sep 19 21:20:40 2023 +0200
Commit:     Andreas Heinisch <andreas.heini...@yahoo.de>
CommitDate: Tue Sep 19 22:44:05 2023 +0200

    tdf#106663 - Test GoToNextPlacemarker in header's fly frame
    
    Change-Id: I3a2d63c0a1f07460db4aeabd1df289090c5f013b
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157070
    Tested-by: Jenkins
    Reviewed-by: Andreas Heinisch <andreas.heini...@yahoo.de>

diff --git a/sw/qa/extras/uiwriter/data/testTdf106663.odt 
b/sw/qa/extras/uiwriter/data/testTdf106663.odt
new file mode 100755
index 000000000000..eee462406bb0
Binary files /dev/null and b/sw/qa/extras/uiwriter/data/testTdf106663.odt differ
diff --git a/sw/qa/extras/uiwriter/uiwriter6.cxx 
b/sw/qa/extras/uiwriter/uiwriter6.cxx
index 80eecbaa5edd..f1f349779dac 100644
--- a/sw/qa/extras/uiwriter/uiwriter6.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter6.cxx
@@ -2522,6 +2522,26 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testTdf146178)
     CPPUNIT_ASSERT_EQUAL(sal_Int32(0), pCursor->GetPoint()->GetContentIndex());
 }
 
+CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, 
testTdf106663HeaderTextFrameGoToNextPlacemarker)
+{
+    createSwDoc("testTdf106663.odt");
+
+    SwDoc* pDoc = getSwDoc();
+    SwPaM* pCursor = pDoc->GetEditShell()->GetCursor();
+    SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
+
+    // Move the cursor into the fly frame of the document's header
+    pWrtShell->GotoFly("FrameInHeader", FLYCNTTYPE_FRM, false);
+
+    // Check that GoToNextPlacemarker highlights the first field instead of 
the second one
+    dispatchCommand(mxComponent, ".uno:GoToNextPlacemarker", {});
+    // Without the fix in place, this test would have failed with
+    // - Expected: Heading
+    // - Actual  : Some other marker
+    // i.e. the GoToNextPlacemarker command skipped the first field
+    
CPPUNIT_ASSERT(pCursor->GetPoint()->GetNode().GetTextNode()->GetText().startsWith("Heading"));
+}
+
 CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testTdf155407)
 {
     createSwDoc();

Reply via email to