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
.framework
import UITestCase
11 from libreoffice
.uno
.propertyvalue
import mkPropertyValues
12 from uitest
.uihelper
.common
import get_state_as_dict
15 class watermark(UITestCase
):
17 def test_insert_watermark(self
):
18 with self
.ui_test
.create_doc_in_start_center("writer"):
20 with self
.ui_test
.execute_dialog_through_command(".uno:Watermark") as xDialog
:
21 xTextInput
= xDialog
.getChild("TextInput")
22 xAngle
= xDialog
.getChild("Angle")
23 xTransparency
= xDialog
.getChild("Transparency")
25 xTextInput
.executeAction("TYPE", mkPropertyValues({"TEXT":"Watermark"}))
26 xAngle
.executeAction("UP", tuple())
27 xTransparency
.executeAction("UP", tuple())
30 with self
.ui_test
.execute_dialog_through_command(".uno:Watermark", close_button
="cancel") as xDialog
:
31 xTextInput
= xDialog
.getChild("TextInput")
32 xAngle
= xDialog
.getChild("Angle")
33 xTransparency
= xDialog
.getChild("Transparency")
35 self
.assertEqual(get_state_as_dict(xTextInput
)["Text"], "Watermark")
36 self
.assertEqual(get_state_as_dict(xAngle
)["Text"], "90°")
37 self
.assertEqual(get_state_as_dict(xTransparency
)["Text"], "51%")
40 with self
.ui_test
.execute_dialog_through_command(".uno:Watermark") as xDialog
:
41 xTextInput
= xDialog
.getChild("TextInput")
42 xTextInput
.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
43 xTextInput
.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
45 with self
.ui_test
.execute_dialog_through_command(".uno:Watermark", close_button
="cancel") as xDialog
:
46 xTextInput
= xDialog
.getChild("TextInput")
48 self
.assertEqual(get_state_as_dict(xTextInput
)["Text"], "")
51 # vim: set shiftwidth=4 softtabstop=4 expandtab: