[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-6.4' - editeng/source sd/qa

Gülşah Köse (via logerrit) logerrit at kemper.freedesktop.org
Wed Jun 23 13:06:33 UTC 2021


 editeng/source/uno/unotext.cxx      |   14 +++++++-------
 sd/qa/unit/data/pptx/tdf142716.pptx |binary
 sd/qa/unit/export-tests.cxx         |   18 ++++++++++++++++++
 3 files changed, 25 insertions(+), 7 deletions(-)

New commits:
commit d212119828a71e4dc72b6e09532e3628a4597d35
Author:     Gülşah Köse <gulsah.kose at collabora.com>
AuthorDate: Fri Jun 18 11:23:41 2021 +0300
Commit:     Mike Kaganski <mike.kaganski at collabora.com>
CommitDate: Wed Jun 23 15:05:56 2021 +0200

    tdf#142716 Update selection after any text is inserted.
    
    When we don't update the selection after insertion of new text
    SvxUnoTextBase::createEnumeration knows old selection and losts last part
    of the text.
    
    Change-Id: I20f6530f34097ff213ff00cff617139887fd287a
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/117409
    Tested-by: Jenkins
    Reviewed-by: Gülşah Köse <gulsah.kose at collabora.com>
    (cherry picked from commit e837f50313a703b6b26abb78f224472c1e4734ea)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/117556
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
    Reviewed-by: Mike Kaganski <mike.kaganski at collabora.com>

diff --git a/editeng/source/uno/unotext.cxx b/editeng/source/uno/unotext.cxx
index 4796732b2c74..246bdc370be6 100644
--- a/editeng/source/uno/unotext.cxx
+++ b/editeng/source/uno/unotext.cxx
@@ -1736,13 +1736,6 @@ void SAL_CALL SvxUnoTextBase::insertString( const uno::Reference< text::XTextRan
     if( !xRange.is() )
         return;
 
-    ESelection aSelection;
-    if (GetEditSource())
-    {
-        ::GetSelection( aSelection, GetEditSource()->GetTextForwarder() );
-        SetSelection( aSelection );
-    }
-
     SvxUnoTextRangeBase* pRange = comphelper::getUnoTunnelImplementation<SvxUnoTextRange>( xRange );
     if(pRange)
     {
@@ -1757,6 +1750,13 @@ void SAL_CALL SvxUnoTextBase::insertString( const uno::Reference< text::XTextRan
         pRange->setString( aString );
 
         pRange->CollapseToEnd();
+
+        ESelection aSelection;
+        if (GetEditSource())
+        {
+            ::GetSelection( aSelection, GetEditSource()->GetTextForwarder() );
+            SetSelection( aSelection );
+        }
     }
 }
 
diff --git a/sd/qa/unit/data/pptx/tdf142716.pptx b/sd/qa/unit/data/pptx/tdf142716.pptx
new file mode 100644
index 000000000000..4ef29e389449
Binary files /dev/null and b/sd/qa/unit/data/pptx/tdf142716.pptx differ
diff --git a/sd/qa/unit/export-tests.cxx b/sd/qa/unit/export-tests.cxx
index fdad324b216a..f246f6568534 100644
--- a/sd/qa/unit/export-tests.cxx
+++ b/sd/qa/unit/export-tests.cxx
@@ -56,6 +56,7 @@ public:
     void testImageWithSpecialID();
     void testTdf62176();
     void testTransparentBackground();
+    void testTdf142716();
     void testEmbeddedPdf();
     void testEmbeddedText();
     void testTransparenText();
@@ -90,6 +91,7 @@ public:
     CPPUNIT_TEST(testImageWithSpecialID);
     CPPUNIT_TEST(testTdf62176);
     CPPUNIT_TEST(testTransparentBackground);
+    CPPUNIT_TEST(testTdf142716);
     CPPUNIT_TEST(testEmbeddedPdf);
     CPPUNIT_TEST(testEmbeddedText);
     CPPUNIT_TEST(testTransparenText);
@@ -282,6 +284,22 @@ void SdExportTest::testTransparentBackground()
     xDocShRef->DoClose();
 }
 
+void SdExportTest::testTdf142716()
+{
+    ::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc(u"/sd/qa/unit/data/pptx/tdf142716.pptx"), PPTX);
+    xDocShRef = saveAndReload( xDocShRef.get(), PPTX );
+
+    const SdrPage *pPage = GetPage( 1, xDocShRef );
+    const SdrTextObj *pObj = dynamic_cast<SdrTextObj *>( pPage->GetObj( 0 ) );
+
+    OUString sText = pObj->GetOutlinerParaObject()->GetTextObject().GetText(0);
+
+    // Without fix "yyy" part will be lost.
+    CPPUNIT_ASSERT_EQUAL( OUString( "xxx and yyy" ), sText);
+
+    xDocShRef->DoClose();
+}
+
 void SdExportTest::testMediaEmbedding()
 {
     if (!OpenGLWrapper::isVCLOpenGLEnabled())


More information about the Libreoffice-commits mailing list