From 360e7eaef92ed38f25a454c8f0f605e7cda974f7 Mon Sep 17 00:00:00 2001 From: Xisco Fauli Date: Mon, 14 Mar 2022 13:48:58 +0100 Subject: [PATCH] tdf#128610: math: add UItest Change-Id: I9fe1a349a73790e7fa1c503112a27f76d238c0c1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131538 Tested-by: Jenkins Reviewed-by: Xisco Fauli --- uitest/UITest_math_demo.mk | 4 ++++ uitest/math_tests/data/tdf128610.fodt | 34 +++++++++++++++++++++++++++ uitest/math_tests/tdf128610.py | 32 +++++++++++++++++++++++++ 3 files changed, 70 insertions(+) create mode 100644 uitest/math_tests/data/tdf128610.fodt create mode 100644 uitest/math_tests/tdf128610.py 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"?> + <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/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: