# -*- 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 from uitest.uihelper.common import get_state_as_dict, get_url_for_data_file from libreoffice.calc.document import get_cell_by_position from libreoffice.uno.propertyvalue import mkPropertyValues
#text to column testcase
class CalcTextToColumns(UITestCase):
def test_text_to_columns_dot(self): #_Dot_as_Separator with self.ui_test.load_file(get_url_for_data_file("text_to_columns_dot.ods")) as calc_doc:
xCalcDoc = self.xUITest.getTopFocusWindow()
gridwin = xCalcDoc.getChild("grid_window")
#Select A1:A5 on Sheet 'Dot_as_Separator'
gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:A5"})) #Data - Text to Columns with self.ui_test.execute_dialog_through_command(".uno:TextToColumns", close_button="") as xDialog: #Untag Tab as separator and tag other. Put a dot into the input field next to the other checkbox
xSeparatedBy = xDialog.getChild("toseparatedby")
xSeparatedBy.executeAction("CLICK", tuple())
def test_text_to_columns_comma(self): #Comma as Separator with self.ui_test.load_file(get_url_for_data_file("text_to_columns_comma.ods")) ascalc_doc:
xCalcDoc = self.xUITest.getTopFocusWindow()
gridwin = xCalcDoc.getChild("grid_window")
# Select A1:A5
gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:A5"})) # Data - Text to Columns with self.ui_test.execute_dialog_through_command(".uno:TextToColumns", close_button="") as xDialog: # Untag Tab as separator and tag comma.
xSeparatedBy = xDialog.getChild("toseparatedby")
xSeparatedBy.executeAction("CLICK", tuple())
xComma = xDialog.getChild("comma") if (get_state_as_dict(xComma)["Selected"]) == "false":
xComma.executeAction("CLICK", tuple()) # Click Ok
xOK = xDialog.getChild("ok") with self.ui_test.execute_blocking_action(xOK.executeAction, args=('CLICK', ()), close_button="yes"): pass
def test_text_to_columns_semicolon(self): #Semicolon as Separator with self.ui_test.load_file(get_url_for_data_file("text_to_columns_semicolon.ods")) as calc_doc:
xCalcDoc = self.xUITest.getTopFocusWindow()
gridwin = xCalcDoc.getChild("grid_window")
# Select A1:A5 on Sheet
gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:A5"})) # Data - Text to Columns with self.ui_test.execute_dialog_through_command(".uno:TextToColumns", close_button="") as xDialog: # Untag comma as separator and tag Semicolon
xSeparatedBy = xDialog.getChild("toseparatedby")
xSeparatedBy.executeAction("CLICK", tuple())
xSemicolon = xDialog.getChild("semicolon") if (get_state_as_dict(xSemicolon)["Selected"]) == "false":
xSemicolon.executeAction("CLICK", tuple()) # Click Ok
xOK = xDialog.getChild("ok") with self.ui_test.execute_blocking_action(xOK.executeAction, args=('CLICK', ()), close_button="yes"): pass
def test_text_to_columns_space(self): #Space as Separator with self.ui_test.load_file(get_url_for_data_file("text_to_columns_space.ods")) ascalc_doc:
xCalcDoc = self.xUITest.getTopFocusWindow()
gridwin = xCalcDoc.getChild("grid_window")
# Select A1:A5 on Sheet
gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:A5"})) # Data - Text to Columns with self.ui_test.execute_dialog_through_command(".uno:TextToColumns", close_button="") as xDialog: # Untag comma as separator and tag Semicolon
xSeparatedBy = xDialog.getChild("toseparatedby")
xSeparatedBy.executeAction("CLICK", tuple())
xSpace = xDialog.getChild("space") if (get_state_as_dict(xSpace)["Selected"]) == "false":
xSpace.executeAction("CLICK", tuple()) # xspace.executeAction("CLICK", tuple()) # Click Ok
xOK = xDialog.getChild("ok") with self.ui_test.execute_blocking_action(xOK.executeAction, args=('CLICK', ()), close_button="yes"): pass
def test_text_to_columns_pipe(self): #Space as Separator with self.ui_test.load_file(get_url_for_data_file("text_to_columns_pipe.ods")) as calc_doc:
xCalcDoc = self.xUITest.getTopFocusWindow()
gridwin = xCalcDoc.getChild("grid_window")
# Select A1:A5 on Sheet
gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:A5"})) # Data - Text to Columns with self.ui_test.execute_dialog_through_command(".uno:TextToColumns", close_button="") as xDialog: # Untag comma as separator and tag Semicolon
xSeparatedBy = xDialog.getChild("toseparatedby")
xSeparatedBy.executeAction("CLICK", tuple())
xother = xDialog.getChild("other")
xinputother = xDialog.getChild("inputother") if (get_state_as_dict(xother)["Selected"]) == "false":
xother.executeAction("CLICK", tuple())
xinputother.executeAction("TYPE", mkPropertyValues({"TEXT":"|"})) # Click Ok
xOK = xDialog.getChild("ok") with self.ui_test.execute_blocking_action(xOK.executeAction, args=('CLICK', ()), close_button="yes"): pass
def test_text_to_columns_pipespace(self): #Space as Separator with self.ui_test.load_file(get_url_for_data_file("text_to_columns_pipe_space.ods")) as calc_doc:
xCalcDoc = self.xUITest.getTopFocusWindow()
gridwin = xCalcDoc.getChild("grid_window")
# Select A1:A5 on Sheet
gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:A5"})) # Data - Text to Columns with self.ui_test.execute_dialog_through_command(".uno:TextToColumns", close_button="") as xDialog:
xSeparatedBy = xDialog.getChild("toseparatedby")
xSeparatedBy.executeAction("CLICK", tuple())
xspace = xDialog.getChild("space")
xother = xDialog.getChild("other")
xinputother = xDialog.getChild("inputother") if (get_state_as_dict(xspace)["Selected"]) == "false":
xspace.executeAction("CLICK", tuple()) if (get_state_as_dict(xother)["Selected"]) == "false":
xother.executeAction("CLICK", tuple())
xinputother.executeAction("TYPE", mkPropertyValues({"TEXT":"|"})) # Click Ok
xOK = xDialog.getChild("ok") with self.ui_test.execute_blocking_action(xOK.executeAction, args=('CLICK', ()), close_button="yes"): pass
¤ Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.0.2Bemerkung:
(vorverarbeitet)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.