uitest: factor out common duplicated code

Change-Id: Ib6d4edaf3bd1b0a4078c277d1139d7b0db479e2b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103757
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
This commit is contained in:
Xisco Fauli
2020-10-01 12:40:04 +02:00
parent 46abe92430
commit a2d3b5721f
22 changed files with 78 additions and 418 deletions

View File

@@ -7,6 +7,7 @@
from uitest.framework import UITestCase
from uitest.uihelper.common import get_state_as_dict
from uitest.uihelper.common import select_pos
from uitest.uihelper.common import change_measurement_unit
from uitest.uihelper.calc import enter_text_to_cell
from libreoffice.calc.document import get_cell_by_position
from libreoffice.uno.propertyvalue import mkPropertyValues
@@ -19,21 +20,8 @@ class CalcColumns(UITestCase):
gridwin = xCalcDoc.getChild("grid_window")
document = self.ui_test.get_component()
#Make sure that tools-options-StarOffice Calc-General
self.ui_test.execute_dialog_through_command(".uno:OptionsTreeDialog") #optionsdialog
xDialogOpt = self.xUITest.getTopFocusWindow()
change_measurement_unit(self, "Centimeter")
xPages = xDialogOpt.getChild("pages")
xWriterEntry = xPages.getChild('3') # Calc
xWriterEntry.executeAction("EXPAND", tuple())
xWriterGeneralEntry = xWriterEntry.getChild('0')
xWriterGeneralEntry.executeAction("SELECT", tuple()) #General /cm
xunitlb = xDialogOpt.getChild("unitlb")
props = {"TEXT": "Centimeter"}
actionProps = mkPropertyValues(props)
xunitlb.executeAction("SELECT", actionProps)
xOKBtn = xDialogOpt.getChild("ok")
self.ui_test.close_dialog_through_button(xOKBtn)
#select A1
gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"}))
#column width
@@ -74,21 +62,7 @@ class CalcColumns(UITestCase):
gridwin = xCalcDoc.getChild("grid_window")
document = self.ui_test.get_component()
#Make sure that tools-options-StarOffice Calc-General
self.ui_test.execute_dialog_through_command(".uno:OptionsTreeDialog") #optionsdialog
xDialogOpt = self.xUITest.getTopFocusWindow()
xPages = xDialogOpt.getChild("pages")
xWriterEntry = xPages.getChild('3') # Calc
xWriterEntry.executeAction("EXPAND", tuple())
xWriterGeneralEntry = xWriterEntry.getChild('0')
xWriterGeneralEntry.executeAction("SELECT", tuple()) #General /cm
xunitlb = xDialogOpt.getChild("unitlb")
props = {"TEXT": "Centimeter"}
actionProps = mkPropertyValues(props)
xunitlb.executeAction("SELECT", actionProps)
xOKBtn = xDialogOpt.getChild("ok")
self.ui_test.close_dialog_through_button(xOKBtn)
change_measurement_unit(self, "Centimeter")
gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"}))
gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "C1", "EXTEND":"1"}))
@@ -129,21 +103,8 @@ class CalcColumns(UITestCase):
gridwin = xCalcDoc.getChild("grid_window")
document = self.ui_test.get_component()
#Make sure that tools-options-StarOffice Calc-General
self.ui_test.execute_dialog_through_command(".uno:OptionsTreeDialog") #optionsdialog
xDialogOpt = self.xUITest.getTopFocusWindow()
change_measurement_unit(self, "Centimeter")
xPages = xDialogOpt.getChild("pages")
xWriterEntry = xPages.getChild('3') # Calc
xWriterEntry.executeAction("EXPAND", tuple())
xWriterGeneralEntry = xWriterEntry.getChild('0')
xWriterGeneralEntry.executeAction("SELECT", tuple()) #General /cm
xunitlb = xDialogOpt.getChild("unitlb")
props = {"TEXT": "Centimeter"}
actionProps = mkPropertyValues(props)
xunitlb.executeAction("SELECT", actionProps)
xOKBtn = xDialogOpt.getChild("ok")
self.ui_test.close_dialog_through_button(xOKBtn)
#select A1
gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"}))
#column width
@@ -231,21 +192,8 @@ class CalcColumns(UITestCase):
gridwin = xCalcDoc.getChild("grid_window")
document = self.ui_test.get_component()
#Make sure that tools-options-StarOffice Calc-General
self.ui_test.execute_dialog_through_command(".uno:OptionsTreeDialog") #optionsdialog
xDialogOpt = self.xUITest.getTopFocusWindow()
change_measurement_unit(self, "Centimeter")
xPages = xDialogOpt.getChild("pages")
xWriterEntry = xPages.getChild('3') # Calc
xWriterEntry.executeAction("EXPAND", tuple())
xWriterGeneralEntry = xWriterEntry.getChild('0')
xWriterGeneralEntry.executeAction("SELECT", tuple()) #General /cm
xunitlb = xDialogOpt.getChild("unitlb")
props = {"TEXT": "Centimeter"}
actionProps = mkPropertyValues(props)
xunitlb.executeAction("SELECT", actionProps)
xOKBtn = xDialogOpt.getChild("ok")
self.ui_test.close_dialog_through_button(xOKBtn)
#select C1
gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "C1"}))
#column width

View File

@@ -7,6 +7,7 @@
from uitest.framework import UITestCase
from uitest.uihelper.common import get_state_as_dict
from uitest.uihelper.common import select_pos
from uitest.uihelper.common import change_measurement_unit
from uitest.uihelper.calc import enter_text_to_cell
from libreoffice.calc.document import get_sheet_from_doc
from libreoffice.calc.conditional_format import get_conditional_format_from_sheet
@@ -299,21 +300,9 @@ class formatCell(UITestCase):
xCalcDoc = self.xUITest.getTopFocusWindow()
gridwin = xCalcDoc.getChild("grid_window")
document = self.ui_test.get_component()
#set points pt measurement
#Make sure that tools-options-LibreOffice Calc-General-Point
self.ui_test.execute_dialog_through_command(".uno:OptionsTreeDialog") #optionsdialog
xDialogOpt = self.xUITest.getTopFocusWindow()
xPages = xDialogOpt.getChild("pages")
xWriterEntry = xPages.getChild('3') # Calc
xWriterEntry.executeAction("EXPAND", tuple())
xWriterGeneralEntry = xWriterEntry.getChild('0')
xWriterGeneralEntry.executeAction("SELECT", tuple()) #General /point
xunitlb = xDialogOpt.getChild("unitlb")
props = {"TEXT": "Point"}
actionProps = mkPropertyValues(props)
xunitlb.executeAction("SELECT", actionProps)
xOKBtn = xDialogOpt.getChild("ok")
self.ui_test.close_dialog_through_button(xOKBtn)
change_measurement_unit(self, "Point")
#select cell A1
gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"}))

View File

@@ -7,6 +7,7 @@
from uitest.framework import UITestCase
from uitest.uihelper.common import get_state_as_dict
from uitest.uihelper.common import select_pos
from uitest.uihelper.common import change_measurement_unit
from uitest.uihelper.calc import enter_text_to_cell
from libreoffice.calc.document import get_cell_by_position
from libreoffice.uno.propertyvalue import mkPropertyValues
@@ -18,21 +19,8 @@ class CalcRows(UITestCase):
gridwin = xCalcDoc.getChild("grid_window")
document = self.ui_test.get_component()
#Make sure that tools-options-StarOffice Calc-General
self.ui_test.execute_dialog_through_command(".uno:OptionsTreeDialog") #optionsdialog
xDialogOpt = self.xUITest.getTopFocusWindow()
change_measurement_unit(self, "Centimeter")
xPages = xDialogOpt.getChild("pages")
xWriterEntry = xPages.getChild('3') # Calc
xWriterEntry.executeAction("EXPAND", tuple())
xWriterGeneralEntry = xWriterEntry.getChild('0')
xWriterGeneralEntry.executeAction("SELECT", tuple()) #General /cm
xunitlb = xDialogOpt.getChild("unitlb")
props = {"TEXT": "Centimeter"}
actionProps = mkPropertyValues(props)
xunitlb.executeAction("SELECT", actionProps)
xOKBtn = xDialogOpt.getChild("ok")
self.ui_test.close_dialog_through_button(xOKBtn)
#select A1
gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"}))
#row height
@@ -73,21 +61,7 @@ class CalcRows(UITestCase):
gridwin = xCalcDoc.getChild("grid_window")
document = self.ui_test.get_component()
#Make sure that tools-options-StarOffice Calc-General
self.ui_test.execute_dialog_through_command(".uno:OptionsTreeDialog") #optionsdialog
xDialogOpt = self.xUITest.getTopFocusWindow()
xPages = xDialogOpt.getChild("pages")
xWriterEntry = xPages.getChild('3') # Calc
xWriterEntry.executeAction("EXPAND", tuple())
xWriterGeneralEntry = xWriterEntry.getChild('0')
xWriterGeneralEntry.executeAction("SELECT", tuple()) #General /cm
xunitlb = xDialogOpt.getChild("unitlb")
props = {"TEXT": "Centimeter"}
actionProps = mkPropertyValues(props)
xunitlb.executeAction("SELECT", actionProps)
xOKBtn = xDialogOpt.getChild("ok")
self.ui_test.close_dialog_through_button(xOKBtn)
change_measurement_unit(self, "Centimeter")
gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"}))
gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A3", "EXTEND":"1"}))
@@ -129,21 +103,8 @@ class CalcRows(UITestCase):
gridwin = xCalcDoc.getChild("grid_window")
document = self.ui_test.get_component()
#Make sure that tools-options-StarOffice Calc-General
self.ui_test.execute_dialog_through_command(".uno:OptionsTreeDialog") #optionsdialog
xDialogOpt = self.xUITest.getTopFocusWindow()
change_measurement_unit(self, "Centimeter")
xPages = xDialogOpt.getChild("pages")
xWriterEntry = xPages.getChild('3') # Calc
xWriterEntry.executeAction("EXPAND", tuple())
xWriterGeneralEntry = xWriterEntry.getChild('0')
xWriterGeneralEntry.executeAction("SELECT", tuple()) #General /cm
xunitlb = xDialogOpt.getChild("unitlb")
props = {"TEXT": "Centimeter"}
actionProps = mkPropertyValues(props)
xunitlb.executeAction("SELECT", actionProps)
xOKBtn = xDialogOpt.getChild("ok")
self.ui_test.close_dialog_through_button(xOKBtn)
#select A1
gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"}))
#row height
@@ -231,21 +192,8 @@ class CalcRows(UITestCase):
gridwin = xCalcDoc.getChild("grid_window")
document = self.ui_test.get_component()
#Make sure that tools-options-StarOffice Calc-General
self.ui_test.execute_dialog_through_command(".uno:OptionsTreeDialog") #optionsdialog
xDialogOpt = self.xUITest.getTopFocusWindow()
change_measurement_unit(self, "Centimeter")
xPages = xDialogOpt.getChild("pages")
xWriterEntry = xPages.getChild('3') # Calc
xWriterEntry.executeAction("EXPAND", tuple())
xWriterGeneralEntry = xWriterEntry.getChild('0')
xWriterGeneralEntry.executeAction("SELECT", tuple()) #General /cm
xunitlb = xDialogOpt.getChild("unitlb")
props = {"TEXT": "Centimeter"}
actionProps = mkPropertyValues(props)
xunitlb.executeAction("SELECT", actionProps)
xOKBtn = xDialogOpt.getChild("ok")
self.ui_test.close_dialog_through_button(xOKBtn)
#select A3
gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A3"}))
#row height

View File

@@ -7,6 +7,7 @@
from uitest.framework import UITestCase
from uitest.uihelper.common import get_state_as_dict
from uitest.uihelper.common import select_pos
from uitest.uihelper.common import change_measurement_unit
from uitest.uihelper.calc import enter_text_to_cell
from libreoffice.calc.document import get_cell_by_position
from libreoffice.uno.propertyvalue import mkPropertyValues
@@ -24,21 +25,7 @@ class tdf126673(UITestCase):
gridwin = xCalcDoc.getChild("grid_window")
document = self.ui_test.get_component()
#set cm Tools-options-StarOffice Calc-General
self.ui_test.execute_dialog_through_command(".uno:OptionsTreeDialog") #optionsdialog
xDialogOpt = self.xUITest.getTopFocusWindow()
xPages = xDialogOpt.getChild("pages")
xWriterEntry = xPages.getChild('3') # Calc
xWriterEntry.executeAction("EXPAND", tuple())
xWriterGeneralEntry = xWriterEntry.getChild('0')
xWriterGeneralEntry.executeAction("SELECT", tuple()) #General /cm
xunitlb = xDialogOpt.getChild("unitlb")
props = {"TEXT": "Centimeter"}
actionProps = mkPropertyValues(props)
xunitlb.executeAction("SELECT", actionProps)
xOKBtn = xDialogOpt.getChild("ok")
self.ui_test.close_dialog_through_button(xOKBtn)
change_measurement_unit(self, "Centimeter")
#select A2
gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A2"}))

View File

@@ -7,6 +7,7 @@
from uitest.framework import UITestCase
from uitest.uihelper.common import get_state_as_dict
from uitest.uihelper.common import select_pos
from uitest.uihelper.common import change_measurement_unit
from uitest.uihelper.calc import enter_text_to_cell
from libreoffice.calc.document import get_cell_by_position
from libreoffice.uno.propertyvalue import mkPropertyValues
@@ -26,20 +27,7 @@ class chartArea(UITestCase):
gridwin = xCalcDoc.getChild("grid_window")
document = self.ui_test.get_component()
self.ui_test.execute_dialog_through_command(".uno:OptionsTreeDialog") #optionsdialog, set centimeters
xDialog = self.xUITest.getTopFocusWindow()
xPages = xDialog.getChild("pages")
xCalcEntry = xPages.getChild('3') # calc
xCalcEntry.executeAction("EXPAND", tuple())
xCalcGeneralEntry = xCalcEntry.getChild('0')
xCalcGeneralEntry.executeAction("SELECT", tuple()) #General
xMetric = xDialog.getChild("unitlb")
props = {"TEXT": "Centimeter"}
actionProps = mkPropertyValues(props)
xMetric.executeAction("SELECT", actionProps)
xOKBtn = xDialog.getChild("ok")
self.ui_test.close_dialog_through_button(xOKBtn)
change_measurement_unit(self, "Centimeter")
gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"}))
gridwin.executeAction("ACTIVATE", tuple())

View File

@@ -7,6 +7,7 @@
from uitest.framework import UITestCase
from uitest.uihelper.common import get_state_as_dict
from uitest.uihelper.common import select_pos
from uitest.uihelper.common import change_measurement_unit
from uitest.uihelper.calc import enter_text_to_cell
from libreoffice.calc.document import get_cell_by_position
from libreoffice.uno.propertyvalue import mkPropertyValues
@@ -28,20 +29,8 @@ class chartGrid(UITestCase):
gridwin = xCalcDoc.getChild("grid_window")
document = self.ui_test.get_component()
self.ui_test.execute_dialog_through_command(".uno:OptionsTreeDialog") #optionsdialog, set centimeters
xDialog = self.xUITest.getTopFocusWindow()
change_measurement_unit(self, "Centimeter")
xPages = xDialog.getChild("pages")
xCalcEntry = xPages.getChild('3') # calc
xCalcEntry.executeAction("EXPAND", tuple())
xCalcGeneralEntry = xCalcEntry.getChild('0')
xCalcGeneralEntry.executeAction("SELECT", tuple()) #General
xMetric = xDialog.getChild("unitlb")
props = {"TEXT": "Centimeter"}
actionProps = mkPropertyValues(props)
xMetric.executeAction("SELECT", actionProps)
xOKBtn = xDialog.getChild("ok")
self.ui_test.close_dialog_through_button(xOKBtn)
#X Axis Major Grid
gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"}))
gridwin.executeAction("ACTIVATE", tuple())

View File

@@ -7,6 +7,7 @@
from uitest.framework import UITestCase
from uitest.uihelper.common import get_state_as_dict
from uitest.uihelper.common import select_pos
from uitest.uihelper.common import change_measurement_unit
from uitest.uihelper.calc import enter_text_to_cell
from libreoffice.calc.document import get_cell_by_position
from libreoffice.uno.propertyvalue import mkPropertyValues
@@ -26,20 +27,7 @@ class chartWall(UITestCase):
gridwin = xCalcDoc.getChild("grid_window")
document = self.ui_test.get_component()
self.ui_test.execute_dialog_through_command(".uno:OptionsTreeDialog") #optionsdialog, set centimeters
xDialog = self.xUITest.getTopFocusWindow()
xPages = xDialog.getChild("pages")
xCalcEntry = xPages.getChild('3') # calc
xCalcEntry.executeAction("EXPAND", tuple())
xCalcGeneralEntry = xCalcEntry.getChild('0')
xCalcGeneralEntry.executeAction("SELECT", tuple()) #General
xMetric = xDialog.getChild("unitlb")
props = {"TEXT": "Centimeter"}
actionProps = mkPropertyValues(props)
xMetric.executeAction("SELECT", actionProps)
xOKBtn = xDialog.getChild("ok")
self.ui_test.close_dialog_through_button(xOKBtn)
change_measurement_unit(self, "Centimeter")
xWall = document.Sheets[0].Charts[0].getEmbeddedObject().getFirstDiagram().Wall
self.assertEqual(xWall.LineWidth, 0)

View File

@@ -7,6 +7,7 @@
from uitest.framework import UITestCase
from uitest.uihelper.common import get_state_as_dict
from uitest.uihelper.common import select_pos
from uitest.uihelper.common import change_measurement_unit
from uitest.uihelper.calc import enter_text_to_cell
from libreoffice.calc.document import get_cell_by_position
from libreoffice.uno.propertyvalue import mkPropertyValues
@@ -27,20 +28,7 @@ class chartXAxis(UITestCase):
gridwin = xCalcDoc.getChild("grid_window")
document = self.ui_test.get_component()
self.ui_test.execute_dialog_through_command(".uno:OptionsTreeDialog") #optionsdialog, set centimeters
xDialog = self.xUITest.getTopFocusWindow()
xPages = xDialog.getChild("pages")
xCalcEntry = xPages.getChild('3') # calc
xCalcEntry.executeAction("EXPAND", tuple())
xCalcGeneralEntry = xCalcEntry.getChild('0')
xCalcGeneralEntry.executeAction("SELECT", tuple()) #General
xMetric = xDialog.getChild("unitlb")
props = {"TEXT": "Centimeter"}
actionProps = mkPropertyValues(props)
xMetric.executeAction("SELECT", actionProps)
xOKBtn = xDialog.getChild("ok")
self.ui_test.close_dialog_through_button(xOKBtn)
change_measurement_unit(self, "Centimeter")
gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"}))
gridwin.executeAction("ACTIVATE", tuple())

View File

@@ -7,6 +7,7 @@
from uitest.framework import UITestCase
from uitest.uihelper.common import get_state_as_dict
from uitest.uihelper.common import select_pos
from uitest.uihelper.common import change_measurement_unit
from uitest.uihelper.calc import enter_text_to_cell
from libreoffice.calc.document import get_cell_by_position
from libreoffice.uno.propertyvalue import mkPropertyValues
@@ -27,20 +28,7 @@ class chartYAxis(UITestCase):
gridwin = xCalcDoc.getChild("grid_window")
document = self.ui_test.get_component()
self.ui_test.execute_dialog_through_command(".uno:OptionsTreeDialog") #optionsdialog, set centimeters
xDialog = self.xUITest.getTopFocusWindow()
xPages = xDialog.getChild("pages")
xCalcEntry = xPages.getChild('3') # calc
xCalcEntry.executeAction("EXPAND", tuple())
xCalcGeneralEntry = xCalcEntry.getChild('0')
xCalcGeneralEntry.executeAction("SELECT", tuple()) #General
xMetric = xDialog.getChild("unitlb")
props = {"TEXT": "Centimeter"}
actionProps = mkPropertyValues(props)
xMetric.executeAction("SELECT", actionProps)
xOKBtn = xDialog.getChild("ok")
self.ui_test.close_dialog_through_button(xOKBtn)
change_measurement_unit(self, "Centimeter")
gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"}))
gridwin.executeAction("ACTIVATE", tuple())

View File

@@ -7,6 +7,7 @@
from uitest.framework import UITestCase
from uitest.uihelper.common import get_state_as_dict
from uitest.uihelper.common import select_pos
from uitest.uihelper.common import change_measurement_unit
from uitest.uihelper.calc import enter_text_to_cell
from libreoffice.calc.document import get_cell_by_position
from libreoffice.uno.propertyvalue import mkPropertyValues
@@ -27,20 +28,7 @@ class chartFormatDataSeries(UITestCase):
gridwin = xCalcDoc.getChild("grid_window")
document = self.ui_test.get_component()
self.ui_test.execute_dialog_through_command(".uno:OptionsTreeDialog") #optionsdialog, set centimeters
xDialog = self.xUITest.getTopFocusWindow()
xPages = xDialog.getChild("pages")
xCalcEntry = xPages.getChild('3') # calc
xCalcEntry.executeAction("EXPAND", tuple())
xCalcGeneralEntry = xCalcEntry.getChild('0')
xCalcGeneralEntry.executeAction("SELECT", tuple()) #General
xMetric = xDialog.getChild("unitlb")
props = {"TEXT": "Centimeter"}
actionProps = mkPropertyValues(props)
xMetric.executeAction("SELECT", actionProps)
xOKBtn = xDialog.getChild("ok")
self.ui_test.close_dialog_through_button(xOKBtn)
change_measurement_unit(self, "Centimeter")
gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"}))
gridwin.executeAction("ACTIVATE", tuple())

View File

@@ -7,6 +7,7 @@
from uitest.framework import UITestCase
from uitest.uihelper.common import get_state_as_dict
from uitest.uihelper.common import select_pos
from uitest.uihelper.common import change_measurement_unit
from uitest.uihelper.calc import enter_text_to_cell
from libreoffice.calc.document import get_cell_by_position
from libreoffice.uno.propertyvalue import mkPropertyValues
@@ -28,20 +29,7 @@ class tdf93506(UITestCase):
gridwin = xCalcDoc.getChild("grid_window")
document = self.ui_test.get_component()
self.ui_test.execute_dialog_through_command(".uno:OptionsTreeDialog") #optionsdialog, set centimeters
xDialog = self.xUITest.getTopFocusWindow()
xPages = xDialog.getChild("pages")
xCalcEntry = xPages.getChild('3') # calc
xCalcEntry.executeAction("EXPAND", tuple())
xCalcGeneralEntry = xCalcEntry.getChild('0')
xCalcGeneralEntry.executeAction("SELECT", tuple()) #General
xMetric = xDialog.getChild("unitlb")
props = {"TEXT": "Centimeter"}
actionProps = mkPropertyValues(props)
xMetric.executeAction("SELECT", actionProps)
xOKBtn = xDialog.getChild("ok")
self.ui_test.close_dialog_through_button(xOKBtn)
change_measurement_unit(self, "Centimeter")
gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"}))
gridwin.executeAction("ACTIVATE", tuple())

View File

@@ -11,6 +11,7 @@ from uitest.path import get_srcdir_url
from libreoffice.uno.propertyvalue import mkPropertyValues
from uitest.uihelper.common import get_state_as_dict, type_text
from uitest.uihelper.common import select_pos
from uitest.uihelper.common import change_measurement_unit
#Outline Numbering is now Chapter Numbering
@@ -20,19 +21,7 @@ class WriterChapterNumbering(UITestCase):
self.ui_test.create_doc_in_start_center("writer")
document = self.ui_test.get_component()
self.ui_test.execute_dialog_through_command(".uno:OptionsTreeDialog") #optionsdialog
xDialog = self.xUITest.getTopFocusWindow()
xPages = xDialog.getChild("pages")
xWriterEntry = xPages.getChild('3') # Writer
xWriterEntry.executeAction("EXPAND", tuple())
xWriterGeneralEntry = xWriterEntry.getChild('0')
xWriterGeneralEntry.executeAction("SELECT", tuple()) #General - set millimeters
xMetric = xDialog.getChild("metric")
props = {"TEXT": "Millimeter"}
actionProps = mkPropertyValues(props)
xMetric.executeAction("SELECT", actionProps)
xOKBtn = xDialog.getChild("ok")
self.ui_test.close_dialog_through_button(xOKBtn)
change_measurement_unit(self, "Millimeter")
self.ui_test.execute_dialog_through_command(".uno:ChapterNumberingDialog")
xDialog = self.xUITest.getTopFocusWindow()

View File

@@ -11,6 +11,7 @@ from uitest.uihelper.calc import enter_text_to_cell
from libreoffice.calc.document import get_cell_by_position
from libreoffice.uno.propertyvalue import mkPropertyValues
from uitest.uihelper.common import get_state_as_dict, type_text
from uitest.uihelper.common import change_measurement_unit
from uitest.debug import sleep
import org.libreoffice.unotest
import pathlib
@@ -24,21 +25,8 @@ class tableProperties(UITestCase):
writer_doc = self.ui_test.load_file(get_url_for_data_file("tableToText.odt"))
document = self.ui_test.get_component()
xWriterDoc = self.xUITest.getTopFocusWindow()
#set cm
self.ui_test.execute_dialog_through_command(".uno:OptionsTreeDialog") #optionsdialog
xDialog = self.xUITest.getTopFocusWindow()
xPages = xDialog.getChild("pages")
xWriterEntry = xPages.getChild('3') # Writer
xWriterEntry.executeAction("EXPAND", tuple())
xWriterGeneralEntry = xWriterEntry.getChild('0')
xWriterGeneralEntry.executeAction("SELECT", tuple()) #General
xMetric = xDialog.getChild("metric")
props = {"TEXT": "Centimeter"}
actionProps = mkPropertyValues(props)
xMetric.executeAction("SELECT", actionProps)
xOKBtn = xDialog.getChild("ok")
self.ui_test.close_dialog_through_button(xOKBtn)
change_measurement_unit(self, "Centimeter")
#dialog Table Properties - Table
self.ui_test.execute_dialog_through_command(".uno:TableDialog")

View File

@@ -12,6 +12,7 @@ import time
from uitest.debug import sleep
from libreoffice.uno.propertyvalue import mkPropertyValues
from uitest.uihelper.common import select_pos
from uitest.uihelper.common import change_measurement_unit
class formatBulletsNumbering(UITestCase):
@@ -20,19 +21,7 @@ class formatBulletsNumbering(UITestCase):
document = self.ui_test.get_component()
xWriterDoc = self.xUITest.getTopFocusWindow()
self.ui_test.execute_dialog_through_command(".uno:OptionsTreeDialog") #optionsdialog
xDialog = self.xUITest.getTopFocusWindow()
xPages = xDialog.getChild("pages")
xWriterEntry = xPages.getChild('3') # Writer
xWriterEntry.executeAction("EXPAND", tuple())
xWriterGeneralEntry = xWriterEntry.getChild('0')
xWriterGeneralEntry.executeAction("SELECT", tuple()) #General - set millimeters
xMetric = xDialog.getChild("metric")
props = {"TEXT": "Millimeter"}
actionProps = mkPropertyValues(props)
xMetric.executeAction("SELECT", actionProps)
xOKBtn = xDialog.getChild("ok")
self.ui_test.close_dialog_through_button(xOKBtn)
change_measurement_unit(self, "Millimeter")
self.ui_test.execute_dialog_through_command(".uno:BulletsAndNumberingDialog")
xDialog = self.xUITest.getTopFocusWindow()
@@ -190,19 +179,7 @@ class formatBulletsNumbering(UITestCase):
xWriterDoc = self.xUITest.getTopFocusWindow()
xWriterEdit = xWriterDoc.getChild("writer_edit")
self.ui_test.execute_dialog_through_command(".uno:OptionsTreeDialog") #optionsdialog
xDialog = self.xUITest.getTopFocusWindow()
xPages = xDialog.getChild("pages")
xWriterEntry = xPages.getChild('3') # Writer
xWriterEntry.executeAction("EXPAND", tuple())
xWriterGeneralEntry = xWriterEntry.getChild('0')
xWriterGeneralEntry.executeAction("SELECT", tuple()) #General - set millimeters
xMetric = xDialog.getChild("metric")
props = {"TEXT": "Millimeter"}
actionProps = mkPropertyValues(props)
xMetric.executeAction("SELECT", actionProps)
xOKBtn = xDialog.getChild("ok")
self.ui_test.close_dialog_through_button(xOKBtn)
change_measurement_unit(self, "Millimeter")
self.ui_test.execute_dialog_through_command(".uno:BulletsAndNumberingDialog")
xDialog = self.xUITest.getTopFocusWindow()
@@ -243,19 +220,7 @@ class formatBulletsNumbering(UITestCase):
document = self.ui_test.get_component()
xWriterDoc = self.xUITest.getTopFocusWindow()
self.ui_test.execute_dialog_through_command(".uno:OptionsTreeDialog") #optionsdialog
xDialog = self.xUITest.getTopFocusWindow()
xPages = xDialog.getChild("pages")
xWriterEntry = xPages.getChild('3') # Writer
xWriterEntry.executeAction("EXPAND", tuple())
xWriterGeneralEntry = xWriterEntry.getChild('0')
xWriterGeneralEntry.executeAction("SELECT", tuple()) #General - set millimeters
xMetric = xDialog.getChild("metric")
props = {"TEXT": "Millimeter"}
actionProps = mkPropertyValues(props)
xMetric.executeAction("SELECT", actionProps)
xOKBtn = xDialog.getChild("ok")
self.ui_test.close_dialog_through_button(xOKBtn)
change_measurement_unit(self, "Millimeter")
self.ui_test.execute_dialog_through_command(".uno:BulletsAndNumberingDialog")
xDialog = self.xUITest.getTopFocusWindow()

View File

@@ -12,6 +12,7 @@ import time
from uitest.debug import sleep
from libreoffice.uno.propertyvalue import mkPropertyValues
from uitest.uihelper.common import select_pos
from uitest.uihelper.common import change_measurement_unit
class formatParagraph(UITestCase):
@@ -310,19 +311,7 @@ class formatParagraph(UITestCase):
document = self.ui_test.get_component()
xWriterDoc = self.xUITest.getTopFocusWindow()
self.ui_test.execute_dialog_through_command(".uno:OptionsTreeDialog") #optionsdialog
xDialog = self.xUITest.getTopFocusWindow()
xPages = xDialog.getChild("pages")
xWriterEntry = xPages.getChild('3') # Writer
xWriterEntry.executeAction("EXPAND", tuple())
xWriterGeneralEntry = xWriterEntry.getChild('0')
xWriterGeneralEntry.executeAction("SELECT", tuple()) #General
xMetric = xDialog.getChild("metric")
props = {"TEXT": "Centimeter"}
actionProps = mkPropertyValues(props)
xMetric.executeAction("SELECT", actionProps)
xOKBtn = xDialog.getChild("ok")
self.ui_test.close_dialog_through_button(xOKBtn)
change_measurement_unit(self, "Centimeter")
self.ui_test.execute_dialog_through_command(".uno:ParagraphDialog")
xDialog = self.xUITest.getTopFocusWindow()
@@ -511,19 +500,7 @@ class formatParagraph(UITestCase):
document = self.ui_test.get_component()
xWriterDoc = self.xUITest.getTopFocusWindow()
self.ui_test.execute_dialog_through_command(".uno:OptionsTreeDialog") #optionsdialog
xDialog = self.xUITest.getTopFocusWindow()
xPages = xDialog.getChild("pages")
xWriterEntry = xPages.getChild('3') # Writer
xWriterEntry.executeAction("EXPAND", tuple())
xWriterGeneralEntry = xWriterEntry.getChild('0')
xWriterGeneralEntry.executeAction("SELECT", tuple()) #General - set centimeter
xMetric = xDialog.getChild("metric")
props = {"TEXT": "Centimeter"}
actionProps = mkPropertyValues(props)
xMetric.executeAction("SELECT", actionProps)
xOKBtn = xDialog.getChild("ok")
self.ui_test.close_dialog_through_button(xOKBtn)
change_measurement_unit(self, "Centimeter")
self.ui_test.execute_dialog_through_command(".uno:ParagraphDialog")
xDialog = self.xUITest.getTopFocusWindow()

View File

@@ -11,6 +11,7 @@ from uitest.path import get_srcdir_url
from libreoffice.uno.propertyvalue import mkPropertyValues
from uitest.uihelper.common import get_state_as_dict, type_text
from uitest.uihelper.common import select_pos
from uitest.uihelper.common import change_measurement_unit
class WriterLineNumbering(UITestCase):
@@ -18,19 +19,7 @@ class WriterLineNumbering(UITestCase):
self.ui_test.create_doc_in_start_center("writer")
document = self.ui_test.get_component()
self.ui_test.execute_dialog_through_command(".uno:OptionsTreeDialog") #optionsdialog
xDialog = self.xUITest.getTopFocusWindow()
xPages = xDialog.getChild("pages")
xWriterEntry = xPages.getChild('3') # Writer
xWriterEntry.executeAction("EXPAND", tuple())
xWriterGeneralEntry = xWriterEntry.getChild('0')
xWriterGeneralEntry.executeAction("SELECT", tuple()) #General - set centimeters
xMetric = xDialog.getChild("metric")
props = {"TEXT": "Centimeter"}
actionProps = mkPropertyValues(props)
xMetric.executeAction("SELECT", actionProps)
xOKBtn = xDialog.getChild("ok")
self.ui_test.close_dialog_through_button(xOKBtn)
change_measurement_unit(self, "Centimeter")
self.ui_test.execute_dialog_through_command(".uno:LineNumberingDialog")
xDialog = self.xUITest.getTopFocusWindow()

View File

@@ -7,6 +7,7 @@
from uitest.framework import UITestCase
from uitest.uihelper.common import get_state_as_dict
from uitest.uihelper.common import select_pos
from uitest.uihelper.common import change_measurement_unit
from uitest.uihelper.calc import enter_text_to_cell
from libreoffice.calc.document import get_cell_by_position
from uitest.debug import sleep
@@ -19,21 +20,7 @@ class columns(UITestCase):
document = self.ui_test.get_component()
xWriterDoc = self.xUITest.getTopFocusWindow()
#set cm
self.ui_test.execute_dialog_through_command(".uno:OptionsTreeDialog") #optionsdialog
xDialog = self.xUITest.getTopFocusWindow()
xPages = xDialog.getChild("pages")
xWriterEntry = xPages.getChild('3') # Writer
xWriterEntry.executeAction("EXPAND", tuple())
xWriterGeneralEntry = xWriterEntry.getChild('0')
xWriterGeneralEntry.executeAction("SELECT", tuple()) #General
xMetric = xDialog.getChild("metric")
props = {"TEXT": "Centimeter"}
actionProps = mkPropertyValues(props)
xMetric.executeAction("SELECT", actionProps)
xOKBtn = xDialog.getChild("ok")
self.ui_test.close_dialog_through_button(xOKBtn)
change_measurement_unit(self, "Centimeter")
#dialog Columns
self.ui_test.execute_dialog_through_command(".uno:FormatColumns")

View File

@@ -6,6 +6,7 @@
from uitest.framework import UITestCase
from uitest.uihelper.common import select_pos, get_state_as_dict
from uitest.uihelper.common import change_measurement_unit
from com.sun.star.uno import RuntimeException
from com.sun.star.awt.GradientStyle import LINEAR
from com.sun.star.drawing.HatchStyle import SINGLE
@@ -21,21 +22,7 @@ class tdf128431(UITestCase):
self.ui_test.create_doc_in_start_center("writer")
document = self.ui_test.get_component()
#set cm Tools-options-StarOffice Writer-General
self.ui_test.execute_dialog_through_command(".uno:OptionsTreeDialog") #optionsdialog
xDialog = self.xUITest.getTopFocusWindow()
xPages = xDialog.getChild("pages")
xWriterEntry = xPages.getChild('3') # Writer
xWriterEntry.executeAction("EXPAND", tuple())
xWriterGeneralEntry = xWriterEntry.getChild('0')
xWriterGeneralEntry.executeAction("SELECT", tuple()) #General
xMetric = xDialog.getChild("metric")
props = {"TEXT": "Centimeter"}
actionProps = mkPropertyValues(props)
xMetric.executeAction("SELECT", actionProps)
xOKBtn = xDialog.getChild("ok")
self.ui_test.close_dialog_through_button(xOKBtn)
change_measurement_unit(self, "Centimeter")
self.ui_test.execute_dialog_through_command(".uno:PageDialog")
xDialog = self.xUITest.getTopFocusWindow()

View File

@@ -8,6 +8,7 @@ from uitest.framework import UITestCase
from uitest.path import get_srcdir_url
from uitest.uihelper.common import get_state_as_dict, type_text
from libreoffice.uno.propertyvalue import mkPropertyValues
from uitest.uihelper.common import change_measurement_unit
def get_url_for_data_file(file_name):
return get_srcdir_url() + "/sw/qa/uitest/writer_tests/data/" + file_name
@@ -18,19 +19,7 @@ class tdf132169(UITestCase):
writer_doc = self.ui_test.load_file(get_url_for_data_file("shape.odt"))
#set measurement to points
self.ui_test.execute_dialog_through_command(".uno:OptionsTreeDialog")
xDialogOpt = self.xUITest.getTopFocusWindow()
xPages = xDialogOpt.getChild("pages")
xWriterEntry = xPages.getChild('3')
xWriterEntry.executeAction("EXPAND", tuple())
xWriterGeneralEntry = xWriterEntry.getChild('0')
xWriterGeneralEntry.executeAction("SELECT", tuple())
xMetric = xDialogOpt.getChild("metric")
props = {"TEXT": "Point"}
actionProps = mkPropertyValues(props)
xMetric.executeAction("SELECT", actionProps)
xOKBtn = xDialogOpt.getChild("ok")
self.ui_test.close_dialog_through_button(xOKBtn)
change_measurement_unit(self, "Point")
xWriterDoc = self.xUITest.getTopFocusWindow()
xWriterEdit = xWriterDoc.getChild("writer_edit")

