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 from uitest
.framework
import UITestCase
13 class Test(UITestCase
):
14 def testContentControlAliasButton(self
):
15 with self
.ui_test
.create_doc_in_start_center("writer") as xComponent
:
16 # Given a document with a content control that has a non-empty alias:
17 self
.xUITest
.executeCommand(".uno:InsertContentControl")
18 paragraphs
= xComponent
.Text
.createEnumeration()
19 paragraph
= paragraphs
.nextElement()
20 portions
= paragraph
.createEnumeration()
21 portion
= portions
.nextElement()
22 contentControl
= portion
.ContentControl
23 contentControl
.Alias
= "myalias"
25 # When entering that content control with the cursor:
26 xCursor
= xComponent
.getCurrentController().getViewCursor()
27 xCursor
.gotoStart(False)
28 xCursor
.goRight(1, False)
30 # Then make sure that the alias button shows up:
31 xWindow
= self
.xUITest
.getTopFocusWindow()
32 # Without the accompanying fix in place, this test would have failed, SwEditWin didn't
33 # have an alias button child.
34 self
.assertIn("ContentControlAliasButton", xWindow
.getChildren())
36 # vim: set shiftwidth=4 softtabstop=4 expandtab: