summaryrefslogtreecommitdiff
path: root/sd
diff options
context:
space:
mode:
authorVarun <varun.dhall@studentpartner.com>2015-08-05 15:42:08 +0530
committerMichael Stahl <mstahl@redhat.com>2015-08-05 13:52:34 +0000
commit077fd3d95cc00bb3cd99f6bb7dae610877ad59b5 (patch)
treed8519f2f77b6f4173657caaff5cd46f0eaa76b4e /sd
parentf967e900c85d0a80a8665439f79238b87855b4a6 (diff)
Added Test for #tdf62176 Negative indent on text shapes
Change-Id: I9548c80f0bda342477cde249f9b55dde95e9c0f4 Reviewed-on: https://gerrit.libreoffice.org/17524 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Michael Stahl <mstahl@redhat.com>
Diffstat (limited to 'sd')
-rw-r--r--sd/qa/unit/data/odp/Tdf62176.odpbin0 -> 10358 bytes
-rw-r--r--sd/qa/unit/export-tests.cxx47
2 files changed, 47 insertions, 0 deletions
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
--- /dev/null
+++ b/sd/qa/unit/data/odp/Tdf62176.odp
Binary files 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<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()
{