Kaydet (Commit) b5608fd4 authored tarafından Markus Mohrhard's avatar Markus Mohrhard

extract a bit more code

Change-Id: I24da9b5e8594d34ff7d5c3f958c2fd1c5cad1908
üst 560ef654
...@@ -766,7 +766,7 @@ void SdFiltersTest::testBnc870237() ...@@ -766,7 +766,7 @@ void SdFiltersTest::testBnc870237()
namespace { namespace {
void checkFontAttributes(const SdrTextObj* pObj, sal_uInt32 nColor, void checkFontAttributes(const SdrTextObj* pObj, sal_uInt32 nColor,
FontWeight eWeight, FontItalic eItalic) bool bCheckWeight, FontWeight eWeight, bool bCheckItalic, FontItalic eItalic)
{ {
CPPUNIT_ASSERT_MESSAGE( "no object", pObj != NULL); CPPUNIT_ASSERT_MESSAGE( "no object", pObj != NULL);
const EditTextObject& aEdit = pObj->GetOutlinerParaObject()->GetTextObject(); const EditTextObject& aEdit = pObj->GetOutlinerParaObject()->GetTextObject();
...@@ -779,17 +779,25 @@ void checkFontAttributes(const SdrTextObj* pObj, sal_uInt32 nColor, ...@@ -779,17 +779,25 @@ void checkFontAttributes(const SdrTextObj* pObj, sal_uInt32 nColor,
{ {
CPPUNIT_ASSERT_EQUAL( nColor, pCharColor->GetValue().GetColor()); CPPUNIT_ASSERT_EQUAL( nColor, pCharColor->GetValue().GetColor());
} }
if(bCheckWeight)
{
const SvxWeightItem *pWeight = dynamic_cast<const SvxWeightItem *>((*it).pAttr); const SvxWeightItem *pWeight = dynamic_cast<const SvxWeightItem *>((*it).pAttr);
if( pWeight ) if( pWeight )
{ {
CPPUNIT_ASSERT_EQUAL( eWeight, pWeight->GetWeight()); CPPUNIT_ASSERT_EQUAL( eWeight, pWeight->GetWeight());
} }
}
if(bCheckItalic)
{
const SvxPostureItem *pPosture = dynamic_cast<const SvxPostureItem *>((*it).pAttr); const SvxPostureItem *pPosture = dynamic_cast<const SvxPostureItem *>((*it).pAttr);
if( pPosture ) if( pPosture )
{ {
CPPUNIT_ASSERT_EQUAL( eItalic, pPosture->GetPosture()); CPPUNIT_ASSERT_EQUAL( eItalic, pPosture->GetPosture());
} }
} }
}
} }
...@@ -810,13 +818,15 @@ void SdFiltersTest::testBnc870233_1() ...@@ -810,13 +818,15 @@ void SdFiltersTest::testBnc870233_1()
// First shape has red, bold font // First shape has red, bold font
{ {
const SdrTextObj *pObj = dynamic_cast<SdrTextObj *>( pPage->GetObj( 0 ) ); const SdrTextObj *pObj = dynamic_cast<SdrTextObj *>( pPage->GetObj( 0 ) );
checkFontAttributes(pObj, sal_uInt32(0xff0000), WEIGHT_BOLD, ITALIC_NONE); checkFontAttributes(pObj, sal_uInt32(0xff0000),
true, WEIGHT_BOLD, true, ITALIC_NONE);
} }
// Second shape has blue, italic font // Second shape has blue, italic font
{ {
const SdrTextObj *pObj = dynamic_cast<SdrTextObj *>( pPage->GetObj( 1 ) ); const SdrTextObj *pObj = dynamic_cast<SdrTextObj *>( pPage->GetObj( 1 ) );
checkFontAttributes(pObj, sal_uInt32(0x0000ff), WEIGHT_NORMAL, ITALIC_NORMAL); checkFontAttributes(pObj, sal_uInt32(0x0000ff),
true, WEIGHT_NORMAL, true, ITALIC_NORMAL);
} }
xDocShRef->DoClose(); xDocShRef->DoClose();
...@@ -837,52 +847,22 @@ void SdFiltersTest::testBnc870233_2() ...@@ -837,52 +847,22 @@ void SdFiltersTest::testBnc870233_2()
// First smart art has blue font color (direct formatting) // First smart art has blue font color (direct formatting)
{ {
const SdrTextObj *pObj = dynamic_cast<SdrTextObj *>( pPage->GetObj( 0 ) ); const SdrTextObj *pObj = dynamic_cast<SdrTextObj *>( pPage->GetObj( 0 ) );
CPPUNIT_ASSERT_MESSAGE( "no object", pObj != NULL); checkFontAttributes(pObj, sal_uInt32(0x0000ff),
const EditTextObject& aEdit = pObj->GetOutlinerParaObject()->GetTextObject(); false, WEIGHT_DONTKNOW, false, ITALIC_NONE);
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());
}
}
} }
// Second smart art has "dk2" font color (style) // Second smart art has "dk2" font color (style)
{ {
const SdrTextObj *pObj = dynamic_cast<SdrTextObj *>( pPage->GetObj( 1 ) ); const SdrTextObj *pObj = dynamic_cast<SdrTextObj *>( pPage->GetObj( 1 ) );
CPPUNIT_ASSERT_MESSAGE( "no object", pObj != NULL); checkFontAttributes(pObj, sal_uInt32(0x1F497D),
const EditTextObject& aEdit = pObj->GetOutlinerParaObject()->GetTextObject(); false, WEIGHT_DONTKNOW, false, ITALIC_NONE);
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(0x1F497D), pCharColor->GetValue().GetColor());
}
}
} }
// Third smart art has white font color (style) // Third smart art has white font color (style)
{ {
const SdrTextObj *pObj = dynamic_cast<SdrTextObj *>( pPage->GetObj( 2 ) ); const SdrTextObj *pObj = dynamic_cast<SdrTextObj *>( pPage->GetObj( 2 ) );
CPPUNIT_ASSERT_MESSAGE( "no object", pObj != NULL); checkFontAttributes(pObj, sal_uInt32(0xffffff),
const EditTextObject& aEdit = pObj->GetOutlinerParaObject()->GetTextObject(); false, WEIGHT_DONTKNOW, false, ITALIC_NONE);
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(0xffffff), pCharColor->GetValue().GetColor());
}
}
} }
xDocShRef->DoClose(); xDocShRef->DoClose();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment