From 077fd3d95cc00bb3cd99f6bb7dae610877ad59b5 Mon Sep 17 00:00:00 2001 From: Varun Date: Wed, 5 Aug 2015 15:42:08 +0530 Subject: Added Test for #tdf62176 Negative indent on text shapes Change-Id: I9548c80f0bda342477cde249f9b55dde95e9c0f4 Reviewed-on: https://gerrit.libreoffice.org/17524 Tested-by: Jenkins Reviewed-by: Michael Stahl --- sd/qa/unit/data/odp/Tdf62176.odp | Bin 0 -> 10358 bytes sd/qa/unit/export-tests.cxx | 47 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 47 insertions(+) create mode 100644 sd/qa/unit/data/odp/Tdf62176.odp (limited to 'sd') diff --git a/sd/qa/unit/data/odp/Tdf62176.odp b/sd/qa/unit/data/odp/Tdf62176.odp new file mode 100644 index 000000000000..1139dd0484d3 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 fe60aeba6fb3..0a8a34267e8c 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 xDoc(xDocShRef->GetDoc()->getUnoModel(), uno::UNO_QUERY_THROW); + uno::Reference 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 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 xText = uno::Reference(xShape, uno::UNO_QUERY)->getText(); + uno::Reference paraEnumAccess(xText, uno::UNO_QUERY); + uno::Reference paraEnum(paraEnumAccess->createEnumeration()); + uno::Reference 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 xDoc2(xDocShRef->GetDoc()->getUnoModel(), uno::UNO_QUERY_THROW); + uno::Reference 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 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 xText2 = uno::Reference(xShape2, uno::UNO_QUERY)->getText(); + uno::Reference paraEnumAccess2(xText2, uno::UNO_QUERY); + uno::Reference paraEnum2(paraEnumAccess2->createEnumeration()); + uno::Reference xParagraph2(paraEnum2->nextElement(), uno::UNO_QUERY_THROW); + CPPUNIT_ASSERT_EQUAL(OUString("Hello World"), xParagraph2->getString()); +} + void SdExportTest::testTdf91378() { -- cgit