diff options
author | Jan Holesovsky <kendy@collabora.com> | 2017-01-04 20:40:28 +0100 |
---|---|---|
committer | Jan Holesovsky <kendy@collabora.com> | 2017-01-04 20:58:50 +0100 |
commit | 6106fea591f685bc1fd5b65ade86e2e45dbc58e1 (patch) | |
tree | cf5c04104b9631aa70eb4d71c4f4823bb5f87f48 | |
parent | 610bc5aa161e726135feee0c7f64331df090475a (diff) |
tdf#81754: Unit test for the loss of text on save of pptx.
The problem itself was fixed by commit
2ad50c9a8c8411a57bbbd7a52734e72ffc4cc0ee.
Change-Id: Ie7f0781e1f5a4d6c5297882a5f64a68b85558515
-rw-r--r-- | sd/CppunitTest_sd_tiledrendering.mk | 1 | ||||
-rw-r--r-- | sd/qa/unit/tiledrendering/data/tdf81754.pptx | bin | 0 -> 35503 bytes | |||
-rw-r--r-- | sd/qa/unit/tiledrendering/tiledrendering.cxx | 41 |
3 files changed, 41 insertions, 1 deletions
diff --git a/sd/CppunitTest_sd_tiledrendering.mk b/sd/CppunitTest_sd_tiledrendering.mk index 60790c4fa19a..711f6eb2ac49 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 Binary files differnew file mode 100644 index 000000000000..8a1fa1dcfd95 --- /dev/null +++ b/sd/qa/unit/tiledrendering/data/tdf81754.pptx diff --git a/sd/qa/unit/tiledrendering/tiledrendering.cxx b/sd/qa/unit/tiledrendering/tiledrendering.cxx index e031d06a4d3a..7eb13a8e60f9 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,6 +20,7 @@ #include <comphelper/propertysequence.hxx> #include <comphelper/string.hxx> #include <editeng/editids.hrc> +#include <editeng/editobj.hxx> #include <editeng/editview.hxx> #include <editeng/editobj.hxx> #include <editeng/outliner.hxx> @@ -45,7 +47,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(); @@ -81,6 +83,7 @@ public: void testPostKeyEventInvalidation(); void testTdf103083(); void testTdf104405(); + void testTdf81754(); CPPUNIT_TEST_SUITE(SdTiledRenderingTest); CPPUNIT_TEST(testRegisterCallback); @@ -112,6 +115,8 @@ public: CPPUNIT_TEST(testPostKeyEventInvalidation); CPPUNIT_TEST(testTdf103083); CPPUNIT_TEST(testTdf104405); + CPPUNIT_TEST(testTdf81754); + CPPUNIT_TEST_SUITE_END(); private: @@ -1466,6 +1471,40 @@ void SdTiledRenderingTest::testTdf104405() 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()->ExecuteList(SID_ATTR_CHAR, + SfxCallMode::SYNCHRON, { &aInputString }); + + 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(); |