diff options
author | Zolnai Tamás <tamas.zolnai@collabora.com> | 2014-06-05 18:43:04 +0200 |
---|---|---|
committer | Zolnai Tamás <tamas.zolnai@collabora.com> | 2014-06-06 10:28:18 +0200 |
commit | 31650d5b4255c484faec11d570cb98a80f0120cc (patch) | |
tree | 8a7018ce14aa27ecc2d2ae95a3589f73357c1cfc /sd/qa/unit | |
parent | 80ef7a645a8118976a4366135faa41bceda423be (diff) |
1th 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.
Change-Id: Iee7a6c0c1f74322fd7b80e41a262849f948e463a
Diffstat (limited to 'sd/qa/unit')
-rw-r--r-- | sd/qa/unit/data/pptx/bnc870233_1.pptx | bin | 0 -> 34111 bytes | |||
-rw-r--r-- | sd/qa/unit/import-tests.cxx | 73 |
2 files changed, 73 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 ae5cdafb2bcd..b9418b4d99ca 100644 --- a/sd/qa/unit/import-tests.cxx +++ b/sd/qa/unit/import-tests.cxx @@ -20,6 +20,7 @@ #include <editeng/wghtitem.hxx> #include <editeng/numitem.hxx> #include <editeng/lrspitem.hxx> +#include <editeng/postitem.hxx> #include <rsc/rscsfx.hxx> #include <svx/svdotext.hxx> @@ -74,6 +75,7 @@ public: void testFdo71961(); void testMediaEmbedding(); void testBnc870237(); + void testBnc870233_1(); CPPUNIT_TEST_SUITE(SdFiltersTest); CPPUNIT_TEST(testDocumentLayout); @@ -99,6 +101,7 @@ public: CPPUNIT_TEST(testFdo71961); CPPUNIT_TEST(testMediaEmbedding); CPPUNIT_TEST(testBnc870237); + CPPUNIT_TEST(testBnc870233_1); CPPUNIT_TEST_SUITE_END(); }; @@ -760,6 +763,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(); |