[Libreoffice-commits] core.git: extensions/source

Xisco Fauli (via logerrit) logerrit at kemper.freedesktop.org
Tue Feb 23 19:42:39 UTC 2021


 extensions/source/propctrlr/formcomponenthandler.cxx |   15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

New commits:
commit ed796e0fcd47edcc1df2766a08aaf0cb85622bab
Author:     Xisco Fauli <xiscofauli at libreoffice.org>
AuthorDate: Tue Feb 23 15:29:06 2021 +0100
Commit:     Xisco Fauli <xiscofauli at libreoffice.org>
CommitDate: Tue Feb 23 20:41:57 2021 +0100

    Set unique buildable names to each widget in the form properties dialog
    
    the dialog has many 'listbox' items and it is not possible to use
    them in uitests if they have the same name
    
    follow-up of d4ca173f2babde53c1d20f10e335244b092c5c97
    
    Change-Id: I3342c0d930f3567219008fc6048c337a8af447af
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111407
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Reviewed-by: Xisco Fauli <xiscofauli at libreoffice.org>
    Tested-by: Jenkins

diff --git a/extensions/source/propctrlr/formcomponenthandler.cxx b/extensions/source/propctrlr/formcomponenthandler.cxx
index 1fd26057a110..ccd910553249 100644
--- a/extensions/source/propctrlr/formcomponenthandler.cxx
+++ b/extensions/source/propctrlr/formcomponenthandler.cxx
@@ -1108,8 +1108,6 @@ namespace pcr
                     {
                         std::unique_ptr<weld::Builder> xBuilder(PropertyHandlerHelper::makeBuilder("modules/spropctrlr/ui/formattedcontrol.ui", m_xContext));
                         auto pSpinButton = xBuilder->weld_formatted_spin_button("formattedcontrol");
-                        // for ui-testing try and distinguish different instances of this formatted control
-                        pSpinButton->set_buildable_name(pSpinButton->get_buildable_name() + "-" + aDescriptor.DisplayName.toUtf8());
                         rtl::Reference<OFormattedNumericControl> pControl = new OFormattedNumericControl(std::move(pSpinButton), std::move(xBuilder), false);
                         pControl->SetModifyHandler();
 
@@ -1149,8 +1147,6 @@ namespace pcr
         {
             std::unique_ptr<weld::Builder> xBuilder(PropertyHandlerHelper::makeBuilder("modules/spropctrlr/ui/formattedcontrol.ui", m_xContext));
             auto pSpinButton = xBuilder->weld_formatted_spin_button("formattedcontrol");
-            // for ui-testing try and distinguish different instances of this formatted control
-            pSpinButton->set_buildable_name(pSpinButton->get_buildable_name() + "-" + aDescriptor.DisplayName.toUtf8());
             rtl::Reference<OFormattedNumericControl> pControl = new OFormattedNumericControl(std::move(pSpinButton), std::move(xBuilder), false);
             pControl->SetModifyHandler();
             aDescriptor.Control = pControl;
@@ -1212,7 +1208,6 @@ namespace pcr
             break;
         }
 
-
         if ( eType == TypeClass_SEQUENCE )
             nControlType = PropertyControlType::StringListField;
 
@@ -1380,6 +1375,16 @@ namespace pcr
         if ( !aDescriptor.SecondaryButtonId.isEmpty() )
             aDescriptor.HasSecondaryButton = true;
 
+        // for ui-testing try and distinguish different instances of the controls
+        auto xWindow = aDescriptor.Control->getControlWindow();
+        if (weld::TransportAsXWindow* pTunnel = dynamic_cast<weld::TransportAsXWindow*>(xWindow.get()))
+        {
+            weld::Widget* m_pControlWindow = pTunnel->getWidget();
+            if (m_pControlWindow)
+                m_pControlWindow->set_buildable_name(m_pControlWindow->get_buildable_name() + "-" + aDescriptor.DisplayName.toUtf8());
+        }
+
+
         bool bIsDataProperty = ( nPropertyUIFlags & PROP_FLAG_DATA_PROPERTY ) != 0;
         aDescriptor.Category = bIsDataProperty ? std::u16string_view(u"Data") : std::u16string_view(u"General");
         return aDescriptor;


More information about the Libreoffice-commits mailing list