View File

@@ -6,23 +6,9 @@
#
from uitest.framework import UITestCase
from uitest.uihelper.common import get_state_as_dict, select_pos
from uitest.uihelper.common import change_measurement_unit
from libreoffice.uno.propertyvalue import mkPropertyValues
def change_metric_units(self, unit):
self.ui_test.execute_dialog_through_command(".uno:OptionsTreeDialog")
xDialogOpt = self.xUITest.getTopFocusWindow()
xPages = xDialogOpt.getChild("pages")
xWriterEntry = xPages.getChild('3')
xWriterEntry.executeAction("EXPAND", tuple())
xWriterGeneralEntry = xWriterEntry.getChild('0')
xWriterGeneralEntry.executeAction("SELECT", tuple())
xMetric = xDialogOpt.getChild("metric")
props = {"TEXT": unit}
actionProps = mkPropertyValues(props)
xMetric.executeAction("SELECT", actionProps)
xOKBtn = xDialogOpt.getChild("ok")
self.ui_test.close_dialog_through_button(xOKBtn)
class tdf133189(UITestCase):
def test_tdf133189(self):
writer_doc = self.ui_test.create_doc_in_start_center("writer")
@@ -40,7 +26,7 @@ class tdf133189(UITestCase):
xPaperMargin = xWriterEdit.getChild('marginLB')
#change measurement to Inches
change_metric_units(self, 'Inch')
change_measurement_unit(self, 'Inch')
self.ui_test.execute_dialog_through_command(".uno:PageDialog")
xDialog = self.xUITest.getTopFocusWindow()
@@ -71,7 +57,7 @@ class tdf133189(UITestCase):
self.assertEqual(get_state_as_dict(xPaperHeight)['Text'], "8.00″")
#change measurement again to Centimeters
change_metric_units(self, 'Centimeter')
change_measurement_unit(self, 'Centimeter')
self.ui_test.wait_until_property_is_updated(xPaperMargin, "SelectEntryText", "Normal (1.90 cm)")
# tdf#129267

View File

@@ -8,6 +8,7 @@ from uitest.framework import UITestCase
from uitest.path import get_srcdir_url
from uitest.uihelper.common import get_state_as_dict
from libreoffice.uno.propertyvalue import mkPropertyValues
from uitest.uihelper.common import change_measurement_unit
def get_url_for_data_file(file_name):
return get_srcdir_url() + "/sw/qa/uitest/writer_tests/data/" + file_name
@@ -18,19 +19,7 @@ class tdf99711(UITestCase):
writer_doc = self.ui_test.load_file(get_url_for_data_file("shape.odt"))
#set measurement to millimeters
self.ui_test.execute_dialog_through_command(".uno:OptionsTreeDialog")
xDialogOpt = self.xUITest.getTopFocusWindow()
xPages = xDialogOpt.getChild("pages")
xWriterEntry = xPages.getChild('3')
xWriterEntry.executeAction("EXPAND", tuple())
xWriterGeneralEntry = xWriterEntry.getChild('0')
xWriterGeneralEntry.executeAction("SELECT", tuple())
xMetric = xDialogOpt.getChild("metric")
props = {"TEXT": "Millimeter"}
actionProps = mkPropertyValues(props)
xMetric.executeAction("SELECT", actionProps)
xOKBtn = xDialogOpt.getChild("ok")
self.ui_test.close_dialog_through_button(xOKBtn)
change_measurement_unit(self, "Millimeter")
xWriterDoc = self.xUITest.getTopFocusWindow()
xWriterEdit = xWriterDoc.getChild("writer_edit")

View File

@@ -19,4 +19,29 @@ def select_pos(ui_object, pos):
def select_text(ui_object, from_pos, to):
ui_object.executeAction("SELECT", mkPropertyValues({"FROM": from_pos, "TO": to}))
def change_measurement_unit(UITestCase, unit):
UITestCase.ui_test.execute_dialog_through_command(".uno:OptionsTreeDialog")
xDialogOpt = UITestCase.xUITest.getTopFocusWindow()
xPages = xDialogOpt.getChild("pages")
xAppEntry = xPages.getChild('3')
xAppEntry.executeAction("EXPAND", tuple())
xGeneralEntry = xAppEntry.getChild('0')
xGeneralEntry.executeAction("SELECT", tuple())
# Calc
if 'unitlb' in xDialogOpt.getChildren():
xUnit = xDialogOpt.getChild("unitlb")
# Writer
elif 'metric' in xDialogOpt.getChildren():
xUnit = xDialogOpt.getChild("metric")
props = {"TEXT": unit}
actionProps = mkPropertyValues(props)
xUnit.executeAction("SELECT", actionProps)
xOKBtn = xDialogOpt.getChild("ok")
UITestCase.ui_test.close_dialog_through_button(xOKBtn)
# vim: set shiftwidth=4 softtabstop=4 expandtab: