GNOME Bugzilla – Bug 760043
[ods] t6512 fails with new time format tests
Last modified: 2016-01-03 06:04:17 UTC
I added tests for some time formats and ods shows differences. Some of the differences are just that we grow quotes around colons. That's not wrong per se, just not canonical. Note, that some strings do need quotes. I also added a test for single character am/pm marker. I can get rid of that if ods doesn't have an equivalent. t6512-format.pl: Check format ods roundtrip. --- format-tests.xml 2015-12-31 20:51:52.367988881 -0500 +++ format-tests-new.xml 2015-12-31 20:51:52.371988881 -0500 @@ -298,22 +298,17 @@ </gnm:Style> </gnm:StyleRegion> <gnm:StyleRegion startCol="1" startRow="33" endCol="1" endRow="33"> - <gnm:Style HAlign="GNM_HALIGN_GENERAL" VAlign="GNM_VALIGN_BOTTOM" WrapText="0" ShrinkToFit="0" Rotation="0" Shade="0" Indent="0" Locked="1" Hidden="0" Fore="0:0:0" Back="FFFF:FFFF:FFFF" PatternColor="0:0:0" Format="hh:mm:ss"> + <gnm:Style HAlign="GNM_HALIGN_GENERAL" VAlign="GNM_VALIGN_BOTTOM" WrapText="0" ShrinkToFit="0" Rotation="0" Shade="0" Indent="0" Locked="1" Hidden="0" Fore="0:0:0" Back="FFFF:FFFF:FFFF" PatternColor="0:0:0" Format="hh":"mm":"ss"> <gnm:Font Unit="10" Bold="0" Italic="0" Underline="0" StrikeThrough="0" Script="0">Sans</gnm:Font> </gnm:Style> </gnm:StyleRegion> <gnm:StyleRegion startCol="1" startRow="34" endCol="1" endRow="34"> - <gnm:Style HAlign="GNM_HALIGN_GENERAL" VAlign="GNM_VALIGN_BOTTOM" WrapText="0" ShrinkToFit="0" Rotation="0" Shade="0" Indent="0" Locked="1" Hidden="0" Fore="0:0:0" Back="FFFF:FFFF:FFFF" PatternColor="0:0:0" Format="h:mm:ss"> + <gnm:Style HAlign="GNM_HALIGN_GENERAL" VAlign="GNM_VALIGN_BOTTOM" WrapText="0" ShrinkToFit="0" Rotation="0" Shade="0" Indent="0" Locked="1" Hidden="0" Fore="0:0:0" Back="FFFF:FFFF:FFFF" PatternColor="0:0:0" Format="h":"mm":"ss"> <gnm:Font Unit="10" Bold="0" Italic="0" Underline="0" StrikeThrough="0" Script="0">Sans</gnm:Font> </gnm:Style> </gnm:StyleRegion> - <gnm:StyleRegion startCol="1" startRow="35" endCol="1" endRow="35"> - <gnm:Style HAlign="GNM_HALIGN_GENERAL" VAlign="GNM_VALIGN_BOTTOM" WrapText="0" ShrinkToFit="0" Rotation="0" Shade="0" Indent="0" Locked="1" Hidden="0" Fore="0:0:0" Back="FFFF:FFFF:FFFF" PatternColor="0:0:0" Format="h:mm AM/PM"> - <gnm:Font Unit="10" Bold="0" Italic="0" Underline="0" StrikeThrough="0" Script="0">Sans</gnm:Font> - </gnm:Style> - </gnm:StyleRegion> - <gnm:StyleRegion startCol="1" startRow="36" endCol="1" endRow="36"> - <gnm:Style HAlign="GNM_HALIGN_GENERAL" VAlign="GNM_VALIGN_BOTTOM" WrapText="0" ShrinkToFit="0" Rotation="0" Shade="0" Indent="0" Locked="1" Hidden="0" Fore="0:0:0" Back="FFFF:FFFF:FFFF" PatternColor="0:0:0" Format="h:mm a/p"> + <gnm:StyleRegion startCol="1" startRow="35" endCol="1" endRow="36"> + <gnm:Style HAlign="GNM_HALIGN_GENERAL" VAlign="GNM_VALIGN_BOTTOM" WrapText="0" ShrinkToFit="0" Rotation="0" Shade="0" Indent="0" Locked="1" Hidden="0" Fore="0:0:0" Back="FFFF:FFFF:FFFF" PatternColor="0:0:0" Format="h":"mm AM/PM"> <gnm:Font Unit="10" Bold="0" Italic="0" Underline="0" StrikeThrough="0" Script="0">Sans</gnm:Font> </gnm:Style> </gnm:StyleRegion>
I fixed the quoting issue. That leaves the a/p issue. Can ods handle that? t6512-format.pl: Check format ods roundtrip. --- format-tests.xml 2016-01-01 10:12:49.148336582 -0500 +++ format-tests-new.xml 2016-01-01 10:12:49.152336582 -0500 @@ -307,16 +307,11 @@ <gnm:Font Unit="10" Bold="0" Italic="0" Underline="0" StrikeThrough="0" Script="0">Sans</gnm:Font> </gnm:Style> </gnm:StyleRegion> - <gnm:StyleRegion startCol="1" startRow="35" endCol="1" endRow="35"> + <gnm:StyleRegion startCol="1" startRow="35" endCol="1" endRow="36"> <gnm:Style HAlign="GNM_HALIGN_GENERAL" VAlign="GNM_VALIGN_BOTTOM" WrapText="0" ShrinkToFit="0" Rotation="0" Shade="0" Indent="0" Locked="1" Hidden="0" Fore="0:0:0" Back="FFFF:FFFF:FFFF" PatternColor="0:0:0" Format="h:mm AM/PM"> <gnm:Font Unit="10" Bold="0" Italic="0" Underline="0" StrikeThrough="0" Script="0">Sans</gnm:Font> </gnm:Style> </gnm:StyleRegion> - <gnm:StyleRegion startCol="1" startRow="36" endCol="1" endRow="36"> - <gnm:Style HAlign="GNM_HALIGN_GENERAL" VAlign="GNM_VALIGN_BOTTOM" WrapText="0" ShrinkToFit="0" Rotation="0" Shade="0" Indent="0" Locked="1" Hidden="0" Fore="0:0:0" Back="FFFF:FFFF:FFFF" PatternColor="0:0:0" Format="h:mm a/p"> - <gnm:Font Unit="10" Bold="0" Italic="0" Underline="0" StrikeThrough="0" Script="0">Sans</gnm:Font> - </gnm:Style> - </gnm:StyleRegion> <gnm:StyleRegion startCol="1" startRow="37" endCol="1" endRow="40"> <gnm:Style HAlign="GNM_HALIGN_GENERAL" VAlign="GNM_VALIGN_BOTTOM" WrapText="0" ShrinkToFit="0" Rotation="0" Shade="0" Indent="0" Locked="1" Hidden="0" Fore="0:0:0" Back="FFFF:FFFF:FFFF" PatternColor="0:0:0" Format="m/d/yy"> <gnm:Font Unit="10" Bold="0" Italic="0" Underline="0" StrikeThrough="0" Script="0">Sans</gnm:Font>
The ODF standard at this time does not allow distinction between am/pm and a/p: "The <number:am-pm> element specifies whether AM/PM is included as part of a date or time. If a <number:am-pm> element is contained in a date or time style, hours are displayed using values from 1 to 12 only. The <number:am-pm> element has no attributes. The <number:am-pm> element has no child elements." LO 3.10.3 understands the a/p notation but when saving to an ODF file and opening again this becomes AM/PM. So this is a prime candidate for introducing a new foreign element and proposing it to the ODF TC for inclusion into a future version of ODF. I will do so.
This problem has been fixed in the unstable development version. The fix will be available in the next major software release. You may need to upgrade your Linux distribution to obtain that newer version. Note that the writing portion of this fix is in goffice.
So currently ods will also mess with cases? am/pm, AM/PM, a/p, A/P
I updated the ods schema with the new attribute.
We seem to treat am/pm the same as AM/PM. I'll have to double-check with Excel. But we deliberately treat a/p differently from A/P. And for kicks there is also a/P and A/p which we can probably ignore here.
I should have seen this before I tried to update the ods schema patch rather than just failing on the push. ODF has only one marker for am/pm and so it is always AM/PM (full length and capital). LO seems to only understand: AM/PM (if you enter am/pm it becomes AM/PM) and a/p (it is always shown in the format code as A/P) In Excel 2013 the AM and PM appears to be always rendered as capitals while the a/p matches the capitalization in the format string. So therr are effectively 5 different possibilities: am/pm in any of the 16 capitalizations yields AM/PM a/p yields a/p A/p yields A/p a/P yields a/P and A/P yields A/P In goffice I see the 2 tokens TOK_AMPM5 and TOK_AMPM3. I gather for the TOK_AMPM3 the exact token string is checked for rendering.
The ODF import/export should now handle all of these possibilities.
Did you forget to commit something? I don't see the write side.
The "write" side is in goffice.