Version 7.5.1.1, tag libreoffice-7.5.1.1
[LibreOffice.git] / sc / qa / python / CalcRTL.py
blob6c8e3e9b4a645f77bc07fea612d3fa450e9c3383
1 '''
2 This is 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.WritingMode2 import RL_TB as __WritingMode2_RL_TB__
22 from com.sun.star.text.WritingMode2 import LR_TB as __WritingMode2_LR_TB__
24 class CalcRTL(unittest.TestCase):
25 xSheetDoc = None
27 @classmethod
28 def setUpClass(cls):
29 cls._uno = UnoInProcess()
30 cls._uno.setUp()
32 @classmethod
33 def tearDownClass(cls):
34 cls._uno.tearDown()
36 def testSpreadsheetProperties(self):
37 self.assertTrue(self.openSpreadsheetDocument(), msg="Couldn't open document")
39 set= self.getSpreadsheet()
40 # Make sure there are at least 2 sheets, otherwise hiding a sheet won't work
41 self.xSheetDoc.getSheets().insertNewByName("Some Sheet", 0)
43 self._uno.checkProperties(set,{'IsVisible': False}, self)
44 self._uno.checkProperties(set,{'IsVisible': True}, self)
45 self._uno.checkProperties(set,{'PageStyle': 'Report'}, self)
46 self._uno.checkProperties(set,{'PageStyle': 'Default'}, self)
47 self._uno.checkProperties(set,{'TableLayout': __WritingMode2_RL_TB__}, self)
48 self._uno.checkProperties(set,{'TableLayout': __WritingMode2_LR_TB__}, self)
50 self.assertTrue(self.closeSpreadsheetDocument(), msg="Couldn't close document")
52 def openSpreadsheetDocument(self):
53 worked = True
54 print("creating a sheetdocument")
55 try:
56 self.xSheetDoc = self._uno.openEmptyCalcDoc()
57 except Exception:
58 worked = False
59 raise
60 return worked
62 def closeSpreadsheetDocument(self):
63 worked = True
64 print(" disposing xSheetDoc ")
65 try:
66 self.xSheetDoc.close(0)
67 except Exception:
68 worked = False
69 raise
70 return worked
72 def getSpreadsheet(self):
73 return self.xSheetDoc.getSheets()[0]
75 if __name__ == '__main__':
76 unittest.main()