summaryrefslogtreecommitdiff
path: root/uitest
diff options
context:
space:
mode:
authorXisco Fauli <xiscofauli@libreoffice.org>2022-03-14 13:48:58 +0100
committerXisco Fauli <xiscofauli@libreoffice.org>2022-03-14 15:25:08 +0100
commit360e7eaef92ed38f25a454c8f0f605e7cda974f7 (patch)
treed007628f8f86e3e0bf5b64c26a9465fd65f67084 /uitest
parent33af49a83e06920f9d24d6127e18ca1ccdc6d321 (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>
Diffstat (limited to 'uitest')
-rw-r--r--uitest/UITest_math_demo.mk4
-rw-r--r--uitest/math_tests/data/tdf128610.fodt34
-rw-r--r--uitest/math_tests/tdf128610.py32
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"/>&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/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: