[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-5.1' - 2 commits - sd/CppunitTest_sd_tiledrendering.mk sd/qa svx/source

Jan Holesovsky kendy at collabora.com
Wed Jan 4 19:46:18 UTC 2017


 sd/CppunitTest_sd_tiledrendering.mk          |    1 
 sd/qa/unit/tiledrendering/data/tdf81754.pptx |binary
 sd/qa/unit/tiledrendering/tiledrendering.cxx |   42 ++++++++++++++++++++++++++-
 svx/source/unodraw/unoshtxt.cxx              |    1 
 4 files changed, 43 insertions(+), 1 deletion(-)

New commits:
commit fb0ed822ddf3e8a2ca6c87fd9c339264c39a574f
Author: Jan Holesovsky <kendy at collabora.com>
Date:   Wed Jan 4 20:40:28 2017 +0100

    tdf#81754: Unit test for the loss of text on save of pptx.
    
    The problem itself was fixed by commit
    2ad50c9a8c8411a57bbbd7a52734e72ffc4cc0ee.
    
    Change-Id: Ie7f0781e1f5a4d6c5297882a5f64a68b85558515

diff --git a/sd/CppunitTest_sd_tiledrendering.mk b/sd/CppunitTest_sd_tiledrendering.mk
index 2a3f29c..69496cf 100644
--- a/sd/CppunitTest_sd_tiledrendering.mk
+++ b/sd/CppunitTest_sd_tiledrendering.mk
@@ -19,6 +19,7 @@ $(eval $(call gb_CppunitTest_use_libraries,sd_tiledrendering, \
     comphelper \
     cppu \
     cppuhelper \
+    drawinglayer \
     editeng \
     sal \
     sfx \
diff --git a/sd/qa/unit/tiledrendering/data/tdf81754.pptx b/sd/qa/unit/tiledrendering/data/tdf81754.pptx
new file mode 100644
index 0000000..8a1fa1d
Binary files /dev/null and b/sd/qa/unit/tiledrendering/data/tdf81754.pptx differ
diff --git a/sd/qa/unit/tiledrendering/tiledrendering.cxx b/sd/qa/unit/tiledrendering/tiledrendering.cxx
index 796367b..3814759 100644
--- a/sd/qa/unit/tiledrendering/tiledrendering.cxx
+++ b/sd/qa/unit/tiledrendering/tiledrendering.cxx
@@ -7,6 +7,7 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
  */
 
+#include "../sdmodeltestbase.hxx"
 #include <test/bootstrapfixture.hxx>
 #include <unotest/macros_test.hxx>
 #include <test/xmltesttools.hxx>
@@ -19,8 +20,10 @@
 #include <comphelper/propertysequence.hxx>
 #include <comphelper/string.hxx>
 #include <editeng/editids.hrc>
+#include <editeng/editobj.hxx>
 #include <editeng/editview.hxx>
 #include <editeng/outliner.hxx>
+#include <editeng/outlobj.hxx>
 #include <osl/conditn.hxx>
 #include <sfx2/dispatch.hxx>
 #include <sfx2/viewfrm.hxx>
@@ -40,7 +43,7 @@ using namespace css;
 
 static const char* DATA_DIRECTORY = "/sd/qa/unit/tiledrendering/data/";
 
-class SdTiledRenderingTest : public test::BootstrapFixture, public unotest::MacrosTest, public XmlTestTools
+class SdTiledRenderingTest : public SdModelTestBase, public XmlTestTools
 {
 public:
     SdTiledRenderingTest();
@@ -73,6 +76,7 @@ public:
     void testCreateViewGraphicSelection();
     void testCreateViewTextCursor();
     void testPostKeyEventInvalidation();
+    void testTdf81754();
 
     CPPUNIT_TEST_SUITE(SdTiledRenderingTest);
     CPPUNIT_TEST(testRegisterCallback);
@@ -101,6 +105,8 @@ public:
     CPPUNIT_TEST(testCreateViewGraphicSelection);
     CPPUNIT_TEST(testCreateViewTextCursor);
     CPPUNIT_TEST(testPostKeyEventInvalidation);
+    CPPUNIT_TEST(testTdf81754);
+
     CPPUNIT_TEST_SUITE_END();
 
 private:
@@ -1286,6 +1292,40 @@ void SdTiledRenderingTest::testPostKeyEventInvalidation()
     comphelper::LibreOfficeKit::setActive(false);
 }
 
+void SdTiledRenderingTest::testTdf81754()
+{
+    SdXImpressDocument* pXImpressDocument = createDoc("tdf81754.pptx");
+    sd::ViewShell* pViewShell = pXImpressDocument->GetDocShell()->GetViewShell();
+    SdPage* pActualPage = pViewShell->GetActualPage();
+    SdrObject* pObject = pActualPage->GetObj(1);
+
+    SdrTextObj* pTextObj = static_cast<SdrTextObj*>(pObject);
+    SdrView* pView = pViewShell->GetView();
+    pView->MarkObj(pTextObj, pView->GetSdrPageView());
+    SfxStringItem aInputString(SID_ATTR_CHAR, "x");
+    pViewShell->GetViewFrame()->GetDispatcher()->Execute(SID_ATTR_CHAR,
+            SfxCallMode::SYNCHRON, &aInputString, nullptr);
+
+    pXImpressDocument->postKeyEvent(LOK_KEYEVENT_KEYINPUT, 'x', 0);
+    pXImpressDocument->postKeyEvent(LOK_KEYEVENT_KEYUP, 'x', 0);
+
+    Scheduler::ProcessEventsToIdle();
+
+    // now save, reload, and assert that we did not lose the edit
+    ::sd::DrawDocShellRef xDocShRef = saveAndReload(pXImpressDocument->GetDocShell(), PPTX);
+
+    const SdrPage *pPage = GetPage(1, xDocShRef);
+    SdrTextObj* pTextObject = dynamic_cast<SdrTextObj*>(pPage->GetObj(1));
+    CPPUNIT_ASSERT(pTextObject);
+
+    OutlinerParaObject* pOutlinerParagraphObject = pTextObject->GetOutlinerParaObject();
+    const EditTextObject& aEdit = pOutlinerParagraphObject->GetTextObject();
+
+    CPPUNIT_ASSERT_EQUAL(OUString("Somethingxx"), aEdit.GetText(0));
+
+    xDocShRef->DoClose();
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(SdTiledRenderingTest);
 
 CPPUNIT_PLUGIN_IMPLEMENT();
commit ca468b358392a16a931b4ad83d911faf152335f8
Author: David Tardon <dtardon at redhat.com>
Date:   Tue Nov 22 09:07:54 2016 +0100

    avoid loss of text in edited placeholder
    
    How to reproduce:
    1. Create an empty presentation.
    2. Save it.
    3. Click at one of the text placeholders and write something.
    4. Save again.
    5. Reload. The placeholder is missing. (Actually, it's still there, but
       empty and 0-size.)
    
    This only happens if a11y is enabled.
    
    Change-Id: I7ae3d3c6ab0ce91aef01c0e9d62f7963dce965fc

diff --git a/svx/source/unodraw/unoshtxt.cxx b/svx/source/unodraw/unoshtxt.cxx
index fcf13a7..9d9d217 100644
--- a/svx/source/unodraw/unoshtxt.cxx
+++ b/svx/source/unodraw/unoshtxt.cxx
@@ -603,6 +603,7 @@ SvxTextForwarder* SvxTextEditSourceImpl::GetBackgroundTextForwarder()
         bCreated = true;
 
         mbForwarderIsEditMode = false;
+        mbDataValid = false;
     }
 
     if( mpObject && mpText && !mbDataValid && mpObject->IsInserted() && mpObject->GetPage() )


More information about the Libreoffice-commits mailing list