[Libreoffice-commits] core.git: sc/qa

Laurent BP (via logerrit) logerrit at kemper.freedesktop.org
Mon Jul 6 07:28:43 UTC 2020


 sc/qa/unit/uicalc/data/tdf133342.ods |binary
 sc/qa/unit/uicalc/uicalc.cxx         |   25 +++++++++++++++++++++++++
 2 files changed, 25 insertions(+)

New commits:
commit 9e2da576bd07a389599f833f2cf1b09e6ead962d
Author:     Laurent BP <laurent.balland-poirier at laposte.net>
AuthorDate: Wed Jun 3 19:08:59 2020 +0200
Commit:     Xisco Fauli <xiscofauli at libreoffice.org>
CommitDate: Mon Jul 6 09:27:53 2020 +0200

    tdf#133342 UnitTest Add/Delete decimal of percent
    
    Space between number and percent sign should be
    preserved while adding/deleting decimals
    
    Change-Id: Ia80faf5eb9ed76bdfb8b26137e2bd4dafd53b062
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/95449
    Tested-by: Jenkins
    Reviewed-by: Xisco Fauli <xiscofauli at libreoffice.org>

diff --git a/sc/qa/unit/uicalc/data/tdf133342.ods b/sc/qa/unit/uicalc/data/tdf133342.ods
new file mode 100644
index 000000000000..3632784f78cb
Binary files /dev/null and b/sc/qa/unit/uicalc/data/tdf133342.ods differ
diff --git a/sc/qa/unit/uicalc/uicalc.cxx b/sc/qa/unit/uicalc/uicalc.cxx
index e93ac339ae76..d2c4bc9bb1a2 100644
--- a/sc/qa/unit/uicalc/uicalc.cxx
+++ b/sc/qa/unit/uicalc/uicalc.cxx
@@ -257,6 +257,31 @@ CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf83901)
     CPPUNIT_ASSERT_EQUAL(3.0, pDoc->GetValue(ScAddress(0, 1, 0)));
 }
 
+CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf133342)
+{
+    ScModelObj* pModelObj = createDoc("tdf133342.ods");
+    ScDocument* pDoc = pModelObj->GetDocument();
+    CPPUNIT_ASSERT(pDoc);
+
+    //Select cell A1
+    CPPUNIT_ASSERT_EQUAL(OUString("12,35 %"), pDoc->GetString(ScAddress(0, 0, 0)));
+    //Add decimals
+    dispatchCommand(mxComponent, ".uno:NumberFormatIncDecimals", {});
+    //Space should preserved before percent sign
+    CPPUNIT_ASSERT_EQUAL(OUString("12,346 %"), pDoc->GetString(ScAddress(0, 0, 0)));
+
+    //Delete decimals
+    dispatchCommand(mxComponent, ".uno:NumberFormatDecDecimals", {});
+    dispatchCommand(mxComponent, ".uno:NumberFormatDecDecimals", {});
+    dispatchCommand(mxComponent, ".uno:NumberFormatDecDecimals", {});
+    //Space should preserved before percent sign
+    CPPUNIT_ASSERT_EQUAL(OUString("12 %"), pDoc->GetString(ScAddress(0, 0, 0)));
+
+    dispatchCommand(mxComponent, ".uno:NumberFormatDecDecimals", {});
+    //Space should preserved before percent sign
+    CPPUNIT_ASSERT_EQUAL(OUString("12 %"), pDoc->GetString(ScAddress(0, 0, 0)));
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */


More information about the Libreoffice-commits mailing list