sw/qa/uitest/writer_tests/tdf146462.py |   45 +++++++++++++++++++++++++++++++++
 sw/source/ui/fldui/flddb.cxx           |    1 
 sw/source/ui/fldui/flddinf.cxx         |    1 
 sw/source/ui/fldui/flddok.cxx          |    1 
 sw/source/ui/fldui/fldfunc.cxx         |    1 
 sw/source/ui/fldui/fldref.cxx          |    1 
 sw/source/ui/fldui/fldvar.cxx          |    1 
 7 files changed, 51 insertions(+)

New commits:
commit d4d16e26a7deb5bfddc9736b4cc9e87c5f6704ee
Author:     Xisco Fauli <xiscofa...@libreoffice.org>
AuthorDate: Mon Feb 7 18:06:46 2022 +0100
Commit:     Xisco Fauli <xiscofa...@libreoffice.org>
CommitDate: Tue Feb 8 08:16:53 2022 +0100

    tdf#146462: sw: Add UItest
    
    Change-Id: Ifae155b3d6c727403d395c28842b3aea36b92b49
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129633
    Tested-by: Jenkins
    Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org>

diff --git a/sw/qa/uitest/writer_tests/tdf146462.py 
b/sw/qa/uitest/writer_tests/tdf146462.py
new file mode 100644
index 000000000000..95eae5ac0fed
--- /dev/null
+++ b/sw/qa/uitest/writer_tests/tdf146462.py
@@ -0,0 +1,45 @@
+# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*-
+#
+# This file is part of the LibreOffice project.
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+#
+
+from uitest.framework import UITestCase
+from libreoffice.uno.propertyvalue import mkPropertyValues
+from uitest.uihelper.common import get_state_as_dict, type_text
+from uitest.uihelper.common import select_pos
+
+class Tdf146462(UITestCase):
+
+    def test_tdf146462(self):
+
+        with self.ui_test.create_doc_in_start_center("writer") as document:
+            xWriterDoc = self.xUITest.getTopFocusWindow()
+            xWriterEdit = xWriterDoc.getChild("writer_edit")
+
+            type_text(xWriterEdit, "Header")
+
+            
self.xUITest.executeCommand(".uno:StyleApply?Style:string=Heading%201&FamilyName:string=ParagraphStyles")
+
+            with 
self.ui_test.execute_modeless_dialog_through_command(".uno:InsertField", 
close_button="cancel") as xDialog:
+                xTab = xDialog.getChild("tabcontrol")
+                select_pos(xTab, "1")
+
+                xType = xDialog.getChild("type-ref")
+                xType.getChild('2').executeAction("SELECT", tuple())
+                self.assertEqual("Headings", 
get_state_as_dict(xType)['SelectEntryText'])
+
+                xFormat = xDialog.getChild("format-ref")
+                self.assertEqual("Page number (unstyled)", 
get_state_as_dict(xFormat)['SelectEntryText'])
+
+                xSelect = xDialog.getChild("selecttip")
+
+                # Without the fix in place, this test would have failed with
+                # AssertionError: 'Header' != ''
+                self.assertEqual("Header", 
get_state_as_dict(xSelect)['SelectEntryText'])
+                self.assertEqual("1", get_state_as_dict(xSelect)['Children'])
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/source/ui/fldui/flddb.cxx b/sw/source/ui/fldui/flddb.cxx
index dd5e7046728d..d59da9aabf63 100644
--- a/sw/source/ui/fldui/flddb.cxx
+++ b/sw/source/ui/fldui/flddb.cxx
@@ -66,6 +66,7 @@ SwFieldDBPage::SwFieldDBPage(weld::Container* pPage, 
weld::DialogController* pCo
     // uitests
     m_xTypeLB->set_buildable_name(m_xTypeLB->get_buildable_name() + "-db");
     m_xNumFormatLB->set_buildable_name(m_xNumFormatLB->get_buildable_name() + 
"-db");
+    m_xFormatLB->set_buildable_name(m_xFormatLB->get_buildable_name() + "-db");
 }
 
 SwFieldDBPage::~SwFieldDBPage()
