tdf#130857 qt weld: Support mail merge "Server Auth" dialog
[LibreOffice.git] / sw / qa / uitest / writer_tests / compareDocuments.py
blobf2575f5ec9061695e655870417921b21a3b3acdc
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 get_state_as_dict, get_url_for_data_file
12 from libreoffice.uno.propertyvalue import mkPropertyValues
13 import datetime
15 class compareDocuments(UITestCase):
17 def test_tdf130960(self):
19 with self.ui_test.load_file(get_url_for_data_file("tdf130960.odt")):
21 with self.ui_test.execute_dialog_through_command(".uno:CompareDocuments", close_button="") as xOpenDialog:
22 xFileName = xOpenDialog.getChild("file_name")
23 xFileName.executeAction("TYPE", mkPropertyValues({"TEXT": get_url_for_data_file("tdf130960_2.odt")}))
24 xOpenBtn = xOpenDialog.getChild("open")
26 # Close the dialog and open it again so the list of changes is updated
27 with self.ui_test.execute_dialog_through_action(xOpenBtn, 'CLICK', close_button="close"):
28 pass
30 with self.ui_test.execute_modeless_dialog_through_command(".uno:AcceptTrackedChanges", close_button="close") as xTrackDlg:
31 changesList = xTrackDlg.getChild("writerchanges")
33 text = "Unknown Author\t" + datetime.datetime.now().strftime("%m/%d/%Y")
34 self.assertEqual(2, len(changesList.getChildren()))
35 self.assertTrue(get_state_as_dict(changesList.getChild('0'))["Text"].startswith(text))
36 self.assertTrue(get_state_as_dict(changesList.getChild('1'))["Text"].startswith(text))
39 def test_tdf137855(self):
41 with self.ui_test.load_file(get_url_for_data_file("tdf137855.odt")):
43 with self.ui_test.execute_dialog_through_command(".uno:CompareDocuments", close_button="") as xOpenDialog:
45 xFileName = xOpenDialog.getChild("file_name")
46 xFileName.executeAction("TYPE", mkPropertyValues({"TEXT": get_url_for_data_file("tdf137855_2.odt")}))
47 xOpenBtn = xOpenDialog.getChild("open")
49 # Close the dialog and open it again so the list of changes is updated
50 with self.ui_test.execute_dialog_through_action(xOpenBtn, 'CLICK', close_button="close"):
51 pass
53 with self.ui_test.execute_modeless_dialog_through_command(".uno:AcceptTrackedChanges", close_button="close") as xTrackDlg:
54 changesList = xTrackDlg.getChild("writerchanges")
56 # Check the number of changes
57 self.assertEqual(263, len(changesList.getChildren()))
59 # Without the fix in place, this test would have crashed here
60 xAccBtn = xTrackDlg.getChild("acceptall")
61 xAccBtn.executeAction("CLICK", tuple())
63 self.assertEqual(0, len(changesList.getChildren()))
66 # vim: set shiftwidth=4 softtabstop=4 expandtab: