nss: upgrade to release 3.73
[LibreOffice.git] / sc / qa / uitest / calc_tests3 / tdf65856.py
blobc3e03ec7a95cfc14730d7cb23394328a1aa228cf
1 # -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*-
3 # This Source Code Form is subject to the terms of the Mozilla Public
4 # License, v. 2.0. If a copy of the MPL was not distributed with this
5 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
7 from uitest.framework import UITestCase
8 import org.libreoffice.unotest
9 import os
10 import pathlib
11 from uitest.uihelper.common import get_state_as_dict
12 from libreoffice.calc.document import get_sheet_from_doc
13 from libreoffice.calc.conditional_format import get_conditional_format_from_sheet
14 from uitest.debug import sleep
15 from libreoffice.uno.propertyvalue import mkPropertyValues
16 from libreoffice.calc.document import get_cell_by_position
18 def get_url_for_data_file(file_name):
19 return pathlib.Path(org.libreoffice.unotest.makeCopyFromTDOC(file_name)).as_uri()
21 class tdf65856(UITestCase):
23 def test_tdf65856_paste_special_shift_right(self):
24 calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf65856.ods"))
25 xCalcDoc = self.xUITest.getTopFocusWindow()
26 gridwin = xCalcDoc.getChild("grid_window")
27 document = self.ui_test.get_component()
29 #- mark D1:E14; copy
30 gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "D1:E14"}))
31 self.xUITest.executeCommand(".uno:Copy")
32 #mark cell D1
33 gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "D1"}))
34 self.ui_test.execute_dialog_through_command(".uno:PasteSpecial")
35 xDialog = self.xUITest.getTopFocusWindow()
37 xmove_right = xDialog.getChild("move_right")
38 xmove_right.executeAction("CLICK", tuple())
40 xOkBtn = xDialog.getChild("ok")
41 self.ui_test.close_dialog_through_button(xOkBtn)
43 #check
44 self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "T1")
45 self.assertEqual(get_cell_by_position(document, 0, 1, 0).getString(), "TE1")
46 self.assertEqual(get_cell_by_position(document, 0, 2, 0).getString(), "TES1")
47 self.assertEqual(get_cell_by_position(document, 0, 3, 0).getString(), "TEST1")
48 self.assertEqual(get_cell_by_position(document, 0, 4, 0).getString(), "TEST1")
49 self.assertEqual(get_cell_by_position(document, 0, 5, 0).getString(), "TEST1")
50 self.assertEqual(get_cell_by_position(document, 0, 6, 0).getString(), "TEST1")
51 self.assertEqual(get_cell_by_position(document, 0, 0, 13).getString(), "T14")
52 self.assertEqual(get_cell_by_position(document, 0, 1, 13).getString(), "TE14")
53 self.assertEqual(get_cell_by_position(document, 0, 2, 13).getString(), "TES14")
54 self.assertEqual(get_cell_by_position(document, 0, 3, 13).getString(), "TEST14")
55 self.assertEqual(get_cell_by_position(document, 0, 4, 13).getString(), "TEST14")
56 self.assertEqual(get_cell_by_position(document, 0, 5, 13).getString(), "TEST14")
57 self.assertEqual(get_cell_by_position(document, 0, 6, 13).getString(), "TEST14")
58 self.ui_test.close_doc()
60 def test_tdf65856_paste_special_shift_right_2(self):
61 calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf65856_2.ods"))
62 xCalcDoc = self.xUITest.getTopFocusWindow()
63 gridwin = xCalcDoc.getChild("grid_window")
64 document = self.ui_test.get_component()
66 #- select range C2:D4; copy
67 gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "C2:D4"}))
68 self.xUITest.executeCommand(".uno:Copy")
69 #mark cell B2
70 gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "B2"}))
71 self.ui_test.execute_dialog_through_command(".uno:PasteSpecial")
72 xDialog = self.xUITest.getTopFocusWindow()
74 xmove_right = xDialog.getChild("move_right")
75 xmove_right.executeAction("CLICK", tuple())
77 xOkBtn = xDialog.getChild("ok")
78 self.ui_test.close_dialog_through_button(xOkBtn)
80 #check
81 self.assertEqual(get_cell_by_position(document, 0, 1, 1).getString(), "1")
82 self.assertEqual(get_cell_by_position(document, 0, 2, 1).getString(), "1")
83 self.assertEqual(get_cell_by_position(document, 0, 3, 1).getString(), "1")
84 self.assertEqual(get_cell_by_position(document, 0, 4, 1).getString(), "1")
85 self.assertEqual(get_cell_by_position(document, 0, 5, 1).getString(), "1")
86 self.assertEqual(get_cell_by_position(document, 0, 1, 2).getString(), "2")
87 self.assertEqual(get_cell_by_position(document, 0, 2, 2).getString(), "2")
88 self.assertEqual(get_cell_by_position(document, 0, 3, 2).getString(), "2")
89 self.assertEqual(get_cell_by_position(document, 0, 4, 2).getString(), "2")
90 self.assertEqual(get_cell_by_position(document, 0, 5, 2).getString(), "2")
91 self.assertEqual(get_cell_by_position(document, 0, 1, 3).getString(), "3")
92 self.assertEqual(get_cell_by_position(document, 0, 2, 3).getString(), "3")
93 self.assertEqual(get_cell_by_position(document, 0, 3, 3).getString(), "3")
94 self.assertEqual(get_cell_by_position(document, 0, 4, 3).getString(), "3")
95 self.assertEqual(get_cell_by_position(document, 0, 5, 3).getString(), "3")
96 self.assertEqual(get_cell_by_position(document, 0, 4, 1).getFormula(), "=D2")
97 self.assertEqual(get_cell_by_position(document, 0, 5, 1).getFormula(), "=D2")
98 self.assertEqual(get_cell_by_position(document, 0, 3, 2).getFormula(), "=E3")
99 self.assertEqual(get_cell_by_position(document, 0, 5, 2).getFormula(), "=E3")
100 self.assertEqual(get_cell_by_position(document, 0, 3, 3).getFormula(), "=F4")
101 self.assertEqual(get_cell_by_position(document, 0, 4, 3).getFormula(), "=F4")
102 self.ui_test.close_doc()
104 # vim: set shiftwidth=4 softtabstop=4 expandtab: