diff options
author | Xisco Fauli <xiscofauli@libreoffice.org> | 2022-03-14 13:48:58 +0100 |
---|---|---|
committer | Xisco Fauli <xiscofauli@libreoffice.org> | 2022-03-14 15:25:08 +0100 |
commit | 360e7eaef92ed38f25a454c8f0f605e7cda974f7 (patch) | |
tree | d007628f8f86e3e0bf5b64c26a9465fd65f67084 | |
parent | 33af49a83e06920f9d24d6127e18ca1ccdc6d321 (diff) |
tdf#128610: math: add UItest
Change-Id: I9fe1a349a73790e7fa1c503112a27f76d238c0c1
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131538
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
-rw-r--r-- | uitest/UITest_math_demo.mk | 4 | ||||
-rw-r--r-- | uitest/math_tests/data/tdf128610.fodt | 34 | ||||
-rw-r--r-- | uitest/math_tests/tdf128610.py | 32 |
3 files changed, 70 insertions, 0 deletions
diff --git a/uitest/UITest_math_demo.mk b/uitest/UITest_math_demo.mk index 5c1a6dbd8ee8..a49b29f2c2dd 100644 --- a/uitest/UITest_math_demo.mk +++ b/uitest/UITest_math_demo.mk @@ -12,4 +12,8 @@ $(eval $(call gb_UITest_UITest,math_demo)) $(eval $(call gb_UITest_add_modules,math_demo,$(SRCDIR)/uitest,\ math_tests/ \ )) + +$(eval $(call gb_UITest_set_defs,math_demo, \ + TDOC="$(SRCDIR)/uitest/math_tests/data" \ +)) # vim: set noet sw=4 ts=4: diff --git a/uitest/math_tests/data/tdf128610.fodt b/uitest/math_tests/data/tdf128610.fodt new file mode 100644 index 000000000000..cee4ed8e59fe --- /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/tdf128610.py b/uitest/math_tests/tdf128610.py new file mode 100644 index 000000000000..4fdd9c2dbc52 --- /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: |