tdf#164393 Change themes UI as per UX feedback
[LibreOffice.git] / sw / qa / python / check_change_color.py
blob07b622031a618d9bf99f95a815d0959f09c0ff45
1 '''
2 This file is part of the LibreOffice project.
4 This Source Code Form is subject to the terms of the Mozilla Public
5 License, v. 2.0. If a copy of the MPL was not distributed with this
6 file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 This file incorporates work covered by the following license notice:
10 Licensed to the Apache Software Foundation (ASF) under one or more
11 contributor license agreements. See the NOTICE file distributed
12 with this work for additional information regarding copyright
13 ownership. The ASF licenses this file to you under the Apache
14 License, Version 2.0 (the "License"); you may not use this file
15 except in compliance with the License. You may obtain a copy of
16 the License at http://www.apache.org/licenses/LICENSE-2.0 .
17 '''
19 import unittest
20 from org.libreoffice.unotest import UnoInProcess
21 from com.sun.star.text.ControlCharacter import PARAGRAPH_BREAK
22 from com.sun.star.awt.FontUnderline import SINGLE
24 class CheckChangeColor(unittest.TestCase):
26 @classmethod
27 def setUpClass(cls):
28 cls._uno = UnoInProcess()
29 cls._uno.setUp()
30 cls.RED = 0xFF0000
31 cls.BLUE = 0x0000FF
32 cls.GREEN = 0x008000
34 @classmethod
35 def tearDownClass(cls):
36 cls._uno.tearDown()
38 def test_change_color(self):
39 xDoc = CheckChangeColor._uno.openEmptyWriterDoc()
40 xPageStyles = xDoc.StyleFamilies["PageStyles"]
41 xPageStyle = xPageStyles["Standard"]
43 self.assertEqual(xPageStyle.BackColor, -1)
44 self.assertEqual(xPageStyle.IsLandscape, False)
46 xPageStyle.BackColor = self.RED
47 xPageStyle.IsLandscape = True
48 self.assertEqual(xPageStyle.BackColor, self.RED)
49 self.assertEqual(xPageStyle.IsLandscape, True)
51 xPageStyle.GridColor = self.GREEN
52 self.assertEqual(xPageStyle.GridColor, self.GREEN)
54 xPageStyle.FootnoteLineColor = self.BLUE
55 self.assertEqual(xPageStyle.FootnoteLineColor, self.BLUE)
57 xDoc.dispose()
59 def test_change_text_color(self):
60 xDoc = CheckChangeColor._uno.openEmptyWriterDoc()
61 cursor = xDoc.Text.createTextCursor()
63 cursor.CharColor = self.RED
64 self.assertEqual(cursor.CharColor, self.RED)
66 cursor.CharBackColor = self.BLUE
67 self.assertEqual(cursor.CharBackColor, self.BLUE)
69 self.assertEqual(cursor.CharUnderlineHasColor, False)
70 cursor.CharUnderlineHasColor = True
71 cursor.CharUnderline = SINGLE
72 cursor.CharUnderlineColor = self.GREEN
73 self.assertEqual(cursor.CharUnderlineColor, self.GREEN)
74 self.assertEqual(cursor.CharUnderline, SINGLE)
75 self.assertEqual(cursor.CharUnderlineHasColor, True)
77 xDoc.Text.insertString(cursor, "One foo to rule them all", 0)
79 self.assertEqual(xDoc.getText().createTextCursor().CharColor, self.RED)
80 self.assertEqual(xDoc.getText().createTextCursor().CharBackColor, self.BLUE)
81 self.assertEqual(xDoc.getText().createTextCursor().CharUnderlineColor, self.GREEN)
83 xDoc.dispose()
85 def test_change_paragraph_color(self):
86 xDoc = CheckChangeColor._uno.openEmptyWriterDoc()
87 cursor = xDoc.Text.createTextCursor()
89 cursor.ParaBackColor = self.RED
90 self.assertEqual(cursor.ParaBackColor, self.RED)
92 xDoc.Text.insertControlCharacter(cursor, PARAGRAPH_BREAK, False)
93 xDoc.Text.insertString(cursor, "One foo to find them all", 0)
95 self.assertEqual(xDoc.getText().createTextCursor().ParaBackColor, self.RED)
97 xDoc.dispose()
99 if __name__ == '__main__':
100 unittest.main()