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

Varun varun.dhall at studentpartner.com
Wed Aug 5 06:52:55 PDT 2015


 sd/qa/unit/data/odp/Tdf62176.odp |binary
 sd/qa/unit/export-tests.cxx      |   47 +++++++++++++++++++++++++++++++++++++++
 2 files changed, 47 insertions(+)

New commits:
commit 077fd3d95cc00bb3cd99f6bb7dae610877ad59b5
Author: Varun <varun.dhall at studentpartner.com>
Date:   Wed Aug 5 15:42:08 2015 +0530

    Added Test for #tdf62176 Negative indent on text shapes
    
    Change-Id: I9548c80f0bda342477cde249f9b55dde95e9c0f4
    Reviewed-on: https://gerrit.libreoffice.org/17524
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Michael Stahl <mstahl at redhat.com>

diff --git a/sd/qa/unit/data/odp/Tdf62176.odp b/sd/qa/unit/data/odp/Tdf62176.odp
new file mode 100644
index 0000000..1139dd0
Binary files /dev/null and b/sd/qa/unit/data/odp/Tdf62176.odp differ
diff --git a/sd/qa/unit/export-tests.cxx b/sd/qa/unit/export-tests.cxx
index fe60aeb..0a8a342 100644
--- a/sd/qa/unit/export-tests.cxx
+++ b/sd/qa/unit/export-tests.cxx
@@ -119,6 +119,7 @@ public:
     void testRightToLeftParaghraph();
     void testTableCellBorder();
     void testBulletColor();
+    void testTdf62176();
     void testBulletMarginAndIndentation();
     void testParaMarginAndindentation();
     void testTransparentBackground();
@@ -156,6 +157,7 @@ public:
     CPPUNIT_TEST(testRightToLeftParaghraph);
     CPPUNIT_TEST(testTableCellBorder);
     CPPUNIT_TEST(testBulletColor);
+    CPPUNIT_TEST(testTdf62176);
     CPPUNIT_TEST(testBulletMarginAndIndentation);
     CPPUNIT_TEST(testParaMarginAndindentation);
     CPPUNIT_TEST(testTransparentBackground);
@@ -974,6 +976,51 @@ void SdExportTest::testBulletColor()
     CPPUNIT_ASSERT_EQUAL_MESSAGE( "Bullet's color is wrong!", sal_uInt32(0xff0000),pNumFmt->GetNumRule()->GetLevel(0).GetBulletColor().GetColor());
 }
 
+void SdExportTest::testTdf62176()
+{
+    ::sd::DrawDocShellRef xDocShRef = loadURL(getURLFromSrc("/sd/qa/unit/data/odp/Tdf62176.odp"), ODP);
+    uno::Reference<drawing::XDrawPagesSupplier> xDoc(xDocShRef->GetDoc()->getUnoModel(), uno::UNO_QUERY_THROW);
+    uno::Reference<drawing::XDrawPage> xPage(xDoc->getDrawPages()->getByIndex(0), uno::UNO_QUERY_THROW);
+    //there should be only *one* shape
+    CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xPage->getCount());
+    uno::Reference<beans::XPropertySet> xShape(xPage->getByIndex(0), uno::UNO_QUERY);
+    //checking Paragraph's Left Margin with expected value
+    sal_Int32 nParaLeftMargin = 0;
+    xShape->getPropertyValue("ParaLeftMargin") >>= nParaLeftMargin;
+    CPPUNIT_ASSERT_EQUAL(sal_Int32(2000), nParaLeftMargin);
+    //checking Paragraph's First Line Indent with expected value
+    sal_Int32 nParaFirstLineIndent = 0;
+    xShape->getPropertyValue("ParaFirstLineIndent") >>= nParaFirstLineIndent;
+    CPPUNIT_ASSERT_EQUAL(sal_Int32(-1300), nParaFirstLineIndent);
+    //Checking the *Text* in TextBox
+    uno::Reference<text::XText> xText = uno::Reference<text::XTextRange>(xShape, uno::UNO_QUERY)->getText();
+    uno::Reference<container::XEnumerationAccess> paraEnumAccess(xText, uno::UNO_QUERY);
+    uno::Reference<container::XEnumeration> paraEnum(paraEnumAccess->createEnumeration());
+    uno::Reference<text::XTextRange> xParagraph(paraEnum->nextElement(), uno::UNO_QUERY_THROW);
+    CPPUNIT_ASSERT_EQUAL(OUString("Hello World"), xParagraph->getString());
+    //Saving and Reloading the file
+    xDocShRef = saveAndReload(xDocShRef, ODP);
+    uno::Reference<drawing::XDrawPagesSupplier> xDoc2(xDocShRef->GetDoc()->getUnoModel(), uno::UNO_QUERY_THROW);
+    uno::Reference<drawing::XDrawPage> xPage2(xDoc2->getDrawPages()->getByIndex(0), uno::UNO_QUERY_THROW);
+    //there should be only *one* shape
+    CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xPage2->getCount());
+    uno::Reference<beans::XPropertySet> xShape2(xPage2->getByIndex(0), uno::UNO_QUERY);
+    //checking Paragraph's Left Margin with expected value
+    sal_Int32 nParaLeftMargin2 = 0;
+    xShape2->getPropertyValue("ParaLeftMargin") >>= nParaLeftMargin2;
+    CPPUNIT_ASSERT_EQUAL(sal_Int32(2000), nParaLeftMargin2);
+    //checking Paragraph's First Line Indent with expected value
+    sal_Int32 nParaFirstLineIndent2 = 0;
+    xShape2->getPropertyValue("ParaFirstLineIndent") >>= nParaFirstLineIndent2;
+    CPPUNIT_ASSERT_EQUAL(sal_Int32(-1300), nParaFirstLineIndent2);
+    //Checking the *Text* in TextBox
+    uno::Reference<text::XText> xText2 = uno::Reference<text::XTextRange>(xShape2, uno::UNO_QUERY)->getText();
+    uno::Reference<container::XEnumerationAccess> paraEnumAccess2(xText2, uno::UNO_QUERY);
+    uno::Reference<container::XEnumeration> paraEnum2(paraEnumAccess2->createEnumeration());
+    uno::Reference<text::XTextRange> xParagraph2(paraEnum2->nextElement(), uno::UNO_QUERY_THROW);
+    CPPUNIT_ASSERT_EQUAL(OUString("Hello World"), xParagraph2->getString());
+}
+
 void SdExportTest::testTdf91378()
 {
 


More information about the Libreoffice-commits mailing list