[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-6.2' - i18npool/source sw/qa

Miklos Vajna (via logerrit) logerrit at kemper.freedesktop.org
Thu Apr 2 10:57:34 UTC 2020


 i18npool/source/defaultnumberingprovider/defaultnumberingprovider.cxx |    1 
 sw/qa/extras/odfexport/data/arabic-zero-numbering.odt                 |binary
 sw/qa/extras/odfexport/odfexport.cxx                                  |   13 ++++++++++
 3 files changed, 14 insertions(+)

New commits:
commit aa258391ecc86dad47a52f51fdaf773dbe9ca6f5
Author:     Miklos Vajna <vmiklos at collabora.com>
AuthorDate: Tue Mar 3 15:54:19 2020 +0100
Commit:     Miklos Vajna <vmiklos at collabora.com>
CommitDate: Thu Apr 2 12:57:02 2020 +0200

    sw padded numbering: add ODF filter
    
    ODF allows any string as style:num-format="...", go with "01, 02, 03,
    ...", because that seems to be consistent with both
    DefaultNumberingProvider::makeNumberingIdentifier()'s fallback mechanism
    and with OOXML (which uses "001, 002, 003, ..." for the "pad to 3"
    case).
    
    (cherry picked from commit 7a8450c3ecf1a8000cb37981c981fdd55d196df4)
    
    Change-Id: I5c5c7ee5bd61175afc3e682276e69344852106d5
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/91502
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
    Reviewed-by: Miklos Vajna <vmiklos at collabora.com>

diff --git a/i18npool/source/defaultnumberingprovider/defaultnumberingprovider.cxx b/i18npool/source/defaultnumberingprovider/defaultnumberingprovider.cxx
index 692289920eff..3b5cb977d33a 100644
--- a/i18npool/source/defaultnumberingprovider/defaultnumberingprovider.cxx
+++ b/i18npool/source/defaultnumberingprovider/defaultnumberingprovider.cxx
@@ -1040,6 +1040,7 @@ static const Supported_NumberingType aSupportedTypes[] =
         {style::NumberingType::CHARS_PERSIAN_WORD,   nullptr, LANG_CTL},
         {style::NumberingType::CHARS_GREEK_UPPER_LETTER,   C_GR_A ", " C_GR_B ", ... (gr)", LANG_ALL},
         {style::NumberingType::CHARS_GREEK_LOWER_LETTER,   S_GR_A ", " S_GR_B ", ... (gr)", LANG_ALL},
+        {style::NumberingType::ARABIC_ZERO, "01, 02, 03, ...", LANG_ALL},
 };
 static const sal_Int32 nSupported_NumberingTypes = SAL_N_ELEMENTS(aSupportedTypes);
 
diff --git a/sw/qa/extras/odfexport/data/arabic-zero-numbering.odt b/sw/qa/extras/odfexport/data/arabic-zero-numbering.odt
new file mode 100644
index 000000000000..2a445b22748a
Binary files /dev/null and b/sw/qa/extras/odfexport/data/arabic-zero-numbering.odt differ
diff --git a/sw/qa/extras/odfexport/odfexport.cxx b/sw/qa/extras/odfexport/odfexport.cxx
index 0bfca2fc0bc8..afb17337be13 100644
--- a/sw/qa/extras/odfexport/odfexport.cxx
+++ b/sw/qa/extras/odfexport/odfexport.cxx
@@ -2228,6 +2228,19 @@ DECLARE_ODFEXPORT_TEST(tdf99631, "tdf99631.docx")
     assertXPathContent(pXmlDoc2, "//config:config-item[@config:name='VisibleAreaWidth']", "4515");
     assertXPathContent(pXmlDoc2, "//config:config-item[@config:name='VisibleAreaHeight']", "1354");
 }
+
+DECLARE_ODFEXPORT_TEST(testArabicZeroNumbering, "arabic-zero-numbering.odt")
+{
+    auto xNumberingRules
+        = getProperty<uno::Reference<container::XIndexAccess>>(getParagraph(1), "NumberingRules");
+    comphelper::SequenceAsHashMap aMap(xNumberingRules->getByIndex(0));
+    // Without the accompanying fix in place, this test would have failed with:
+    // - Expected: 64
+    // - Actual  : 4
+    // i.e. numbering type was ARABIC, not ARABIC_ZERO.
+    CPPUNIT_ASSERT_EQUAL(static_cast<sal_uInt16>(style::NumberingType::ARABIC_ZERO),
+                         aMap["NumberingType"].get<sal_uInt16>());
+}
 #endif
 
 CPPUNIT_PLUGIN_IMPLEMENT();


More information about the Libreoffice-commits mailing list