sc/qa/uitest/calc_tests9/tdf144296_automatic_cell_direction.py | 33 ---------- sc/qa/unit/uicalc/uicalc.cxx | 22 ++++++ 2 files changed, 22 insertions(+), 33 deletions(-)
New commits: commit a7c1a6569f694e876d4a4fc6712396f0c99be23f Author: Xisco Fauli <[email protected]> AuthorDate: Wed Mar 4 10:37:47 2026 +0100 Commit: Xisco Fauli <[email protected]> CommitDate: Wed Mar 4 11:48:57 2026 +0100 tdf#65563 sc: move UItest to CppUnittest Change-Id: I01c06b722f83e5909d8859bd35ef156dcd6a3c1d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/200934 Tested-by: Jenkins Reviewed-by: Xisco Fauli <[email protected]> diff --git a/sc/qa/uitest/calc_tests9/tdf144296_automatic_cell_direction.py b/sc/qa/uitest/calc_tests9/tdf144296_automatic_cell_direction.py deleted file mode 100644 index 2dcc50684430..000000000000 --- a/sc/qa/uitest/calc_tests9/tdf144296_automatic_cell_direction.py +++ /dev/null @@ -1,33 +0,0 @@ -# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-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/. -# - -from uitest.framework import UITestCase -from uitest.uihelper.common import get_url_for_data_file -from libreoffice.calc.document import get_cell_by_position -from libreoffice.uno.propertyvalue import mkPropertyValues - -class Tdf144296(UITestCase): - def test_tdf144296_automatic_cell_direction(self): - with self.ui_test.create_doc_in_start_center("calc") as document: - xCalcDoc = self.xUITest.getTopFocusWindow() - xGridWindow = xCalcDoc.getChild("grid_window") - xCell = get_cell_by_position(document, 0, 0, 0) - - # Before input, the cell's direction should be inherited - self.assertEqual(4, xCell.getPropertyValue("WritingMode")) - - # Type a single RTL character into the cell and dismiss - xGridWindow.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) - xGridWindow.executeAction("TYPE", mkPropertyValues({"TEXT": "א"})) - xGridWindow.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RETURN"})) - - # After typing, the cell should now be automatically set right-to-left - self.assertEqual(1, xCell.getPropertyValue("WritingMode")) - -# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/unit/uicalc/uicalc.cxx b/sc/qa/unit/uicalc/uicalc.cxx index c078f692792e..3dee1e77fb11 100644 --- a/sc/qa/unit/uicalc/uicalc.cxx +++ b/sc/qa/unit/uicalc/uicalc.cxx @@ -21,6 +21,7 @@ #include <com/sun/star/awt/Key.hpp> #include <com/sun/star/sheet/GlobalSheetSettings.hpp> #include <com/sun/star/table/BorderLineStyle.hpp> +#include <com/sun/star/text/WritingMode2.hpp> #include <condformathelper.hxx> #include <conditio.hxx> #include <document.hxx> @@ -1807,6 +1808,27 @@ CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf86166) CPPUNIT_ASSERT_EQUAL(static_cast<SCTAB>(1), pDoc->GetTableCount()); } +CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf144296_automatic_cell_direction) +{ + createScDoc(); + + uno::Reference<sheet::XSpreadsheetDocument> xDoc(mxComponent, uno::UNO_QUERY_THROW); + + css::uno::Reference<css::sheet::XCellRangesAccess> xSheets(xDoc->getSheets(), + css::uno::UNO_QUERY_THROW); + css::uno::Reference<css::table::XCell> xCell = xSheets->getCellByPosition(0, 0, 0); + uno::Reference<beans::XPropertySet> xProp(xCell, css::uno::UNO_QUERY_THROW); + + sal_Int16 eWritingMode = text::WritingMode2::LR_TB; + xProp->getPropertyValue(u"WritingMode"_ustr) >>= eWritingMode; + CPPUNIT_ASSERT_EQUAL(sal_Int16(text::WritingMode2::PAGE), eWritingMode); + + insertStringToCell(u"A1"_ustr, u"א"); + + xProp->getPropertyValue(u"WritingMode"_ustr) >>= eWritingMode; + CPPUNIT_ASSERT_EQUAL(sal_Int16(text::WritingMode2::RL_TB), eWritingMode); +} + CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf158802) { createScDoc("tdf158802.xlsx");
