[Libreoffice-commits] core.git: sd/qa sd/source
Tomaž Vajngerl
tomaz.vajngerl at collabora.co.uk
Wed May 9 00:03:39 UTC 2018
sd/qa/unit/export-tests-ooxml2.cxx | 28 ------------------------
sd/qa/unit/export-tests.cxx | 42 ++++++++++++++++++++++++++++++++++++
sd/source/filter/eppt/pptx-text.cxx | 4 +--
3 files changed, 44 insertions(+), 30 deletions(-)
New commits:
commit 711c2e49dd3c51877263148267344e2eb4ca7c0d
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
Date: Tue May 8 19:45:36 2018 +0900
tdf#116272 use correct property name when exporting to PPT
Change-Id: Ic1f5fb0e00531f9e36f05cbdf68b4c2fa7e98989
Reviewed-on: https://gerrit.libreoffice.org/53987
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Tomaž Vajngerl <quikee at gmail.com>
diff --git a/sd/qa/unit/export-tests-ooxml2.cxx b/sd/qa/unit/export-tests-ooxml2.cxx
index 4840940274f2..739560b0b74d 100644
--- a/sd/qa/unit/export-tests-ooxml2.cxx
+++ b/sd/qa/unit/export-tests-ooxml2.cxx
@@ -132,7 +132,6 @@ public:
void testFontScale();
void testTdf115394();
void testTdf115394Zero();
- void testBulletsAsImage();
void testTdf115005();
int testTdf115005_FallBack_Images(bool bAddReplacementImages);
void testTdf115005_FallBack_Images_On();
@@ -200,7 +199,6 @@ public:
CPPUNIT_TEST(testFontScale);
CPPUNIT_TEST(testTdf115394);
CPPUNIT_TEST(testTdf115394Zero);
- CPPUNIT_TEST(testBulletsAsImage);
CPPUNIT_TEST(testTdf115005);
CPPUNIT_TEST(testTdf115005_FallBack_Images_On);
CPPUNIT_TEST(testTdf115005_FallBack_Images_Off);
@@ -1505,32 +1503,6 @@ void SdOOXMLExportTest2::testTdf115394Zero()
xDocShRef->DoClose();
}
-void SdOOXMLExportTest2::testBulletsAsImage()
-{
- ::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("sd/qa/unit/data/odp/BulletsAsImage.odp"), ODP);
- utl::TempFile tempFile;
- xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile);
-
- uno::Reference<beans::XPropertySet> xShape(getShapeFromPage(0, 0, xDocShRef));
- uno::Reference<text::XTextRange> const xParagraph(getParagraphFromShape(0, xShape));
- uno::Reference<beans::XPropertySet> xPropSet(xParagraph, uno::UNO_QUERY_THROW);
-
- uno::Reference<container::XIndexAccess> xLevels(xPropSet->getPropertyValue("NumberingRules"), uno::UNO_QUERY);
- uno::Sequence<beans::PropertyValue> aProperties;
- xLevels->getByIndex(0) >>= aProperties; // 1st level
- uno::Reference<awt::XBitmap> xBitmap;
- for (const beans::PropertyValue& rProperty : aProperties)
- {
- if (rProperty.Name == "GraphicBitmap")
- {
- xBitmap = rProperty.Value.get<uno::Reference<awt::XBitmap>>();
- }
- }
- CPPUNIT_ASSERT_MESSAGE("No bitmap for the bullets", xBitmap.is());
-
- xDocShRef->DoClose();
-}
-
void SdOOXMLExportTest2::testTdf115005()
{
sd::DrawDocShellRef xDocShRefOriginal = loadURL(m_directories.getURLFromSrc("sd/qa/unit/data/odp/tdf115005.odp"), ODP);
diff --git a/sd/qa/unit/export-tests.cxx b/sd/qa/unit/export-tests.cxx
index f5c7c4e97d15..c6dd4a70741f 100644
--- a/sd/qa/unit/export-tests.cxx
+++ b/sd/qa/unit/export-tests.cxx
@@ -95,6 +95,7 @@ public:
void testPageWithTransparentBackground();
void testTextRotation();
void testTdf115394PPT();
+ void testBulletsAsImage();
CPPUNIT_TEST_SUITE(SdExportTest);
@@ -117,6 +118,7 @@ public:
CPPUNIT_TEST(testPageWithTransparentBackground);
CPPUNIT_TEST(testTextRotation);
CPPUNIT_TEST(testTdf115394PPT);
+ CPPUNIT_TEST(testBulletsAsImage);
CPPUNIT_TEST_SUITE_END();
@@ -915,6 +917,46 @@ void SdExportTest::testTdf115394PPT()
xDocShRef->DoClose();
}
+void SdExportTest::testBulletsAsImage()
+{
+ for (sal_Int32 nExportFormat : {ODP, PPTX, PPT})
+ {
+ ::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("sd/qa/unit/data/odp/BulletsAsImage.odp"), ODP);
+ const OString sFailedMessageBase = OString("Failed on filter '") + OString(aFileFormats[nExportFormat].pFilterName) + OString("': ");
+
+ uno::Reference< lang::XComponent > xComponent(xDocShRef->GetModel(), uno::UNO_QUERY);
+ uno::Reference<frame::XStorable> xStorable(xComponent, uno::UNO_QUERY);
+ utl::MediaDescriptor aMediaDescriptor;
+ aMediaDescriptor["FilterName"] <<= OStringToOUString(OString(aFileFormats[nExportFormat].pFilterName), RTL_TEXTENCODING_UTF8);
+
+ utl::TempFile aTempFile;
+ aTempFile.EnableKillingFile();
+ xStorable->storeToURL(aTempFile.GetURL(), aMediaDescriptor.getAsConstPropertyValueList());
+ xComponent.set(xStorable, uno::UNO_QUERY);
+ xComponent->dispose();
+
+ xDocShRef = loadURL(aTempFile.GetURL(), nExportFormat);
+
+ uno::Reference<beans::XPropertySet> xShape(getShapeFromPage(0, 0, xDocShRef));
+ uno::Reference<text::XTextRange> const xParagraph(getParagraphFromShape(0, xShape));
+ uno::Reference<beans::XPropertySet> xPropSet(xParagraph, uno::UNO_QUERY_THROW);
+
+ uno::Reference<container::XIndexAccess> xLevels(xPropSet->getPropertyValue("NumberingRules"), uno::UNO_QUERY_THROW);
+ uno::Sequence<beans::PropertyValue> aProperties;
+ xLevels->getByIndex(0) >>= aProperties; // 1st level
+ uno::Reference<awt::XBitmap> xBitmap;
+ for (const beans::PropertyValue& rProperty : aProperties)
+ {
+ if (rProperty.Name == "GraphicBitmap")
+ xBitmap = rProperty.Value.get<uno::Reference<awt::XBitmap>>();
+ }
+ const OString sFailed = sFailedMessageBase + "No bitmap for the bullets";
+ CPPUNIT_ASSERT_MESSAGE(sFailed.getStr(), xBitmap.is());
+
+ xDocShRef->DoClose();
+ }
+}
+
CPPUNIT_TEST_SUITE_REGISTRATION(SdExportTest);
CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/sd/source/filter/eppt/pptx-text.cxx b/sd/source/filter/eppt/pptx-text.cxx
index a01e263f2804..615cb15aad09 100644
--- a/sd/source/filter/eppt/pptx-text.cxx
+++ b/sd/source/filter/eppt/pptx-text.cxx
@@ -845,7 +845,7 @@ void ParagraphObj::ImplGetNumberingLevel( PPTExBulletProvider* pBuProv, sal_Int1
aFontDesc.CharSet = RTL_TEXTENCODING_MS_1252;
}
- else if ( aPropName == "Graphic" )
+ else if ( aPropName == "GraphicBitmap" )
xGraphic = pPropValue[i].Value.get<uno::Reference<graphic::XGraphic>>();
else if ( aPropName == "GraphicSize" )
{
@@ -882,7 +882,7 @@ void ParagraphObj::ImplGetNumberingLevel( PPTExBulletProvider* pBuProv, sal_Int1
#ifdef DBG_UTIL
else if ( ! (
( aPropName == "SymbolTextDistance" )
- || ( aPropName == "Graphic" ) ) )
+ || ( aPropName == "GraphicBitmap" ) ) )
{
OSL_FAIL( "Unknown Property" );
}
More information about the Libreoffice-commits
mailing list