summaryrefslogtreecommitdiffstats
path: root/uitest/math_tests
diff options
context:
space:
mode:
Diffstat (limited to 'uitest/math_tests')
-rw-r--r--uitest/math_tests/data/tdf128610.fodt34
-rw-r--r--uitest/math_tests/start.py70
-rw-r--r--uitest/math_tests/tdf128610.py32
-rw-r--r--uitest/math_tests/tdf147755.py32
4 files changed, 168 insertions, 0 deletions
diff --git a/uitest/math_tests/data/tdf128610.fodt b/uitest/math_tests/data/tdf128610.fodt
new file mode 100644
index 000000000..cee4ed8e5
--- /dev/null
+++ b/uitest/math_tests/data/tdf128610.fodt
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<office:document xmlns:officeooo="http://openoffice.org/2009/office" xmlns:css3t="http://www.w3.org/TR/css3-text/" xmlns:grddl="http://www.w3.org/2003/g/data-view#" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:formx="urn:openoffice:names:experimental:ooxml-odf-interop:xmlns:form:1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:oooc="http://openoffice.org/2004/calc" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:ooow="http://openoffice.org/2004/writer" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rpt="http://openoffice.org/2005/report" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:ooo="http://openoffice.org/2004/office" xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:of="urn:oasis:names:tc:opendocument:xmlns:of:1.2" xmlns:calcext="urn:org:documentfoundation:names:experimental:calc:xmlns:calcext:1.0" xmlns:tableooo="http://openoffice.org/2009/table" xmlns:drawooo="http://openoffice.org/2010/draw" xmlns:loext="urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.0" xmlns:dom="http://www.w3.org/2001/xml-events" xmlns:field="urn:openoffice:names:experimental:ooo-ms-interop:xmlns:field:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:xforms="http://www.w3.org/2002/xforms" office:version="1.3" office:mimetype="application/vnd.oasis.opendocument.text">
+ <office:body>
+ <office:text>
+ <text:sequence-decls>
+ <text:sequence-decl text:display-outline-level="0" text:name="Illustration"/>
+ <text:sequence-decl text:display-outline-level="0" text:name="Table"/>
+ <text:sequence-decl text:display-outline-level="0" text:name="Text"/>
+ <text:sequence-decl text:display-outline-level="0" text:name="Drawing"/>
+ <text:sequence-decl text:display-outline-level="0" text:name="Figure"/>
+ </text:sequence-decls>
+ <text:p text:style-name="Preformatted_20_Text"><text:bookmark text:name="comment_text_19"/>&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;</text:p>
+ <text:p text:style-name="Preformatted_20_Text">&lt;math xmlns=&quot;<text:a xlink:type="simple" xlink:href="http://www.w3.org/1998/Math/MathML" text:style-name="Internet_20_link" text:visited-style-name="Visited_20_Internet_20_Link">http://www.w3.org/1998/Math/MathML</text:a>&quot; display=&quot;block&quot;&gt;</text:p>
+ <text:p text:style-name="Preformatted_20_Text"><text:s/>&lt;semantics&gt;</text:p>
+ <text:p text:style-name="Preformatted_20_Text"><text:s text:c="2"/>&lt;mrow&gt;</text:p>
+ <text:p text:style-name="Preformatted_20_Text"><text:s text:c="3"/>&lt;msub&gt;</text:p>
+ <text:p text:style-name="Preformatted_20_Text"><text:s text:c="4"/>&lt;mi&gt;f&lt;/mi&gt;</text:p>
+ <text:p text:style-name="Preformatted_20_Text"><text:s text:c="4"/>&lt;mi&gt;c&lt;/mi&gt;</text:p>
+ <text:p text:style-name="Preformatted_20_Text"><text:s text:c="3"/>&lt;/msub&gt;</text:p>
+ <text:p text:style-name="Preformatted_20_Text"><text:s text:c="3"/>&lt;mo stretchy=&quot;false&quot;&gt;=&lt;/mo&gt;</text:p>
+ <text:p text:style-name="Preformatted_20_Text"><text:s text:c="3"/>&lt;mfrac&gt;</text:p>
+ <text:p text:style-name="Preformatted_20_Text"><text:s text:c="4"/>&lt;mn&gt;1&lt;/mn&gt;</text:p>
+ <text:p text:style-name="Preformatted_20_Text"><text:s text:c="4"/>&lt;msub&gt;</text:p>
+ <text:p text:style-name="Preformatted_20_Text"><text:s text:c="5"/>&lt;mi&gt;K&lt;/mi&gt;</text:p>
+ <text:p text:style-name="Preformatted_20_Text"><text:s text:c="5"/>&lt;mi&gt;m&lt;/mi&gt;</text:p>
+ <text:p text:style-name="Preformatted_20_Text"><text:s text:c="4"/>&lt;/msub&gt;</text:p>
+ <text:p text:style-name="Preformatted_20_Text"><text:s text:c="3"/>&lt;/mfrac&gt;</text:p>
+ <text:p text:style-name="Preformatted_20_Text"><text:s text:c="2"/>&lt;/mrow&gt;</text:p>
+ <text:p text:style-name="Preformatted_20_Text"><text:s/>&lt;/semantics&gt;</text:p>
+ <text:p text:style-name="P1">&lt;/math&gt;</text:p>
+ </office:text>
+ </office:body>
+</office:document>
diff --git a/uitest/math_tests/start.py b/uitest/math_tests/start.py
new file mode 100644
index 000000000..fc298fc6e
--- /dev/null
+++ b/uitest/math_tests/start.py
@@ -0,0 +1,70 @@
+# -*- 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
+
+import unittest
+import platform
+
+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")
+ xMathEdit = xMathDoc.getChild("editview")
+
+ 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("listbox")
+ 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")
+ 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 000000000..4fdd9c2db
--- /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 000000000..4ee9bc169
--- /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("Greek", 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: '%ALPHA ' != ''
+ self.assertEqual("%ALPHA ", get_state_as_dict(xEditView)["Text"])
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab: