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/.
9 from uitest
.framework
import UITestCase
10 from uitest
.uihelper
.common
import get_state_as_dict
11 from libreoffice
.uno
.propertyvalue
import mkPropertyValues
13 class Comments(UITestCase
):
14 def test_comment(self
):
15 with self
.ui_test
.create_doc_in_start_center("calc"):
16 xCalcDoc
= self
.xUITest
.getTopFocusWindow()
17 gridwin
= xCalcDoc
.getChild("grid_window")
20 gridwin
.executeAction("SELECT", mkPropertyValues({"TABLE": "0"}))
21 gridwin
.executeAction("SELECT", mkPropertyValues({"CELL": "D8"}))
23 # Create comment and open it's window
24 gridwin
.executeAction("COMMENT", mkPropertyValues({"OPEN": ""}))
26 # Write text in the Comment Window
27 gridwin
.executeAction("TYPE", mkPropertyValues({"TEXT": "First Comment"}))
29 # Close Comment Window
30 gridwin
.executeAction("COMMENT", mkPropertyValues({"CLOSE":""}))
32 # Check on the comment text
33 self
.assertEqual(get_state_as_dict(gridwin
)["CurrentCellCommentText"], "First Comment")
35 # Check on comment in another cell
36 gridwin
.executeAction("SELECT", mkPropertyValues({"CELL": "A1"}))
37 gridwin
.executeAction("COMMENT", mkPropertyValues({"OPEN": ""}))
38 gridwin
.executeAction("TYPE", mkPropertyValues({"TEXT": "Second Comment"}))
39 gridwin
.executeAction("COMMENT", mkPropertyValues({"CLOSE":""}))
40 self
.assertEqual(get_state_as_dict(gridwin
)["CurrentCellCommentText"], "Second Comment")
42 # Write Comment without opening Comment window
43 gridwin
.executeAction("SELECT", mkPropertyValues({"CELL": "B5"}))
44 gridwin
.executeAction("COMMENT", mkPropertyValues({"SETTEXT": "Third Comment"}))
45 self
.assertEqual(get_state_as_dict(gridwin
)["CurrentCellCommentText"], "Third Comment")
48 # vim: set shiftwidth=4 softtabstop=4 expandtab: