[Libreoffice-commits] core.git: 2 commits - oox/source sd/qa

Muthu Subramanian sumuthu at collabora.com
Wed Dec 18 06:19:28 PST 2013


 oox/source/export/drawingml.cxx |    8 +++----
 sd/qa/unit/data/n828390_4.odp   |binary
 sd/qa/unit/import-tests.cxx     |   43 ++++++++++++++++++++++++++++++++++++++++
 3 files changed, 47 insertions(+), 4 deletions(-)

New commits:
commit 33b59c555755283edbcb3bb50a44db153cb1c23f
Author: Muthu Subramanian <sumuthu at collabora.com>
Date:   Wed Dec 18 20:01:11 2013 +0530

    n#828390: Add unit test for font properties export.

diff --git a/sd/qa/unit/data/n828390_4.odp b/sd/qa/unit/data/n828390_4.odp
new file mode 100644
index 0000000..888611c
Binary files /dev/null and b/sd/qa/unit/data/n828390_4.odp differ
diff --git a/sd/qa/unit/import-tests.cxx b/sd/qa/unit/import-tests.cxx
index 630891c..31b9e7b 100644
--- a/sd/qa/unit/import-tests.cxx
+++ b/sd/qa/unit/import-tests.cxx
@@ -16,6 +16,8 @@
 #include <editeng/fhgtitem.hxx>
 #include <editeng/escapementitem.hxx>
 #include <editeng/colritem.hxx>
+#include <editeng/fontitem.hxx>
+#include <editeng/wghtitem.hxx>
 #include <rsc/rscsfx.hxx>
 
 #include <svx/svdotext.hxx>
@@ -51,6 +53,7 @@ public:
     void testN828390();
     void testN828390_2();
     void testN828390_3();
+    void testN828390_4();
     void testFdo68594();
 
     CPPUNIT_TEST_SUITE(SdFiltersTest);
@@ -63,6 +66,7 @@ public:
     CPPUNIT_TEST(testN828390);
     CPPUNIT_TEST(testN828390_2);
     CPPUNIT_TEST(testN828390_3);
+    CPPUNIT_TEST(testN828390_4);
     CPPUNIT_TEST(testFdo68594);
 
     CPPUNIT_TEST_SUITE_END();
@@ -283,6 +287,45 @@ void SdFiltersTest::testN828390_3()
     CPPUNIT_ASSERT_MESSAGE("CharEscapment not imported properly", bPassed);
 }
 
+void SdFiltersTest::testN828390_4()
+{
+    bool bPassed = false;
+    ::sd::DrawDocShellRef xDocShRef = loadURL( getURLFromSrc("/sd/qa/unit/data/n828390_4.odp") );
+    CPPUNIT_ASSERT_MESSAGE( "failed to load", xDocShRef.Is() );
+
+    xDocShRef = saveAndReload( xDocShRef, PPTX );
+    CPPUNIT_ASSERT_MESSAGE( "failed to load", xDocShRef.Is() );
+    CPPUNIT_ASSERT_MESSAGE( "not in destruction", !xDocShRef->IsInDestruction() );
+
+    SdDrawDocument *pDoc = xDocShRef->GetDoc();
+    CPPUNIT_ASSERT_MESSAGE( "no document", pDoc != NULL );
+    const SdrPage *pPage = pDoc->GetPage(1);
+    CPPUNIT_ASSERT_MESSAGE( "no page", pPage != NULL );
+    {
+        std::vector<EECharAttrib> rLst;
+        SdrObject *pObj = pPage->GetObj(0);
+        SdrTextObj *pTxtObj = dynamic_cast<SdrTextObj *>( pObj );
+        const EditTextObject& aEdit = pTxtObj->GetOutlinerParaObject()->GetTextObject();
+        aEdit.GetCharAttribs(1, rLst);
+        for( std::vector<EECharAttrib>::reverse_iterator it = rLst.rbegin(); it!=rLst.rend(); ++it)
+        {
+            const SvxFontHeightItem * pFontHeight = dynamic_cast<const SvxFontHeightItem *>((*it).pAttr);
+            if( pFontHeight )
+                CPPUNIT_ASSERT_MESSAGE( "Font height is wrong", pFontHeight->GetHeight() == 1129 );
+            const SvxFontItem *pFont = dynamic_cast<const SvxFontItem *>((*it).pAttr);
+            if( pFont )
+            {
+                CPPUNIT_ASSERT_MESSAGE( "Font is wrong", pFont->GetFamilyName().equalsAscii("Arial"));
+                bPassed = true;
+            }
+            const SvxWeightItem *pWeight = dynamic_cast<const SvxWeightItem *>((*it).pAttr);
+            if( pWeight )
+                CPPUNIT_ASSERT_MESSAGE( "Font Weight is wrong", pWeight->GetWeight() == WEIGHT_BOLD);
+        }
+    }
+    CPPUNIT_ASSERT(bPassed);
+}
+
 void SdFiltersTest::testN778859()
 {
     ::sd::DrawDocShellRef xDocShRef = loadURL(getURLFromSrc("/sd/qa/unit/data/pptx/n778859.pptx"));
commit 33b796eb1484b9a3fc11a189faddb7fc36509856
Author: Muthu Subramanian <sumuthu at collabora.com>
Date:   Wed Dec 18 19:56:28 2013 +0530

    n#828390: Explictly export font properties.
    
    Seems like the status is returned as default,
    but the font properties needs to be still exported.

diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx
index 0e8db87..6a0d65b 100644
--- a/oox/source/export/drawingml.cxx
+++ b/oox/source/export/drawingml.cxx
@@ -711,14 +711,14 @@ void DrawingML::WriteRunProperties( Reference< XPropertySet > rRun, sal_Bool bIs
     sal_Int32 nSize = 1800;
     sal_Int32 nCharEscapement = 0;
 
-    if( GETAD( CharHeight ) )
+    if( GETA( CharHeight ) )
         nSize = (sal_Int32) (100*(*((float*) mAny.getValue())));
 
-    if ( ( bComplex && GETAD( CharWeightComplex ) ) || GETAD( CharWeight ) )
+    if ( ( bComplex && GETA( CharWeightComplex ) ) || GETA( CharWeight ) )
         if ( *((float*) mAny.getValue()) >= awt::FontWeight::SEMIBOLD )
             bold = "1";
 
-    if ( ( bComplex && GETAD( CharPostureComplex ) ) || GETAD( CharPosture ) )
+    if ( ( bComplex && GETA( CharPostureComplex ) ) || GETA( CharPosture ) )
         switch ( *((awt::FontSlant*) mAny.getValue()) )
         {
             case awt::FontSlant_OBLIQUE :
@@ -827,7 +827,7 @@ void DrawingML::WriteRunProperties( Reference< XPropertySet > rRun, sal_Bool bIs
         WriteSolidFill( color );
     }
 
-    if( GETAD( CharFontName ) ) {
+    if( GETA( CharFontName ) ) {
         const char* pitch = NULL;
         const char* charset = NULL;
         OUString usTypeface;


More information about the Libreoffice-commits mailing list