sc/qa/unit/tiledrendering2/data/decimal-separator.ods |binary sc/qa/unit/tiledrendering2/tiledrendering2.cxx | 45 ++++++++++++++++++ 2 files changed, 45 insertions(+)
New commits: commit 18e206907713768366cff5ee385eafdf26255980 Author: Gökay Şatır <[email protected]> AuthorDate: Tue Feb 4 13:56:16 2025 +0300 Commit: Miklos Vajna <[email protected]> CommitDate: Wed Feb 5 12:01:00 2025 +0100 Add a test for decimal separator info. Ensure that decimal separator of the number inside the cell is also sent to the server. Signed-off-by: Gökay Şatır <[email protected]> Change-Id: I5864b86ae2d1c4a582a86a0f2488f7229be7bdaa Reviewed-on: https://gerrit.libreoffice.org/c/core/+/181094 Tested-by: Jenkins CollaboraOffice <[email protected]> Reviewed-by: Miklos Vajna <[email protected]> diff --git a/sc/qa/unit/tiledrendering2/data/decimal-separator.ods b/sc/qa/unit/tiledrendering2/data/decimal-separator.ods new file mode 100644 index 000000000000..6f4baedd63f1 Binary files /dev/null and b/sc/qa/unit/tiledrendering2/data/decimal-separator.ods differ diff --git a/sc/qa/unit/tiledrendering2/tiledrendering2.cxx b/sc/qa/unit/tiledrendering2/tiledrendering2.cxx index 058e7deb0883..e4037781fd3e 100644 --- a/sc/qa/unit/tiledrendering2/tiledrendering2.cxx +++ b/sc/qa/unit/tiledrendering2/tiledrendering2.cxx @@ -14,9 +14,11 @@ #include <LibreOfficeKit/LibreOfficeKitEnums.h> #include <comphelper/lok.hxx> #include <comphelper/servicehelper.hxx> +#include <comphelper/propertyvalue.hxx> #include <sfx2/lokhelper.hxx> #include <test/lokcallback.hxx> #include <vcl/scheduler.hxx> +#include <tabvwsh.hxx> #include <docuno.hxx> @@ -79,6 +81,7 @@ class ViewCallback final public: std::map<std::string, boost::property_tree::ptree> m_aStateChanges; + std::string decimalSeparator; TestLokCallbackWrapper m_callbackWrapper; ViewCallback() @@ -128,6 +131,26 @@ public: m_aStateChanges[aCommandName] = aTree; } break; + case LOK_CALLBACK_JSDIALOG: + { + std::stringstream aStream(pPayload); + boost::property_tree::ptree aTree; + boost::property_tree::read_json(aStream, aTree); + if (aTree.get_child("jsontype").get_value<std::string>() == "formulabar") + { + if (aTree.find("data") != aTree.not_found()) + { + if (aTree.get_child("data").find("separator") + != aTree.get_child("data").not_found()) + { + decimalSeparator = aTree.get_child("data") + .get_child("separator") + .get_value<std::string>(); + } + } + } + } + break; } } }; @@ -159,6 +182,28 @@ CPPUNIT_TEST_FIXTURE(Test, testSidebarLocale) std::string aLocale = it->second.get<std::string>("locale"); CPPUNIT_ASSERT_EQUAL(std::string("de-DE"), aLocale); } + +CPPUNIT_TEST_FIXTURE(Test, testDecimalSeparatorInfo) +{ + createDoc("decimal-separator.ods"); + + ViewCallback aView1; + + // Go to cell A1. + uno::Sequence<beans::PropertyValue> aPropertyValues + = { comphelper::makePropertyValue("ToPoint", OUString("$A$1")) }; + dispatchCommand(mxComponent, ".uno:GoToCell", aPropertyValues); + + // Cell A1 has language set to English. Decimal separator should be ".". + CPPUNIT_ASSERT_EQUAL(std::string("."), aView1.decimalSeparator); + + // Go to cell B1. + aPropertyValues = { comphelper::makePropertyValue("ToPoint", OUString("B$1")) }; + dispatchCommand(mxComponent, ".uno:GoToCell", aPropertyValues); + + // Cell B1 has language set to Turkish. Decimal separator should be ",". + CPPUNIT_ASSERT_EQUAL(std::string(","), aView1.decimalSeparator); +} } CPPUNIT_PLUGIN_IMPLEMENT();
