[Libreoffice-commits] core.git: Branch 'libreoffice-6-3-3' - sw/qa sw/source

Xisco Fauli (via logerrit) logerrit at kemper.freedesktop.org
Wed Oct 23 11:49:56 UTC 2019


 sw/qa/extras/ooxmlimport/data/tdf128076.docx |binary
 sw/qa/extras/ooxmlimport/ooxmlimport.cxx     |   16 ++++++++++++++++
 sw/source/core/unocore/unofield.cxx          |    6 +++---
 3 files changed, 19 insertions(+), 3 deletions(-)

New commits:
commit c3dbf906a72a8b7a6d1bf47aa980cf6fd7426e94
Author:     Xisco Fauli <xiscofauli at libreoffice.org>
AuthorDate: Fri Oct 11 19:00:05 2019 +0200
Commit:     Christian Lohmaier <lohmaier+LibreOffice at googlemail.com>
CommitDate: Wed Oct 23 13:49:06 2019 +0200

    tdf#128076: throw exception only if it's not alive and it's not a description
    
    According to a comment from https://gerrit.libreoffice.org/#/c/74533/
    
    okay... then i guess there are different kinds of callers:
    those who actually want to check if its a descriptor,
    and those who want to check that it isn't "live"
    
    so check if it's a description even if it's not alive
    
    Change-Id: I1526fdbcb006506cc67d29cbe3f65138f90843dc
    Reviewed-on: https://gerrit.libreoffice.org/80677
    Reviewed-by: Michael Stahl <michael.stahl at cib.de>
    Tested-by: Michael Stahl <michael.stahl at cib.de>
    (cherry picked from commit 802d034c55876c9a933206176a7882ac1ae7566e)
    Reviewed-on: https://gerrit.libreoffice.org/80764
    Tested-by: Jenkins
    Reviewed-by: Xisco FaulĂ­ <xiscofauli at libreoffice.org>
    (cherry picked from commit 52485e1f3464ab69b38d2e240c8c364d6b78ceb8)
    Reviewed-on: https://gerrit.libreoffice.org/80877
    Reviewed-by: Adolfo Jayme Barrientos <fitojb at ubuntu.com>
    Reviewed-by: Christian Lohmaier <lohmaier+LibreOffice at googlemail.com>
    Tested-by: Christian Lohmaier <lohmaier+LibreOffice at googlemail.com>

diff --git a/sw/qa/extras/ooxmlimport/data/tdf128076.docx b/sw/qa/extras/ooxmlimport/data/tdf128076.docx
new file mode 100644
index 000000000000..69490a14554b
Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/tdf128076.docx differ
diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
index 4ee66606b7a6..94b6c66ac82d 100644
--- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
+++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
@@ -211,6 +211,22 @@ xray ThisComponent.DrawPage(1).getByIndex(0).Anchor.PageStyleName
     CPPUNIT_ASSERT_EQUAL(OUString("First Page"), getProperty<OUString>(xTextContent->getAnchor(), "PageStyleName"));
 }
 
+DECLARE_OOXMLIMPORT_TEST(testTdf128076, "tdf128076.docx")
+{
+    uno::Reference<text::XTextFieldsSupplier> xTextFieldsSupplier(mxComponent, uno::UNO_QUERY);
+    uno::Reference<container::XEnumerationAccess> xFieldsAccess(xTextFieldsSupplier->getTextFields());
+    uno::Reference<container::XEnumeration> xFields(xFieldsAccess->createEnumeration());
+
+    if( !xFields->hasMoreElements() ) {
+        CPPUNIT_ASSERT(false);
+        return;
+    }
+
+    uno::Reference<text::XTextField> xEnumerationAccess(xFields->nextElement(), uno::UNO_QUERY);
+    CPPUNIT_ASSERT_EQUAL(OUString("User Field adres = Test"), xEnumerationAccess->getPresentation(true).trim());
+    CPPUNIT_ASSERT_EQUAL(OUString("Test"), xEnumerationAccess->getPresentation(false).trim());
+}
+
 DECLARE_OOXMLIMPORT_TEST(testfdo90720, "testfdo90720.docx")
 {
     uno::Reference<text::XTextFramesSupplier> xTextFramesSupplier(mxComponent, uno::UNO_QUERY);
diff --git a/sw/source/core/unocore/unofield.cxx b/sw/source/core/unocore/unofield.cxx
index 0cbf59a13931..c8363b9c01f9 100644
--- a/sw/source/core/unocore/unofield.cxx
+++ b/sw/source/core/unocore/unofield.cxx
@@ -1186,11 +1186,11 @@ public:
 
     SwFieldType* GetFieldType() const
     {
-        if(!m_pDoc)
+        if(!m_pDoc && !IsDescriptor())
             throw uno::RuntimeException();
-
-        if (IsDescriptor())
+        else if (IsDescriptor())
             return m_pFieldType;
+
         return m_pFormatField->GetField()->GetTyp();
     }
     void SetFieldType(SwFieldType& rType)


More information about the Libreoffice-commits mailing list