[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-6.4' - oox/source sd/qa
Sarper Akdemir (via logerrit)
logerrit at kemper.freedesktop.org
Wed Jun 30 08:09:48 UTC 2021
oox/source/drawingml/textfield.cxx | 23 ++++++++++++-----------
oox/source/export/drawingml.cxx | 4 +++-
sd/qa/unit/data/odp/numfmt.odp |binary
sd/qa/unit/data/pptx/numfmt.pptx |binary
sd/qa/unit/export-tests-ooxml2.cxx | 32 ++++++++++++++++++++------------
5 files changed, 35 insertions(+), 24 deletions(-)
New commits:
commit cfec09ebd15a301555a7c3d01bc0ed25aafc2dcc
Author: Sarper Akdemir <sarper.akdemir at collabora.com>
AuthorDate: Tue Jun 29 13:33:52 2021 +0300
Commit: Jan Holesovsky <kendy at collabora.com>
CommitDate: Wed Jun 30 10:09:22 2021 +0200
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/+/118104
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
Reviewed-by: Jan Holesovsky <kendy at collabora.com>
diff --git a/oox/source/drawingml/textfield.cxx b/oox/source/drawingml/textfield.cxx
index d3fb06f94fc8..a8e058603f7a 100644
--- a/oox/source/drawingml/textfield.cxx
+++ b/oox/source/drawingml/textfield.cxx
@@ -220,21 +220,22 @@ SvxDateFormat TextField::getLODateFormat(std::u16string_view rDateTimeType)
switch( nDateTimeNum )
{
case 1: // Date dd/mm/yyyy
- case 2: // Date Day, Month dd, yyyy
- case 5: // Date dd-Mon-yy
- case 6: // Date Month yy
- case 7: // Date Mon-yy
case 8: // DateTime dd/mm/yyyy H:MM PM
case 9: // DateTime dd/mm/yyyy H:MM:SS PM
return SvxDateFormat::B;
- case 3: // Date dd Month yyyy
+ case 2: // Date Day, Month dd, yyyy
return SvxDateFormat::StdBig;
- case 4: // Date Month dd, yyyy
- return SvxDateFormat::StdSmall;
- case 10: // Time H:MM
- case 11: // Time H:MM:SS
- case 12: // Time H:MM PM
- case 13: // Time H:MM:SS PM
+ case 3: // Date dd Month yyyy
+ case 4: // Date Month dd, yyyy - no exact map
+ case 6: // Date Month yy - no exact map
+ return SvxDateFormat::D;
+ case 5: // Date dd-Mon-yy - no exact map
+ case 7: // Date Mon-yy - no exact map
+ return SvxDateFormat::C;
+ case 10: // Time H:MM - not a date format
+ case 11: // Time H:MM:SS - not a date format
+ case 12: // Time H:MM PM - not a date format
+ case 13: // Time H:MM:SS PM - not a date format
default:
return SvxDateFormat::AppDefault;
}
diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx
index 87898bb7d9d2..dacfe516585c 100644
--- a/oox/source/export/drawingml.cxx
+++ b/oox/source/export/drawingml.cxx
@@ -2193,11 +2193,13 @@ OUString DrawingML::GetDatetimeTypeFromDateTime(SvxDateFormat eDate, SvxTimeForm
case SvxDateFormat::B:
aDateField = "datetime1"; // 13/02/1996
break;
- case SvxDateFormat::StdBig:
case SvxDateFormat::C:
+ aDateField = "datetime5";
+ break;
case SvxDateFormat::D:
aDateField = "datetime3"; // 13 February 1996
break;
+ case SvxDateFormat::StdBig:
case SvxDateFormat::E:
case SvxDateFormat::F:
aDateField = "datetime2";
diff --git a/sd/qa/unit/data/odp/numfmt.odp b/sd/qa/unit/data/odp/numfmt.odp
index 6fd32ce0a66d..51227ea091d9 100644
Binary files a/sd/qa/unit/data/odp/numfmt.odp and b/sd/qa/unit/data/odp/numfmt.odp differ
diff --git a/sd/qa/unit/data/pptx/numfmt.pptx b/sd/qa/unit/data/pptx/numfmt.pptx
index e5f0f5cf151a..f855fbbeb12c 100644
Binary files a/sd/qa/unit/data/pptx/numfmt.pptx and b/sd/qa/unit/data/pptx/numfmt.pptx differ
diff --git a/sd/qa/unit/export-tests-ooxml2.cxx b/sd/qa/unit/export-tests-ooxml2.cxx
index 747168ba6940..f005e4800e8e 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>
@@ -751,26 +752,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;
}
}
@@ -782,7 +790,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) );
}
@@ -796,7 +804,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) );
}
More information about the Libreoffice-commits
mailing list