diff options
author | Xisco Fauli <xiscofauli@libreoffice.org> | 2021-09-08 12:13:32 +0200 |
---|---|---|
committer | Xisco Fauli <xiscofauli@libreoffice.org> | 2021-09-08 17:51:47 +0200 |
commit | 2c0e5d8b2e53921f09b2e5036cc25f8b0a177dd6 (patch) | |
tree | 3207b7a36f6308eed648f7404d07420bf4321a81 /sc/qa/uitest/csv_dialog/tdf142395.py | |
parent | 9c2d703363798aad33a22b3b4e6ac8043dd53b95 (diff) |
uitest: sc: factor out common code
Change-Id: Iaba3b9633eac26516bbb4bb0b6baadb4c6772fa6
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/121808
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Diffstat (limited to 'sc/qa/uitest/csv_dialog/tdf142395.py')
-rw-r--r-- | sc/qa/uitest/csv_dialog/tdf142395.py | 42 |
1 files changed, 7 insertions, 35 deletions
diff --git a/sc/qa/uitest/csv_dialog/tdf142395.py b/sc/qa/uitest/csv_dialog/tdf142395.py index 66efc397d5b3..829bcb951663 100644 --- a/sc/qa/uitest/csv_dialog/tdf142395.py +++ b/sc/qa/uitest/csv_dialog/tdf142395.py @@ -5,47 +5,18 @@ # file, You can obtain one at http://mozilla.org/MPL/2.0/. # from uitest.framework import UITestCase -from uitest.uihelper.common import get_state_as_dict, get_url_for_data_file from libreoffice.uno.propertyvalue import mkPropertyValues from libreoffice.calc.document import get_cell_by_position +from libreoffice.calc.csv_dialog import load_csv_file class Tdf142395(UITestCase): def test_tdf142395(self): - - # Load file from Open dialog - with self.ui_test.execute_dialog_through_command(".uno:Open", close_button="open") as xOpenDialog: - - xFileName = xOpenDialog.getChild("file_name") - xFileName.executeAction("TYPE", mkPropertyValues({"TEXT": get_url_for_data_file("tdf142395.csv")})) - - - xDialog = self.ui_test.wait_for_top_focus_window('TextImportCsvDialog') - xSeparatedBy = xDialog.getChild("toseparatedby") - xSeparatedBy.executeAction("CLICK", tuple()) - - # Remove the text delimiter - xTextDelimiter = xDialog.getChild("textdelimiter") - xTextDelimiter.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) - xTextDelimiter.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) - - xTab = xDialog.getChild("tab") - if get_state_as_dict(xTab)['Selected'] == 'false': - xTab.executeAction("CLICK", tuple()) - self.assertEqual('true', get_state_as_dict(xTab)['Selected']) - xComma = xDialog.getChild("comma") - if get_state_as_dict(xComma)['Selected'] == 'false': - xComma.executeAction("CLICK", tuple()) - self.assertEqual('true', get_state_as_dict(xComma)['Selected']) - xSemicolon = xDialog.getChild("semicolon") - if get_state_as_dict(xSemicolon)['Selected'] == 'false': - xSemicolon.executeAction("CLICK", tuple()) - self.assertEqual('true', get_state_as_dict(xSemicolon)['Selected']) - self.assertEqual('1', get_state_as_dict(xDialog.getChild("fromrow"))['Text']) - - xOK = xDialog.getChild('ok') - with self.ui_test.wait_until_component_loaded(): - self.ui_test.close_dialog_through_button(xOK) + with load_csv_file(self, "tdf142395.csv", True) as xDialog: + # Remove the text delimiter + xTextDelimiter = xDialog.getChild("textdelimiter") + xTextDelimiter.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xTextDelimiter.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) document = self.ui_test.get_component() @@ -62,5 +33,6 @@ class Tdf142395(UITestCase): self.assertEqual(" g", get_cell_by_position(document, 0, 2, 1).getString()) self.assertEqual(" ", get_cell_by_position(document, 0, 3, 1).getString()) + self.ui_test.close_doc() # vim: set shiftwidth=4 softtabstop=4 expandtab: |