[Libreoffice-commits] core.git: sfx2/source sw/qa

Xisco Fauli (via logerrit) logerrit at kemper.freedesktop.org
Fri Feb 19 21:34:10 UTC 2021


 sfx2/source/dialog/dinfdlg.cxx        |   18 +++++++++++++-----
 sw/qa/uitest/writer_tests/tdf81457.py |   15 +++++++++++++++
 2 files changed, 28 insertions(+), 5 deletions(-)

New commits:
commit 6997ed7babe5d72cff8f46fdf997543a36efb766
Author:     Xisco Fauli <xiscofauli at libreoffice.org>
AuthorDate: Fri Feb 19 15:46:07 2021 +0100
Commit:     Xisco Fauli <xiscofauli at libreoffice.org>
CommitDate: Fri Feb 19 22:33:26 2021 +0100

    uitest: sw: differentiate the elements in the custompropertieslines
    
    Change-Id: Ic61cd1655df2bcd7b89c4dfadcda801b7160253c
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111226
    Tested-by: Jenkins
    Reviewed-by: Xisco Fauli <xiscofauli at libreoffice.org>

diff --git a/sfx2/source/dialog/dinfdlg.cxx b/sfx2/source/dialog/dinfdlg.cxx
index 27c18056468e..5e63fa018c00 100644
--- a/sfx2/source/dialog/dinfdlg.cxx
+++ b/sfx2/source/dialog/dinfdlg.cxx
@@ -236,8 +236,7 @@ SfxDocumentInfoItem::SfxDocumentInfoItem( const OUString& rFile,
                 }
 
                 uno::Any aValue = xSet->getPropertyValue(rProp.Name);
-                std::unique_ptr<CustomProperty> pProp(new CustomProperty( rProp.Name, aValue ));
-                m_aCustomProperties.push_back( std::move(pProp) );
+                AddCustomProperty( rProp.Name, aValue );
             }
         }
 
@@ -274,9 +273,7 @@ SfxDocumentInfoItem::SfxDocumentInfoItem( const SfxDocumentInfoItem& rItem )
 {
     for (auto const & pOtherProp : rItem.m_aCustomProperties)
     {
-        std::unique_ptr<CustomProperty> pProp(new CustomProperty( pOtherProp->m_sName,
-                                                    pOtherProp->m_aValue ));
-        m_aCustomProperties.push_back( std::move(pProp) );
+        AddCustomProperty( pOtherProp->m_sName, pOtherProp->m_aValue );
     }
 
     m_aCmisProperties = rItem.m_aCmisProperties;
@@ -1475,6 +1472,17 @@ void CustomPropertiesWindow::CreateNewLine()
 
     m_aCustomPropertiesLines.emplace_back( pNewLine );
 
+    // for ui-testing. Distinguish the elements in the lines
+    sal_uInt16 nSize = m_aCustomPropertiesLines.size();
+    pNewLine->m_xNameBox->set_buildable_name(
+        pNewLine->m_xNameBox->get_buildable_name() + OString::number(nSize));
+    pNewLine->m_xTypeBox->set_buildable_name(
+        pNewLine->m_xTypeBox->get_buildable_name() + OString::number(nSize));
+    pNewLine->m_xValueEdit->set_buildable_name(
+        pNewLine->m_xValueEdit->get_buildable_name() + OString::number(nSize));
+    pNewLine->m_xRemoveButton->set_buildable_name(
+        pNewLine->m_xRemoveButton->get_buildable_name() + OString::number(nSize));
+
     pNewLine->DoTypeHdl(*pNewLine->m_xTypeBox);
     pNewLine->m_xNameBox->grab_focus();
 }
diff --git a/sw/qa/uitest/writer_tests/tdf81457.py b/sw/qa/uitest/writer_tests/tdf81457.py
index 655d0c2f671b..f8b93a9bc60a 100644
--- a/sw/qa/uitest/writer_tests/tdf81457.py
+++ b/sw/qa/uitest/writer_tests/tdf81457.py
@@ -21,6 +21,21 @@ class tdf81457(UITestCase):
         xDialog = self.xUITest.getTopFocusWindow()
         xTabs = xDialog.getChild("tabcontrol")
         select_pos(xTabs, "2")     #tab Custom properties
+
+        aExpectedNames = ['BookMarkCount', 'BookMarkInfo1', 'BookMarkInfo10', 'BookMarkInfo11',
+                'BookMarkInfo12', 'BookMarkInfo13']
+        aExpectedValues = ['78', '00FF0000FF010', '00FF0000FF1E0', '00FF0000FF1E0',
+                '00FF0000FF210', '00FF0000FF230']
+
+        for i in range(6):
+            xNameBox = xDialog.getChild("namebox" + str(i + 1))
+            xTypeBox = xDialog.getChild("typebox" + str(i + 1))
+            xValueEdit = xDialog.getChild("valueedit" + str(i + 1))
+            self.assertEqual(aExpectedNames[i], get_state_as_dict(xNameBox)['Text'])
+            self.assertEqual('Text', get_state_as_dict(xTypeBox)['DisplayText'])
+            self.assertEqual(aExpectedValues[i], get_state_as_dict(xValueEdit)['Text'][:13])
+
+
         xOkBtn = xDialog.getChild("ok")
         xOkBtn.executeAction("CLICK", tuple())
 


More information about the Libreoffice-commits mailing list