summaryrefslogtreecommitdiff
path: root/sd/qa/unit/export-tests-ooxml2.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'sd/qa/unit/export-tests-ooxml2.cxx')
-rw-r--r--sd/qa/unit/export-tests-ooxml2.cxx103
1 files changed, 91 insertions, 12 deletions
diff --git a/sd/qa/unit/export-tests-ooxml2.cxx b/sd/qa/unit/export-tests-ooxml2.cxx
index 27d42132557f..a6279f8eadf1 100644
--- a/sd/qa/unit/export-tests-ooxml2.cxx
+++ b/sd/qa/unit/export-tests-ooxml2.cxx
@@ -12,6 +12,7 @@
#include <comphelper/sequence.hxx>
#include <editeng/eeitem.hxx>
#include <editeng/editobj.hxx>
+#include <editeng/flditem.hxx>
#include <editeng/outlobj.hxx>
#include <editeng/numitem.hxx>
#include <editeng/unoprnms.hxx>
@@ -20,6 +21,7 @@
#include <svx/svdomedia.hxx>
#include <svx/xlineit0.hxx>
#include <svx/xlndsit.hxx>
+#include <svx/svdoole2.hxx>
#include <rtl/ustring.hxx>
#include <com/sun/star/drawing/XDrawPage.hpp>
@@ -189,6 +191,8 @@ public:
void testTdf132282();
void testTdf128213ShapeRot();
void testTdf96061_textHighlight();
+ void testTdf59323_slideFooters();
+ void testTdf143222_embeddedWorksheet();
CPPUNIT_TEST_SUITE(SdOOXMLExportTest2);
@@ -296,6 +300,8 @@ public:
CPPUNIT_TEST(testTdf132282);
CPPUNIT_TEST(testTdf128213ShapeRot);
CPPUNIT_TEST(testTdf96061_textHighlight);
+ CPPUNIT_TEST(testTdf59323_slideFooters);
+ CPPUNIT_TEST(testTdf143222_embeddedWorksheet);
CPPUNIT_TEST_SUITE_END();
@@ -749,26 +755,33 @@ void matchNumberFormat( int nPage, uno::Reference< text::XTextField > const & xF
xPropSet->getPropertyValue("NumberFormat") >>= nNumFmt;
switch( nPage )
{
- case 0: // 13/02/96
- CPPUNIT_ASSERT_EQUAL_MESSAGE("Number formats of Date fields don't match", sal_Int32(2), nNumFmt);
+ case 0: // 13/02/96 (StdSmall)
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("Number formats of Date fields don't match", sal_Int32(SvxDateFormat::StdSmall), nNumFmt);
break;
case 1: // 13/02/1996
- CPPUNIT_ASSERT_EQUAL_MESSAGE("Number formats of Date fields don't match", sal_Int32(5), nNumFmt);
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("Number formats of Date fields don't match", sal_Int32(SvxDateFormat::B), nNumFmt);
break;
- case 2: // 13 February 1996
- CPPUNIT_ASSERT_EQUAL_MESSAGE("Number formats of Date fields don't match", sal_Int32(3), nNumFmt);
+ case 2: // Tuesday, June 29, 2021 (StdBig)
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("Number formats of Date fields don't match", sal_Int32(SvxDateFormat::StdBig), nNumFmt);
break;
- case 3: // 13:49:38
- CPPUNIT_ASSERT_EQUAL_MESSAGE("Number formats of Time fields don't match", sal_Int32(2), nNumFmt);
+ case 3: // 13:49:38 (Standard)
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("Number formats of Time fields don't match", sal_Int32(SvxTimeFormat::Standard), nNumFmt);
break;
case 4: // 13:49
- CPPUNIT_ASSERT_EQUAL_MESSAGE("Number formats of Time fields don't match", sal_Int32(3), nNumFmt);
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("Number formats of Time fields don't match", sal_Int32(SvxTimeFormat::HH24_MM), nNumFmt);
break;
case 5: // 01:49 PM
- CPPUNIT_ASSERT_EQUAL_MESSAGE("Number formats of Time fields don't match", sal_Int32(6), nNumFmt);
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("Number formats of Time fields don't match", sal_Int32(SvxTimeFormat::HH12_MM), nNumFmt);
break;
case 6: // 01:49:38 PM
- CPPUNIT_ASSERT_EQUAL_MESSAGE("Number formats of Time fields don't match", sal_Int32(7), nNumFmt);
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("Number formats of Time fields don't match", sal_Int32(SvxTimeFormat::HH12_MM_SS), nNumFmt);
+ break;
+ case 7: // June 29, 2021
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("Number formats of Date fields don't match", sal_Int32(SvxDateFormat::D), nNumFmt);
+ break;
+ case 8: // Jun 29, 2021
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("Number formats of Date fields don't match", sal_Int32(SvxDateFormat::C), nNumFmt);
+ break;
}
}
@@ -780,7 +793,7 @@ void SdOOXMLExportTest2::testDatetimeFieldNumberFormat()
xDocShRef = saveAndReload( xDocShRef.get(), PPTX );
- for(sal_uInt16 i = 0; i <= 6; ++i)
+ for(sal_uInt16 i = 0; i <= 8; ++i)
{
matchNumberFormat( i, getTextFieldFromPage(0, 0, 0, i, xDocShRef) );
}
@@ -794,7 +807,7 @@ void SdOOXMLExportTest2::testDatetimeFieldNumberFormatPPTX()
xDocShRef = saveAndReload( xDocShRef.get(), PPTX );
- for(sal_uInt16 i = 0; i <= 6; ++i)
+ for(sal_uInt16 i = 0; i <= 8; ++i)
{
matchNumberFormat( i, getTextFieldFromPage(0, 0, 0, i, xDocShRef) );
}
@@ -2788,6 +2801,72 @@ void SdOOXMLExportTest2::testTdf96061_textHighlight()
CPPUNIT_ASSERT_EQUAL(sal_Int32(-1), aColor);
}
+void SdOOXMLExportTest2::testTdf59323_slideFooters()
+{
+ ::sd::DrawDocShellRef xDocShRef
+ = loadURL(m_directories.getURLFromSrc(u"/sd/qa/unit/data/pptx/tdf59323.pptx"), PPTX);
+
+ utl::TempFile tempFile;
+ xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile);
+
+ uno::Reference<drawing::XDrawPagesSupplier> xDoc(xDocShRef->GetDoc()->getUnoModel(),
+ uno::UNO_QUERY_THROW);
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(3), xDoc->getDrawPages()->getCount());
+
+ for (int nPageIndex = 0; nPageIndex < 3; nPageIndex++)
+ {
+ uno::Reference<drawing::XDrawPage> xPage(getPage(0, xDocShRef));
+ uno::Reference<beans::XPropertySet> xPropSet(xPage, uno::UNO_QUERY);
+ CPPUNIT_ASSERT_EQUAL(true, xPropSet->getPropertyValue("IsFooterVisible").get<bool>());
+ CPPUNIT_ASSERT_EQUAL(true, xPropSet->getPropertyValue("IsDateTimeVisible").get<bool>());
+ CPPUNIT_ASSERT_EQUAL(true, xPropSet->getPropertyValue("IsPageNumberVisible").get<bool>());
+ }
+
+ // Test placeholder indexes
+ xmlDocPtr pXmlDocMaster = parseExport(tempFile, "ppt/slideMasters/slideMaster1.xml");
+ assertXPath(pXmlDocMaster, "//p:ph [@type='dt']", "idx", "1");
+ assertXPath(pXmlDocMaster, "//p:ph [@type='ftr']", "idx", "2");
+ assertXPath(pXmlDocMaster, "//p:ph [@type='sldNum']", "idx", "3");
+
+ xmlDocPtr pXmlDocSlide1 = parseExport(tempFile, "ppt/slides/slide1.xml");
+ assertXPath(pXmlDocSlide1, "//p:ph [@type='dt']", "idx", "1");
+ assertXPath(pXmlDocSlide1, "//p:ph [@type='ftr']", "idx", "2");
+ assertXPath(pXmlDocSlide1, "//p:ph [@type='sldNum']", "idx", "3");
+
+ // Test if datetime fields have text in them
+ // This is needed for backwards compatibility
+ assertXPath(pXmlDocSlide1, "//a:fld [@type='datetime1']/a:t");
+
+ xDocShRef->DoClose();
+}
+
+void SdOOXMLExportTest2::testTdf143222_embeddedWorksheet()
+{
+ // Check import of embedded worksheet in slide.
+ ::sd::DrawDocShellRef xDocShRef
+ = loadURL(m_directories.getURLFromSrc(u"sd/qa/unit/data/pptx/tdf143222.pptx"), PPTX);
+
+ const SdrPage* pPage = GetPage(1, xDocShRef.get());
+ const SdrOle2Obj* pOleObj = static_cast<SdrOle2Obj*>(pPage->GetObj(0));
+ CPPUNIT_ASSERT_MESSAGE("no object", pOleObj != nullptr);
+
+ // Without the fix we lost the graphic of ole object.
+ const Graphic* pGraphic = pOleObj->GetGraphic();
+ CPPUNIT_ASSERT_MESSAGE("no graphic", pGraphic != nullptr);
+
+ // Check export of embedded worksheet in slide.
+ xDocShRef = saveAndReload(xDocShRef.get(), PPTX);
+
+ pPage = GetPage(1, xDocShRef.get());
+ pOleObj = static_cast<SdrOle2Obj*>(pPage->GetObj(0));
+ CPPUNIT_ASSERT_MESSAGE("no object after the export", pOleObj != nullptr);
+
+ pGraphic = pOleObj->GetGraphic();
+ CPPUNIT_ASSERT_MESSAGE("no graphic after the export", pGraphic != nullptr);
+ xDocShRef->DoClose();
+}
+
+
CPPUNIT_TEST_SUITE_REGISTRATION(SdOOXMLExportTest2);
CPPUNIT_PLUGIN_IMPLEMENT();