diff options
author | Sarper Akdemir <sarper.akdemir@collabora.com> | 2021-06-29 13:33:52 +0300 |
---|---|---|
committer | Jan Holesovsky <kendy@collabora.com> | 2021-07-19 16:47:10 +0200 |
commit | 7ec4a0872d16eb20d790eb8079ba538898fd2ff6 (patch) | |
tree | bfc5a880f17e8daf2a0a95d5b47efaaf4cc84702 /sd | |
parent | b1668edf7fa3ad8c32bcc4d73821770f2df011ca (diff) |
tdf#59323 tdf#142221: fix pptx datetime import export format
fixed some problems from the original implementation of
pptx datetime field formatting
(2b0669eec0d86e973a7d8def8744c522bbf8af8b)
also the comments on tests seemed to be based on en-IN which
seems to differ a lot for SvxDateFormat::StdBig. So converted
them to en-US's StdBig.
expanded the tests, so it covers previously poorly imported
types. Also made them use the SvxDateFormat and SvxTimeFormat
Change-Id: I675c482d3095b5373975abb2e6e7eca2d353243d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118135
Tested-by: Jenkins
Reviewed-by: Jan Holesovsky <kendy@collabora.com>
Diffstat (limited to 'sd')
-rw-r--r-- | sd/qa/unit/data/odp/numfmt.odp | bin | 10608 -> 11438 bytes | |||
-rw-r--r-- | sd/qa/unit/data/pptx/numfmt.pptx | bin | 41390 -> 44390 bytes | |||
-rw-r--r-- | sd/qa/unit/export-tests-ooxml2.cxx | 32 |
3 files changed, 20 insertions, 12 deletions
diff --git a/sd/qa/unit/data/odp/numfmt.odp b/sd/qa/unit/data/odp/numfmt.odp Binary files differindex 6fd32ce0a66d..51227ea091d9 100644 --- a/sd/qa/unit/data/odp/numfmt.odp +++ b/sd/qa/unit/data/odp/numfmt.odp diff --git a/sd/qa/unit/data/pptx/numfmt.pptx b/sd/qa/unit/data/pptx/numfmt.pptx Binary files differindex e5f0f5cf151a..f855fbbeb12c 100644 --- a/sd/qa/unit/data/pptx/numfmt.pptx +++ b/sd/qa/unit/data/pptx/numfmt.pptx diff --git a/sd/qa/unit/export-tests-ooxml2.cxx b/sd/qa/unit/export-tests-ooxml2.cxx index e2cdef3d76f6..b7d6e0ca5554 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> @@ -787,26 +788,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; } } @@ -818,7 +826,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) ); } @@ -832,7 +840,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) ); } |