diff options
Diffstat (limited to 'uitest/math_tests')
-rw-r--r-- | uitest/math_tests/data/tdf128610.fodt | 34 | ||||
-rw-r--r-- | uitest/math_tests/start.py | 70 | ||||
-rw-r--r-- | uitest/math_tests/tdf128610.py | 32 | ||||
-rw-r--r-- | uitest/math_tests/tdf147755.py | 32 |
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"/><?xml version="1.0" encoding="UTF-8"?></text:p> + <text:p text:style-name="Preformatted_20_Text"><math xmlns="<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>" display="block"></text:p> + <text:p text:style-name="Preformatted_20_Text"><text:s/><semantics></text:p> + <text:p text:style-name="Preformatted_20_Text"><text:s text:c="2"/><mrow></text:p> + <text:p text:style-name="Preformatted_20_Text"><text:s text:c="3"/><msub></text:p> + <text:p text:style-name="Preformatted_20_Text"><text:s text:c="4"/><mi>f</mi></text:p> + <text:p text:style-name="Preformatted_20_Text"><text:s text:c="4"/><mi>c</mi></text:p> + <text:p text:style-name="Preformatted_20_Text"><text:s text:c="3"/></msub></text:p> + <text:p text:style-name="Preformatted_20_Text"><text:s text:c="3"/><mo stretchy="false">=</mo></text:p> + <text:p text:style-name="Preformatted_20_Text"><text:s text:c="3"/><mfrac></text:p> + <text:p text:style-name="Preformatted_20_Text"><text:s text:c="4"/><mn>1</mn></text:p> + <text:p text:style-name="Preformatted_20_Text"><text:s text:c="4"/><msub></text:p> + <text:p text:style-name="Preformatted_20_Text"><text:s text:c="5"/><mi>K</mi></text:p> + <text:p text:style-name="Preformatted_20_Text"><text:s text:c="5"/><mi>m</mi></text:p> + <text:p text:style-name="Preformatted_20_Text"><text:s text:c="4"/></msub></text:p> + <text:p text:style-name="Preformatted_20_Text"><text:s text:c="3"/></mfrac></text:p> + <text:p text:style-name="Preformatted_20_Text"><text:s text:c="2"/></mrow></text:p> + <text:p text:style-name="Preformatted_20_Text"><text:s/></semantics></text:p> + <text:p text:style-name="P1"></math></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: |