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 import org
.libreoffice
.unotest
11 from uitest
.framework
import UITestCase
12 from uitest
.uihelper
.common
import get_url_for_data_file
, get_state_as_dict
14 class tdf163325(UITestCase
):
16 def test_tdf163325_toc_preview_crash(self
):
17 xFilePath
= get_url_for_data_file("tdf163325.odt")
18 with self
.ui_test
.load_file(xFilePath
):
19 # Open ToC dialog and check index preview
20 with self
.ui_test
.execute_dialog_through_command(".uno:InsertMultiIndex") as xTocDialog
:
21 xShowExample
= xTocDialog
.getChild("showexample")
22 xShowExample
.executeAction("CLICK", tuple())
23 self
.assertEqual(get_state_as_dict(xShowExample
)["Selected"], "true")
25 # Save, reload and update all indexes in the document
26 self
.xUITest
.executeCommand('.uno:Save')
27 self
.xUITest
.executeCommand('.uno:Reload')
28 # Without the fix in place, this test would have crashed here
29 self
.xUITest
.executeCommand(".uno:UpdateAllIndexes")
31 with self
.ui_test
.load_file(xFilePath
) as document
:
32 # Check that the index is present
33 xDocumentIndexes
= document
.DocumentIndexes
34 self
.assertEqual(len(xDocumentIndexes
), 1)
36 # vim: set shiftwidth=4 softtabstop=4 expandtab: