diff options
author | Zolnai Tamás <tamas.zolnai@collabora.com> | 2014-06-06 10:50:53 +0200 |
---|---|---|
committer | Zolnai Tamás <tamas.zolnai@collabora.com> | 2014-06-06 10:50:53 +0200 |
commit | d8e310afbc5c4b0ec280c36eded9ad24c5e972ec (patch) | |
tree | ace5ed0c83e4a9705fe276a81784da3ca745c66f /sd | |
parent | 47a9bdf32558248940d2466058a4951ff38c7419 (diff) |
1st part of bnc#870233: wrong list style in shapes
Text list styles were copied, without proper
copy constructor and operator. It lad to mix
up list styles and so text font.
(cherry picked from commit 31650d5b4255c484faec11d570cb98a80f0120cc)
Conflicts:
sd/qa/unit/import-tests.cxx
Change-Id: Iee7a6c0c1f74322fd7b80e41a262849f948e463a
Diffstat (limited to 'sd')
-rw-r--r-- | sd/qa/unit/data/pptx/bnc870233_1.pptx | bin | 0 -> 34111 bytes | |||
-rw-r--r-- | sd/qa/unit/import-tests.cxx | 75 |
2 files changed, 75 insertions, 0 deletions
diff --git a/sd/qa/unit/data/pptx/bnc870233_1.pptx b/sd/qa/unit/data/pptx/bnc870233_1.pptx Binary files differnew file mode 100644 index 000000000000..0659e30b3840 --- /dev/null +++ b/sd/qa/unit/data/pptx/bnc870233_1.pptx diff --git a/sd/qa/unit/import-tests.cxx b/sd/qa/unit/import-tests.cxx index 8e81c7d2089c..adf11538d02b 100644 --- a/sd/qa/unit/import-tests.cxx +++ b/sd/qa/unit/import-tests.cxx @@ -15,6 +15,9 @@ #include <editeng/ulspitem.hxx> #include <editeng/fhgtitem.hxx> #include <editeng/escapementitem.hxx> +#include <editeng/colritem.hxx> +#include <editeng/wghtitem.hxx> +#include <editeng/postitem.hxx> #include <svx/svdotext.hxx> #include <svx/svdoashp.hxx> @@ -55,6 +58,7 @@ public: void testN828390(); void testFdo71961(); void testBnc870237(); + void testBnc870233_1(); CPPUNIT_TEST_SUITE(SdFiltersTest); CPPUNIT_TEST(testDocumentLayout); @@ -67,6 +71,7 @@ public: CPPUNIT_TEST(testN828390); CPPUNIT_TEST(testFdo71961); CPPUNIT_TEST(testBnc870237); + CPPUNIT_TEST(testBnc870233_1); CPPUNIT_TEST_SUITE_END(); }; @@ -422,6 +427,76 @@ void SdFiltersTest::testBnc870237() xDocShRef->DoClose(); } +void SdFiltersTest::testBnc870233_1() +{ + ::sd::DrawDocShellRef xDocShRef = loadURL(getURLFromSrc("/sd/qa/unit/data/pptx/bnc870233_1.pptx")); + xDocShRef = saveAndReload( xDocShRef, PPTX ); + + SdDrawDocument *pDoc = xDocShRef->GetDoc(); + CPPUNIT_ASSERT_MESSAGE( "no document", pDoc != NULL ); + const SdrPage *pPage = pDoc->GetPage (1); + CPPUNIT_ASSERT_MESSAGE( "no page", pPage != NULL ); + + // The problem was all shapes had the same font (the last parsed font attribues overwrote all previous ones) + + // First shape has red, bold font + { + const SdrTextObj *pObj = dynamic_cast<SdrTextObj *>( pPage->GetObj( 0 ) ); + CPPUNIT_ASSERT_MESSAGE( "no object", pObj != NULL); + const EditTextObject& aEdit = pObj->GetOutlinerParaObject()->GetTextObject(); + std::vector<EECharAttrib> rLst; + aEdit.GetCharAttribs(0, rLst); + for( std::vector<EECharAttrib>::reverse_iterator it = rLst.rbegin(); it!=rLst.rend(); ++it) + { + const SvxColorItem *pCharColor = dynamic_cast<const SvxColorItem *>((*it).pAttr); + if( pCharColor ) + { + CPPUNIT_ASSERT_EQUAL( sal_uInt32(0xff0000), pCharColor->GetValue().GetColor()); + } + const SvxWeightItem *pWeight = dynamic_cast<const SvxWeightItem *>((*it).pAttr); + if( pWeight ) + { + CPPUNIT_ASSERT_EQUAL( FontWeight::WEIGHT_BOLD, pWeight->GetWeight()); + } + const SvxPostureItem *pPosture = dynamic_cast<const SvxPostureItem *>((*it).pAttr); + if( pPosture ) + { + CPPUNIT_ASSERT_EQUAL( FontItalic::ITALIC_NONE, pPosture->GetPosture()); + } + } + } + + // Second shape has blue, italic font + { + const SdrTextObj *pObj = dynamic_cast<SdrTextObj *>( pPage->GetObj( 1 ) ); + CPPUNIT_ASSERT_MESSAGE( "no object", pObj != NULL); + const EditTextObject& aEdit = pObj->GetOutlinerParaObject()->GetTextObject(); + std::vector<EECharAttrib> rLst; + aEdit.GetCharAttribs(0, rLst); + for( std::vector<EECharAttrib>::reverse_iterator it = rLst.rbegin(); it!=rLst.rend(); ++it) + { + const SvxColorItem *pCharColor = dynamic_cast<const SvxColorItem *>((*it).pAttr); + if( pCharColor ) + { + CPPUNIT_ASSERT_EQUAL( sal_uInt32(0x0000ff), pCharColor->GetValue().GetColor()); + } + const SvxWeightItem *pWeight = dynamic_cast<const SvxWeightItem *>((*it).pAttr); + if( pWeight ) + { + CPPUNIT_ASSERT_EQUAL( FontWeight::WEIGHT_NORMAL, pWeight->GetWeight()); + } + const SvxPostureItem *pPosture = dynamic_cast<const SvxPostureItem *>((*it).pAttr); + if( pPosture ) + { + CPPUNIT_ASSERT_EQUAL( FontItalic::ITALIC_NORMAL, pPosture->GetPosture()); + } + } + } + + xDocShRef->DoClose(); +} + + CPPUNIT_TEST_SUITE_REGISTRATION(SdFiltersTest); CPPUNIT_PLUGIN_IMPLEMENT(); |