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/.
9 from uitest
.framework
import UITestCase
10 from uitest
.uihelper
.common
import select_pos
11 from uitest
.uihelper
.common
import get_state_as_dict
, get_url_for_data_file
13 class tdf140506(UITestCase
):
15 def test_tdf140506(self
):
16 with self
.ui_test
.load_file(get_url_for_data_file("tdf140506.odt")) as writer_doc
:
18 tables
= writer_doc
.getTextTables()
19 self
.assertEqual(len(tables
[0].getRows()), 20)
20 self
.assertEqual(len(tables
[0].getColumns()), 2)
22 self
.assertEqual(2, writer_doc
.CurrentController
.PageCount
)
24 with self
.ui_test
.execute_dialog_through_command(".uno:TableDialog") as xDialog
:
25 tabcontrol
= xDialog
.getChild("tabcontrol")
26 select_pos(tabcontrol
, "1")
28 headline
= xDialog
.getChild("headline")
29 repeatheader
= xDialog
.getChild("repeatheadernf")
30 self
.assertEqual('false', get_state_as_dict(headline
)["Selected"])
31 headline
.executeAction("CLICK", tuple())
32 self
.assertEqual('true', get_state_as_dict(headline
)["Selected"])
33 self
.assertEqual('1', get_state_as_dict(repeatheader
)["Value"])
36 xToolkit
= self
.xContext
.ServiceManager
.createInstance('com.sun.star.awt.Toolkit')
37 xToolkit
.processEventsToIdle()
39 self
.assertEqual(len(tables
[0].getRows()), 20)
40 self
.assertEqual(len(tables
[0].getColumns()), 2)
42 # Without the fix in place, this test would have failed with
43 # AssertionError: 20 != 2
44 self
.assertEqual(20, writer_doc
.CurrentController
.PageCount
)
47 # vim: set shiftwidth=4 softtabstop=4 expandtab: