sc/qa/unit/tiledrendering/tiledrendering2.cxx             |   22 +
 sc/qa/unit/tiledrendering/tiledrenderingmodeltestbase.cxx |   21 +
 sc/qa/unit/tiledrendering2/tiledrendering2.cxx            |  183 --------------
 3 files changed, 43 insertions(+), 183 deletions(-)

New commits:
commit 4f0d77436b0c2e92887fd3153096e052d9dea348
Author:     Miklos Vajna <vmik...@collabora.com>
AuthorDate: Wed Apr 9 13:20:55 2025 +0200
Commit:     Caolán McNamara <caolan.mcnam...@collabora.com>
CommitDate: Mon Apr 14 10:56:55 2025 +0200

    CppunitTest_sc_tiledrendering2, testDecimalSeparatorInfo: fix mismerge
    
    18e206907713768366cff5ee385eafdf26255980 (Add a test for decimal
    separator info., 2025-02-05) was OK, but then the version on master was
    mismerged, restore the lost test.
    
    Change-Id: I289cc228f6a429a0065310389c89a312bf413277
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/184134
    Reviewed-by: Caolán McNamara <caolan.mcnam...@collabora.com>
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com>

diff --git a/sc/qa/unit/tiledrendering/tiledrendering2.cxx 
b/sc/qa/unit/tiledrendering/tiledrendering2.cxx
index 141c6f58985f..ccf2acd92e51 100644
--- a/sc/qa/unit/tiledrendering/tiledrendering2.cxx
+++ b/sc/qa/unit/tiledrendering/tiledrendering2.cxx
@@ -119,6 +119,28 @@ CPPUNIT_TEST_FIXTURE(ScTiledRenderingTest, 
testLocaleFormulaSeparator)
     CPPUNIT_ASSERT_EQUAL(u"0"_ustr, pDoc->GetString(addr));
 }
 
+CPPUNIT_TEST_FIXTURE(ScTiledRenderingTest, 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();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/qa/unit/tiledrendering/tiledrenderingmodeltestbase.cxx 
b/sc/qa/unit/tiledrendering/tiledrenderingmodeltestbase.cxx
index 1c01d6d4f626..99917ea72ca2 100644
--- a/sc/qa/unit/tiledrendering/tiledrenderingmodeltestbase.cxx
+++ b/sc/qa/unit/tiledrendering/tiledrenderingmodeltestbase.cxx
@@ -272,6 +272,7 @@ public:
     OString m_aHyperlinkClicked;
     OString m_ShapeSelection;
     std::map<std::string, boost::property_tree::ptree> m_aStateChanges;
+    std::string decimalSeparator;
     TestLokCallbackWrapper m_callbackWrapper;
 
     ViewCallback(bool bDeleteListenerOnDestruct = true)
@@ -461,6 +462,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;
         }
     }
 
diff --git a/sc/qa/unit/tiledrendering2/tiledrendering2.cxx 
b/sc/qa/unit/tiledrendering2/tiledrendering2.cxx
deleted file mode 100644
index 5c9e8b539822..000000000000
--- a/sc/qa/unit/tiledrendering2/tiledrendering2.cxx
+++ /dev/null
@@ -1,183 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- */
-
-#include <test/unoapixml_test.hxx>
-
-#include <boost/property_tree/json_parser.hpp>
-
-#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>
-
-using namespace com::sun::star;
-
-namespace
-{
-class Test : public UnoApiXmlTest
-{
-public:
-    Test();
-    void setUp() override;
-    void tearDown() override;
-
-    ScModelObj* createDoc(const char* pName);
-};
-
-Test::Test()
-    : UnoApiXmlTest("/sc/qa/unit/tiledrendering2/data/")
-{
-}
-
-void Test::setUp()
-{
-    UnoApiXmlTest::setUp();
-
-    comphelper::LibreOfficeKit::setActive(true);
-}
-
-void Test::tearDown()
-{
-    if (mxComponent.is())
-    {
-        mxComponent->dispose();
-        mxComponent.clear();
-    }
-
-    comphelper::LibreOfficeKit::resetCompatFlag();
-
-    comphelper::LibreOfficeKit::setActive(false);
-
-    UnoApiXmlTest::tearDown();
-}
-
-ScModelObj* Test::createDoc(const char* pName)
-{
-    loadFromFile(OUString::createFromAscii(pName));
-
-    ScModelObj* pModelObj = 
comphelper::getFromUnoTunnel<ScModelObj>(mxComponent);
-    CPPUNIT_ASSERT(pModelObj);
-    
pModelObj->initializeForTiledRendering(uno::Sequence<beans::PropertyValue>());
-    return pModelObj;
-}
-
-/// A view callback tracks callbacks invoked on one specific view.
-class ViewCallback final
-{
-    SfxViewShell* mpViewShell;
-    int mnView;
-
-public:
-    std::map<std::string, boost::property_tree::ptree> m_aStateChanges;
-    std::string decimalSeparator;
-    TestLokCallbackWrapper m_callbackWrapper;
-
-    ViewCallback()
-        : m_callbackWrapper(&callback, this)
-    {
-        mpViewShell = SfxViewShell::Current();
-        mpViewShell->setLibreOfficeKitViewCallback(&m_callbackWrapper);
-        mnView = SfxLokHelper::getView();
-        m_callbackWrapper.setLOKViewId(mnView);
-    }
-
-    ~ViewCallback()
-    {
-        if (mpViewShell)
-        {
-            SfxLokHelper::setView(mnView);
-            mpViewShell->setLibreOfficeKitViewCallback(nullptr);
-        }
-    }
-
-    static void callback(int nType, const char* pPayload, void* pData)
-    {
-        static_cast<ViewCallback*>(pData)->callbackImpl(nType, pPayload);
-    }
-
-    void callbackImpl(int nType, const char* pPayload)
-    {
-        switch (nType)
-        {
-            case LOK_CALLBACK_STATE_CHANGED:
-            {
-                std::stringstream aStream(pPayload);
-                if (!aStream.str().starts_with("{"))
-                {
-                    break;
-                }
-
-                boost::property_tree::ptree aTree;
-                boost::property_tree::read_json(aStream, aTree);
-                auto it = aTree.find("commandName");
-                if (it == aTree.not_found())
-                {
-                    break;
-                }
-
-                std::string aCommandName = it->second.get_value<std::string>();
-                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;
-        }
-    }
-};
-
-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();
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Reply via email to