From 267c6f2ac71f92999e969232431ba04678e7437e Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Mon, 15 Apr 2024 07:54:39 +0200 Subject: Adding upstream version 4:24.2.0. Signed-off-by: Daniel Baumann --- uitest/math_tests/data/tdf128610.fodt | 34 ++++++++++++++++++ uitest/math_tests/start.py | 67 +++++++++++++++++++++++++++++++++++ uitest/math_tests/tdf128610.py | 32 +++++++++++++++++ uitest/math_tests/tdf147755.py | 32 +++++++++++++++++ 4 files changed, 165 insertions(+) create mode 100644 uitest/math_tests/data/tdf128610.fodt create mode 100644 uitest/math_tests/start.py create mode 100644 uitest/math_tests/tdf128610.py create mode 100644 uitest/math_tests/tdf147755.py (limited to 'uitest/math_tests') diff --git a/uitest/math_tests/data/tdf128610.fodt b/uitest/math_tests/data/tdf128610.fodt new file mode 100644 index 0000000000..cee4ed8e59 --- /dev/null +++ b/uitest/math_tests/data/tdf128610.fodt @@ -0,0 +1,34 @@ + + + + + + + + + + + + + <?xml version="1.0" encoding="UTF-8"?> + <math xmlns="http://www.w3.org/1998/Math/MathML" display="block"> + <semantics> + <mrow> + <msub> + <mi>f</mi> + <mi>c</mi> + </msub> + <mo stretchy="false">=</mo> + <mfrac> + <mn>1</mn> + <msub> + <mi>K</mi> + <mi>m</mi> + </msub> + </mfrac> + </mrow> + </semantics> + </math> + + + diff --git a/uitest/math_tests/start.py b/uitest/math_tests/start.py new file mode 100644 index 0000000000..7504387a16 --- /dev/null +++ b/uitest/math_tests/start.py @@ -0,0 +1,67 @@ +# -*- 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.uihelper.common import get_state_as_dict + +from libreoffice.uno.propertyvalue import mkPropertyValues + +from uitest.framework import UITestCase +from uitest.uihelper.common import type_text, select_pos + +class SimpleMathTest(UITestCase): + + def test_math_unoCommand(self): + with self.ui_test.create_doc_in_start_center("math"): + + xMathDoc = self.xUITest.getTopFocusWindow() + + # tdf#140386 + self.xUITest.executeCommand(".uno:InsertCommandText?Text:string=backepsilon") + + xEditView = xMathDoc.getChild("editview") + + self.assertEqual("backepsilon", get_state_as_dict(xEditView)["Text"]) + + def test_math_edit(self): + with self.ui_test.create_doc_in_start_center("math"): + + xMathDoc = self.xUITest.getTopFocusWindow() + + xEditView = xMathDoc.getChild("editview") + + type_text(xEditView, "E=mc^2") + + self.assertEqual("E=mc^2", get_state_as_dict(xEditView)["Text"]) + + def test_complete_math(self): + with self.ui_test.create_doc_in_start_center("math"): + + xMathDoc = self.xUITest.getTopFocusWindow() + + xList = xMathDoc.getChild("categorylist") + state = get_state_as_dict(xList) + self.assertEqual(state["SelectEntryText"], "Unary/Binary Operators") + select_pos(xList, "1") + state = get_state_as_dict(xList) + self.assertEqual(state["SelectEntryText"], "Relations") + + xMathSelector = xMathDoc.getChild("elements") + + xElement = xMathSelector.getChild("1") + xElement.executeAction("DOUBLECLICK", tuple()) + + xEditView = xMathDoc.getChild("editview") + xEditView.executeAction("TYPE", mkPropertyValues({"KEYCODE":"F4"})) + type_text(xEditView, "1") + xEditView.executeAction("TYPE", mkPropertyValues({"KEYCODE":"F4"})) + type_text(xEditView, "2") + + self.assertEqual("{ 1 <> 2 }", get_state_as_dict(xEditView)["Text"]) + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/uitest/math_tests/tdf128610.py b/uitest/math_tests/tdf128610.py new file mode 100644 index 0000000000..29b7d5ac45 --- /dev/null +++ b/uitest/math_tests/tdf128610.py @@ -0,0 +1,32 @@ +# -*- 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_state_as_dict +from uitest.uihelper.common import get_url_for_data_file + +class Tdf128610(UITestCase): + + def test_tdf128610(self): + with self.ui_test.load_file(get_url_for_data_file('tdf128610.fodt')): + self.xUITest.executeCommand('.uno:SelectAll') + self.xUITest.executeCommand('.uno:Copy') + + with self.ui_test.load_empty_file("math"): + + self.xUITest.executeCommand('.uno:ImportMathMLClipboard') + + xMathDoc = self.xUITest.getTopFocusWindow() + xEditView = xMathDoc.getChild("editview") + + # Without the fix in place, this test would have failed with + # AssertionError: '{ f _ c = frac { 1 } { K _ m } }' != '' + self.assertEqual("{ f _ c = { frac { 1 } { K _ m } } }", get_state_as_dict(xEditView)["Text"]) + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/uitest/math_tests/tdf147755.py b/uitest/math_tests/tdf147755.py new file mode 100644 index 0000000000..4919747878 --- /dev/null +++ b/uitest/math_tests/tdf147755.py @@ -0,0 +1,32 @@ +# -*- 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_state_as_dict + +class Tdf147755(UITestCase): + + def test_tdf147755(self): + with self.ui_test.create_doc_in_start_center("math"): + + with self.ui_test.execute_dialog_through_command(".uno:SymbolCatalogue", close_button="close") as xDialog: + xSymbolset = xDialog.getChild("symbolset") + self.assertEqual("Arabic", get_state_as_dict(xSymbolset)["DisplayText"]) + + xOk = xDialog.getChild("ok") + xOk.executeAction("CLICK", tuple()) + + xMathDoc = self.xUITest.getTopFocusWindow() + xEditView = xMathDoc.getChild("editview") + + # Without the fix in place, this test would have failed with + # AssertionError: '%arRay' != '' + self.assertEqual("%arRay", get_state_as_dict(xEditView)["Text"]) + +# vim: set shiftwidth=4 softtabstop=4 expandtab: -- cgit v1.2.3