summaryrefslogtreecommitdiff
path: root/sd
diff options
context:
space:
mode:
authorZolnai Tamás <tamas.zolnai@collabora.com>2014-12-22 16:36:27 +0100
committerZolnai Tamás <tamas.zolnai@collabora.com>2014-12-22 16:36:59 +0100
commit7a64988dbc7a1542aa38f0e8f9a8a47941fbc67d (patch)
tree8359b96d20f356c946d192e3c6c474208a7376ce /sd
parent89206c472ecf18bfde6824cea8004921cd404365 (diff)
bnc#862510: PPTX import: Wrong text vertical adjustment inside shape.
When alignment is not specified, it should be set to the default "left" value just on time, when properties are pushed to the property set, otherwise uninitialized value is better. Change-Id: Ic294c5d7cc477f7515aea1c071ad9b67275c012d
Diffstat (limited to 'sd')
-rw-r--r--sd/qa/unit/data/pptx/bnc862510_7.pptxbin0 -> 24443 bytes
-rw-r--r--sd/qa/unit/import-tests.cxx35
2 files changed, 35 insertions, 0 deletions
diff --git a/sd/qa/unit/data/pptx/bnc862510_7.pptx b/sd/qa/unit/data/pptx/bnc862510_7.pptx
new file mode 100644
index 000000000000..0eb3bbec7556
--- /dev/null
+++ b/sd/qa/unit/data/pptx/bnc862510_7.pptx
Binary files differ
diff --git a/sd/qa/unit/import-tests.cxx b/sd/qa/unit/import-tests.cxx
index 771746b0634d..c33176f3499f 100644
--- a/sd/qa/unit/import-tests.cxx
+++ b/sd/qa/unit/import-tests.cxx
@@ -53,6 +53,7 @@
#include <com/sun/star/chart2/data/XDataSequence.hpp>
#include <com/sun/star/chart2/data/XNumericalDataSequence.hpp>
#include <com/sun/star/table/BorderLine2.hpp>
+#include <com/sun/star/style/ParagraphAdjust.hpp>
#include <stlpool.hxx>
@@ -90,6 +91,7 @@ public:
void testBnc904423();
void testShapeLineStyle();
void testBnc862510_6();
+ void testBnc862510_7();
CPPUNIT_TEST_SUITE(SdImportTest);
CPPUNIT_TEST(testDocumentLayout);
@@ -120,6 +122,7 @@ public:
CPPUNIT_TEST(testBnc904423);
CPPUNIT_TEST(testShapeLineStyle);
CPPUNIT_TEST(testBnc862510_6);
+ CPPUNIT_TEST(testBnc862510_7);
CPPUNIT_TEST_SUITE_END();
};
@@ -1033,6 +1036,38 @@ void SdImportTest::testBnc862510_6()
xDocShRef->DoClose();
}
+void SdImportTest::testBnc862510_7()
+{
+ // Title shape's text was aligned to left instead of center.
+ ::sd::DrawDocShellRef xDocShRef = loadURL(getURLFromSrc("/sd/qa/unit/data/pptx/bnc862510_7.pptx"), PPTX);
+
+ 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 );
+
+ uno::Reference< beans::XPropertySet > xShape(
+ xPage->getByIndex(0), uno::UNO_QUERY );
+ CPPUNIT_ASSERT_MESSAGE( "no shape", xShape.is() );
+
+ // Get first paragraph
+ uno::Reference<text::XText> xText = uno::Reference<text::XTextRange>(xShape, uno::UNO_QUERY)->getText();
+ CPPUNIT_ASSERT_MESSAGE( "not a text shape", xText.is() );
+ uno::Reference<container::XEnumerationAccess> paraEnumAccess;
+ paraEnumAccess.set(xText, uno::UNO_QUERY);
+ uno::Reference<container::XEnumeration> paraEnum = paraEnumAccess->createEnumeration();
+ uno::Reference<text::XTextRange> const xParagraph(paraEnum->nextElement(),
+ uno::UNO_QUERY_THROW);
+ uno::Reference< beans::XPropertySet > xPropSet( xParagraph, uno::UNO_QUERY_THROW );
+
+ sal_Int16 nParaAdjust = 0;
+ xPropSet->getPropertyValue( "ParaAdjust" ) >>= nParaAdjust;
+ CPPUNIT_ASSERT_EQUAL(style::ParagraphAdjust_CENTER, static_cast<style::ParagraphAdjust>(nParaAdjust));
+
+ xDocShRef->DoClose();
+}
+
CPPUNIT_TEST_SUITE_REGISTRATION(SdImportTest);
CPPUNIT_PLUGIN_IMPLEMENT();