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
11 from uitest
.uihelper
.common
import type_text
, get_state_as_dict
13 class tdf124088(UITestCase
):
15 def test_tdf124088_propose_autotext(self
):
16 with self
.ui_test
.create_doc_in_start_center("writer"):
17 # Insert a random text greater than 25 characters and select it
18 xWriterDoc
= self
.xUITest
.getTopFocusWindow()
19 xWriterEdit
= xWriterDoc
.getChild("writer_edit")
20 type_text(xWriterEdit
, "This is a sample paragraph")
21 self
.xUITest
.executeCommand(".uno:SelectAll")
23 # Open auto text dialog and check proposed text
24 with self
.ui_test
.execute_dialog_through_command(".uno:EditGlossary") as xEditGlossaryDlg
:
25 xName
= xEditGlossaryDlg
.getChild("name")
26 self
.assertEqual(get_state_as_dict(xName
)["Text"], "This is a sample")
27 # Click on a group entry, proposed auto text should remain
28 xCategory
= xEditGlossaryDlg
.getChild("category")
29 xMyAutoText
= xCategory
.getChild("2")
30 xMyAutoText
.executeAction("SELECT", tuple())
31 self
.assertEqual(get_state_as_dict(xName
)["Text"], "This is a sample")
33 # vim: set shiftwidth=4 softtabstop=4 expandtab: