sw/qa/extras/uiwriter/uiwriter8.cxx            |   33 +++++++++++++++++++++++++
 sw/qa/uitest/writer_tests4/insertPageHeader.py |   18 -------------
 2 files changed, 33 insertions(+), 18 deletions(-)

New commits:
commit b2f3072bdf419492ad20cbfb1da14e2d53acf83b
Author:     Xisco Fauli <xiscofa...@libreoffice.org>
AuthorDate: Wed Feb 1 11:16:42 2023 +0100
Commit:     Xisco Fauli <xiscofa...@libreoffice.org>
CommitDate: Wed Feb 1 11:10:11 2023 +0000

    tdf#107427: sw: move UItest to CppUnittest
    
    Change-Id: I13b8757c384c3ecd23c0b06b93e2db03ce0b364e
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146431
    Tested-by: Jenkins
    Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org>

diff --git a/sw/qa/extras/uiwriter/uiwriter8.cxx 
b/sw/qa/extras/uiwriter/uiwriter8.cxx
index 2bd6b415f11e..18d390ef64ce 100644
--- a/sw/qa/extras/uiwriter/uiwriter8.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter8.cxx
@@ -842,6 +842,39 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest8, testTdf146248)
     CPPUNIT_ASSERT_EQUAL(true, getProperty<bool>(xPageStyle, "HeaderIsOn"));
 }
 
+CPPUNIT_TEST_FIXTURE(SwUiWriterTest8, testTdf107427)
+{
+    createSwDoc();
+
+    dispatchCommand(mxComponent,
+                    
".uno:InsertPageHeader?PageStyle:string=Default%20Page%20Style&On:bool=true",
+                    {});
+    uno::Sequence<beans::PropertyValue> aArgs(comphelper::InitPropertySequence(
+        { { "Rows", uno::Any(sal_Int32(2)) }, { "Columns", 
uno::Any(sal_Int32(2)) } }));
+
+    dispatchCommand(mxComponent, ".uno:InsertTable", aArgs);
+    Scheduler::ProcessEventsToIdle();
+
+    xmlDocUniquePtr pLayout = parseLayoutDump();
+    assertXPath(pLayout, "/root/page[1]/header/tab/row", 2);
+
+    SwDoc* pDoc = getSwDoc();
+    SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
+    // Delete the header
+    pWrtShell->ChangeHeaderOrFooter(u"Default Page Style", true, false, false);
+
+    discardDumpedLayout();
+    pLayout = parseLayoutDump();
+    assertXPath(pLayout, "/root/page[1]/header", 0);
+
+    dispatchCommand(mxComponent, ".uno:Undo", {});
+    Scheduler::ProcessEventsToIdle();
+
+    discardDumpedLayout();
+    pLayout = parseLayoutDump();
+    assertXPath(pLayout, "/root/page[1]/header/tab/row", 2);
+}
+
 CPPUNIT_TEST_FIXTURE(SwUiWriterTest8, testTdf141613)
 {
     createSwDoc();
diff --git a/sw/qa/uitest/writer_tests4/insertPageHeader.py 
b/sw/qa/uitest/writer_tests4/insertPageHeader.py
index e71749b82931..7f965cc9040d 100644
--- a/sw/qa/uitest/writer_tests4/insertPageHeader.py
+++ b/sw/qa/uitest/writer_tests4/insertPageHeader.py
@@ -44,22 +44,4 @@ class WriterInsertPageHeader(UITestCase):
 
             self.delete_header()
 
-
-    def test_tdf107427(self):
-        with self.ui_test.create_doc_in_start_center("writer") as document:
-
-            self.insert_header()
-
-            with 
self.ui_test.execute_dialog_through_command(".uno:InsertTable"):
-                pass
-
-
-            tables = document.getTextTables()
-            self.assertEqual(len(tables[0].getRows()), 2)
-            self.assertEqual(len(tables[0].getColumns()), 2)
-
-            self.xUITest.executeCommand(".uno:SelectAll")
-
-            self.delete_header()
-
 # vim: set shiftwidth=4 softtabstop=4 expandtab:

Reply via email to