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/.
10 """Covers sw/source/ui/frmdlg/ fixes."""
13 from libreoffice
.uno
.propertyvalue
import mkPropertyValues
14 from uitest
.framework
import UITestCase
15 from uitest
.uihelper
.common
import get_state_as_dict
16 from uitest
.uihelper
.common
import get_url_for_data_file
19 class Test(UITestCase
):
20 def test_content_control_dialog(self
):
21 with self
.ui_test
.create_doc_in_start_center("writer") as xComponent
:
22 # Given a document with a floating table:
27 self
.xUITest
.executeCommandWithParameters(".uno:InsertTable", mkPropertyValues(args
))
28 self
.xUITest
.executeCommand(".uno:SelectAll")
32 self
.xUITest
.executeCommandWithParameters(".uno:InsertFrame", mkPropertyValues(args
))
33 # Wait until SwTextShell is replaced with SwDrawShell after 120 ms, as set in the SwView
36 self
.assertEqual(xComponent
.TextFrames
.Frame1
.IsSplitAllowed
, False)
38 # When allowing it to split on the UI:
39 with self
.ui_test
.execute_dialog_through_command(".uno:FrameDialog") as xDialog
:
40 xFlysplit
= xDialog
.getChild("flysplit")
41 self
.assertEqual(get_state_as_dict(xFlysplit
)['Visible'], "true")
42 self
.assertEqual(get_state_as_dict(xFlysplit
)['Selected'], "false")
43 xFlysplit
.executeAction("CLICK", tuple())
45 # Then make sure the doc model is updated correctly:
46 self
.assertEqual(xComponent
.TextFrames
.Frame1
.IsSplitAllowed
, True)
48 def test_chained_fly_split(self
):
49 # Given a document with 2 chained fly frames:
50 with self
.ui_test
.load_file(get_url_for_data_file("chained-frames.odt")):
51 # When selecting the first and opening the fly frame properties dialog:
52 self
.xUITest
.executeCommand(".uno:JumpToNextFrame")
53 # Wait until SwTextShell is replaced with SwDrawShell after 120 ms, as set in the SwView
56 with self
.ui_test
.execute_dialog_through_command(".uno:FrameDialog") as xDialog
:
57 # Then make sure that the 'split' checkbox is hidden:
58 xFlysplit
= xDialog
.getChild("flysplit")
59 # Without the accompanying fix in place, this test would have failed with:
60 # AssertionError: 'true' != 'false'
61 # i.e. the UI didn't hide this option, leading to some weird mix of chained shapes
62 # and floating tables.
63 self
.assertEqual(get_state_as_dict(xFlysplit
)['Visible'], "false")
65 # vim: set shiftwidth=4 softtabstop=4 expandtab: