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 from uitest
.uihelper
.common
import get_state_as_dict
9 from uitest
.uihelper
.common
import select_pos
10 from uitest
.uihelper
.calc
import enter_text_to_cell
11 from libreoffice
.calc
.document
import get_sheet_from_doc
12 from libreoffice
.calc
.conditional_format
import get_conditional_format_from_sheet
13 from uitest
.debug
import sleep
14 from libreoffice
.calc
.document
import get_cell_by_position
15 from libreoffice
.uno
.propertyvalue
import mkPropertyValues
16 import org
.libreoffice
.unotest
18 #Bug 63805 - EDITING: 'Autofill - Date - Months' wrong if day of month exceeds max. days of month
20 def get_url_for_data_file(file_name
):
21 return pathlib
.Path(org
.libreoffice
.unotest
.makeCopyFromTDOC(file_name
)).as_uri()
23 class tdf63805(UITestCase
):
25 def test_tdf63805_autofill_Date_Months(self
):
26 calc_doc
= self
.ui_test
.load_file(get_url_for_data_file("tdf63805.ods"))
27 xCalcDoc
= self
.xUITest
.getTopFocusWindow()
28 gridwin
= xCalcDoc
.getChild("grid_window")
29 document
= self
.ui_test
.get_component()
32 enter_text_to_cell(gridwin
, "A1", "2012-10-31")
34 gridwin
.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:A20"}))
35 #3 - Edit -> fill -> Series -> Down - Date-Month-Increment=1 <ok>
36 self
.ui_test
.execute_dialog_through_command(".uno:FillSeries")
37 xDialog
= self
.xUITest
.getTopFocusWindow()
38 xOK
= xDialog
.getChild("ok")
39 self
.ui_test
.close_dialog_through_button(xOK
)
40 #5 -Expected: All Cells show last day of month / Actual: some months skipped
41 self
.assertEqual(get_cell_by_position(document
, 0, 0, 0).getValue(), 41213)
42 self
.assertEqual(get_cell_by_position(document
, 0, 0, 1).getValue(), 41243)
43 self
.assertEqual(get_cell_by_position(document
, 0, 0, 2).getValue(), 41274)
44 self
.assertEqual(get_cell_by_position(document
, 0, 0, 3).getValue(), 41305)
45 self
.assertEqual(get_cell_by_position(document
, 0, 0, 4).getValue(), 41333)
46 self
.assertEqual(get_cell_by_position(document
, 0, 0, 5).getValue(), 41364)
47 self
.assertEqual(get_cell_by_position(document
, 0, 0, 6).getValue(), 41394)
48 self
.assertEqual(get_cell_by_position(document
, 0, 0, 7).getValue(), 41425)
49 self
.assertEqual(get_cell_by_position(document
, 0, 0, 8).getValue(), 41455)
50 self
.assertEqual(get_cell_by_position(document
, 0, 0, 9).getValue(), 41486)
51 self
.assertEqual(get_cell_by_position(document
, 0, 0, 10).getValue(), 41517)
52 self
.assertEqual(get_cell_by_position(document
, 0, 0, 11).getValue(), 41547)
53 self
.assertEqual(get_cell_by_position(document
, 0, 0, 12).getValue(), 41578)
54 self
.assertEqual(get_cell_by_position(document
, 0, 0, 13).getValue(), 41608)
55 self
.assertEqual(get_cell_by_position(document
, 0, 0, 14).getValue(), 41639)
56 self
.assertEqual(get_cell_by_position(document
, 0, 0, 15).getValue(), 41670)
57 self
.assertEqual(get_cell_by_position(document
, 0, 0, 16).getValue(), 41698)
58 self
.assertEqual(get_cell_by_position(document
, 0, 0, 17).getValue(), 41729)
59 self
.assertEqual(get_cell_by_position(document
, 0, 0, 18).getValue(), 41759)
60 self
.assertEqual(get_cell_by_position(document
, 0, 0, 19).getValue(), 41790)
62 self
.xUITest
.executeCommand(".uno:Undo")
63 self
.assertEqual(get_cell_by_position(document
, 0, 0, 0).getValue(), 41213)
64 self
.assertEqual(get_cell_by_position(document
, 0, 0, 1).getValue(), 0)
65 self
.ui_test
.close_doc()
67 # vim: set shiftwidth=4 softtabstop=4 expandtab: