1 # -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*-
3 # This file is part of the LibreOffice project.
5 # This Source Code Form is subject to the terms of the Mozilla Public
6 # License, v. 2.0. If a copy of the MPL was not distributed with this
7 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
10 from uitest
.uihelper
.common
import get_state_as_dict
12 from libreoffice
.uno
.propertyvalue
import mkPropertyValues
14 from uitest
.framework
import UITestCase
15 from uitest
.uihelper
.common
import type_text
, select_pos
17 class SimpleMathTest(UITestCase
):
19 def test_math_unoCommand(self
):
20 with self
.ui_test
.create_doc_in_start_center("math"):
22 xMathDoc
= self
.xUITest
.getTopFocusWindow()
25 self
.xUITest
.executeCommand(".uno:InsertCommandText?Text:string=backepsilon")
27 xEditView
= xMathDoc
.getChild("editview")
29 self
.assertEqual("backepsilon", get_state_as_dict(xEditView
)["Text"])
31 def test_math_edit(self
):
32 with self
.ui_test
.create_doc_in_start_center("math"):
34 xMathDoc
= self
.xUITest
.getTopFocusWindow()
36 xEditView
= xMathDoc
.getChild("editview")
38 type_text(xEditView
, "E=mc^2")
40 self
.assertEqual("E=mc^2", get_state_as_dict(xEditView
)["Text"])
42 def test_complete_math(self
):
43 with self
.ui_test
.create_doc_in_start_center("math"):
45 xMathDoc
= self
.xUITest
.getTopFocusWindow()
47 xList
= xMathDoc
.getChild("categorylist")
48 state
= get_state_as_dict(xList
)
49 self
.assertEqual(state
["SelectEntryText"], "Unary/Binary Operators")
50 select_pos(xList
, "1")
51 state
= get_state_as_dict(xList
)
52 self
.assertEqual(state
["SelectEntryText"], "Relations")
54 xMathSelector
= xMathDoc
.getChild("elements")
56 xElement
= xMathSelector
.getChild("1")
57 xElement
.executeAction("DOUBLECLICK", tuple())
59 xEditView
= xMathDoc
.getChild("editview")
60 type_text(xEditView
, "1")
61 xEditView
.executeAction("TYPE", mkPropertyValues({"KEYCODE":"F4"}))
62 type_text(xEditView
, "2")
64 self
.assertEqual("1 <> 2 ", get_state_as_dict(xEditView
)["Text"])
66 # vim: set shiftwidth=4 softtabstop=4 expandtab: