[Libreoffice-commits] .: sd/qa

Muthu Subramanian sumuthu at kemper.freedesktop.org
Tue Aug 14 04:40:37 PDT 2012


 sd/qa/unit/data/n759180.pptx   |binary
 sd/qa/unit/regression-test.cxx |   45 +++++++++++++++++++++++++++++++++++++++++
 2 files changed, 45 insertions(+)

New commits:
commit 3ccb8dac1405dc4ffa0ca3c45bd0724cc339d8ad
Author: Muthu Subramanian <sumuthu at suse.com>
Date:   Tue Aug 14 17:04:40 2012 +0530

    Adding unit test case for n#759180

diff --git a/sd/qa/unit/data/n759180.pptx b/sd/qa/unit/data/n759180.pptx
new file mode 100644
index 0000000..16cbf9a
Binary files /dev/null and b/sd/qa/unit/data/n759180.pptx differ
diff --git a/sd/qa/unit/regression-test.cxx b/sd/qa/unit/regression-test.cxx
index 787291b..342d6a8 100644
--- a/sd/qa/unit/regression-test.cxx
+++ b/sd/qa/unit/regression-test.cxx
@@ -60,6 +60,11 @@
 #include <com/sun/star/drawing/XDrawPagesSupplier.hpp>
 #include <drawinglayer/XShapeDumper.hxx>
 
+#include <editeng/editobj.hxx>
+#include <editeng/outlobj.hxx>
+#include <editeng/ulspitem.hxx>
+#include <editeng/fhgtitem.hxx>
+
 /* Implementation of Filters test */
 
 using namespace ::com::sun::star;
@@ -78,9 +83,11 @@ public:
     virtual void tearDown();
 
     void test();
+    void testN759180();
 
     CPPUNIT_TEST_SUITE(SdFiltersTest);
     CPPUNIT_TEST(test);
+    CPPUNIT_TEST(testN759180);
     CPPUNIT_TEST_SUITE_END();
 
 private:
@@ -152,6 +159,44 @@ void SdFiltersTest::test()
     }*/
 }
 
+void SdFiltersTest::testN759180()
+{
+    ::sd::DrawDocShellRef xDocShRef = loadURL(getURLFromSrc("/sd/qa/unit/data/n759180.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 );
+
+    //sal_uIntPtr nObjs = pPage->GetObjCount();
+    //for (sal_uIntPtr i = 0; i < nObjs; i++)
+    {
+        // Get the object
+        SdrObject *pObj = pPage->GetObj(0);
+        SdrTextObj *pTxtObj = dynamic_cast<SdrTextObj *>( pObj );
+        CPPUNIT_ASSERT(pTxtObj);
+        std::vector<EECharAttrib> rLst;
+        const EditTextObject& aEdit = pTxtObj->GetOutlinerParaObject()->GetTextObject();
+        const SvxULSpaceItem *pULSpace = dynamic_cast<const SvxULSpaceItem *>(aEdit.GetParaAttribs(0).GetItem(EE_PARA_ULSPACE));
+        CPPUNIT_ASSERT(pULSpace);
+        CPPUNIT_ASSERT_MESSAGE( "Para bottom spacing is wrong!", pULSpace->GetLower() == 0 );
+        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)
+            {
+                // nStart == 9
+                // font height = 5 => 5*2540/72
+                CPPUNIT_ASSERT_MESSAGE( "Font height is wrong", pFontHeight->GetHeight() == 176 );
+                break;
+            }
+        }
+    }
+}
+
 void SdFiltersTest::testStuff(::sd::DrawDocShellRef xDocShRef, const rtl::OString& fileNameBase)
 {
     CPPUNIT_ASSERT_MESSAGE( "failed to load", xDocShRef.Is() );


More information about the Libreoffice-commits mailing list