diff options
author | Miklos Vajna <vmiklos@collabora.com> | 2022-10-17 09:07:47 +0200 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.com> | 2022-10-17 11:45:49 +0200 |
commit | 1a94cd8257ef4c462eaaa6d49bf4f26c9ac56a5e (patch) | |
tree | b31a01f86aa0689f60c0d8ec8812cb2df40e5a94 /sw/qa/uitest/uibase | |
parent | c308ed9fc6c2a223a51fd585e6e0a7d7f6c83352 (diff) |
sw content controls: add rendering for the alias
- add a new SwFrameMenuButtonBase subclass to show the title/alias of
the content control under the cursor, if it's non-empty
- hide it when leaving the content control
- set its label to the alias from SwContentControl
- set the position similar to footer frame menu buttons, at the first
text portion of the content control
- make the label clickable and bind the handler to the content control
properties dialog
Change-Id: Ia35f0cc59c70910fb88719b207ef9e498d6760d3
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141441
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Tested-by: Jenkins
Diffstat (limited to 'sw/qa/uitest/uibase')
-rw-r--r-- | sw/qa/uitest/uibase/docvw/docvw.py | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/sw/qa/uitest/uibase/docvw/docvw.py b/sw/qa/uitest/uibase/docvw/docvw.py new file mode 100644 index 000000000000..e2640df96343 --- /dev/null +++ b/sw/qa/uitest/uibase/docvw/docvw.py @@ -0,0 +1,36 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# + +from uitest.framework import UITestCase + + +class Test(UITestCase): + def testContentControlAliasButton(self): + with self.ui_test.create_doc_in_start_center("writer") as xComponent: + # Given a document with a content control that has a non-empty alias: + self.xUITest.executeCommand(".uno:InsertContentControl") + paragraphs = xComponent.Text.createEnumeration() + paragraph = paragraphs.nextElement() + portions = paragraph.createEnumeration() + portion = portions.nextElement() + contentControl = portion.ContentControl + contentControl.Alias = "myalias" + + # When entering that content control with the cursor: + xCursor = xComponent.getCurrentController().getViewCursor() + xCursor.gotoStart(False) + xCursor.goRight(1, False) + + # Then make sure that the alias button shows up: + xWindow = self.xUITest.getTopFocusWindow() + # Without the accompanying fix in place, this test would have failed, SwEditWin didn't + # have an alias button child. + self.assertIn("ContentControlAliasButton", xWindow.getChildren()) + +# vim: set shiftwidth=4 softtabstop=4 expandtab: |