diff --git a/sw/source/ui/fldui/flddinf.cxx b/sw/source/ui/fldui/flddinf.cxx
index 1729a68c148c..86e61c60e705 100644
--- a/sw/source/ui/fldui/flddinf.cxx
+++ b/sw/source/ui/fldui/flddinf.cxx
@@ -82,6 +82,7 @@ SwFieldDokInfPage::SwFieldDokInfPage(weld::Container* pPage, 
weld::DialogControl
     // uitests
     m_xTypeTLB->set_buildable_name(m_xTypeTLB->get_buildable_name() + 
"-docinf");
     m_xSelectionLB->set_buildable_name(m_xSelectionLB->get_buildable_name() + 
"-docinf");
+    m_xFormatLB->set_buildable_name(m_xFormatLB->get_buildable_name() + 
"-docinf");
 }
 
 SwFieldDokInfPage::~SwFieldDokInfPage()
diff --git a/sw/source/ui/fldui/flddok.cxx b/sw/source/ui/fldui/flddok.cxx
index 3a4288fdcfcb..4546dfd34ded 100644
--- a/sw/source/ui/fldui/flddok.cxx
+++ b/sw/source/ui/fldui/flddok.cxx
@@ -74,6 +74,7 @@ SwFieldDokPage::SwFieldDokPage(weld::Container* pPage, 
weld::DialogController* p
     m_xValueED->set_buildable_name(m_xValueED->get_buildable_name() + "-doc");
     m_xNumFormatLB->set_buildable_name(m_xNumFormatLB->get_buildable_name() + 
"-doc");
     m_xSelectionLB->set_buildable_name(m_xSelectionLB->get_buildable_name() + 
"-doc");
+    m_xFormatLB->set_buildable_name(m_xFormatLB->get_buildable_name() + 
"-doc");
 }
 
 SwFieldDokPage::~SwFieldDokPage()
diff --git a/sw/source/ui/fldui/fldfunc.cxx b/sw/source/ui/fldui/fldfunc.cxx
index 9571d60ac5de..a9157ccde8de 100644
--- a/sw/source/ui/fldui/fldfunc.cxx
+++ b/sw/source/ui/fldui/fldfunc.cxx
@@ -84,6 +84,7 @@ SwFieldFuncPage::SwFieldFuncPage(weld::Container* pPage, 
weld::DialogController*
     m_xTypeLB->set_buildable_name(m_xTypeLB->get_buildable_name() + "-func");
     m_xValueED->set_buildable_name(m_xValueED->get_buildable_name() + "-func");
     m_xSelectionLB->set_buildable_name(m_xSelectionLB->get_buildable_name() + 
"-func");
+    m_xFormatLB->set_buildable_name(m_xFormatLB->get_buildable_name() + 
"-func");
 }
 
 SwFieldFuncPage::~SwFieldFuncPage()
diff --git a/sw/source/ui/fldui/fldref.cxx b/sw/source/ui/fldui/fldref.cxx
index c50f9c5ed898..f9dec1a8a099 100644
--- a/sw/source/ui/fldui/fldref.cxx
+++ b/sw/source/ui/fldui/fldref.cxx
@@ -108,6 +108,7 @@ SwFieldRefPage::SwFieldRefPage(weld::Container* pPage, 
weld::DialogController* p
     m_xNameED->set_buildable_name(m_xNameED->get_buildable_name() + "-ref");
     m_xValueED->set_buildable_name(m_xValueED->get_buildable_name() + "-ref");
     m_xSelectionLB->set_buildable_name(m_xSelectionLB->get_buildable_name() + 
"-ref");
+    m_xFormatLB->set_buildable_name(m_xFormatLB->get_buildable_name() + 
"-ref");
 }
 
 SwFieldRefPage::~SwFieldRefPage()
diff --git a/sw/source/ui/fldui/fldvar.cxx b/sw/source/ui/fldui/fldvar.cxx
index 22f0f5e596a5..e07117a3c737 100644
--- a/sw/source/ui/fldui/fldvar.cxx
+++ b/sw/source/ui/fldui/fldvar.cxx
@@ -86,6 +86,7 @@ SwFieldVarPage::SwFieldVarPage(weld::Container* pPage, 
weld::DialogController* p
     m_xValueED->set_buildable_name(m_xValueED->get_buildable_name() + "-var");
     m_xNumFormatLB->set_buildable_name(m_xNumFormatLB->get_buildable_name() + 
"-var");
     m_xSelectionLB->set_buildable_name(m_xSelectionLB->get_buildable_name() + 
"-var");
+    m_xFormatLB->set_buildable_name(m_xFormatLB->get_buildable_name() + 
"-var");
 }
 
 SwFieldVarPage::~SwFieldVarPage()

Reply via email to