diff options
author | Xisco Fauli <xiscofauli@libreoffice.org> | 2021-06-23 12:14:24 +0200 |
---|---|---|
committer | Xisco Fauli <xiscofauli@libreoffice.org> | 2021-06-25 18:21:22 +0200 |
commit | 8a2d7c797958680bcf133fef44abcf2efd1007d1 (patch) | |
tree | 463ffbe3d6bd181914295c4ea3e97435204115f9 | |
parent | 49cf5e5303d064a66e4ae97223df92238d556dd1 (diff) |
uitest: guard execute_dialog_through_action
Mostly done with a script
for motivation, see 89aaa17a0a4413f07da2bc5084b0164f15dc01ac
< UITest: introduce guarded context managers >
Change-Id: I8b0e4aa746f7973b1bd1343219820d8b2315cf19
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/117703
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
34 files changed, 1455 insertions, 1729 deletions
diff --git a/sc/qa/uitest/calc_tests9/tdf124318.py b/sc/qa/uitest/calc_tests9/tdf124318.py index 8aad127c608e..80a1d004b941 100644 --- a/sc/qa/uitest/calc_tests9/tdf124318.py +++ b/sc/qa/uitest/calc_tests9/tdf124318.py @@ -19,15 +19,13 @@ class tdf124318(UITestCase): gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "B4"})) - self.ui_test.execute_dialog_through_action(gridwin, "TYPE", mkPropertyValues({"KEYCODE": "CTRL+k"})) - xDialog = self.xUITest.getTopFocusWindow() - - # Without the fix in place, this test would have failed with - # AssertionError: 'mobile/identification/authentification' != - # 'mobile/identification/authentification%00塹\uf481ᴻ䡿ⲯ嶂藄挧%00%00ꮥ%00' - self.assertEqual("mobile/identification/authentification", - get_state_as_dict(xDialog.getChild("target"))['Text'].split(".fr/")[1]) - self.assertEqual("mobile/identification/authentification", - get_state_as_dict(xDialog.getChild("indication"))['Text'].split(".fr/")[1]) + with self.ui_test.execute_dialog_through_action(gridwin, "TYPE", mkPropertyValues({"KEYCODE": "CTRL+k"})) as xDialog: + # Without the fix in place, this test would have failed with + # AssertionError: 'mobile/identification/authentification' != + # 'mobile/identification/authentification%00塹\uf481ᴻ䡿ⲯ嶂藄挧%00%00ꮥ%00' + self.assertEqual("mobile/identification/authentification", + get_state_as_dict(xDialog.getChild("target"))['Text'].split(".fr/")[1]) + self.assertEqual("mobile/identification/authentification", + get_state_as_dict(xDialog.getChild("indication"))['Text'].split(".fr/")[1]) # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/chart/chartArea.py b/sc/qa/uitest/chart/chartArea.py index d7a744749188..05aac7a5bf8e 100644 --- a/sc/qa/uitest/chart/chartArea.py +++ b/sc/qa/uitest/chart/chartArea.py @@ -34,20 +34,17 @@ class chartArea(UITestCase): xChartMainTop = self.xUITest.getTopFocusWindow() xChartMain = xChartMainTop.getChild("chart_window") xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0") - self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramArea"})) - xDialog = self.xUITest.getTopFocusWindow() - #Click on tab "Borders". - tabcontrol = xDialog.getChild("tabcontrol") - select_pos(tabcontrol, "0") + with self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramArea"})) as xDialog: + #Click on tab "Borders". + tabcontrol = xDialog.getChild("tabcontrol") + select_pos(tabcontrol, "0") - xWidth = xDialog.getChild("MTR_FLD_LINE_WIDTH") - transparency = xDialog.getChild("MTR_LINE_TRANSPARENT") + xWidth = xDialog.getChild("MTR_FLD_LINE_WIDTH") + transparency = xDialog.getChild("MTR_LINE_TRANSPARENT") - xWidth.executeAction("UP", tuple()) - transparency.executeAction("UP", tuple()) + xWidth.executeAction("UP", tuple()) + transparency.executeAction("UP", tuple()) - xOKBtn = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOKBtn) self.assertEqual(xArea.LineWidth, 100) self.assertEqual(xArea.LineTransparence, 5) @@ -60,43 +57,40 @@ class chartArea(UITestCase): xChartMainTop = self.xUITest.getTopFocusWindow() xChartMain = xChartMainTop.getChild("chart_window") xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0") - self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramArea"})) - xDialog = self.xUITest.getTopFocusWindow() - - tabcontrol = xDialog.getChild("tabcontrol") - select_pos(tabcontrol, "0") - xWidth = xDialog.getChild("MTR_FLD_LINE_WIDTH") - transparency = xDialog.getChild("MTR_LINE_TRANSPARENT") - - self.assertEqual(get_state_as_dict(xWidth)["Text"], "0.10 cm") - self.assertEqual(get_state_as_dict(transparency)["Text"], "5%") - - #Click on tab "Area" - tabcontrol = xDialog.getChild("tabcontrol") - select_pos(tabcontrol, "1") - - btncolor = xDialog.getChild("btncolor") - btncolor.executeAction("CLICK", tuple()) - - rCustom = xDialog.getChild("R_custom") - gCustom = xDialog.getChild("G_custom") - bCustom = xDialog.getChild("B_custom") - - rCustom.executeAction("CLEAR", tuple()) - rCustom.executeAction("TYPE", mkPropertyValues({"TEXT":"35"})) - rCustom.executeAction("UP", tuple()) - rCustom.executeAction("DOWN", tuple()) #without this save data doesn't works - self.assertEqual(get_state_as_dict(rCustom)["Text"], "35") - gCustom.executeAction("CLEAR", tuple()) - gCustom.executeAction("TYPE", mkPropertyValues({"TEXT":"169"})) - gCustom.executeAction("UP", tuple()) - gCustom.executeAction("DOWN", tuple()) #without this save data doesn't works - bCustom.executeAction("CLEAR", tuple()) - bCustom.executeAction("TYPE", mkPropertyValues({"TEXT":"211"})) - bCustom.executeAction("UP", tuple()) - bCustom.executeAction("DOWN", tuple()) #without this save data doesn't works - xOKBtn = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOKBtn) + with self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramArea"})) as xDialog: + + tabcontrol = xDialog.getChild("tabcontrol") + select_pos(tabcontrol, "0") + xWidth = xDialog.getChild("MTR_FLD_LINE_WIDTH") + transparency = xDialog.getChild("MTR_LINE_TRANSPARENT") + + self.assertEqual(get_state_as_dict(xWidth)["Text"], "0.10 cm") + self.assertEqual(get_state_as_dict(transparency)["Text"], "5%") + + #Click on tab "Area" + tabcontrol = xDialog.getChild("tabcontrol") + select_pos(tabcontrol, "1") + + btncolor = xDialog.getChild("btncolor") + btncolor.executeAction("CLICK", tuple()) + + rCustom = xDialog.getChild("R_custom") + gCustom = xDialog.getChild("G_custom") + bCustom = xDialog.getChild("B_custom") + + rCustom.executeAction("CLEAR", tuple()) + rCustom.executeAction("TYPE", mkPropertyValues({"TEXT":"35"})) + rCustom.executeAction("UP", tuple()) + rCustom.executeAction("DOWN", tuple()) #without this save data doesn't works + self.assertEqual(get_state_as_dict(rCustom)["Text"], "35") + gCustom.executeAction("CLEAR", tuple()) + gCustom.executeAction("TYPE", mkPropertyValues({"TEXT":"169"})) + gCustom.executeAction("UP", tuple()) + gCustom.executeAction("DOWN", tuple()) #without this save data doesn't works + bCustom.executeAction("CLEAR", tuple()) + bCustom.executeAction("TYPE", mkPropertyValues({"TEXT":"211"})) + bCustom.executeAction("UP", tuple()) + bCustom.executeAction("DOWN", tuple()) #without this save data doesn't works self.assertEqual(xArea.LineWidth, 100) self.assertEqual(xArea.LineTransparence, 5) @@ -109,30 +103,27 @@ class chartArea(UITestCase): xChartMainTop = self.xUITest.getTopFocusWindow() xChartMain = xChartMainTop.getChild("chart_window") xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0") - self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramArea"})) - xDialog = self.xUITest.getTopFocusWindow() + with self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramArea"})) as xDialog: - tabcontrol = xDialog.getChild("tabcontrol") - select_pos(tabcontrol, "1") + tabcontrol = xDialog.getChild("tabcontrol") + select_pos(tabcontrol, "1") - rCustom = xDialog.getChild("R_custom") - gCustom = xDialog.getChild("G_custom") - bCustom = xDialog.getChild("B_custom") + rCustom = xDialog.getChild("R_custom") + gCustom = xDialog.getChild("G_custom") + bCustom = xDialog.getChild("B_custom") - self.assertEqual(get_state_as_dict(rCustom)["Text"], "35") - self.assertEqual(get_state_as_dict(gCustom)["Text"], "169") - self.assertEqual(get_state_as_dict(bCustom)["Text"], "211") + self.assertEqual(get_state_as_dict(rCustom)["Text"], "35") + self.assertEqual(get_state_as_dict(gCustom)["Text"], "169") + self.assertEqual(get_state_as_dict(bCustom)["Text"], "211") - #change tab "Transparency" - select_pos(tabcontrol, "2") - transparency = xDialog.getChild("RBT_TRANS_LINEAR") - transparencyPercent = xDialog.getChild("MTR_TRANSPARENT") #51% + #change tab "Transparency" + select_pos(tabcontrol, "2") + transparency = xDialog.getChild("RBT_TRANS_LINEAR") + transparencyPercent = xDialog.getChild("MTR_TRANSPARENT") #51% - transparency.executeAction("CLICK", tuple()) - transparencyPercent.executeAction("UP", tuple()) + transparency.executeAction("CLICK", tuple()) + transparencyPercent.executeAction("UP", tuple()) - xOKBtn = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOKBtn) self.assertEqual(xArea.LineWidth, 100) self.assertEqual(xArea.LineTransparence, 5) @@ -145,20 +136,17 @@ class chartArea(UITestCase): xChartMainTop = self.xUITest.getTopFocusWindow() xChartMain = xChartMainTop.getChild("chart_window") xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0") - self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramArea"})) - xDialog = self.xUITest.getTopFocusWindow() + with self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramArea"})) as xDialog: - tabcontrol = xDialog.getChild("tabcontrol") - select_pos(tabcontrol, "2") + tabcontrol = xDialog.getChild("tabcontrol") + select_pos(tabcontrol, "2") - transparency = xDialog.getChild("RBT_TRANS_LINEAR") - transparencyPercent = xDialog.getChild("MTR_TRANSPARENT") #51% + transparency = xDialog.getChild("RBT_TRANS_LINEAR") + transparencyPercent = xDialog.getChild("MTR_TRANSPARENT") #51% - self.assertEqual(get_state_as_dict(transparency)["Checked"], "true") - self.assertEqual(get_state_as_dict(transparencyPercent)["Text"], "51%") + self.assertEqual(get_state_as_dict(transparency)["Checked"], "true") + self.assertEqual(get_state_as_dict(transparencyPercent)["Text"], "51%") - xOKBtn = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOKBtn) self.assertEqual(xArea.LineWidth, 100) self.assertEqual(xArea.LineTransparence, 5) diff --git a/sc/qa/uitest/chart/chartAxes.py b/sc/qa/uitest/chart/chartAxes.py index 9b8db33aa4e7..e45b48309f13 100644 --- a/sc/qa/uitest/chart/chartAxes.py +++ b/sc/qa/uitest/chart/chartAxes.py @@ -25,21 +25,18 @@ class chartAxes(UITestCase): xChartMainTop = self.xUITest.getTopFocusWindow() xChartMain = xChartMainTop.getChild("chart_window") xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0") - self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "InsertMenuAxes"})) - xDialog = self.xUITest.getTopFocusWindow() + with self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "InsertMenuAxes"})) as xDialog: - primaryX = xDialog.getChild("primaryX") - primaryY = xDialog.getChild("primaryY") - secondaryX = xDialog.getChild("secondaryX") - secondaryY = xDialog.getChild("secondaryY") + primaryX = xDialog.getChild("primaryX") + primaryY = xDialog.getChild("primaryY") + secondaryX = xDialog.getChild("secondaryX") + secondaryY = xDialog.getChild("secondaryY") - primaryX.executeAction("CLICK", tuple()) - primaryY.executeAction("CLICK", tuple()) - secondaryX.executeAction("CLICK", tuple()) - secondaryY.executeAction("CLICK", tuple()) + primaryX.executeAction("CLICK", tuple()) + primaryY.executeAction("CLICK", tuple()) + secondaryX.executeAction("CLICK", tuple()) + secondaryY.executeAction("CLICK", tuple()) - xOKBtn = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOKBtn) #reopen and verify Grids dialog gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"})) @@ -47,20 +44,17 @@ class chartAxes(UITestCase): xChartMainTop = self.xUITest.getTopFocusWindow() xChartMain = xChartMainTop.getChild("chart_window") xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0") - self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "InsertMenuAxes"})) - xDialog = self.xUITest.getTopFocusWindow() + with self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "InsertMenuAxes"})) as xDialog: - primaryX = xDialog.getChild("primaryX") - primaryY = xDialog.getChild("primaryY") - secondaryX = xDialog.getChild("secondaryX") - secondaryY = xDialog.getChild("secondaryY") + primaryX = xDialog.getChild("primaryX") + primaryY = xDialog.getChild("primaryY") + secondaryX = xDialog.getChild("secondaryX") + secondaryY = xDialog.getChild("secondaryY") - self.assertEqual(get_state_as_dict(primaryX)["Selected"], "false") - self.assertEqual(get_state_as_dict(primaryY)["Selected"], "false") - self.assertEqual(get_state_as_dict(secondaryX)["Selected"], "true") - self.assertEqual(get_state_as_dict(secondaryY)["Selected"], "true") + self.assertEqual(get_state_as_dict(primaryX)["Selected"], "false") + self.assertEqual(get_state_as_dict(primaryY)["Selected"], "false") + self.assertEqual(get_state_as_dict(secondaryX)["Selected"], "true") + self.assertEqual(get_state_as_dict(secondaryY)["Selected"], "true") - xOKBtn = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOKBtn) # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/chart/chartDataLabels.py b/sc/qa/uitest/chart/chartDataLabels.py index 0d5bae2f0333..bbf82bab76f3 100644 --- a/sc/qa/uitest/chart/chartDataLabels.py +++ b/sc/qa/uitest/chart/chartDataLabels.py @@ -36,38 +36,35 @@ class chartDataLabels(UITestCase): self.assertFalse(xDataSeries[0].Label.ShowLegendSymbol) self.assertEqual(xDataSeries[0].LabelSeparator, " ") - self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "InsertMenuDataLabels"})) - xDialog = self.xUITest.getTopFocusWindow() + with self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "InsertMenuDataLabels"})) as xDialog: - xTabs = xDialog.getChild("tabcontrol") - select_pos(xTabs, "1") + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "1") - self.assertTrue(xDataSeries[0].Label.ShowNumber) - self.assertFalse(xDataSeries[0].Label.ShowCategoryName) - self.assertFalse(xDataSeries[0].Label.ShowLegendSymbol) - self.assertEqual(xDataSeries[0].LabelSeparator, " ") + self.assertTrue(xDataSeries[0].Label.ShowNumber) + self.assertFalse(xDataSeries[0].Label.ShowCategoryName) + self.assertFalse(xDataSeries[0].Label.ShowLegendSymbol) + self.assertEqual(xDataSeries[0].LabelSeparator, " ") - valueAsNumber = xDialog.getChild("CB_VALUE_AS_NUMBER") - category = xDialog.getChild("CB_CATEGORY") - legend = xDialog.getChild("CB_SYMBOL") - wrapText = xDialog.getChild("CB_WRAP_TEXT") - separator = xDialog.getChild("LB_TEXT_SEPARATOR") - placement = xDialog.getChild("LB_LABEL_PLACEMENT") - degrees = xDialog.getChild("NF_LABEL_DEGREES") - textDirection = xDialog.getChild("LB_LABEL_TEXTDIR") + valueAsNumber = xDialog.getChild("CB_VALUE_AS_NUMBER") + category = xDialog.getChild("CB_CATEGORY") + legend = xDialog.getChild("CB_SYMBOL") + wrapText = xDialog.getChild("CB_WRAP_TEXT") + separator = xDialog.getChild("LB_TEXT_SEPARATOR") + placement = xDialog.getChild("LB_LABEL_PLACEMENT") + degrees = xDialog.getChild("NF_LABEL_DEGREES") + textDirection = xDialog.getChild("LB_LABEL_TEXTDIR") - #valueAsNumber.executeAction("CLICK", tuple()) - category.executeAction("CLICK", tuple()) - legend.executeAction("CLICK", tuple()) - wrapText.executeAction("CLICK", tuple()) - select_by_text(separator, "Comma") + #valueAsNumber.executeAction("CLICK", tuple()) + category.executeAction("CLICK", tuple()) + legend.executeAction("CLICK", tuple()) + wrapText.executeAction("CLICK", tuple()) + select_by_text(separator, "Comma") - select_by_text(placement, "Below") - degrees.executeAction("UP", tuple()) - select_by_text(textDirection, "Right-to-left") + select_by_text(placement, "Below") + degrees.executeAction("UP", tuple()) + select_by_text(textDirection, "Right-to-left") - xOKBtn = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOKBtn) self.assertTrue(xDataSeries[0].Label.ShowNumber) self.assertTrue(xDataSeries[0].Label.ShowCategoryName) @@ -80,37 +77,34 @@ class chartDataLabels(UITestCase): xChartMainTop = self.xUITest.getTopFocusWindow() xChartMain = xChartMainTop.getChild("chart_window") xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0") - self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "InsertMenuDataLabels"})) - xDialog = self.xUITest.getTopFocusWindow() - - xTabs = xDialog.getChild("tabcontrol") - select_pos(xTabs, "1") - - self.assertTrue(xDataSeries[0].Label.ShowNumber) - self.assertTrue(xDataSeries[0].Label.ShowCategoryName) - self.assertTrue(xDataSeries[0].Label.ShowLegendSymbol) - self.assertEqual(xDataSeries[0].LabelSeparator, ", ") + with self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "InsertMenuDataLabels"})) as xDialog: + + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "1") + + self.assertTrue(xDataSeries[0].Label.ShowNumber) + self.assertTrue(xDataSeries[0].Label.ShowCategoryName) + self.assertTrue(xDataSeries[0].Label.ShowLegendSymbol) + self.assertEqual(xDataSeries[0].LabelSeparator, ", ") + + valueAsNumber = xDialog.getChild("CB_VALUE_AS_NUMBER") + category = xDialog.getChild("CB_CATEGORY") + legend = xDialog.getChild("CB_SYMBOL") + wrapText = xDialog.getChild("CB_WRAP_TEXT") + separator = xDialog.getChild("LB_TEXT_SEPARATOR") + placement = xDialog.getChild("LB_LABEL_PLACEMENT") + degrees = xDialog.getChild("NF_LABEL_DEGREES") + textDirection = xDialog.getChild("LB_LABEL_TEXTDIR") + + self.assertEqual(get_state_as_dict(valueAsNumber)["Selected"], "true") + self.assertEqual(get_state_as_dict(category)["Selected"], "true") + self.assertEqual(get_state_as_dict(legend)["Selected"], "true") + self.assertEqual(get_state_as_dict(wrapText)["Selected"], "true") + self.assertEqual(get_state_as_dict(separator)["SelectEntryText"], "Comma") + self.assertEqual(get_state_as_dict(placement)["SelectEntryText"], "Below") + self.assertEqual(get_state_as_dict(degrees)["Text"], "1°") + self.assertEqual(get_state_as_dict(textDirection)["SelectEntryText"], "Right-to-left") - valueAsNumber = xDialog.getChild("CB_VALUE_AS_NUMBER") - category = xDialog.getChild("CB_CATEGORY") - legend = xDialog.getChild("CB_SYMBOL") - wrapText = xDialog.getChild("CB_WRAP_TEXT") - separator = xDialog.getChild("LB_TEXT_SEPARATOR") - placement = xDialog.getChild("LB_LABEL_PLACEMENT") - degrees = xDialog.getChild("NF_LABEL_DEGREES") - textDirection = xDialog.getChild("LB_LABEL_TEXTDIR") - - self.assertEqual(get_state_as_dict(valueAsNumber)["Selected"], "true") - self.assertEqual(get_state_as_dict(category)["Selected"], "true") - self.assertEqual(get_state_as_dict(legend)["Selected"], "true") - self.assertEqual(get_state_as_dict(wrapText)["Selected"], "true") - self.assertEqual(get_state_as_dict(separator)["SelectEntryText"], "Comma") - self.assertEqual(get_state_as_dict(placement)["SelectEntryText"], "Below") - self.assertEqual(get_state_as_dict(degrees)["Text"], "1°") - self.assertEqual(get_state_as_dict(textDirection)["SelectEntryText"], "Right-to-left") - - xOKBtn = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOKBtn) self.assertTrue(xDataSeries[0].Label.ShowNumber) self.assertTrue(xDataSeries[0].Label.ShowCategoryName) @@ -134,51 +128,48 @@ class chartDataLabels(UITestCase): self.assertFalse(xDataSeries[0].Label.ShowNumberInPercent) self.assertIsNone(xDataSeries[0].PercentageNumberFormat) - self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "FormatDataLabels"})) - xDialog = self.xUITest.getTopFocusWindow() + with self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "FormatDataLabels"})) as xDialog: + + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "1") + + self.assertTrue(xDataSeries[0].Label.ShowNumber) + self.assertFalse(xDataSeries[0].Label.ShowNumberInPercent) + self.assertIsNone(xDataSeries[0].PercentageNumberFormat) + + valueAsNumber = xDialog.getChild("CB_VALUE_AS_NUMBER") + valueAsPercentage = xDialog.getChild("CB_VALUE_AS_PERCENTAGE") + category = xDialog.getChild("CB_CATEGORY") + legend = xDialog.getChild("CB_SYMBOL") + wrapText = xDialog.getChild("CB_WRAP_TEXT") + separator = xDialog.getChild("LB_TEXT_SEPARATOR") + placement = xDialog.getChild("LB_LABEL_PLACEMENT") + degrees = xDialog.getChild("NF_LABEL_DEGREES") + textDirection = xDialog.getChild("LB_LABEL_TEXTDIR") + buttonPercentage = xDialog.getChild("PB_PERCENT_NUMBERFORMAT") + + valueAsNumber.executeAction("CLICK", tuple()) + valueAsPercentage.executeAction("CLICK", tuple()) + #button Percentage format + + with self.ui_test.execute_blocking_action(buttonPercentage.executeAction, args=('CLICK', ())) as dialog: + sourceformat = dialog.getChild("sourceformat") + decimalsed = dialog.getChild("decimalsed") + leadzerosed = dialog.getChild("leadzerosed") + negnumred = dialog.getChild("negnumred") + thousands = dialog.getChild("thousands") + formatted = dialog.getChild("formatted") + + sourceformat.executeAction("CLICK", tuple()) + decimalsed.executeAction("UP", tuple()) + leadzerosed.executeAction("UP", tuple()) + negnumred.executeAction("CLICK", tuple()) + thousands.executeAction("CLICK", tuple()) + self.assertEqual(get_state_as_dict(formatted)["Text"], "#,#00.0%;[RED]-#,#00.0%") + + self.assertEqual(get_state_as_dict(valueAsNumber)["Selected"], "false") + self.assertEqual(get_state_as_dict(valueAsPercentage)["Selected"], "true") - xTabs = xDialog.getChild("tabcontrol") - select_pos(xTabs, "1") - - self.assertTrue(xDataSeries[0].Label.ShowNumber) - self.assertFalse(xDataSeries[0].Label.ShowNumberInPercent) - self.assertIsNone(xDataSeries[0].PercentageNumberFormat) - - valueAsNumber = xDialog.getChild("CB_VALUE_AS_NUMBER") - valueAsPercentage = xDialog.getChild("CB_VALUE_AS_PERCENTAGE") - category = xDialog.getChild("CB_CATEGORY") - legend = xDialog.getChild("CB_SYMBOL") - wrapText = xDialog.getChild("CB_WRAP_TEXT") - separator = xDialog.getChild("LB_TEXT_SEPARATOR") - placement = xDialog.getChild("LB_LABEL_PLACEMENT") - degrees = xDialog.getChild("NF_LABEL_DEGREES") - textDirection = xDialog.getChild("LB_LABEL_TEXTDIR") - buttonPercentage = xDialog.getChild("PB_PERCENT_NUMBERFORMAT") - - valueAsNumber.executeAction("CLICK", tuple()) - valueAsPercentage.executeAction("CLICK", tuple()) - #button Percentage format - - with self.ui_test.execute_blocking_action(buttonPercentage.executeAction, args=('CLICK', ())) as dialog: - sourceformat = dialog.getChild("sourceformat") - decimalsed = dialog.getChild("decimalsed") - leadzerosed = dialog.getChild("leadzerosed") - negnumred = dialog.getChild("negnumred") - thousands = dialog.getChild("thousands") - formatted = dialog.getChild("formatted") - - sourceformat.executeAction("CLICK", tuple()) - decimalsed.executeAction("UP", tuple()) - leadzerosed.executeAction("UP", tuple()) - negnumred.executeAction("CLICK", tuple()) - thousands.executeAction("CLICK", tuple()) - self.assertEqual(get_state_as_dict(formatted)["Text"], "#,#00.0%;[RED]-#,#00.0%") - - self.assertEqual(get_state_as_dict(valueAsNumber)["Selected"], "false") - self.assertEqual(get_state_as_dict(valueAsPercentage)["Selected"], "true") - - xOKBtn = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOKBtn) xNumberFormats = document.Sheets[0].Charts[0].getEmbeddedObject().getNumberFormats() xLocale = Locale('en', 'US', '') @@ -194,32 +185,29 @@ class chartDataLabels(UITestCase): xChartMainTop = self.xUITest.getTopFocusWindow() xChartMain = xChartMainTop.getChild("chart_window") xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0") - self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "FormatDataLabels"})) - xDialog = self.xUITest.getTopFocusWindow() + with self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "FormatDataLabels"})) as xDialog: - xTabs = xDialog.getChild("tabcontrol") - select_pos(xTabs, "1") + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "1") - self.assertFalse(xDataSeries[0].Label.ShowNumber) - self.assertTrue(xDataSeries[0].Label.ShowNumberInPercent) - self.assertEqual(xDataSeries[0].PercentageNumberFormat, xFormat) + self.assertFalse(xDataSeries[0].Label.ShowNumber) + self.assertTrue(xDataSeries[0].Label.ShowNumberInPercent) + self.assertEqual(xDataSeries[0].PercentageNumberFormat, xFormat) - valueAsNumber = xDialog.getChild("CB_VALUE_AS_NUMBER") - valueAsPercentage = xDialog.getChild("CB_VALUE_AS_PERCENTAGE") - category = xDialog.getChild("CB_CATEGORY") - legend = xDialog.getChild("CB_SYMBOL") - wrapText = xDialog.getChild("CB_WRAP_TEXT") - separator = xDialog.getChild("LB_TEXT_SEPARATOR") - placement = xDialog.getChild("LB_LABEL_PLACEMENT") - degrees = xDialog.getChild("NF_LABEL_DEGREES") - textDirection = xDialog.getChild("LB_LABEL_TEXTDIR") - buttonPercentage = xDialog.getChild("PB_PERCENT_NUMBERFORMAT") + valueAsNumber = xDialog.getChild("CB_VALUE_AS_NUMBER") + valueAsPercentage = xDialog.getChild("CB_VALUE_AS_PERCENTAGE") + category = xDialog.getChild("CB_CATEGORY") + legend = xDialog.getChild("CB_SYMBOL") + wrapText = xDialog.getChild("CB_WRAP_TEXT") + separator = xDialog.getChild("LB_TEXT_SEPARATOR") + placement = xDialog.getChild("LB_LABEL_PLACEMENT") + degrees = xDialog.getChild("NF_LABEL_DEGREES") + textDirection = xDialog.getChild("LB_LABEL_TEXTDIR") + buttonPercentage = xDialog.getChild("PB_PERCENT_NUMBERFORMAT") - self.assertEqual(get_state_as_dict(valueAsNumber)["Selected"], "false") - self.assertEqual(get_state_as_dict(valueAsPercentage)["Selected"], "true") + self.assertEqual(get_state_as_dict(valueAsNumber)["Selected"], "false") + self.assertEqual(get_state_as_dict(valueAsPercentage)["Selected"], "true") - xOKBtn = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOKBtn) self.assertFalse(xDataSeries[0].Label.ShowNumber) self.assertTrue(xDataSeries[0].Label.ShowNumberInPercent) @@ -241,32 +229,29 @@ class chartDataLabels(UITestCase): self.assertTrue(xDataSeries[0].Label.ShowNumber) self.assertFalse(xDataSeries[0].Label.ShowNumberInPercent) - self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "FormatDataLabels"})) - xDialog = self.xUITest.getTopFocusWindow() + with self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "FormatDataLabels"})) as xDialog: - xTabs = xDialog.getChild("tabcontrol") - select_pos(xTabs, "1") + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "1") - self.assertTrue(xDataSeries[0].Label.ShowNumber) - self.assertFalse(xDataSeries[0].Label.ShowNumberInPercent) + self.assertTrue(xDataSeries[0].Label.ShowNumber) + self.assertFalse(xDataSeries[0].Label.ShowNumberInPercent) - xNumberFormatBtn = xDialog.getChild("PB_NUMBERFORMAT") + xNumberFormatBtn = xDialog.getChild("PB_NUMBERFORMAT") - with self.ui_test.execute_blocking_action(xNumberFormatBtn.executeAction, args=('CLICK', ())) as dialog: - categoryformat = dialog.getChild("categorylb") - formatted = dialog.getChild("formatted") - sourceformat = dialog.getChild("sourceformat") + with self.ui_test.execute_blocking_action(xNumberFormatBtn.executeAction, args=('CLICK', ())) as dialog: + categoryformat = dialog.getChild("categorylb") + formatted = dialog.getChild("formatted") + sourceformat = dialog.getChild("sourceformat") - # Select currency - sourceformat.executeAction("CLICK", tuple()); - categoryformat.getChild("4").executeAction("SELECT", tuple()); + # Select currency + sourceformat.executeAction("CLICK", tuple()); + categoryformat.getChild("4").executeAction("SELECT", tuple()); - self.assertEqual(get_state_as_dict(categoryformat)["SelectEntryText"], "Currency") + self.assertEqual(get_state_as_dict(categoryformat)["SelectEntryText"], "Currency") - self.assertEqual(get_state_as_dict(formatted)["Text"], "[$$-409]#,##0.00;[RED]-[$$-409]#,##0.00") + self.assertEqual(get_state_as_dict(formatted)["Text"], "[$$-409]#,##0.00;[RED]-[$$-409]#,##0.00") - xOKBtn = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOKBtn) xNumberFormats = document.Sheets[0].Charts[0].getEmbeddedObject().getNumberFormats() xLocale = Locale() @@ -277,16 +262,13 @@ class chartDataLabels(UITestCase): self.assertEqual(xDataSeries[0].NumberFormat, xFormat) #reopen and verify the previous changes - self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "FormatDataLabels"})) - xDialog = self.xUITest.getTopFocusWindow() + with self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "FormatDataLabels"})) as xDialog: - self.assertTrue(xDataSeries[0].Label.ShowNumber) - self.assertFalse(xDataSeries[0].Label.ShowNumberInPercent) - # tdf#131291: it would fail here: AssertionError: 0 != 104 - self.assertEqual(xDataSeries[0].NumberFormat, xFormat) + self.assertTrue(xDataSeries[0].Label.ShowNumber) + self.assertFalse(xDataSeries[0].Label.ShowNumberInPercent) + # tdf#131291: it would fail here: AssertionError: 0 != 104 + self.assertEqual(xDataSeries[0].NumberFormat, xFormat) - xOKBtn = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOKBtn) self.assertTrue(xDataSeries[0].Label.ShowNumber) self.assertFalse(xDataSeries[0].Label.ShowNumberInPercent) @@ -308,27 +290,21 @@ class chartDataLabels(UITestCase): xDataLabel = xChartMain.getChild("CID/MultiClick/CID/D=0:CS=0:CT=0:Series=0:DataLabels=:DataLabel=0") xDataLabel.executeAction("SELECT", tuple()) - self.ui_test.execute_dialog_through_action(xDataLabel, "COMMAND", mkPropertyValues({"COMMAND": "TransformDialog"})) + with self.ui_test.execute_dialog_through_action(xDataLabel, "COMMAND", mkPropertyValues({"COMMAND": "TransformDialog"})) as xDialog: - xDialog = self.xUITest.getTopFocusWindow() - self.assertEqual("0.5", get_state_as_dict(xDialog.getChild("MTR_FLD_POS_X"))['Value']) - self.assertEqual("2.89", get_state_as_dict(xDialog.getChild("MTR_FLD_POS_Y"))['Value']) + self.assertEqual("0.5", get_state_as_dict(xDialog.getChild("MTR_FLD_POS_X"))['Value']) + self.assertEqual("2.89", get_state_as_dict(xDialog.getChild("MTR_FLD_POS_Y"))['Value']) - # Use OK button in order to test tdf#137165 - xOkBtn = xDialog.getChild("ok") - xOkBtn.executeAction("CLICK", tuple()) + # Use OK button in order to test tdf#137165 xChartMain.executeAction("TYPE", mkPropertyValues({"KEYCODE": "UP"})) xChartMain.executeAction("TYPE", mkPropertyValues({"KEYCODE": "LEFT"})) - self.ui_test.execute_dialog_through_action(xDataLabel, "COMMAND", mkPropertyValues({"COMMAND": "TransformDialog"})) + with self.ui_test.execute_dialog_through_action(xDataLabel, "COMMAND", mkPropertyValues({"COMMAND": "TransformDialog"})) as xDialog: - # Check the position has changed after moving the label using the arrows keys - xDialog = self.xUITest.getTopFocusWindow() - self.assertEqual("0.4", get_state_as_dict(xDialog.getChild("MTR_FLD_POS_X"))['Value']) - self.assertEqual("2.79", get_state_as_dict(xDialog.getChild("MTR_FLD_POS_Y"))['Value']) + # Check the position has changed after moving the label using the arrows keys + self.assertEqual("0.4", get_state_as_dict(xDialog.getChild("MTR_FLD_POS_X"))['Value']) + self.assertEqual("2.79", get_state_as_dict(xDialog.getChild("MTR_FLD_POS_Y"))['Value']) - xOkBtn = xDialog.getChild("ok") - xOkBtn.executeAction("CLICK", tuple()) # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/chart/chartGrid.py b/sc/qa/uitest/chart/chartGrid.py index 7b9814194e51..cbc91f264f6b 100644 --- a/sc/qa/uitest/chart/chartGrid.py +++ b/sc/qa/uitest/chart/chartGrid.py @@ -30,20 +30,17 @@ class chartGrid(UITestCase): xChartMainTop = self.xUITest.getTopFocusWindow() xChartMain = xChartMainTop.getChild("chart_window") xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0") - self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramGridYMain"})) - xDialog = self.xUITest.getTopFocusWindow() - #tab "Line". - tabcontrol = xDialog.getChild("tabcontrol") - select_pos(tabcontrol, "0") + with self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramGridYMain"})) as xDialog: + #tab "Line". + tabcontrol = xDialog.getChild("tabcontrol") + select_pos(tabcontrol, "0") - xWidth = xDialog.getChild("MTR_FLD_LINE_WIDTH") - transparency = xDialog.getChild("MTR_LINE_TRANSPARENT") + xWidth = xDialog.getChild("MTR_FLD_LINE_WIDTH") + transparency = xDialog.getChild("MTR_LINE_TRANSPARENT") - xWidth.executeAction("UP", tuple()) - transparency.executeAction("UP", tuple()) + xWidth.executeAction("UP", tuple()) + transparency.executeAction("UP", tuple()) - xOKBtn = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOKBtn) #reopen and verify X Axis Major Grid gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"})) @@ -51,18 +48,15 @@ class chartGrid(UITestCase): xChartMainTop = self.xUITest.getTopFocusWindow() xChartMain = xChartMainTop.getChild("chart_window") xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0") - self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramGridYMain"})) - xDialog = self.xUITest.getTopFocusWindow() + with self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramGridYMain"})) as xDialog: - tabcontrol = xDialog.getChild("tabcontrol") - select_pos(tabcontrol, "0") - xWidth = xDialog.getChild("MTR_FLD_LINE_WIDTH") - transparency = xDialog.getChild("MTR_LINE_TRANSPARENT") + tabcontrol = xDialog.getChild("tabcontrol") + select_pos(tabcontrol, "0") + xWidth = xDialog.getChild("MTR_FLD_LINE_WIDTH") + transparency = xDialog.getChild("MTR_LINE_TRANSPARENT") - self.assertEqual(get_state_as_dict(xWidth)["Text"], "0.10 cm") - self.assertEqual(get_state_as_dict(transparency)["Text"], "5%") - xOKBtn = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOKBtn) + self.assertEqual(get_state_as_dict(xWidth)["Text"], "0.10 cm") + self.assertEqual(get_state_as_dict(transparency)["Text"], "5%") #Y Axis Major Grid gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"})) @@ -70,20 +64,17 @@ class chartGrid(UITestCase): xChartMainTop = self.xUITest.getTopFocusWindow() xChartMain = xChartMainTop.getChild("chart_window") xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0") - self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramGridXMain"})) - xDialog = self.xUITest.getTopFocusWindow() + with self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramGridXMain"})) as xDialog: - tabcontrol = xDialog.getChild("tabcontrol") - select_pos(tabcontrol, "0") + tabcontrol = xDialog.getChild("tabcontrol") + select_pos(tabcontrol, "0") - xWidth = xDialog.getChild("MTR_FLD_LINE_WIDTH") - transparency = xDialog.getChild("MTR_LINE_TRANSPARENT") + xWidth = xDialog.getChild("MTR_FLD_LINE_WIDTH") + transparency = xDialog.getChild("MTR_LINE_TRANSPARENT") - xWidth.executeAction("UP", tuple()) - transparency.executeAction("UP", tuple()) + xWidth.executeAction("UP", tuple()) + transparency.executeAction("UP", tuple()) - xOKBtn = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOKBtn) #reopen and verify Y Axis Major Grid gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"})) @@ -91,20 +82,17 @@ class chartGrid(UITestCase): xChartMainTop = self.xUITest.getTopFocusWindow() xChartMain = xChartMainTop.getChild("chart_window") xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0") - self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramGridXMain"})) - xDialog = self.xUITest.getTopFocusWindow() + with self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramGridXMain"})) as xDialog: - tabcontrol = xDialog.getChild("tabcontrol") - select_pos(tabcontrol, "0") + tabcontrol = xDialog.getChild("tabcontrol") + select_pos(tabcontrol, "0") - xWidth = xDialog.getChild("MTR_FLD_LINE_WIDTH") - transparency = xDialog.getChild("MTR_LINE_TRANSPARENT") + xWidth = xDialog.getChild("MTR_FLD_LINE_WIDTH") + transparency = xDialog.getChild("MTR_LINE_TRANSPARENT") - self.assertEqual(get_state_as_dict(xWidth)["Text"], "0.10 cm") - self.assertEqual(get_state_as_dict(transparency)["Text"], "5%") + self.assertEqual(get_state_as_dict(xWidth)["Text"], "0.10 cm") + self.assertEqual(get_state_as_dict(transparency)["Text"], "5%") - xOKBtn = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOKBtn) #Y Axis Minor Grid gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"})) @@ -112,20 +100,17 @@ class chartGrid(UITestCase): xChartMainTop = self.xUITest.getTopFocusWindow() xChartMain = xChartMainTop.getChild("chart_window") xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0") - self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramGridXHelp"})) - xDialog = self.xUITest.getTopFocusWindow() + with self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramGridXHelp"})) as xDialog: - tabcontrol = xDialog.getChild("tabcontrol") - select_pos(tabcontrol, "0") + tabcontrol = xDialog.getChild("tabcontrol") + select_pos(tabcontrol, "0") - xWidth = xDialog.getChild("MTR_FLD_LINE_WIDTH") - transparency = xDialog.getChild("MTR_LINE_TRANSPARENT") + xWidth = xDialog.getChild("MTR_FLD_LINE_WIDTH") + transparency = xDialog.getChild("MTR_LINE_TRANSPARENT") - xWidth.executeAction("UP", tuple()) - transparency.executeAction("UP", tuple()) + xWidth.executeAction("UP", tuple()) + transparency.executeAction("UP", tuple()) - xOKBtn = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOKBtn) #reopen and verify Y Axis Minor Grid gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"})) @@ -133,19 +118,16 @@ class chartGrid(UITestCase): xChartMainTop = self.xUITest.getTopFocusWindow() xChartMain = xChartMainTop.getChild("chart_window") xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0") - self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramGridXHelp"})) - xDialog = self.xUITest.getTopFocusWindow() + with self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramGridXHelp"})) as xDialog: - tabcontrol = xDialog.getChild("tabcontrol") - select_pos(tabcontrol, "0") - xWidth = xDialog.getChild("MTR_FLD_LINE_WIDTH") - transparency = xDialog.getChild("MTR_LINE_TRANSPARENT") + tabcontrol = xDialog.getChild("tabcontrol") + select_pos(tabcontrol, "0") + xWidth = xDialog.getChild("MTR_FLD_LINE_WIDTH") + transparency = xDialog.getChild("MTR_LINE_TRANSPARENT") - self.assertEqual(get_state_as_dict(xWidth)["Text"], "0.10 cm") - self.assertEqual(get_state_as_dict(transparency)["Text"], "5%") + self.assertEqual(get_state_as_dict(xWidth)["Text"], "0.10 cm") + self.assertEqual(get_state_as_dict(transparency)["Text"], "5%") - xOKBtn = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOKBtn) #X Axis Minor Grid gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"})) @@ -153,20 +135,17 @@ class chartGrid(UITestCase): xChartMainTop = self.xUITest.getTopFocusWindow() xChartMain = xChartMainTop.getChild("chart_window") xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0") - self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramGridYHelp"})) - xDialog = self.xUITest.getTopFocusWindow() + with self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramGridYHelp"})) as xDialog: - tabcontrol = xDialog.getChild("tabcontrol") - select_pos(tabcontrol, "0") + tabcontrol = xDialog.getChild("tabcontrol") + select_pos(tabcontrol, "0") - xWidth = xDialog.getChild("MTR_FLD_LINE_WIDTH") - transparency = xDialog.getChild("MTR_LINE_TRANSPARENT") + xWidth = xDialog.getChild("MTR_FLD_LINE_WIDTH") + transparency = xDialog.getChild("MTR_LINE_TRANSPARENT") - xWidth.executeAction("UP", tuple()) - transparency.executeAction("UP", tuple()) + xWidth.executeAction("UP", tuple()) + transparency.executeAction("UP", tuple()) - xOKBtn = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOKBtn) #reopen and verify X Axis Minor Grid gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"})) @@ -174,19 +153,16 @@ class chartGrid(UITestCase): xChartMainTop = self.xUITest.getTopFocusWindow() xChartMain = xChartMainTop.getChild("chart_window") xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0") - self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramGridYHelp"})) - xDialog = self.xUITest.getTopFocusWindow() + with self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramGridYHelp"})) as xDialog: - tabcontrol = xDialog.getChild("tabcontrol") - select_pos(tabcontrol, "0") - xWidth = xDialog.getChild("MTR_FLD_LINE_WIDTH") - transparency = xDialog.getChild("MTR_LINE_TRANSPARENT") + tabcontrol = xDialog.getChild("tabcontrol") + select_pos(tabcontrol, "0") + xWidth = xDialog.getChild("MTR_FLD_LINE_WIDTH") + transparency = xDialog.getChild("MTR_LINE_TRANSPARENT") - self.assertEqual(get_state_as_dict(xWidth)["Text"], "0.10 cm") - self.assertEqual(get_state_as_dict(transparency)["Text"], "5%") + self.assertEqual(get_state_as_dict(xWidth)["Text"], "0.10 cm") + self.assertEqual(get_state_as_dict(transparency)["Text"], "5%") - xOKBtn = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOKBtn) #All Grids gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"})) @@ -194,20 +170,17 @@ class chartGrid(UITestCase): xChartMainTop = self.xUITest.getTopFocusWindow() xChartMain = xChartMainTop.getChild("chart_window") xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0") - self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramGridAll"})) - xDialog = self.xUITest.getTopFocusWindow() + with self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramGridAll"})) as xDialog: - tabcontrol = xDialog.getChild("tabcontrol") - select_pos(tabcontrol, "0") + tabcontrol = xDialog.getChild("tabcontrol") + select_pos(tabcontrol, "0") - xWidth = xDialog.getChild("MTR_FLD_LINE_WIDTH") - transparency = xDialog.getChild("MTR_LINE_TRANSPARENT") + xWidth = xDialog.getChild("MTR_FLD_LINE_WIDTH") + transparency = xDialog.getChild("MTR_LINE_TRANSPARENT") - xWidth.executeAction("UP", tuple()) - transparency.executeAction("UP", tuple()) + xWidth.executeAction("UP", tuple()) + transparency.executeAction("UP", tuple()) - xOKBtn = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOKBtn) #reopen and verify X Axis Minor Grid (changed in All Grids) gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"})) @@ -215,18 +188,15 @@ class chartGrid(UITestCase): xChartMainTop = self.xUITest.getTopFocusWindow() xChartMain = xChartMainTop.getChild("chart_window") xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0") - self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramGridYHelp"})) - xDialog = self.xUITest.getTopFocusWindow() + with self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramGridYHelp"})) as xDialog: - tabcontrol = xDialog.getChild("tabcontrol") - select_pos(tabcontrol, "0") - xWidth = xDialog.getChild("MTR_FLD_LINE_WIDTH") - transparency = xDialog.getChild("MTR_LINE_TRANSPARENT") + tabcontrol = xDialog.getChild("tabcontrol") + select_pos(tabcontrol, "0") + xWidth = xDialog.getChild("MTR_FLD_LINE_WIDTH") + transparency = xDialog.getChild("MTR_LINE_TRANSPARENT") - self.assertEqual(get_state_as_dict(xWidth)["Text"], "0.20 cm") - self.assertEqual(get_state_as_dict(transparency)["Text"], "10%") + self.assertEqual(get_state_as_dict(xWidth)["Text"], "0.20 cm") + self.assertEqual(get_state_as_dict(transparency)["Text"], "10%") - xOKBtn = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOKBtn) # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/chart/chartGrids.py b/sc/qa/uitest/chart/chartGrids.py index b1ffd01b0c49..e7548ba6e0f1 100644 --- a/sc/qa/uitest/chart/chartGrids.py +++ b/sc/qa/uitest/chart/chartGrids.py @@ -25,21 +25,18 @@ class chartGrids(UITestCase): xChartMainTop = self.xUITest.getTopFocusWindow() xChartMain = xChartMainTop.getChild("chart_window") xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0") - self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "InsertMenuGrids"})) - xDialog = self.xUITest.getTopFocusWindow() + with self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "InsertMenuGrids"})) as xDialog: - primaryX = xDialog.getChild("primaryX") - primaryY = xDialog.getChild("primaryY") - secondaryX = xDialog.getChild("secondaryX") - secondaryY = xDialog.getChild("secondaryY") + primaryX = xDialog.getChild("primaryX") + primaryY = xDialog.getChild("primaryY") + secondaryX = xDialog.getChild("secondaryX") + secondaryY = xDialog.getChild("secondaryY") - primaryX.executeAction("CLICK", tuple()) - primaryY.executeAction("CLICK", tuple()) - secondaryX.executeAction("CLICK", tuple()) - secondaryY.executeAction("CLICK", tuple()) + primaryX.executeAction("CLICK", tuple()) + primaryY.executeAction("CLICK", tuple()) + secondaryX.executeAction("CLICK", tuple()) + secondaryY.executeAction("CLICK", tuple()) - xOKBtn = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOKBtn) #reopen and verify Grids dialog gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"})) @@ -47,26 +44,23 @@ class chartGrids(UITestCase): xChartMainTop = self.xUITest.getTopFocusWindow() xChartMain = xChartMainTop.getChild("chart_window") xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0") - self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "InsertMenuGrids"})) - xDialog = self.xUITest.getTopFocusWindow() + with self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "InsertMenuGrids"})) as xDialog: - primaryX = xDialog.getChild("primaryX") - primaryY = xDialog.getChild("primaryY") - secondaryX = xDialog.getChild("secondaryX") - secondaryY = xDialog.getChild("secondaryY") + primaryX = xDialog.getChild("primaryX") + primaryY = xDialog.getChild("primaryY") + secondaryX = xDialog.getChild("secondaryX") + secondaryY = xDialog.getChild("secondaryY") - self.assertEqual(get_state_as_dict(primaryX)["Selected"], "false") - self.assertEqual(get_state_as_dict(primaryY)["Selected"], "false") - self.assertEqual(get_state_as_dict(secondaryX)["Selected"], "false") - self.assertEqual(get_state_as_dict(secondaryY)["Selected"], "false") + self.assertEqual(get_state_as_dict(primaryX)["Selected"], "false") + self.assertEqual(get_state_as_dict(primaryY)["Selected"], "false") + self.assertEqual(get_state_as_dict(secondaryX)["Selected"], "false") + self.assertEqual(get_state_as_dict(secondaryY)["Selected"], "false") - primaryX.executeAction("CLICK", tuple()) - primaryY.executeAction("CLICK", tuple()) - secondaryX.executeAction("CLICK", tuple()) - secondaryY.executeAction("CLICK", tuple()) + primaryX.executeAction("CLICK", tuple()) + primaryY.executeAction("CLICK", tuple()) + secondaryX.executeAction("CLICK", tuple()) + secondaryY.executeAction("CLICK", tuple()) - xOKBtn = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOKBtn) #reopen and verify Grids dialog gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"})) @@ -74,20 +68,17 @@ class chartGrids(UITestCase): xChartMainTop = self.xUITest.getTopFocusWindow() xChartMain = xChartMainTop.getChild("chart_window") xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0") - self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "InsertMenuGrids"})) - xDialog = self.xUITest.getTopFocusWindow() + with self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "InsertMenuGrids"})) as xDialog: - primaryX = xDialog.getChild("primaryX") - primaryY = xDialog.getChild("primaryY") - secondaryX = xDialog.getChild("secondaryX") - secondaryY = xDialog.getChild("secondaryY") + primaryX = xDialog.getChild("primaryX") + primaryY = xDialog.getChild("primaryY") + secondaryX = xDialog.getChild("secondaryX") + secondaryY = xDialog.getChild("secondaryY") - self.assertEqual(get_state_as_dict(primaryX)["Selected"], "true") - self.assertEqual(get_state_as_dict(primaryY)["Selected"], "true") - self.assertEqual(get_state_as_dict(secondaryX)["Selected"], "true") - self.assertEqual(get_state_as_dict(secondaryY)["Selected"], "true") + self.assertEqual(get_state_as_dict(primaryX)["Selected"], "true") + self.assertEqual(get_state_as_dict(primaryY)["Selected"], "true") + self.assertEqual(get_state_as_dict(secondaryX)["Selected"], "true") + self.assertEqual(get_state_as_dict(secondaryY)["Selected"], "true") - xOKBtn = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOKBtn) # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/chart/chartLegend.py b/sc/qa/uitest/chart/chartLegend.py index 54929c5c6c30..9128ad040a9a 100644 --- a/sc/qa/uitest/chart/chartLegend.py +++ b/sc/qa/uitest/chart/chartLegend.py @@ -11,7 +11,6 @@ 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, get_url_for_data_file, type_text -from uitest.uihelper import guarded #Chart Display Legend dialog @@ -27,7 +26,7 @@ class chartLegend(UITestCase): xChartMainTop = self.xUITest.getTopFocusWindow() xChartMain = xChartMainTop.getChild("chart_window") xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0") - with guarded.execute_dialog_through_action(self, xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "InsertMenuLegend"})) as xDialog: + with self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "InsertMenuLegend"})) as xDialog: left = xDialog.getChild("left") right = xDialog.getChild("right") top = xDialog.getChild("top") @@ -41,7 +40,7 @@ class chartLegend(UITestCase): xChartMainTop = self.xUITest.getTopFocusWindow() xChartMain = xChartMainTop.getChild("chart_window") xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0") - with guarded.execute_dialog_through_action(self, xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "InsertMenuLegend"})) as xDialog: + with self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "InsertMenuLegend"})) as xDialog: left = xDialog.getChild("left") right = xDialog.getChild("right") top = xDialog.getChild("top") @@ -61,7 +60,7 @@ class chartLegend(UITestCase): xChartMainTop = self.xUITest.getTopFocusWindow() xChartMain = xChartMainTop.getChild("chart_window") xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0") - with guarded.execute_dialog_through_action(self, xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "InsertMenuLegend"})) as xDialog: + with self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "InsertMenuLegend"})) as xDialog: left = xDialog.getChild("left") right = xDialog.getChild("right") top = xDialog.getChild("top") @@ -92,7 +91,7 @@ class chartLegend(UITestCase): xLegends = xChartMain.getChild("CID/D=0:Legend=") xLegends.executeAction("SELECT", tuple()) - with guarded.execute_dialog_through_action(self, xLegends, "COMMAND", mkPropertyValues({"COMMAND": "TransformDialog"})) as xDialog: + with self.ui_test.execute_dialog_through_action(xLegends, "COMMAND", mkPropertyValues({"COMMAND": "TransformDialog"})) as xDialog: self.assertEqual("4.61", get_state_as_dict(xDialog.getChild("MTR_FLD_POS_X"))['Value']) self.assertEqual("1.53", get_state_as_dict(xDialog.getChild("MTR_FLD_POS_Y"))['Value']) @@ -100,7 +99,7 @@ class chartLegend(UITestCase): xChartMain.executeAction("TYPE", mkPropertyValues({"KEYCODE": "LEFT"})) # Check the position has changed after moving the label using the arrows keys - with guarded.execute_dialog_through_action(self, xLegends, "COMMAND", mkPropertyValues({"COMMAND": "TransformDialog"})) as xDialog: + with self.ui_test.execute_dialog_through_action(xLegends, "COMMAND", mkPropertyValues({"COMMAND": "TransformDialog"})) as xDialog: self.assertEqual("4.51", get_state_as_dict(xDialog.getChild("MTR_FLD_POS_X"))['Value']) self.assertEqual("1.43", get_state_as_dict(xDialog.getChild("MTR_FLD_POS_Y"))['Value']) diff --git a/sc/qa/uitest/chart/chartTitles.py b/sc/qa/uitest/chart/chartTitles.py index 84f0878a22e8..c94823387ece 100644 --- a/sc/qa/uitest/chart/chartTitles.py +++ b/sc/qa/uitest/chart/chartTitles.py @@ -33,25 +33,22 @@ class chartTitles(UITestCase): xChartMainTop = self.xUITest.getTopFocusWindow() xChartMain = xChartMainTop.getChild("chart_window") xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0") - self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "InsertMenuTitles"})) - xDialog = self.xUITest.getTopFocusWindow() - - maintitle = xDialog.getChild("maintitle") - subtitle = xDialog.getChild("subtitle") - primaryXaxis = xDialog.getChild("primaryXaxis") - primaryYaxis = xDialog.getChild("primaryYaxis") - secondaryXaxis = xDialog.getChild("secondaryXaxis") - secondaryYaxis = xDialog.getChild("secondaryYaxis") - - maintitle.executeAction("TYPE", mkPropertyValues({"TEXT":"A"})) - subtitle.executeAction("TYPE", mkPropertyValues({"TEXT":"B"})) - primaryXaxis.executeAction("TYPE", mkPropertyValues({"TEXT":"C"})) - primaryYaxis.executeAction("TYPE", mkPropertyValues({"TEXT":"D"})) - secondaryXaxis.executeAction("TYPE", mkPropertyValues({"TEXT":"E"})) - secondaryYaxis.executeAction("TYPE", mkPropertyValues({"TEXT":"F"})) - - xOKBtn = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOKBtn) + with self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "InsertMenuTitles"})) as xDialog: + + maintitle = xDialog.getChild("maintitle") + subtitle = xDialog.getChild("subtitle") + primaryXaxis = xDialog.getChild("primaryXaxis") + primaryYaxis = xDialog.getChild("primaryYaxis") + secondaryXaxis = xDialog.getChild("secondaryXaxis") + secondaryYaxis = xDialog.getChild("secondaryYaxis") + + maintitle.executeAction("TYPE", mkPropertyValues({"TEXT":"A"})) + subtitle.executeAction("TYPE", mkPropertyValues({"TEXT":"B"})) + primaryXaxis.executeAction("TYPE", mkPropertyValues({"TEXT":"C"})) + primaryYaxis.executeAction("TYPE", mkPropertyValues({"TEXT":"D"})) + secondaryXaxis.executeAction("TYPE", mkPropertyValues({"TEXT":"E"})) + secondaryYaxis.executeAction("TYPE", mkPropertyValues({"TEXT":"F"})) + self.assertTrue(document.Sheets[0].Charts[0].getEmbeddedObject().HasMainTitle) self.assertTrue(document.Sheets[0].Charts[0].getEmbeddedObject().HasSubTitle) @@ -68,25 +65,22 @@ class chartTitles(UITestCase): xChartMainTop = self.xUITest.getTopFocusWindow() xChartMain = xChartMainTop.getChild("chart_window") xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0") - self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "InsertMenuTitles"})) - xDialog = self.xUITest.getTopFocusWindow() - - maintitle = xDialog.getChild("maintitle") - subtitle = xDialog.getChild("subtitle") - primaryXaxis = xDialog.getChild("primaryXaxis") - primaryYaxis = xDialog.getChild("primaryYaxis") - secondaryXaxis = xDialog.getChild("secondaryXaxis") - secondaryYaxis = xDialog.getChild("secondaryYaxis") - - self.assertEqual(get_state_as_dict(maintitle)["Text"], "A") - self.assertEqual(get_state_as_dict(subtitle)["Text"], "B") - self.assertEqual(get_state_as_dict(primaryXaxis)["Text"], "C") - self.assertEqual(get_state_as_dict(primaryYaxis)["Text"], "D") - self.assertEqual(get_state_as_dict(secondaryXaxis)["Text"], "E") - self.assertEqual(get_state_as_dict(secondaryYaxis)["Text"], "F") - - xOKBtn = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOKBtn) + with self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "InsertMenuTitles"})) as xDialog: + + maintitle = xDialog.getChild("maintitle") + subtitle = xDialog.getChild("subtitle") + primaryXaxis = xDialog.getChild("primaryXaxis") + primaryYaxis = xDialog.getChild("primaryYaxis") + secondaryXaxis = xDialog.getChild("secondaryXaxis") + secondaryYaxis = xDialog.getChild("secondaryYaxis") + + self.assertEqual(get_state_as_dict(maintitle)["Text"], "A") + self.assertEqual(get_state_as_dict(subtitle)["Text"], "B") + self.assertEqual(get_state_as_dict(primaryXaxis)["Text"], "C") + self.assertEqual(get_state_as_dict(primaryYaxis)["Text"], "D") + self.assertEqual(get_state_as_dict(secondaryXaxis)["Text"], "E") + self.assertEqual(get_state_as_dict(secondaryYaxis)["Text"], "F") + def test_title_move_with_arrows_keys(self): @@ -105,26 +99,20 @@ class chartTitles(UITestCase): xTitle = xChartMain.getChild("CID/Title=") xTitle.executeAction("SELECT", tuple()) - self.ui_test.execute_dialog_through_action(xTitle, "COMMAND", mkPropertyValues({"COMMAND": "TransformDialog"})) + with self.ui_test.execute_dialog_through_action(xTitle, "COMMAND", mkPropertyValues({"COMMAND": "TransformDialog"})) as xDialog: - xDialog = self.xUITest.getTopFocusWindow() - self.assertEqual("3.52", get_state_as_dict(xDialog.getChild("MTR_FLD_POS_X"))['Value']) - self.assertEqual("0.3", get_state_as_dict(xDialog.getChild("MTR_FLD_POS_Y"))['Value']) + self.assertEqual("3.52", get_state_as_dict(xDialog.getChild("MTR_FLD_POS_X"))['Value']) + self.assertEqual("0.3", get_state_as_dict(xDialog.getChild("MTR_FLD_POS_Y"))['Value']) - xOkBtn = xDialog.getChild("ok") - xOkBtn.executeAction("CLICK", tuple()) xChartMain.executeAction("TYPE", mkPropertyValues({"KEYCODE": "UP"})) xChartMain.executeAction("TYPE", mkPropertyValues({"KEYCODE": "LEFT"})) - self.ui_test.execute_dialog_through_action(xTitle, "COMMAND", mkPropertyValues({"COMMAND": "TransformDialog"})) + with self.ui_test.execute_dialog_through_action(xTitle, "COMMAND", mkPropertyValues({"COMMAND": "TransformDialog"})) as xDialog: - # Check the position has changed after moving the title using the arrows keys - xDialog = self.xUITest.getTopFocusWindow() - self.assertEqual("3.42", get_state_as_dict(xDialog.getChild("MTR_FLD_POS_X"))['Value']) - self.assertEqual("0.2", get_state_as_dict(xDialog.getChild("MTR_FLD_POS_Y"))['Value']) + # Check the position has changed after moving the title using the arrows keys + self.assertEqual("3.42", get_state_as_dict(xDialog.getChild("MTR_FLD_POS_X"))['Value']) + self.assertEqual("0.2", get_state_as_dict(xDialog.getChild("MTR_FLD_POS_Y"))['Value']) - xOkBtn = xDialog.getChild("ok") - xOkBtn.executeAction("CLICK", tuple()) # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/chart/chartWall.py b/sc/qa/uitest/chart/chartWall.py index 485ce8d2090f..600bb8e6d362 100644 --- a/sc/qa/uitest/chart/chartWall.py +++ b/sc/qa/uitest/chart/chartWall.py @@ -34,20 +34,17 @@ class chartWall(UITestCase): xChartMainTop = self.xUITest.getTopFocusWindow() xChartMain = xChartMainTop.getChild("chart_window") xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0") - self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramWall"})) - xDialog = self.xUITest.getTopFocusWindow() - #Click on tab "Borders". - tabcontrol = xDialog.getChild("tabcontrol") - select_pos(tabcontrol, "0") + with self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramWall"})) as xDialog: + #Click on tab "Borders". + tabcontrol = xDialog.getChild("tabcontrol") + select_pos(tabcontrol, "0") - xWidth = xDialog.getChild("MTR_FLD_LINE_WIDTH") - transparency = xDialog.getChild("MTR_LINE_TRANSPARENT") + xWidth = xDialog.getChild("MTR_FLD_LINE_WIDTH") + transparency = xDialog.getChild("MTR_LINE_TRANSPARENT") - xWidth.executeAction("UP", tuple()) - transparency.executeAction("UP", tuple()) + xWidth.executeAction("UP", tuple()) + transparency.executeAction("UP", tuple()) - xOKBtn = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOKBtn) self.assertEqual(xWall.LineWidth, 100) self.assertEqual(xWall.LineTransparence, 5) @@ -60,48 +57,45 @@ class chartWall(UITestCase): xChartMainTop = self.xUITest.getTopFocusWindow() xChartMain = xChartMainTop.getChild("chart_window") xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0") - self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramWall"})) - xDialog = self.xUITest.getTopFocusWindow() - - tabcontrol = xDialog.getChild("tabcontrol") - select_pos(tabcontrol, "0") - xWidth = xDialog.getChild("MTR_FLD_LINE_WIDTH") - transparency = xDialog.getChild("MTR_LINE_TRANSPARENT") - - self.assertEqual(get_state_as_dict(xWidth)["Text"], "0.10 cm") - self.assertEqual(get_state_as_dict(transparency)["Text"], "5%") - - self.assertEqual(xWall.LineWidth, 100) - self.assertEqual(xWall.LineTransparence, 5) - self.assertEqual(hex(xWall.FillColor), '0xe6e6e6') - self.assertEqual(xWall.FillTransparence, 0) - - #Click on tab "Area" - tabcontrol = xDialog.getChild("tabcontrol") - select_pos(tabcontrol, "1") - - btncolor = xDialog.getChild("btncolor") - btncolor.executeAction("CLICK", tuple()) - - rCustom = xDialog.getChild("R_custom") - gCustom = xDialog.getChild("G_custom") - bCustom = xDialog.getChild("B_custom") - - rCustom.executeAction("CLEAR", tuple()) - rCustom.executeAction("TYPE", mkPropertyValues({"TEXT":"35"})) - rCustom.executeAction("UP", tuple()) - rCustom.executeAction("DOWN", tuple()) #without this save data doesn't works - self.assertEqual(get_state_as_dict(rCustom)["Text"], "35") - gCustom.executeAction("CLEAR", tuple()) - gCustom.executeAction("TYPE", mkPropertyValues({"TEXT":"169"})) - gCustom.executeAction("UP", tuple()) - gCustom.executeAction("DOWN", tuple()) #without this save data doesn't works - bCustom.executeAction("CLEAR", tuple()) - bCustom.executeAction("TYPE", mkPropertyValues({"TEXT":"211"})) - bCustom.executeAction("UP", tuple()) - bCustom.executeAction("DOWN", tuple()) #without this save data doesn't works - xOKBtn = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOKBtn) + with self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramWall"})) as xDialog: + + tabcontrol = xDialog.getChild("tabcontrol") + select_pos(tabcontrol, "0") + xWidth = xDialog.getChild("MTR_FLD_LINE_WIDTH") + transparency = xDialog.getChild("MTR_LINE_TRANSPARENT") + + self.assertEqual(get_state_as_dict(xWidth)["Text"], "0.10 cm") + self.assertEqual(get_state_as_dict(transparency)["Text"], "5%") + + self.assertEqual(xWall.LineWidth, 100) + self.assertEqual(xWall.LineTransparence, 5) + self.assertEqual(hex(xWall.FillColor), '0xe6e6e6') + self.assertEqual(xWall.FillTransparence, 0) + + #Click on tab "Area" + tabcontrol = xDialog.getChild("tabcontrol") + select_pos(tabcontrol, "1") + + btncolor = xDialog.getChild("btncolor") + btncolor.executeAction("CLICK", tuple()) + + rCustom = xDialog.getChild("R_custom") + gCustom = xDialog.getChild("G_custom") + bCustom = xDialog.getChild("B_custom") + + rCustom.executeAction("CLEAR", tuple()) + rCustom.executeAction("TYPE", mkPropertyValues({"TEXT":"35"})) + rCustom.executeAction("UP", tuple()) + rCustom.executeAction("DOWN", tuple()) #without this save data doesn't works + self.assertEqual(get_state_as_dict(rCustom)["Text"], "35") + gCustom.executeAction("CLEAR", tuple()) + gCustom.executeAction("TYPE", mkPropertyValues({"TEXT":"169"})) + gCustom.executeAction("UP", tuple()) + gCustom.executeAction("DOWN", tuple()) #without this save data doesn't works + bCustom.executeAction("CLEAR", tuple()) + bCustom.executeAction("TYPE", mkPropertyValues({"TEXT":"211"})) + bCustom.executeAction("UP", tuple()) + bCustom.executeAction("DOWN", tuple()) #without this save data doesn't works self.assertEqual(xWall.LineWidth, 100) self.assertEqual(xWall.LineTransparence, 5) @@ -114,35 +108,32 @@ class chartWall(UITestCase): xChartMainTop = self.xUITest.getTopFocusWindow() xChartMain = xChartMainTop.getChild("chart_window") xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0") - self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramWall"})) - xDialog = self.xUITest.getTopFocusWindow() + with self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramWall"})) as xDialog: - tabcontrol = xDialog.getChild("tabcontrol") - select_pos(tabcontrol, "1") + tabcontrol = xDialog.getChild("tabcontrol") + select_pos(tabcontrol, "1") - rCustom = xDialog.getChild("R_custom") - gCustom = xDialog.getChild("G_custom") - bCustom = xDialog.getChild("B_custom") + rCustom = xDialog.getChild("R_custom") + gCustom = xDialog.getChild("G_custom") + bCustom = xDialog.getChild("B_custom") - self.assertEqual(get_state_as_dict(rCustom)["Text"], "35") - self.assertEqual(get_state_as_dict(gCustom)["Text"], "169") - self.assertEqual(get_state_as_dict(bCustom)["Text"], "211") + self.assertEqual(get_state_as_dict(rCustom)["Text"], "35") + self.assertEqual(get_state_as_dict(gCustom)["Text"], "169") + self.assertEqual(get_state_as_dict(bCustom)["Text"], "211") - self.assertEqual(xWall.LineWidth, 100) - self.assertEqual(xWall.LineTransparence, 5) - self.assertEqual(hex(xWall.FillColor), '0x23a9d3') - self.assertEqual(xWall.FillTransparence, 0) + self.assertEqual(xWall.LineWidth, 100) + self.assertEqual(xWall.LineTransparence, 5) + self.assertEqual(hex(xWall.FillColor), '0x23a9d3') + self.assertEqual(xWall.FillTransparence, 0) - #change tab "Transparency" - select_pos(tabcontrol, "2") - transparency = xDialog.getChild("RBT_TRANS_LINEAR") - transparencyPercent = xDialog.getChild("MTR_TRANSPARENT") #51% + #change tab "Transparency" + select_pos(tabcontrol, "2") + transparency = xDialog.getChild("RBT_TRANS_LINEAR") + transparencyPercent = xDialog.getChild("MTR_TRANSPARENT") #51% - transparency.executeAction("CLICK", tuple()) - transparencyPercent.executeAction("UP", tuple()) + transparency.executeAction("CLICK", tuple()) + transparencyPercent.executeAction("UP", tuple()) - xOKBtn = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOKBtn) self.assertEqual(xWall.LineWidth, 100) self.assertEqual(xWall.LineTransparence, 5) @@ -155,25 +146,22 @@ class chartWall(UITestCase): xChartMainTop = self.xUITest.getTopFocusWindow() xChartMain = xChartMainTop.getChild("chart_window") xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0") - self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramWall"})) - xDialog = self.xUITest.getTopFocusWindow() + with self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramWall"})) as xDialog: - tabcontrol = xDialog.getChild("tabcontrol") - select_pos(tabcontrol, "2") + tabcontrol = xDialog.getChild("tabcontrol") + select_pos(tabcontrol, "2") - transparency = xDialog.getChild("RBT_TRANS_LINEAR") - transparencyPercent = xDialog.getChild("MTR_TRANSPARENT") #51% + transparency = xDialog.getChild("RBT_TRANS_LINEAR") + transparencyPercent = xDialog.getChild("MTR_TRANSPARENT") #51% - self.assertEqual(get_state_as_dict(transparency)["Checked"], "true") - self.assertEqual(get_state_as_dict(transparencyPercent)["Text"], "51%") + self.assertEqual(get_state_as_dict(transparency)["Checked"], "true") + self.assertEqual(get_state_as_dict(transparencyPercent)["Text"], "51%") - self.assertEqual(xWall.LineWidth, 100) - self.assertEqual(xWall.LineTransparence, 5) - self.assertEqual(hex(xWall.FillColor), '0x23a9d3') - self.assertEqual(xWall.FillTransparence, 51) + self.assertEqual(xWall.LineWidth, 100) + self.assertEqual(xWall.LineTransparence, 5) + self.assertEqual(hex(xWall.FillColor), '0x23a9d3') + self.assertEqual(xWall.FillTransparence, 51) - xOKBtn = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOKBtn) self.assertEqual(xWall.LineWidth, 100) self.assertEqual(xWall.LineTransparence, 5) diff --git a/sc/qa/uitest/chart/chartXAxis.py b/sc/qa/uitest/chart/chartXAxis.py index 15adb54b64b0..085bee88bb8f 100644 --- a/sc/qa/uitest/chart/chartXAxis.py +++ b/sc/qa/uitest/chart/chartXAxis.py @@ -29,36 +29,33 @@ class chartXAxis(UITestCase): xChartMainTop = self.xUITest.getTopFocusWindow() xChartMain = xChartMainTop.getChild("chart_window") xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0") - self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramAxisX"})) # X Axis... - xDialog = self.xUITest.getTopFocusWindow() - #Click on tab "Scale". - tabcontrol = xDialog.getChild("tabcontrol") - select_pos(tabcontrol, "0") - - reverseDirection = xDialog.getChild("CBX_REVERSE") - logarithmicScale = xDialog.getChild("CBX_LOGARITHM") - autoMinimum = xDialog.getChild("CBX_AUTO_MIN") - autoMaximum = xDialog.getChild("CBX_AUTO_MAX") - majorInterval = xDialog.getChild("CBX_AUTO_STEP_MAIN") - minorInterval = xDialog.getChild("CBX_AUTO_STEP_HELP") - minimum = xDialog.getChild("EDT_MIN") - maximum = xDialog.getChild("EDT_MAX") - major = xDialog.getChild("EDT_STEP_MAIN") - minor = xDialog.getChild("MT_STEPHELP") - - reverseDirection.executeAction("CLICK", tuple()) - logarithmicScale.executeAction("CLICK", tuple()) - autoMinimum.executeAction("CLICK", tuple()) - autoMaximum.executeAction("CLICK", tuple()) - majorInterval.executeAction("CLICK", tuple()) - minorInterval.executeAction("CLICK", tuple()) - - minimum.executeAction("DOWN", tuple()) #10.12.2017 - maximum.executeAction("DOWN", tuple()) #29.04.2018 - major.executeAction("DOWN", tuple()) #19 - minor.executeAction("UP", tuple()) #3 - xOKBtn = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOKBtn) + with self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramAxisX"})) as xDialog: + #Click on tab "Scale". + tabcontrol = xDialog.getChild("tabcontrol") + select_pos(tabcontrol, "0") + + reverseDirection = xDialog.getChild("CBX_REVERSE") + logarithmicScale = xDialog.getChild("CBX_LOGARITHM") + autoMinimum = xDialog.getChild("CBX_AUTO_MIN") + autoMaximum = xDialog.getChild("CBX_AUTO_MAX") + majorInterval = xDialog.getChild("CBX_AUTO_STEP_MAIN") + minorInterval = xDialog.getChild("CBX_AUTO_STEP_HELP") + minimum = xDialog.getChild("EDT_MIN") + maximum = xDialog.getChild("EDT_MAX") + major = xDialog.getChild("EDT_STEP_MAIN") + minor = xDialog.getChild("MT_STEPHELP") + + reverseDirection.executeAction("CLICK", tuple()) + logarithmicScale.executeAction("CLICK", tuple()) + autoMinimum.executeAction("CLICK", tuple()) + autoMaximum.executeAction("CLICK", tuple()) + majorInterval.executeAction("CLICK", tuple()) + minorInterval.executeAction("CLICK", tuple()) + + minimum.executeAction("DOWN", tuple()) #10.12.2017 + maximum.executeAction("DOWN", tuple()) #29.04.2018 + major.executeAction("DOWN", tuple()) #19 + minor.executeAction("UP", tuple()) #3 #reopen and verify gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"})) @@ -66,57 +63,54 @@ class chartXAxis(UITestCase): xChartMainTop = self.xUITest.getTopFocusWindow() xChartMain = xChartMainTop.getChild("chart_window") xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0") - self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramAxisX"})) - xDialog = self.xUITest.getTopFocusWindow() - #Click on tab "Scale". - tabcontrol = xDialog.getChild("tabcontrol") - select_pos(tabcontrol, "0") - - reverseDirection = xDialog.getChild("CBX_REVERSE") - logarithmicScale = xDialog.getChild("CBX_LOGARITHM") - autoMinimum = xDialog.getChild("CBX_AUTO_MIN") - autoMaximum = xDialog.getChild("CBX_AUTO_MAX") - majorInterval = xDialog.getChild("CBX_AUTO_STEP_MAIN") - minorInterval = xDialog.getChild("CBX_AUTO_STEP_HELP") - minimum = xDialog.getChild("EDT_MIN") - maximum = xDialog.getChild("EDT_MAX") - major = xDialog.getChild("EDT_STEP_MAIN") - minor = xDialog.getChild("MT_STEPHELP") - - self.assertEqual(get_state_as_dict(reverseDirection)["Selected"], "true") - self.assertEqual(get_state_as_dict(logarithmicScale)["Selected"], "true") - self.assertEqual(get_state_as_dict(autoMinimum)["Selected"], "false") - self.assertEqual(get_state_as_dict(autoMaximum)["Selected"], "false") - self.assertEqual(get_state_as_dict(majorInterval)["Selected"], "false") - self.assertEqual(get_state_as_dict(minorInterval)["Selected"], "false") - self.assertEqual(get_state_as_dict(minimum)["Text"], "10.12.2017") - self.assertEqual(get_state_as_dict(maximum)["Text"], "29.04.2018") - self.assertEqual(get_state_as_dict(major)["Text"], "19") - self.assertEqual(get_state_as_dict(minor)["Text"], "3") - - #Click on tab "positioning". - tabcontrol = xDialog.getChild("tabcontrol") - select_pos(tabcontrol, "1") - - crossAxis = xDialog.getChild("LB_CROSSES_OTHER_AXIS_AT") - crossAxisValue = xDialog.getChild("EDT_CROSSES_OTHER_AXIS_AT") #only available when crossAxis = Value - placeLabels = xDialog.getChild("LB_PLACE_LABELS") - innerMajorTick = xDialog.getChild("CB_TICKS_INNER") - outerMajorTick = xDialog.getChild("CB_TICKS_OUTER") - innerMinorTick = xDialog.getChild("CB_MINOR_INNER") - outerMinorTick = xDialog.getChild("CB_MINOR_OUTER") - placeMarks = xDialog.getChild("LB_PLACE_TICKS") - - select_by_text(crossAxis, "Start") - select_by_text(placeLabels, "Outside end") - innerMajorTick.executeAction("CLICK", tuple()) - outerMajorTick.executeAction("CLICK", tuple()) - innerMinorTick.executeAction("CLICK", tuple()) - outerMinorTick.executeAction("CLICK", tuple()) - select_by_text(placeMarks, "At axis") - - xOKBtn = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOKBtn) + with self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramAxisX"})) as xDialog: + #Click on tab "Scale". + tabcontrol = xDialog.getChild("tabcontrol") + select_pos(tabcontrol, "0") + + reverseDirection = xDialog.getChild("CBX_REVERSE") + logarithmicScale = xDialog.getChild("CBX_LOGARITHM") + autoMinimum = xDialog.getChild("CBX_AUTO_MIN") + autoMaximum = xDialog.getChild("CBX_AUTO_MAX") + majorInterval = xDialog.getChild("CBX_AUTO_STEP_MAIN") + minorInterval = xDialog.getChild("CBX_AUTO_STEP_HELP") + minimum = xDialog.getChild("EDT_MIN") + maximum = xDialog.getChild("EDT_MAX") + major = xDialog.getChild("EDT_STEP_MAIN") + minor = xDialog.getChild("MT_STEPHELP") + + self.assertEqual(get_state_as_dict(reverseDirection)["Selected"], "true") + self.assertEqual(get_state_as_dict(logarithmicScale)["Selected"], "true") + self.assertEqual(get_state_as_dict(autoMinimum)["Selected"], "false") + self.assertEqual(get_state_as_dict(autoMaximum)["Selected"], "false") + self.assertEqual(get_state_as_dict(majorInterval)["Selected"], "false") + self.assertEqual(get_state_as_dict(minorInterval)["Selected"], "false") + self.assertEqual(get_state_as_dict(minimum)["Text"], "10.12.2017") + self.assertEqual(get_state_as_dict(maximum)["Text"], "29.04.2018") + self.assertEqual(get_state_as_dict(major)["Text"], "19") + self.assertEqual(get_state_as_dict(minor)["Text"], "3") + + #Click on tab "positioning". + tabcontrol = xDialog.getChild("tabcontrol") + select_pos(tabcontrol, "1") + + crossAxis = xDialog.getChild("LB_CROSSES_OTHER_AXIS_AT") + crossAxisValue = xDialog.getChild("EDT_CROSSES_OTHER_AXIS_AT") #only available when crossAxis = Value + placeLabels = xDialog.getChild("LB_PLACE_LABELS") + innerMajorTick = xDialog.getChild("CB_TICKS_INNER") + outerMajorTick = xDialog.getChild("CB_TICKS_OUTER") + innerMinorTick = xDialog.getChild("CB_MINOR_INNER") + outerMinorTick = xDialog.getChild("CB_MINOR_OUTER") + placeMarks = xDialog.getChild("LB_PLACE_TICKS") + + select_by_text(crossAxis, "Start") + select_by_text(placeLabels, "Outside end") + innerMajorTick.executeAction("CLICK", tuple()) + outerMajorTick.executeAction("CLICK", tuple()) + innerMinorTick.executeAction("CLICK", tuple()) + outerMinorTick.executeAction("CLICK", tuple()) + select_by_text(placeMarks, "At axis") + #reopen and verify tab "positioning". gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"})) @@ -124,34 +118,31 @@ class chartXAxis(UITestCase): xChartMainTop = self.xUITest.getTopFocusWindow() xChartMain = xChartMainTop.getChild("chart_window") xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0") - self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramAxisX"})) - xDialog = self.xUITest.getTopFocusWindow() - - tabcontrol = xDialog.getChild("tabcontrol") - select_pos(tabcontrol, "1") - - crossAxis = xDialog.getChild("LB_CROSSES_OTHER_AXIS_AT") - crossAxisValue = xDialog.getChild("EDT_CROSSES_OTHER_AXIS_AT") #only available when crossAxis = Value - placeLabels = xDialog.getChild("LB_PLACE_LABELS") - innerMajorTick = xDialog.getChild("CB_TICKS_INNER") - outerMajorTick = xDialog.getChild("CB_TICKS_OUTER") - innerMinorTick = xDialog.getChild("CB_MINOR_INNER") - outerMinorTick = xDialog.getChild("CB_MINOR_OUTER") - placeMarks = xDialog.getChild("LB_PLACE_TICKS") - - self.assertEqual(get_state_as_dict(crossAxis)["SelectEntryText"], "Start") - self.assertEqual(get_state_as_dict(placeLabels)["SelectEntryText"], "Outside end") - self.assertEqual(get_state_as_dict(innerMajorTick)["Selected"], "true") - self.assertEqual(get_state_as_dict(outerMajorTick)["Selected"], "false") - self.assertEqual(get_state_as_dict(innerMinorTick)["Selected"], "true") - self.assertEqual(get_state_as_dict(outerMinorTick)["Selected"], "true") - self.assertEqual(get_state_as_dict(placeMarks)["SelectEntryText"], "At axis") - #change tab "positioning". - select_by_text(crossAxis, "Value") - crossAxisValue.executeAction("UP", tuple()) #1 - - xOKBtn = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOKBtn) + with self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramAxisX"})) as xDialog: + + tabcontrol = xDialog.getChild("tabcontrol") + select_pos(tabcontrol, "1") + + crossAxis = xDialog.getChild("LB_CROSSES_OTHER_AXIS_AT") + crossAxisValue = xDialog.getChild("EDT_CROSSES_OTHER_AXIS_AT") #only available when crossAxis = Value + placeLabels = xDialog.getChild("LB_PLACE_LABELS") + innerMajorTick = xDialog.getChild("CB_TICKS_INNER") + outerMajorTick = xDialog.getChild("CB_TICKS_OUTER") + innerMinorTick = xDialog.getChild("CB_MINOR_INNER") + outerMinorTick = xDialog.getChild("CB_MINOR_OUTER") + placeMarks = xDialog.getChild("LB_PLACE_TICKS") + + self.assertEqual(get_state_as_dict(crossAxis)["SelectEntryText"], "Start") + self.assertEqual(get_state_as_dict(placeLabels)["SelectEntryText"], "Outside end") + self.assertEqual(get_state_as_dict(innerMajorTick)["Selected"], "true") + self.assertEqual(get_state_as_dict(outerMajorTick)["Selected"], "false") + self.assertEqual(get_state_as_dict(innerMinorTick)["Selected"], "true") + self.assertEqual(get_state_as_dict(outerMinorTick)["Selected"], "true") + self.assertEqual(get_state_as_dict(placeMarks)["SelectEntryText"], "At axis") + #change tab "positioning". + select_by_text(crossAxis, "Value") + crossAxisValue.executeAction("UP", tuple()) #1 + #reopen and verify tab "positioning". gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"})) @@ -159,40 +150,37 @@ class chartXAxis(UITestCase): xChartMainTop = self.xUITest.getTopFocusWindow() xChartMain = xChartMainTop.getChild("chart_window") xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0") - self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramAxisX"})) - xDialog = self.xUITest.getTopFocusWindow() - - tabcontrol = xDialog.getChild("tabcontrol") - select_pos(tabcontrol, "1") - - crossAxis = xDialog.getChild("LB_CROSSES_OTHER_AXIS_AT") - crossAxisValue = xDialog.getChild("EDT_CROSSES_OTHER_AXIS_AT") #only available when crossAxis = Value - placeLabels = xDialog.getChild("LB_PLACE_LABELS") - innerMajorTick = xDialog.getChild("CB_TICKS_INNER") - outerMajorTick = xDialog.getChild("CB_TICKS_OUTER") - innerMinorTick = xDialog.getChild("CB_MINOR_INNER") - outerMinorTick = xDialog.getChild("CB_MINOR_OUTER") - placeMarks = xDialog.getChild("LB_PLACE_TICKS") - - self.assertEqual(get_state_as_dict(crossAxis)["SelectEntryText"], "Value") - self.assertEqual(get_state_as_dict(crossAxisValue)["Text"], "1") - self.assertEqual(get_state_as_dict(placeLabels)["SelectEntryText"], "Outside end") - self.assertEqual(get_state_as_dict(innerMajorTick)["Selected"], "true") - self.assertEqual(get_state_as_dict(outerMajorTick)["Selected"], "false") - self.assertEqual(get_state_as_dict(innerMinorTick)["Selected"], "true") - self.assertEqual(get_state_as_dict(outerMinorTick)["Selected"], "true") - self.assertEqual(get_state_as_dict(placeMarks)["SelectEntryText"], "At axis") - #change tab "Line". - select_pos(tabcontrol, "2") - - xWidth = xDialog.getChild("MTR_FLD_LINE_WIDTH") - transparency = xDialog.getChild("MTR_LINE_TRANSPARENT") - - xWidth.executeAction("UP", tuple()) - transparency.executeAction("UP", tuple()) - - xOKBtn = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOKBtn) + with self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramAxisX"})) as xDialog: + + tabcontrol = xDialog.getChild("tabcontrol") + select_pos(tabcontrol, "1") + + crossAxis = xDialog.getChild("LB_CROSSES_OTHER_AXIS_AT") + crossAxisValue = xDialog.getChild("EDT_CROSSES_OTHER_AXIS_AT") #only available when crossAxis = Value + placeLabels = xDialog.getChild("LB_PLACE_LABELS") + innerMajorTick = xDialog.getChild("CB_TICKS_INNER") + outerMajorTick = xDialog.getChild("CB_TICKS_OUTER") + innerMinorTick = xDialog.getChild("CB_MINOR_INNER") + outerMinorTick = xDialog.getChild("CB_MINOR_OUTER") + placeMarks = xDialog.getChild("LB_PLACE_TICKS") + + self.assertEqual(get_state_as_dict(crossAxis)["SelectEntryText"], "Value") + self.assertEqual(get_state_as_dict(crossAxisValue)["Text"], "1") + self.assertEqual(get_state_as_dict(placeLabels)["SelectEntryText"], "Outside end") + self.assertEqual(get_state_as_dict(innerMajorTick)["Selected"], "true") + self.assertEqual(get_state_as_dict(outerMajorTick)["Selected"], "false") + self.assertEqual(get_state_as_dict(innerMinorTick)["Selected"], "true") + self.assertEqual(get_state_as_dict(outerMinorTick)["Selected"], "true") + self.assertEqual(get_state_as_dict(placeMarks)["SelectEntryText"], "At axis") + #change tab "Line". + select_pos(tabcontrol, "2") + + xWidth = xDialog.getChild("MTR_FLD_LINE_WIDTH") + transparency = xDialog.getChild("MTR_LINE_TRANSPARENT") + + xWidth.executeAction("UP", tuple()) + transparency.executeAction("UP", tuple()) + #reopen and verify tab "Line". gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"})) @@ -200,36 +188,33 @@ class chartXAxis(UITestCase): xChartMainTop = self.xUITest.getTopFocusWindow() xChartMain = xChartMainTop.getChild("chart_window") xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0") - self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramAxisX"})) - xDialog = self.xUITest.getTopFocusWindow() + with self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramAxisX"})) as xDialog: - tabcontrol = xDialog.getChild("tabcontrol") - select_pos(tabcontrol, "2") + tabcontrol = xDialog.getChild("tabcontrol") + select_pos(tabcontrol, "2") - xWidth = xDialog.getChild("MTR_FLD_LINE_WIDTH") - transparency = xDialog.getChild("MTR_LINE_TRANSPARENT") + xWidth = xDialog.getChild("MTR_FLD_LINE_WIDTH") + transparency = xDialog.getChild("MTR_LINE_TRANSPARENT") - self.assertEqual(get_state_as_dict(xWidth)["Text"], "0.10 cm") - self.assertEqual(get_state_as_dict(transparency)["Text"], "5%") + self.assertEqual(get_state_as_dict(xWidth)["Text"], "0.10 cm") + self.assertEqual(get_state_as_dict(transparency)["Text"], "5%") - #change tab "Label" - tabcontrol = xDialog.getChild("tabcontrol") - select_pos(tabcontrol, "3") + #change tab "Label" + tabcontrol = xDialog.getChild("tabcontrol") + select_pos(tabcontrol, "3") - tile = xDialog.getChild("tile") - overlapCB = xDialog.getChild("overlapCB") - breakCB = xDialog.getChild("breakCB") - stackedCB = xDialog.getChild("stackedCB") - textdirLB = xDialog.getChild("textdirLB") + tile = xDialog.getChild("tile") + overlapCB = xDialog.getChild("overlapCB") + breakCB = xDialog.getChild("breakCB") + stackedCB = xDialog.getChild("stackedCB") + textdirLB = xDialog.getChild("textdirLB") - tile.executeAction("CLICK", tuple()) - overlapCB.executeAction("CLICK", tuple()) - breakCB.executeAction("CLICK", tuple()) - stackedCB.executeAction("CLICK", tuple()) - select_by_text(textdirLB, "Right-to-left") + tile.executeAction("CLICK", tuple()) + overlapCB.executeAction("CLICK", tuple()) + breakCB.executeAction("CLICK", tuple()) + stackedCB.executeAction("CLICK", tuple()) + select_by_text(textdirLB, "Right-to-left") - xOKBtn = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOKBtn) #reopen and verify tab "Label". gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"})) @@ -237,25 +222,22 @@ class chartXAxis(UITestCase): xChartMainTop = self.xUITest.getTopFocusWindow() xChartMain = xChartMainTop.getChild("chart_window") xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0") - self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramAxisX"})) - xDialog = self.xUITest.getTopFocusWindow() - - tabcontrol = xDialog.getChild("tabcontrol") - select_pos(tabcontrol, "3") - - tile = xDialog.getChild("tile") - overlapCB = xDialog.getChild("overlapCB") - breakCB = xDialog.getChild("breakCB") - stackedCB = xDialog.getChild("stackedCB") - textdirLB = xDialog.getChild("textdirLB") - - self.assertEqual(get_state_as_dict(tile)["Checked"], "true") - self.assertEqual(get_state_as_dict(overlapCB)["Selected"], "true") - self.assertEqual(get_state_as_dict(breakCB)["Selected"], "true") - self.assertEqual(get_state_as_dict(stackedCB)["Selected"], "true") - self.assertEqual(get_state_as_dict(textdirLB)["SelectEntryText"], "Right-to-left") - - xOKBtn = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOKBtn) + with self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramAxisX"})) as xDialog: + + tabcontrol = xDialog.getChild("tabcontrol") + select_pos(tabcontrol, "3") + + tile = xDialog.getChild("tile") + overlapCB = xDialog.getChild("overlapCB") + breakCB = xDialog.getChild("breakCB") + stackedCB = xDialog.getChild("stackedCB") + textdirLB = xDialog.getChild("textdirLB") + + self.assertEqual(get_state_as_dict(tile)["Checked"], "true") + self.assertEqual(get_state_as_dict(overlapCB)["Selected"], "true") + self.assertEqual(get_state_as_dict(breakCB)["Selected"], "true") + self.assertEqual(get_state_as_dict(stackedCB)["Selected"], "true") + self.assertEqual(get_state_as_dict(textdirLB)["SelectEntryText"], "Right-to-left") + # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/chart/chartYAxis.py b/sc/qa/uitest/chart/chartYAxis.py index 22e7fe67b8fb..bb4f09119685 100644 --- a/sc/qa/uitest/chart/chartYAxis.py +++ b/sc/qa/uitest/chart/chartYAxis.py @@ -29,37 +29,34 @@ class chartYAxis(UITestCase): xChartMainTop = self.xUITest.getTopFocusWindow() xChartMain = xChartMainTop.getChild("chart_window") xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0") - self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramAxisY"})) # X Axis... - xDialog = self.xUITest.getTopFocusWindow() - #Click on tab "Scale". - tabcontrol = xDialog.getChild("tabcontrol") - select_pos(tabcontrol, "0") - - - reverseDirection = xDialog.getChild("CBX_REVERSE") - logarithmicScale = xDialog.getChild("CBX_LOGARITHM") - autoMinimum = xDialog.getChild("CBX_AUTO_MIN") - autoMaximum = xDialog.getChild("CBX_AUTO_MAX") - majorInterval = xDialog.getChild("CBX_AUTO_STEP_MAIN") - minorInterval = xDialog.getChild("CBX_AUTO_STEP_HELP") - minimum = xDialog.getChild("EDT_MIN") - maximum = xDialog.getChild("EDT_MAX") - major = xDialog.getChild("EDT_STEP_MAIN") - minor = xDialog.getChild("MT_STEPHELP") - - reverseDirection.executeAction("CLICK", tuple()) - logarithmicScale.executeAction("CLICK", tuple()) - autoMinimum.executeAction("CLICK", tuple()) - autoMaximum.executeAction("CLICK", tuple()) - majorInterval.executeAction("CLICK", tuple()) - minorInterval.executeAction("CLICK", tuple()) - - minimum.executeAction("UP", tuple()) #1 - maximum.executeAction("DOWN", tuple()) #17 - major.executeAction("DOWN", tuple()) #1 - minor.executeAction("UP", tuple()) #3 - xOKBtn = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOKBtn) + with self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramAxisY"})) as xDialog: + #Click on tab "Scale". + tabcontrol = xDialog.getChild("tabcontrol") + select_pos(tabcontrol, "0") + + + reverseDirection = xDialog.getChild("CBX_REVERSE") + logarithmicScale = xDialog.getChild("CBX_LOGARITHM") + autoMinimum = xDialog.getChild("CBX_AUTO_MIN") + autoMaximum = xDialog.getChild("CBX_AUTO_MAX") + majorInterval = xDialog.getChild("CBX_AUTO_STEP_MAIN") + minorInterval = xDialog.getChild("CBX_AUTO_STEP_HELP") + minimum = xDialog.getChild("EDT_MIN") + maximum = xDialog.getChild("EDT_MAX") + major = xDialog.getChild("EDT_STEP_MAIN") + minor = xDialog.getChild("MT_STEPHELP") + + reverseDirection.executeAction("CLICK", tuple()) + logarithmicScale.executeAction("CLICK", tuple()) + autoMinimum.executeAction("CLICK", tuple()) + autoMaximum.executeAction("CLICK", tuple()) + majorInterval.executeAction("CLICK", tuple()) + minorInterval.executeAction("CLICK", tuple()) + + minimum.executeAction("UP", tuple()) #1 + maximum.executeAction("DOWN", tuple()) #17 + major.executeAction("DOWN", tuple()) #1 + minor.executeAction("UP", tuple()) #3 #reopen and verify gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"})) @@ -67,57 +64,54 @@ class chartYAxis(UITestCase): xChartMainTop = self.xUITest.getTopFocusWindow() xChartMain = xChartMainTop.getChild("chart_window") xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0") - self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramAxisY"})) - xDialog = self.xUITest.getTopFocusWindow() - #Click on tab "Scale". - tabcontrol = xDialog.getChild("tabcontrol") - select_pos(tabcontrol, "0") - - reverseDirection = xDialog.getChild("CBX_REVERSE") - logarithmicScale = xDialog.getChild("CBX_LOGARITHM") - autoMinimum = xDialog.getChild("CBX_AUTO_MIN") - autoMaximum = xDialog.getChild("CBX_AUTO_MAX") - majorInterval = xDialog.getChild("CBX_AUTO_STEP_MAIN") - minorInterval = xDialog.getChild("CBX_AUTO_STEP_HELP") - minimum = xDialog.getChild("EDT_MIN") - maximum = xDialog.getChild("EDT_MAX") - major = xDialog.getChild("EDT_STEP_MAIN") - minor = xDialog.getChild("MT_STEPHELP") - - self.assertEqual(get_state_as_dict(reverseDirection)["Selected"], "true") - self.assertEqual(get_state_as_dict(logarithmicScale)["Selected"], "true") - self.assertEqual(get_state_as_dict(autoMinimum)["Selected"], "false") - self.assertEqual(get_state_as_dict(autoMaximum)["Selected"], "false") - self.assertEqual(get_state_as_dict(majorInterval)["Selected"], "false") - self.assertEqual(get_state_as_dict(minorInterval)["Selected"], "false") - self.assertEqual(get_state_as_dict(minimum)["Text"], "1") - self.assertEqual(get_state_as_dict(maximum)["Text"], "17") - self.assertEqual(get_state_as_dict(major)["Text"], "1") - self.assertEqual(get_state_as_dict(minor)["Text"], "3") - - #Click on tab "positioning". - tabcontrol = xDialog.getChild("tabcontrol") - select_pos(tabcontrol, "1") - - crossAxis = xDialog.getChild("LB_CROSSES_OTHER_AXIS_AT") - crossAxisValue = xDialog.getChild("EDT_CROSSES_OTHER_AXIS_AT") #only available when crossAxis = Value - placeLabels = xDialog.getChild("LB_PLACE_LABELS") - innerMajorTick = xDialog.getChild("CB_TICKS_INNER") - outerMajorTick = xDialog.getChild("CB_TICKS_OUTER") - innerMinorTick = xDialog.getChild("CB_MINOR_INNER") - outerMinorTick = xDialog.getChild("CB_MINOR_OUTER") - placeMarks = xDialog.getChild("LB_PLACE_TICKS") - - select_by_text(crossAxis, "Start") - select_by_text(placeLabels, "Outside end") - innerMajorTick.executeAction("CLICK", tuple()) - outerMajorTick.executeAction("CLICK", tuple()) - innerMinorTick.executeAction("CLICK", tuple()) - outerMinorTick.executeAction("CLICK", tuple()) - select_by_text(placeMarks, "At axis") - - xOKBtn = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOKBtn) + with self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramAxisY"})) as xDialog: + #Click on tab "Scale". + tabcontrol = xDialog.getChild("tabcontrol") + select_pos(tabcontrol, "0") + + reverseDirection = xDialog.getChild("CBX_REVERSE") + logarithmicScale = xDialog.getChild("CBX_LOGARITHM") + autoMinimum = xDialog.getChild("CBX_AUTO_MIN") + autoMaximum = xDialog.getChild("CBX_AUTO_MAX") + majorInterval = xDialog.getChild("CBX_AUTO_STEP_MAIN") + minorInterval = xDialog.getChild("CBX_AUTO_STEP_HELP") + minimum = xDialog.getChild("EDT_MIN") + maximum = xDialog.getChild("EDT_MAX") + major = xDialog.getChild("EDT_STEP_MAIN") + minor = xDialog.getChild("MT_STEPHELP") + + self.assertEqual(get_state_as_dict(reverseDirection)["Selected"], "true") + self.assertEqual(get_state_as_dict(logarithmicScale)["Selected"], "true") + self.assertEqual(get_state_as_dict(autoMinimum)["Selected"], "false") + self.assertEqual(get_state_as_dict(autoMaximum)["Selected"], "false") + self.assertEqual(get_state_as_dict(majorInterval)["Selected"], "false") + self.assertEqual(get_state_as_dict(minorInterval)["Selected"], "false") + self.assertEqual(get_state_as_dict(minimum)["Text"], "1") + self.assertEqual(get_state_as_dict(maximum)["Text"], "17") + self.assertEqual(get_state_as_dict(major)["Text"], "1") + self.assertEqual(get_state_as_dict(minor)["Text"], "3") + + #Click on tab "positioning". + tabcontrol = xDialog.getChild("tabcontrol") + select_pos(tabcontrol, "1") + + crossAxis = xDialog.getChild("LB_CROSSES_OTHER_AXIS_AT") + crossAxisValue = xDialog.getChild("EDT_CROSSES_OTHER_AXIS_AT") #only available when crossAxis = Value + placeLabels = xDialog.getChild("LB_PLACE_LABELS") + innerMajorTick = xDialog.getChild("CB_TICKS_INNER") + outerMajorTick = xDialog.getChild("CB_TICKS_OUTER") + innerMinorTick = xDialog.getChild("CB_MINOR_INNER") + outerMinorTick = xDialog.getChild("CB_MINOR_OUTER") + placeMarks = xDialog.getChild("LB_PLACE_TICKS") + + select_by_text(crossAxis, "Start") + select_by_text(placeLabels, "Outside end") + innerMajorTick.executeAction("CLICK", tuple()) + outerMajorTick.executeAction("CLICK", tuple()) + innerMinorTick.executeAction("CLICK", tuple()) + outerMinorTick.executeAction("CLICK", tuple()) + select_by_text(placeMarks, "At axis") + #reopen and verify tab "positioning". gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"})) @@ -125,35 +119,32 @@ class chartYAxis(UITestCase): xChartMainTop = self.xUITest.getTopFocusWindow() xChartMain = xChartMainTop.getChild("chart_window") xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0") - self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramAxisY"})) - xDialog = self.xUITest.getTopFocusWindow() - - tabcontrol = xDialog.getChild("tabcontrol") - select_pos(tabcontrol, "1") - - crossAxis = xDialog.getChild("LB_CROSSES_OTHER_AXIS_AT") - crossAxisValue = xDialog.getChild("EDT_CROSSES_OTHER_AXIS_AT") #only available when crossAxis = Value - placeLabels = xDialog.getChild("LB_PLACE_LABELS") - innerMajorTick = xDialog.getChild("CB_TICKS_INNER") - outerMajorTick = xDialog.getChild("CB_TICKS_OUTER") - innerMinorTick = xDialog.getChild("CB_MINOR_INNER") - outerMinorTick = xDialog.getChild("CB_MINOR_OUTER") - placeMarks = xDialog.getChild("LB_PLACE_TICKS") - - self.assertEqual(get_state_as_dict(crossAxis)["SelectEntryText"], "Start") - self.assertEqual(get_state_as_dict(placeLabels)["SelectEntryText"], "Outside end") - self.assertEqual(get_state_as_dict(innerMajorTick)["Selected"], "true") - self.assertEqual(get_state_as_dict(outerMajorTick)["Selected"], "false") - self.assertEqual(get_state_as_dict(innerMinorTick)["Selected"], "true") - self.assertEqual(get_state_as_dict(outerMinorTick)["Selected"], "true") - self.assertEqual(get_state_as_dict(placeMarks)["SelectEntryText"], "At axis") - #change tab "positioning". - select_by_text(crossAxis, "Value") - crossAxisValue.executeAction("CLEAR", tuple()) - crossAxisValue.executeAction("TYPE", mkPropertyValues({"TEXT":"19.01.2018"})) #19.01.2018 - - xOKBtn = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOKBtn) + with self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramAxisY"})) as xDialog: + + tabcontrol = xDialog.getChild("tabcontrol") + select_pos(tabcontrol, "1") + + crossAxis = xDialog.getChild("LB_CROSSES_OTHER_AXIS_AT") + crossAxisValue = xDialog.getChild("EDT_CROSSES_OTHER_AXIS_AT") #only available when crossAxis = Value + placeLabels = xDialog.getChild("LB_PLACE_LABELS") + innerMajorTick = xDialog.getChild("CB_TICKS_INNER") + outerMajorTick = xDialog.getChild("CB_TICKS_OUTER") + innerMinorTick = xDialog.getChild("CB_MINOR_INNER") + outerMinorTick = xDialog.getChild("CB_MINOR_OUTER") + placeMarks = xDialog.getChild("LB_PLACE_TICKS") + + self.assertEqual(get_state_as_dict(crossAxis)["SelectEntryText"], "Start") + self.assertEqual(get_state_as_dict(placeLabels)["SelectEntryText"], "Outside end") + self.assertEqual(get_state_as_dict(innerMajorTick)["Selected"], "true") + self.assertEqual(get_state_as_dict(outerMajorTick)["Selected"], "false") + self.assertEqual(get_state_as_dict(innerMinorTick)["Selected"], "true") + self.assertEqual(get_state_as_dict(outerMinorTick)["Selected"], "true") + self.assertEqual(get_state_as_dict(placeMarks)["SelectEntryText"], "At axis") + #change tab "positioning". + select_by_text(crossAxis, "Value") + crossAxisValue.executeAction("CLEAR", tuple()) + crossAxisValue.executeAction("TYPE", mkPropertyValues({"TEXT":"19.01.2018"})) #19.01.2018 + #reopen and verify tab "positioning". gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"})) @@ -161,40 +152,37 @@ class chartYAxis(UITestCase): xChartMainTop = self.xUITest.getTopFocusWindow() xChartMain = xChartMainTop.getChild("chart_window") xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0") - self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramAxisY"})) - xDialog = self.xUITest.getTopFocusWindow() - - tabcontrol = xDialog.getChild("tabcontrol") - select_pos(tabcontrol, "1") - - crossAxis = xDialog.getChild("LB_CROSSES_OTHER_AXIS_AT") - crossAxisValue = xDialog.getChild("EDT_CROSSES_OTHER_AXIS_AT") #only available when crossAxis = Value - placeLabels = xDialog.getChild("LB_PLACE_LABELS") - innerMajorTick = xDialog.getChild("CB_TICKS_INNER") - outerMajorTick = xDialog.getChild("CB_TICKS_OUTER") - innerMinorTick = xDialog.getChild("CB_MINOR_INNER") - outerMinorTick = xDialog.getChild("CB_MINOR_OUTER") - placeMarks = xDialog.getChild("LB_PLACE_TICKS") - - self.assertEqual(get_state_as_dict(crossAxis)["SelectEntryText"], "Value") - #self.assertEqual(get_state_as_dict(crossAxisValue)["Text"], "19.01.2018") #bug 123520 - self.assertEqual(get_state_as_dict(placeLabels)["SelectEntryText"], "Outside end") - self.assertEqual(get_state_as_dict(innerMajorTick)["Selected"], "true") - self.assertEqual(get_state_as_dict(outerMajorTick)["Selected"], "false") - self.assertEqual(get_state_as_dict(innerMinorTick)["Selected"], "true") - self.assertEqual(get_state_as_dict(outerMinorTick)["Selected"], "true") - self.assertEqual(get_state_as_dict(placeMarks)["SelectEntryText"], "At axis") - #change tab "Line". - select_pos(tabcontrol, "2") - - xWidth = xDialog.getChild("MTR_FLD_LINE_WIDTH") - transparency = xDialog.getChild("MTR_LINE_TRANSPARENT") - - xWidth.executeAction("UP", tuple()) - transparency.executeAction("UP", tuple()) - - xOKBtn = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOKBtn) + with self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramAxisY"})) as xDialog: + + tabcontrol = xDialog.getChild("tabcontrol") + select_pos(tabcontrol, "1") + + crossAxis = xDialog.getChild("LB_CROSSES_OTHER_AXIS_AT") + crossAxisValue = xDialog.getChild("EDT_CROSSES_OTHER_AXIS_AT") #only available when crossAxis = Value + placeLabels = xDialog.getChild("LB_PLACE_LABELS") + innerMajorTick = xDialog.getChild("CB_TICKS_INNER") + outerMajorTick = xDialog.getChild("CB_TICKS_OUTER") + innerMinorTick = xDialog.getChild("CB_MINOR_INNER") + outerMinorTick = xDialog.getChild("CB_MINOR_OUTER") + placeMarks = xDialog.getChild("LB_PLACE_TICKS") + + self.assertEqual(get_state_as_dict(crossAxis)["SelectEntryText"], "Value") + #self.assertEqual(get_state_as_dict(crossAxisValue)["Text"], "19.01.2018") #bug 123520 + self.assertEqual(get_state_as_dict(placeLabels)["SelectEntryText"], "Outside end") + self.assertEqual(get_state_as_dict(innerMajorTick)["Selected"], "true") + self.assertEqual(get_state_as_dict(outerMajorTick)["Selected"], "false") + self.assertEqual(get_state_as_dict(innerMinorTick)["Selected"], "true") + self.assertEqual(get_state_as_dict(outerMinorTick)["Selected"], "true") + self.assertEqual(get_state_as_dict(placeMarks)["SelectEntryText"], "At axis") + #change tab "Line". + select_pos(tabcontrol, "2") + + xWidth = xDialog.getChild("MTR_FLD_LINE_WIDTH") + transparency = xDialog.getChild("MTR_LINE_TRANSPARENT") + + xWidth.executeAction("UP", tuple()) + transparency.executeAction("UP", tuple()) + #reopen and verify tab "Line". gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"})) @@ -202,36 +190,33 @@ class chartYAxis(UITestCase): xChartMainTop = self.xUITest.getTopFocusWindow() xChartMain = xChartMainTop.getChild("chart_window") xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0") - self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramAxisY"})) - xDialog = self.xUITest.getTopFocusWindow() + with self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramAxisY"})) as xDialog: - tabcontrol = xDialog.getChild("tabcontrol") - select_pos(tabcontrol, "2") + tabcontrol = xDialog.getChild("tabcontrol") + select_pos(tabcontrol, "2") - xWidth = xDialog.getChild("MTR_FLD_LINE_WIDTH") - transparency = xDialog.getChild("MTR_LINE_TRANSPARENT") + xWidth = xDialog.getChild("MTR_FLD_LINE_WIDTH") + transparency = xDialog.getChild("MTR_LINE_TRANSPARENT") - self.assertEqual(get_state_as_dict(xWidth)["Text"], "0.10 cm") - self.assertEqual(get_state_as_dict(transparency)["Text"], "5%") + self.assertEqual(get_state_as_dict(xWidth)["Text"], "0.10 cm") + self.assertEqual(get_state_as_dict(transparency)["Text"], "5%") - #change tab "Label" - tabcontrol = xDialog.getChild("tabcontrol") - select_pos(tabcontrol, "3") + #change tab "Label" + tabcontrol = xDialog.getChild("tabcontrol") + select_pos(tabcontrol, "3") - tile = xDialog.getChild("tile") - overlapCB = xDialog.getChild("overlapCB") - breakCB = xDialog.getChild("breakCB") - stackedCB = xDialog.getChild("stackedCB") - textdirLB = xDialog.getChild("textdirLB") + tile = xDialog.getChild("tile") + overlapCB = xDialog.getChild("overlapCB") + breakCB = xDialog.getChild("breakCB") + stackedCB = xDialog.getChild("stackedCB") + textdirLB = xDialog.getChild("textdirLB") - tile.executeAction("CLICK", tuple()) - overlapCB.executeAction("CLICK", tuple()) - breakCB.executeAction("CLICK", tuple()) - stackedCB.executeAction("CLICK", tuple()) - select_by_text(textdirLB, "Right-to-left") + tile.executeAction("CLICK", tuple()) + overlapCB.executeAction("CLICK", tuple()) + breakCB.executeAction("CLICK", tuple()) + stackedCB.executeAction("CLICK", tuple()) + select_by_text(textdirLB, "Right-to-left") - xOKBtn = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOKBtn) #reopen and verify tab "Label". gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"})) @@ -239,25 +224,22 @@ class chartYAxis(UITestCase): xChartMainTop = self.xUITest.getTopFocusWindow() xChartMain = xChartMainTop.getChild("chart_window") xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0") - self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramAxisY"})) - xDialog = self.xUITest.getTopFocusWindow() - - tabcontrol = xDialog.getChild("tabcontrol") - select_pos(tabcontrol, "3") - - tile = xDialog.getChild("tile") - overlapCB = xDialog.getChild("overlapCB") - breakCB = xDialog.getChild("breakCB") - stackedCB = xDialog.getChild("stackedCB") - textdirLB = xDialog.getChild("textdirLB") - - self.assertEqual(get_state_as_dict(tile)["Checked"], "true") - self.assertEqual(get_state_as_dict(overlapCB)["Selected"], "true") - self.assertEqual(get_state_as_dict(breakCB)["Selected"], "true") - self.assertEqual(get_state_as_dict(stackedCB)["Selected"], "true") - self.assertEqual(get_state_as_dict(textdirLB)["SelectEntryText"], "Right-to-left") - - xOKBtn = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOKBtn) + with self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramAxisY"})) as xDialog: + + tabcontrol = xDialog.getChild("tabcontrol") + select_pos(tabcontrol, "3") + + tile = xDialog.getChild("tile") + overlapCB = xDialog.getChild("overlapCB") + breakCB = xDialog.getChild("breakCB") + stackedCB = xDialog.getChild("stackedCB") + textdirLB = xDialog.getChild("textdirLB") + + self.assertEqual(get_state_as_dict(tile)["Checked"], "true") + self.assertEqual(get_state_as_dict(overlapCB)["Selected"], "true") + self.assertEqual(get_state_as_dict(breakCB)["Selected"], "true") + self.assertEqual(get_state_as_dict(stackedCB)["Selected"], "true") + self.assertEqual(get_state_as_dict(textdirLB)["SelectEntryText"], "Right-to-left") + # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/chart/edit_chart.py b/sc/qa/uitest/chart/edit_chart.py index d74a8c2eced3..b3742fe6c42b 100644 --- a/sc/qa/uitest/chart/edit_chart.py +++ b/sc/qa/uitest/chart/edit_chart.py @@ -53,14 +53,11 @@ class CalcChartEditUIDemo(UITestCase): xChartMain = xChartMainTop.getChild("chart_window") xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0") - self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "FormatDataSeries"})) - xSeriesFormatDlg = self.xUITest.getTopFocusWindow() - xAxis2 = xSeriesFormatDlg.getChild("RBT_OPT_AXIS_2") - xAxis2.executeAction("CLICK", tuple()) + with self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "FormatDataSeries"})) as xSeriesFormatDlg: - xCancelBtn = xSeriesFormatDlg.getChild("ok") - xCancelBtn.executeAction("CLICK", tuple()) + xAxis2 = xSeriesFormatDlg.getChild("RBT_OPT_AXIS_2") + xAxis2.executeAction("CLICK", tuple()) xGridWindow.executeAction("DESELECT", mkPropertyValues({"OBJECT": ""})) diff --git a/sc/qa/uitest/chart/formatDataSeries.py b/sc/qa/uitest/chart/formatDataSeries.py index 660a29de0507..ce9f871a6430 100644 --- a/sc/qa/uitest/chart/formatDataSeries.py +++ b/sc/qa/uitest/chart/formatDataSeries.py @@ -28,39 +28,36 @@ class chartFormatDataSeries(UITestCase): xChartMainTop = self.xUITest.getTopFocusWindow() xChartMain = xChartMainTop.getChild("chart_window") xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0") - self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "FormatDataSeries"})) - xDialog = self.xUITest.getTopFocusWindow() - #Click on tab "Options". - tabcontrol = xDialog.getChild("tabcontrol") - select_pos(tabcontrol, "0") - - primaryYAxis = xDialog.getChild("RBT_OPT_AXIS_1") - secondaryYAxis = xDialog.getChild("RBT_OPT_AXIS_2") - leaveGap = xDialog.getChild("RB_DONT_PAINT") - assumeZero = xDialog.getChild("RB_ASSUME_ZERO") - continueLine = xDialog.getChild("RB_CONTINUE_LINE") - includeHiddenCells = xDialog.getChild("CB_INCLUDE_HIDDEN_CELLS") - hideLegend = xDialog.getChild("CB_LEGEND_ENTRY_HIDDEN") - - secondaryYAxis.executeAction("CLICK", tuple()) - leaveGap.executeAction("CLICK", tuple()) - includeHiddenCells.executeAction("CLICK", tuple()) - hideLegend.executeAction("CLICK", tuple()) - - #Click on tab "Line". - select_pos(tabcontrol, "1") - - xWidth = xDialog.getChild("MF_SYMBOL_WIDTH") - xHeight = xDialog.getChild("MF_SYMBOL_HEIGHT") - xKeep = xDialog.getChild("CB_SYMBOL_RATIO") - - xKeep.executeAction("CLICK", tuple()) - xWidth.executeAction("UP", tuple()) - xWidth.executeAction("UP", tuple()) - xHeight.executeAction("UP", tuple()) - - xOKBtn = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOKBtn) + with self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "FormatDataSeries"})) as xDialog: + #Click on tab "Options". + tabcontrol = xDialog.getChild("tabcontrol") + select_pos(tabcontrol, "0") + + primaryYAxis = xDialog.getChild("RBT_OPT_AXIS_1") + secondaryYAxis = xDialog.getChild("RBT_OPT_AXIS_2") + leaveGap = xDialog.getChild("RB_DONT_PAINT") + assumeZero = xDialog.getChild("RB_ASSUME_ZERO") + continueLine = xDialog.getChild("RB_CONTINUE_LINE") + includeHiddenCells = xDialog.getChild("CB_INCLUDE_HIDDEN_CELLS") + hideLegend = xDialog.getChild("CB_LEGEND_ENTRY_HIDDEN") + + secondaryYAxis.executeAction("CLICK", tuple()) + leaveGap.executeAction("CLICK", tuple()) + includeHiddenCells.executeAction("CLICK", tuple()) + hideLegend.executeAction("CLICK", tuple()) + + #Click on tab "Line". + select_pos(tabcontrol, "1") + + xWidth = xDialog.getChild("MF_SYMBOL_WIDTH") + xHeight = xDialog.getChild("MF_SYMBOL_HEIGHT") + xKeep = xDialog.getChild("CB_SYMBOL_RATIO") + + xKeep.executeAction("CLICK", tuple()) + xWidth.executeAction("UP", tuple()) + xWidth.executeAction("UP", tuple()) + xHeight.executeAction("UP", tuple()) + #reopen and verify gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"})) @@ -68,42 +65,39 @@ class chartFormatDataSeries(UITestCase): xChartMainTop = self.xUITest.getTopFocusWindow() xChartMain = xChartMainTop.getChild("chart_window") xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0") - self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "FormatDataSeries"})) - xDialog = self.xUITest.getTopFocusWindow() - #Click on tab "Options". - tabcontrol = xDialog.getChild("tabcontrol") - select_pos(tabcontrol, "0") - - primaryYAxis = xDialog.getChild("RBT_OPT_AXIS_1") - secondaryYAxis = xDialog.getChild("RBT_OPT_AXIS_2") - leaveGap = xDialog.getChild("RB_DONT_PAINT") - assumeZero = xDialog.getChild("RB_ASSUME_ZERO") - continueLine = xDialog.getChild("RB_CONTINUE_LINE") - includeHiddenCells = xDialog.getChild("CB_INCLUDE_HIDDEN_CELLS") - hideLegend = xDialog.getChild("CB_LEGEND_ENTRY_HIDDEN") - - self.assertEqual(get_state_as_dict(secondaryYAxis)["Checked"], "true") - self.assertEqual(get_state_as_dict(leaveGap)["Checked"], "true") - self.assertEqual(get_state_as_dict(includeHiddenCells)["Selected"], "true") - self.assertEqual(get_state_as_dict(hideLegend)["Selected"], "true") - - #Click on tab "Line". - select_pos(tabcontrol, "1") - - xWidth = xDialog.getChild("MF_SYMBOL_WIDTH") - xHeight = xDialog.getChild("MF_SYMBOL_HEIGHT") - xKeep = xDialog.getChild("CB_SYMBOL_RATIO") - - self.assertEqual(get_state_as_dict(xKeep)["Selected"], "true") #checked as default even after reopen - self.assertEqual(get_state_as_dict(xWidth)["Text"], "0.35 cm") - self.assertEqual(get_state_as_dict(xHeight)["Text"], "0.30 cm") - #click up, should up both values, because Keep ratio is checked - xWidth.executeAction("UP", tuple()) - xHeight.executeAction("UP", tuple()) - self.assertEqual(get_state_as_dict(xWidth)["Text"], "0.41 cm") - self.assertEqual(get_state_as_dict(xHeight)["Text"], "0.35 cm") - - xOKBtn = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOKBtn) + with self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "FormatDataSeries"})) as xDialog: + #Click on tab "Options". + tabcontrol = xDialog.getChild("tabcontrol") + select_pos(tabcontrol, "0") + + primaryYAxis = xDialog.getChild("RBT_OPT_AXIS_1") + secondaryYAxis = xDialog.getChild("RBT_OPT_AXIS_2") + leaveGap = xDialog.getChild("RB_DONT_PAINT") + assumeZero = xDialog.getChild("RB_ASSUME_ZERO") + continueLine = xDialog.getChild("RB_CONTINUE_LINE") + includeHiddenCells = xDialog.getChild("CB_INCLUDE_HIDDEN_CELLS") + hideLegend = xDialog.getChild("CB_LEGEND_ENTRY_HIDDEN") + + self.assertEqual(get_state_as_dict(secondaryYAxis)["Checked"], "true") + self.assertEqual(get_state_as_dict(leaveGap)["Checked"], "true") + self.assertEqual(get_state_as_dict(includeHiddenCells)["Selected"], "true") + self.assertEqual(get_state_as_dict(hideLegend)["Selected"], "true") + + #Click on tab "Line". + select_pos(tabcontrol, "1") + + xWidth = xDialog.getChild("MF_SYMBOL_WIDTH") + xHeight = xDialog.getChild("MF_SYMBOL_HEIGHT") + xKeep = xDialog.getChild("CB_SYMBOL_RATIO") + + self.assertEqual(get_state_as_dict(xKeep)["Selected"], "true") #checked as default even after reopen + self.assertEqual(get_state_as_dict(xWidth)["Text"], "0.35 cm") + self.assertEqual(get_state_as_dict(xHeight)["Text"], "0.30 cm") + #click up, should up both values, because Keep ratio is checked + xWidth.executeAction("UP", tuple()) + xHeight.executeAction("UP", tuple()) + self.assertEqual(get_state_as_dict(xWidth)["Text"], "0.41 cm") + self.assertEqual(get_state_as_dict(xHeight)["Text"], "0.35 cm") + # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/chart/tdf122398.py b/sc/qa/uitest/chart/tdf122398.py index c6093f61677c..5d14db351268 100644 --- a/sc/qa/uitest/chart/tdf122398.py +++ b/sc/qa/uitest/chart/tdf122398.py @@ -28,34 +28,31 @@ class tdf122398(UITestCase): xChartMainTop = self.xUITest.getTopFocusWindow() xChartMain = xChartMainTop.getChild("chart_window") xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0") - self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramAxisX"})) # X Axis... - xDialog = self.xUITest.getTopFocusWindow() - #Click on tab "Scale". - tabcontrol = xDialog.getChild("tabcontrol") - select_pos(tabcontrol, "0") + with self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramAxisX"})) as xDialog: + #Click on tab "Scale". + tabcontrol = xDialog.getChild("tabcontrol") + select_pos(tabcontrol, "0") - autoMinimum = xDialog.getChild("CBX_AUTO_MIN") - autoMaximum = xDialog.getChild("CBX_AUTO_MAX") - majorInterval = xDialog.getChild("CBX_AUTO_STEP_MAIN") - minorInterval = xDialog.getChild("CBX_AUTO_STEP_HELP") - minimum = xDialog.getChild("EDT_MIN") - maximum = xDialog.getChild("EDT_MAX") - major = xDialog.getChild("EDT_STEP_MAIN") - minor = xDialog.getChild("MT_STEPHELP") + autoMinimum = xDialog.getChild("CBX_AUTO_MIN") + autoMaximum = xDialog.getChild("CBX_AUTO_MAX") + majorInterval = xDialog.getChild("CBX_AUTO_STEP_MAIN") + minorInterval = xDialog.getChild("CBX_AUTO_STEP_HELP") + minimum = xDialog.getChild("EDT_MIN") + maximum = xDialog.getChild("EDT_MAX") + major = xDialog.getChild("EDT_STEP_MAIN") + minor = xDialog.getChild("MT_STEPHELP") - autoMinimum.executeAction("CLICK", tuple()) - autoMaximum.executeAction("CLICK", tuple()) - majorInterval.executeAction("CLICK", tuple()) - minorInterval.executeAction("CLICK", tuple()) - #In a chart that contains an axis with a date datatype, the UI does not allow specifying - #a minimum or maximum value greater than 09/04/1900 (i.e., April 9, 1900) - minimum.executeAction("CLEAR", tuple()) - minimum.executeAction("TYPE", mkPropertyValues({"TEXT":"01.01.2018"})) - maximum.executeAction("DOWN", tuple()) #29.04.2018 - major.executeAction("UP", tuple()) #21 - minor.executeAction("DOWN", tuple()) #1 - xOKBtn = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOKBtn) + autoMinimum.executeAction("CLICK", tuple()) + autoMaximum.executeAction("CLICK", tuple()) + majorInterval.executeAction("CLICK", tuple()) + minorInterval.executeAction("CLICK", tuple()) + #In a chart that contains an axis with a date datatype, the UI does not allow specifying + #a minimum or maximum value greater than 09/04/1900 (i.e., April 9, 1900) + minimum.executeAction("CLEAR", tuple()) + minimum.executeAction("TYPE", mkPropertyValues({"TEXT":"01.01.2018"})) + maximum.executeAction("DOWN", tuple()) #29.04.2018 + major.executeAction("UP", tuple()) #21 + minor.executeAction("DOWN", tuple()) #1 #reopen and verify gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"})) @@ -63,31 +60,28 @@ class tdf122398(UITestCase): xChartMainTop = self.xUITest.getTopFocusWindow() xChartMain = xChartMainTop.getChild("chart_window") xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0") - self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramAxisX"})) - xDialog = self.xUITest.getTopFocusWindow() - #Click on tab "Scale". - tabcontrol = xDialog.getChild("tabcontrol") - select_pos(tabcontrol, "0") + with self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramAxisX"})) as xDialog: + #Click on tab "Scale". + tabcontrol = xDialog.getChild("tabcontrol") + select_pos(tabcontrol, "0") - autoMinimum = xDialog.getChild("CBX_AUTO_MIN") - autoMaximum = xDialog.getChild("CBX_AUTO_MAX") - majorInterval = xDialog.getChild("CBX_AUTO_STEP_MAIN") - minorInterval = xDialog.getChild("CBX_AUTO_STEP_HELP") - minimum = xDialog.getChild("EDT_MIN") - maximum = xDialog.getChild("EDT_MAX") - major = xDialog.getChild("EDT_STEP_MAIN") - minor = xDialog.getChild("MT_STEPHELP") + autoMinimum = xDialog.getChild("CBX_AUTO_MIN") + autoMaximum = xDialog.getChild("CBX_AUTO_MAX") + majorInterval = xDialog.getChild("CBX_AUTO_STEP_MAIN") + minorInterval = xDialog.getChild("CBX_AUTO_STEP_HELP") + minimum = xDialog.getChild("EDT_MIN") + maximum = xDialog.getChild("EDT_MAX") + major = xDialog.getChild("EDT_STEP_MAIN") + minor = xDialog.getChild("MT_STEPHELP") - self.assertEqual(get_state_as_dict(autoMinimum)["Selected"], "false") - self.assertEqual(get_state_as_dict(autoMaximum)["Selected"], "false") - self.assertEqual(get_state_as_dict(majorInterval)["Selected"], "false") - self.assertEqual(get_state_as_dict(minorInterval)["Selected"], "false") - self.assertEqual(get_state_as_dict(minimum)["Text"], "01.01.2018") - self.assertEqual(get_state_as_dict(maximum)["Text"], "29.04.2018") - self.assertEqual(get_state_as_dict(major)["Text"], "21") - self.assertEqual(get_state_as_dict(minor)["Text"], "1") + self.assertEqual(get_state_as_dict(autoMinimum)["Selected"], "false") + self.assertEqual(get_state_as_dict(autoMaximum)["Selected"], "false") + self.assertEqual(get_state_as_dict(majorInterval)["Selected"], "false") + self.assertEqual(get_state_as_dict(minorInterval)["Selected"], "false") + self.assertEqual(get_state_as_dict(minimum)["Text"], "01.01.2018") + self.assertEqual(get_state_as_dict(maximum)["Text"], "29.04.2018") + self.assertEqual(get_state_as_dict(major)["Text"], "21") + self.assertEqual(get_state_as_dict(minor)["Text"], "1") - xOKBtn = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOKBtn) # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/chart/tdf123013.py b/sc/qa/uitest/chart/tdf123013.py index 23a667f86317..45bb294fcfa0 100644 --- a/sc/qa/uitest/chart/tdf123013.py +++ b/sc/qa/uitest/chart/tdf123013.py @@ -24,16 +24,13 @@ class tdf123013(UITestCase): xChartMainTop = self.xUITest.getTopFocusWindow() xChartMain = xChartMainTop.getChild("chart_window") xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0") - self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "FormatTrendline"})) - xDialog = self.xUITest.getTopFocusWindow() - #Click on tab "Type". - tabcontrol = xDialog.getChild("tabcontrol") - select_pos(tabcontrol, "0") - #add name - xentryname = xDialog.getChild("entry_name") - xentryname.executeAction("TYPE", mkPropertyValues({"TEXT":"Tline"})) - xOKBtn = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOKBtn) + with self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "FormatTrendline"})) as xDialog: + #Click on tab "Type". + tabcontrol = xDialog.getChild("tabcontrol") + select_pos(tabcontrol, "0") + #add name + xentryname = xDialog.getChild("entry_name") + xentryname.executeAction("TYPE", mkPropertyValues({"TEXT":"Tline"})) #reopen and try again gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"})) @@ -44,15 +41,12 @@ class tdf123013(UITestCase): #Right-click on the chart; from the pop-up menu select "Format Y bars # The program presents dialog "Format Y bars", tab "Line". xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0") - self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "FormatTrendline"})) - xDialog = self.xUITest.getTopFocusWindow() - #Click on tab "Type". - tabcontrol = xDialog.getChild("tabcontrol") - select_pos(tabcontrol, "0") - #add name - xentryname = xDialog.getChild("entry_name") - self.assertEqual(get_state_as_dict(xentryname)["Text"], "Tline") - xOKBtn = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOKBtn) + with self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "FormatTrendline"})) as xDialog: + #Click on tab "Type". + tabcontrol = xDialog.getChild("tabcontrol") + select_pos(tabcontrol, "0") + #add name + xentryname = xDialog.getChild("entry_name") + self.assertEqual(get_state_as_dict(xentryname)["Text"], "Tline") # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/chart/tdf123231.py b/sc/qa/uitest/chart/tdf123231.py index a9d3546fb0eb..d384229df275 100644 --- a/sc/qa/uitest/chart/tdf123231.py +++ b/sc/qa/uitest/chart/tdf123231.py @@ -26,19 +26,16 @@ class tdf123231(UITestCase): xChartMainTop = self.xUITest.getTopFocusWindow() xChartMain = xChartMainTop.getChild("chart_window") xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0") - self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "FormatTrendline"})) - xDialog = self.xUITest.getTopFocusWindow() - #Click on tab "Type". - tabcontrol = xDialog.getChild("tabcontrol") - select_pos(tabcontrol, "0") - logarithmic = xDialog.getChild("logarithmic") #type regression logarithmic - exponential = xDialog.getChild("exponential") #type regression exponential - power = xDialog.getChild("exponential") #type regression power + with self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "FormatTrendline"})) as xDialog: + #Click on tab "Type". + tabcontrol = xDialog.getChild("tabcontrol") + select_pos(tabcontrol, "0") + logarithmic = xDialog.getChild("logarithmic") #type regression logarithmic + exponential = xDialog.getChild("exponential") #type regression exponential + power = xDialog.getChild("exponential") #type regression power - power.executeAction("CLICK", tuple()) #set power + power.executeAction("CLICK", tuple()) #set power - xOKBtn = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOKBtn) #reopen dialog and close dialog gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"})) @@ -46,17 +43,14 @@ class tdf123231(UITestCase): xChartMainTop = self.xUITest.getTopFocusWindow() xChartMain = xChartMainTop.getChild("chart_window") xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0") - self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "FormatTrendline"})) - xDialog = self.xUITest.getTopFocusWindow() - #Click on tab "Type". - tabcontrol = xDialog.getChild("tabcontrol") - select_pos(tabcontrol, "0") - logarithmic = xDialog.getChild("logarithmic") #type regression logarithmic - exponential = xDialog.getChild("exponential") #type regression exponential - power = xDialog.getChild("exponential") #type regression power - self.assertEqual(get_state_as_dict(power)["Checked"], "true") - xOKBtn = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOKBtn) + with self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "FormatTrendline"})) as xDialog: + #Click on tab "Type". + tabcontrol = xDialog.getChild("tabcontrol") + select_pos(tabcontrol, "0") + logarithmic = xDialog.getChild("logarithmic") #type regression logarithmic + exponential = xDialog.getChild("exponential") #type regression exponential + power = xDialog.getChild("exponential") #type regression power + self.assertEqual(get_state_as_dict(power)["Checked"], "true") #reopen and verify Power gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"})) @@ -64,19 +58,16 @@ class tdf123231(UITestCase): xChartMainTop = self.xUITest.getTopFocusWindow() xChartMain = xChartMainTop.getChild("chart_window") xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0") - self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "FormatTrendline"})) - xDialog = self.xUITest.getTopFocusWindow() - #Click on tab "Type". - tabcontrol = xDialog.getChild("tabcontrol") - select_pos(tabcontrol, "0") + with self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "FormatTrendline"})) as xDialog: + #Click on tab "Type". + tabcontrol = xDialog.getChild("tabcontrol") + select_pos(tabcontrol, "0") - logarithmic = xDialog.getChild("logarithmic") #type regression logarithmic - exponential = xDialog.getChild("exponential") #type regression exponential - power = xDialog.getChild("exponential") #type regression power + logarithmic = xDialog.getChild("logarithmic") #type regression logarithmic + exponential = xDialog.getChild("exponential") #type regression exponential + power = xDialog.getChild("exponential") #type regression power - self.assertEqual(get_state_as_dict(power)["Checked"], "true") + self.assertEqual(get_state_as_dict(power)["Checked"], "true") - xOKBtn = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOKBtn) # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/chart/tdf123520.py b/sc/qa/uitest/chart/tdf123520.py index 2fa43e9e110a..b2d1b169cf9a 100644 --- a/sc/qa/uitest/chart/tdf123520.py +++ b/sc/qa/uitest/chart/tdf123520.py @@ -26,28 +26,25 @@ class tdf123520(UITestCase): xChartMainTop = self.xUITest.getTopFocusWindow() xChartMain = xChartMainTop.getChild("chart_window") xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0") - self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramAxisY"})) # Y Axis - xDialog = self.xUITest.getTopFocusWindow() - #Click on tab "positioning". - tabcontrol = xDialog.getChild("tabcontrol") - select_pos(tabcontrol, "1") + with self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramAxisY"})) as xDialog: + #Click on tab "positioning". + tabcontrol = xDialog.getChild("tabcontrol") + select_pos(tabcontrol, "1") - crossAxis = xDialog.getChild("LB_CROSSES_OTHER_AXIS_AT") - crossAxisValue = xDialog.getChild("EDT_CROSSES_OTHER_AXIS_AT") #only available when crossAxis = Value - placeLabels = xDialog.getChild("LB_PLACE_LABELS") - innerMajorTick = xDialog.getChild("CB_TICKS_INNER") - outerMajorTick = xDialog.getChild("CB_TICKS_OUTER") - innerMinorTick = xDialog.getChild("CB_MINOR_INNER") - outerMinorTick = xDialog.getChild("CB_MINOR_OUTER") - placeMarks = xDialog.getChild("LB_PLACE_TICKS") - crossAxisValue.executeAction("CLEAR", tuple()) - crossAxisValue.executeAction("TYPE", mkPropertyValues({"TEXT":"01.01.2018"})) - #crossAxisValue.executeAction("TYPE", mkPropertyValues({"KEYCODE":"TAB"})) - #TAB doesn't works- add "a" at the end of textbox - #workaround - edit another ui item, it should trigger leave of textbox - select_by_text(placeLabels, "Outside start") - xOKBtn = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOKBtn) + crossAxis = xDialog.getChild("LB_CROSSES_OTHER_AXIS_AT") + crossAxisValue = xDialog.getChild("EDT_CROSSES_OTHER_AXIS_AT") #only available when crossAxis = Value + placeLabels = xDialog.getChild("LB_PLACE_LABELS") + innerMajorTick = xDialog.getChild("CB_TICKS_INNER") + outerMajorTick = xDialog.getChild("CB_TICKS_OUTER") + innerMinorTick = xDialog.getChild("CB_MINOR_INNER") + outerMinorTick = xDialog.getChild("CB_MINOR_OUTER") + placeMarks = xDialog.getChild("LB_PLACE_TICKS") + crossAxisValue.executeAction("CLEAR", tuple()) + crossAxisValue.executeAction("TYPE", mkPropertyValues({"TEXT":"01.01.2018"})) + #crossAxisValue.executeAction("TYPE", mkPropertyValues({"KEYCODE":"TAB"})) + #TAB doesn't works- add "a" at the end of textbox + #workaround - edit another ui item, it should trigger leave of textbox + select_by_text(placeLabels, "Outside start") #reopen and verify tab "positioning". gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"})) @@ -55,26 +52,23 @@ class tdf123520(UITestCase): xChartMainTop = self.xUITest.getTopFocusWindow() xChartMain = xChartMainTop.getChild("chart_window") xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0") - self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramAxisY"})) - xDialog = self.xUITest.getTopFocusWindow() + with self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramAxisY"})) as xDialog: - tabcontrol = xDialog.getChild("tabcontrol") - select_pos(tabcontrol, "1") + tabcontrol = xDialog.getChild("tabcontrol") + select_pos(tabcontrol, "1") - crossAxis = xDialog.getChild("LB_CROSSES_OTHER_AXIS_AT") - crossAxisValue = xDialog.getChild("EDT_CROSSES_OTHER_AXIS_AT") #only available when crossAxis = Value - placeLabels = xDialog.getChild("LB_PLACE_LABELS") - innerMajorTick = xDialog.getChild("CB_TICKS_INNER") - outerMajorTick = xDialog.getChild("CB_TICKS_OUTER") - innerMinorTick = xDialog.getChild("CB_MINOR_INNER") - outerMinorTick = xDialog.getChild("CB_MINOR_OUTER") - placeMarks = xDialog.getChild("LB_PLACE_TICKS") + crossAxis = xDialog.getChild("LB_CROSSES_OTHER_AXIS_AT") + crossAxisValue = xDialog.getChild("EDT_CROSSES_OTHER_AXIS_AT") #only available when crossAxis = Value + placeLabels = xDialog.getChild("LB_PLACE_LABELS") + innerMajorTick = xDialog.getChild("CB_TICKS_INNER") + outerMajorTick = xDialog.getChild("CB_TICKS_OUTER") + innerMinorTick = xDialog.getChild("CB_MINOR_INNER") + outerMinorTick = xDialog.getChild("CB_MINOR_OUTER") + placeMarks = xDialog.getChild("LB_PLACE_TICKS") - self.assertEqual(get_state_as_dict(crossAxis)["SelectEntryText"], "Value") - self.assertEqual(get_state_as_dict(crossAxisValue)["Text"], "01.01.2018") - self.assertEqual(get_state_as_dict(placeLabels)["SelectEntryText"], "Outside start") + self.assertEqual(get_state_as_dict(crossAxis)["SelectEntryText"], "Value") + self.assertEqual(get_state_as_dict(crossAxisValue)["Text"], "01.01.2018") + self.assertEqual(get_state_as_dict(placeLabels)["SelectEntryText"], "Outside start") - xOKBtn = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOKBtn) # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/chart/tdf124111.py b/sc/qa/uitest/chart/tdf124111.py index 056deff2f103..3adbd0848293 100644 --- a/sc/qa/uitest/chart/tdf124111.py +++ b/sc/qa/uitest/chart/tdf124111.py @@ -25,24 +25,21 @@ class tdf124111(UITestCase): xChartMainTop = self.xUITest.getTopFocusWindow() xChartMain = xChartMainTop.getChild("chart_window") xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0") - self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramAxisX"})) # X Axis... - xDialog = self.xUITest.getTopFocusWindow() - #Click on tab "positioning". - tabcontrol = xDialog.getChild("tabcontrol") - select_pos(tabcontrol, "1") + with self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramAxisX"})) as xDialog: + #Click on tab "positioning". + tabcontrol = xDialog.getChild("tabcontrol") + select_pos(tabcontrol, "1") - crossAxis = xDialog.getChild("LB_CROSSES_OTHER_AXIS_AT") - crossAxisValue = xDialog.getChild("EDT_CROSSES_OTHER_AXIS_AT") #only available when crossAxis = Value - placeLabels = xDialog.getChild("LB_PLACE_LABELS") - innerMajorTick = xDialog.getChild("CB_TICKS_INNER") - outerMajorTick = xDialog.getChild("CB_TICKS_OUTER") - innerMinorTick = xDialog.getChild("CB_MINOR_INNER") - outerMinorTick = xDialog.getChild("CB_MINOR_OUTER") - placeMarks = xDialog.getChild("LB_PLACE_TICKS") - crossAxisValue.executeAction("DOWN", tuple()) #-1 + crossAxis = xDialog.getChild("LB_CROSSES_OTHER_AXIS_AT") + crossAxisValue = xDialog.getChild("EDT_CROSSES_OTHER_AXIS_AT") #only available when crossAxis = Value + placeLabels = xDialog.getChild("LB_PLACE_LABELS") + innerMajorTick = xDialog.getChild("CB_TICKS_INNER") + outerMajorTick = xDialog.getChild("CB_TICKS_OUTER") + innerMinorTick = xDialog.getChild("CB_MINOR_INNER") + outerMinorTick = xDialog.getChild("CB_MINOR_OUTER") + placeMarks = xDialog.getChild("LB_PLACE_TICKS") + crossAxisValue.executeAction("DOWN", tuple()) #-1 - xOKBtn = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOKBtn) #reopen and verify tab "positioning". gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"})) @@ -50,24 +47,21 @@ class tdf124111(UITestCase): xChartMainTop = self.xUITest.getTopFocusWindow() xChartMain = xChartMainTop.getChild("chart_window") xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0") - self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramAxisX"})) - xDialog = self.xUITest.getTopFocusWindow() + with self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramAxisX"})) as xDialog: - tabcontrol = xDialog.getChild("tabcontrol") - select_pos(tabcontrol, "1") + tabcontrol = xDialog.getChild("tabcontrol") + select_pos(tabcontrol, "1") - crossAxis = xDialog.getChild("LB_CROSSES_OTHER_AXIS_AT") - crossAxisValue = xDialog.getChild("EDT_CROSSES_OTHER_AXIS_AT") #only available when crossAxis = Value - placeLabels = xDialog.getChild("LB_PLACE_LABELS") - innerMajorTick = xDialog.getChild("CB_TICKS_INNER") - outerMajorTick = xDialog.getChild("CB_TICKS_OUTER") - innerMinorTick = xDialog.getChild("CB_MINOR_INNER") - outerMinorTick = xDialog.getChild("CB_MINOR_OUTER") - placeMarks = xDialog.getChild("LB_PLACE_TICKS") + crossAxis = xDialog.getChild("LB_CROSSES_OTHER_AXIS_AT") + crossAxisValue = xDialog.getChild("EDT_CROSSES_OTHER_AXIS_AT") #only available when crossAxis = Value + placeLabels = xDialog.getChild("LB_PLACE_LABELS") + innerMajorTick = xDialog.getChild("CB_TICKS_INNER") + outerMajorTick = xDialog.getChild("CB_TICKS_OUTER") + innerMinorTick = xDialog.getChild("CB_MINOR_INNER") + outerMinorTick = xDialog.getChild("CB_MINOR_OUTER") + placeMarks = xDialog.getChild("LB_PLACE_TICKS") - self.assertEqual(get_state_as_dict(crossAxis)["SelectEntryText"], "Value") - self.assertEqual(get_state_as_dict(crossAxisValue)["Text"], "-1") + self.assertEqual(get_state_as_dict(crossAxis)["SelectEntryText"], "Value") + self.assertEqual(get_state_as_dict(crossAxisValue)["Text"], "-1") - xOKBtn = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOKBtn) # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/chart/tdf129587.py b/sc/qa/uitest/chart/tdf129587.py index 020b866274b7..a969c5e7e3d9 100644 --- a/sc/qa/uitest/chart/tdf129587.py +++ b/sc/qa/uitest/chart/tdf129587.py @@ -26,30 +26,27 @@ class tdf129587(UITestCase): xChartMain = xChartMainTop.getChild("chart_window") xSeriesObj = xChartMain.getChild("CID/MultiClick/D=0:CS=0:CT=0:Series=0:ErrorsY=") - self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "FormatYErrorBars"})) - xDialog = self.xUITest.getTopFocusWindow() + with self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "FormatYErrorBars"})) as xDialog: - tabcontrol = xDialog.getChild("tabcontrol") - select_pos(tabcontrol, "0") + tabcontrol = xDialog.getChild("tabcontrol") + select_pos(tabcontrol, "0") - xPerBtn = xDialog.getChild("RB_PERCENT") - xPerBtn.executeAction("CLICK", tuple()) + xPerBtn = xDialog.getChild("RB_PERCENT") + xPerBtn.executeAction("CLICK", tuple()) - xPosField = xDialog.getChild("MF_POSITIVE") - xNegField = xDialog.getChild("MF_NEGATIVE") + xPosField = xDialog.getChild("MF_POSITIVE") + xNegField = xDialog.getChild("MF_NEGATIVE") - self.assertEqual("0%", get_state_as_dict(xPosField)['Text']) - self.assertEqual("0%", get_state_as_dict(xNegField)['Text']) + self.assertEqual("0%", get_state_as_dict(xPosField)['Text']) + self.assertEqual("0%", get_state_as_dict(xNegField)['Text']) - #Increase value by one - xPosField.executeAction("UP", tuple()) + #Increase value by one + xPosField.executeAction("UP", tuple()) - #Both fields are updated because 'Same value for both' is enabled - self.assertEqual("1%", get_state_as_dict(xPosField)['Text']) - self.assertEqual("1%", get_state_as_dict(xNegField)['Text']) + #Both fields are updated because 'Same value for both' is enabled + self.assertEqual("1%", get_state_as_dict(xPosField)['Text']) + self.assertEqual("1%", get_state_as_dict(xNegField)['Text']) - xOKBtn = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOKBtn) #Without the fix in place, it would have crashed here xDataSeries = document.Sheets[0].Charts[0].getEmbeddedObject().getFirstDiagram().CoordinateSystems[0].ChartTypes[0].DataSeries diff --git a/sc/qa/uitest/chart/tdf133630.py b/sc/qa/uitest/chart/tdf133630.py index 2b0ee28e3913..100b2695a139 100644 --- a/sc/qa/uitest/chart/tdf133630.py +++ b/sc/qa/uitest/chart/tdf133630.py @@ -30,35 +30,29 @@ class tdf133630(UITestCase): xChartMainTop = self.xUITest.getTopFocusWindow() xChartMain = xChartMainTop.getChild("chart_window") xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:Axis=0,0") - self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramAxisX"})) + with self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramAxisX"})) as xDialog: - xDialog = self.xUITest.getTopFocusWindow() - tabcontrol = xDialog.getChild("tabcontrol") - select_pos(tabcontrol, "2") + tabcontrol = xDialog.getChild("tabcontrol") + select_pos(tabcontrol, "2") - xWidth = xDialog.getChild("MTR_FLD_LINE_WIDTH") - xWidth.executeAction("UP", tuple()) + xWidth = xDialog.getChild("MTR_FLD_LINE_WIDTH") + xWidth.executeAction("UP", tuple()) - xOKBtn = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOKBtn) self.assertEqual(100, xCS.getAxisByDimension(0, 0).LineWidth) self.assertEqual(80, xCS.ChartTypes[0].DataSeries[0].LineWidth) # Now change the line width of another element xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0") - self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "FormatDataSeries"})) + with self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "FormatDataSeries"})) as xDialog: - xDialog = self.xUITest.getTopFocusWindow() - tabcontrol = xDialog.getChild("tabcontrol") - select_pos(tabcontrol, "1") + tabcontrol = xDialog.getChild("tabcontrol") + select_pos(tabcontrol, "1") - xWidth = xDialog.getChild("MTR_FLD_LINE_WIDTH") - xWidth.executeAction("UP", tuple()) + xWidth = xDialog.getChild("MTR_FLD_LINE_WIDTH") + xWidth.executeAction("UP", tuple()) - # Without the fix in place, this test would have crashed here - xOKBtn = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOKBtn) + # Without the fix in place, this test would have crashed here self.assertEqual(100, xCS.getAxisByDimension(0, 0).LineWidth) self.assertEqual(100, xCS.ChartTypes[0].DataSeries[0].LineWidth) diff --git a/sc/qa/uitest/chart/tdf134059.py b/sc/qa/uitest/chart/tdf134059.py index 76f364a7c58d..a77822920d8c 100644 --- a/sc/qa/uitest/chart/tdf134059.py +++ b/sc/qa/uitest/chart/tdf134059.py @@ -21,20 +21,17 @@ class Tdf134059(UITestCase): xPage = xChartMain.getChild("CID/Page=") - self.ui_test.execute_dialog_through_action(xPage, "COMMAND", mkPropertyValues({"COMMAND": "DataRanges"})) - xDialog = self.xUITest.getTopFocusWindow() + with self.ui_test.execute_dialog_through_action(xPage, "COMMAND", mkPropertyValues({"COMMAND": "DataRanges"})) as xDialog: - xTabs = xDialog.getChild("tabcontrol") - select_pos(xTabs, "1") + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "1") - xSeries = xDialog.getChild("LB_SERIES") - self.assertEqual(3, len(xSeries.getChildren())) - self.assertEqual("Col. 1", get_state_as_dict(xSeries.getChild('0'))['Text']) - self.assertEqual("Col. 2", get_state_as_dict(xSeries.getChild('1'))['Text']) - self.assertEqual("Col. 3", get_state_as_dict(xSeries.getChild('2'))['Text']) + xSeries = xDialog.getChild("LB_SERIES") + self.assertEqual(3, len(xSeries.getChildren())) + self.assertEqual("Col. 1", get_state_as_dict(xSeries.getChild('0'))['Text']) + self.assertEqual("Col. 2", get_state_as_dict(xSeries.getChild('1'))['Text']) + self.assertEqual("Col. 3", get_state_as_dict(xSeries.getChild('2'))['Text']) - xOKBtn = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOKBtn) gridwin.executeAction("DESELECT", mkPropertyValues({"OBJECT": "Object 1"})) diff --git a/sc/qa/uitest/chart/tdf142851.py b/sc/qa/uitest/chart/tdf142851.py index 512af056b65e..2adf25da0709 100644 --- a/sc/qa/uitest/chart/tdf142851.py +++ b/sc/qa/uitest/chart/tdf142851.py @@ -23,13 +23,9 @@ class tdf142851(UITestCase): xChartMain = xChartMainTop.getChild("chart_window") xChart = xChartMain.getChild("CID/Page=") - self.ui_test.execute_dialog_through_action(xChart, "COMMAND", - mkPropertyValues({"COMMAND" : "DiagramType"})) - xDialog = self.xUITest.getTopFocusWindow() - chartTypeVisible = get_state_as_dict(xDialog.getChild("charttype"))['Visible'] - subTypeVisible = get_state_as_dict(xDialog.getChild("subtype"))['Visible'] - xOKBtn = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOKBtn) + with self.ui_test.execute_dialog_through_action(xChart, "COMMAND", mkPropertyValues({"COMMAND" : "DiagramType"})) as xDialog: + chartTypeVisible = get_state_as_dict(xDialog.getChild("charttype"))['Visible'] + subTypeVisible = get_state_as_dict(xDialog.getChild("subtype"))['Visible'] self.assertEqual('true', chartTypeVisible) self.assertEqual('true', subTypeVisible) diff --git a/sc/qa/uitest/chart/tdf93506_trendline.py b/sc/qa/uitest/chart/tdf93506_trendline.py index f528238bdd90..f44ccf64e576 100644 --- a/sc/qa/uitest/chart/tdf93506_trendline.py +++ b/sc/qa/uitest/chart/tdf93506_trendline.py @@ -30,47 +30,44 @@ class tdf93506(UITestCase): xChartMainTop = self.xUITest.getTopFocusWindow() xChartMain = xChartMainTop.getChild("chart_window") xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0") - self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "FormatTrendline"})) - xDialog = self.xUITest.getTopFocusWindow() - #Click on tab "Type". - tabcontrol = xDialog.getChild("tabcontrol") - select_pos(tabcontrol, "0") - - logarithmic = xDialog.getChild("logarithmic") #type regression logarithmic - xentryname = xDialog.getChild("entry_name") #add name - extrapolateForward = xDialog.getChild("extrapolateForward") - extrapolateBackward = xDialog.getChild("extrapolateBackward") - setIntercept = xDialog.getChild("setIntercept") - interceptValue = xDialog.getChild("interceptValue") - showEquation = xDialog.getChild("showEquation") - showCorrelationCoefficient = xDialog.getChild("showCorrelationCoefficient") - xVarname = xDialog.getChild("entry_Xname") - yVarName = xDialog.getChild("entry_Yname") - - logarithmic.executeAction("CLICK", tuple()) - xentryname.executeAction("TYPE", mkPropertyValues({"TEXT":"Name"})) - extrapolateForward.executeAction("UP", tuple()) - extrapolateBackward.executeAction("UP", tuple()) - showEquation.executeAction("CLICK", tuple()) - showCorrelationCoefficient.executeAction("CLICK", tuple()) - xVarname.executeAction("CLEAR", tuple()) - xVarname.executeAction("TYPE", mkPropertyValues({"TEXT":"a"})) - yVarName.executeAction("CLEAR", tuple()) - yVarName.executeAction("TYPE", mkPropertyValues({"TEXT":"f(a)"})) - - #Click on tab "Line". - select_pos(tabcontrol, "1") - - xWidth = xDialog.getChild("MTR_FLD_LINE_WIDTH") - xTransparent = xDialog.getChild("MTR_LINE_TRANSPARENT") - - xWidth.executeAction("UP", tuple()) - xTransparent.executeAction("UP", tuple()) - self.assertEqual(get_state_as_dict(xWidth)["Text"], "0.10 cm") - self.assertEqual(get_state_as_dict(xTransparent)["Text"], "5%") - - xOKBtn = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOKBtn) + with self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "FormatTrendline"})) as xDialog: + #Click on tab "Type". + tabcontrol = xDialog.getChild("tabcontrol") + select_pos(tabcontrol, "0") + + logarithmic = xDialog.getChild("logarithmic") #type regression logarithmic + xentryname = xDialog.getChild("entry_name") #add name + extrapolateForward = xDialog.getChild("extrapolateForward") + extrapolateBackward = xDialog.getChild("extrapolateBackward") + setIntercept = xDialog.getChild("setIntercept") + interceptValue = xDialog.getChild("interceptValue") + showEquation = xDialog.getChild("showEquation") + showCorrelationCoefficient = xDialog.getChild("showCorrelationCoefficient") + xVarname = xDialog.getChild("entry_Xname") + yVarName = xDialog.getChild("entry_Yname") + + logarithmic.executeAction("CLICK", tuple()) + xentryname.executeAction("TYPE", mkPropertyValues({"TEXT":"Name"})) + extrapolateForward.executeAction("UP", tuple()) + extrapolateBackward.executeAction("UP", tuple()) + showEquation.executeAction("CLICK", tuple()) + showCorrelationCoefficient.executeAction("CLICK", tuple()) + xVarname.executeAction("CLEAR", tuple()) + xVarname.executeAction("TYPE", mkPropertyValues({"TEXT":"a"})) + yVarName.executeAction("CLEAR", tuple()) + yVarName.executeAction("TYPE", mkPropertyValues({"TEXT":"f(a)"})) + + #Click on tab "Line". + select_pos(tabcontrol, "1") + + xWidth = xDialog.getChild("MTR_FLD_LINE_WIDTH") + xTransparent = xDialog.getChild("MTR_LINE_TRANSPARENT") + + xWidth.executeAction("UP", tuple()) + xTransparent.executeAction("UP", tuple()) + self.assertEqual(get_state_as_dict(xWidth)["Text"], "0.10 cm") + self.assertEqual(get_state_as_dict(xTransparent)["Text"], "5%") + #reopen and verify gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"})) @@ -78,42 +75,39 @@ class tdf93506(UITestCase): xChartMainTop = self.xUITest.getTopFocusWindow() xChartMain = xChartMainTop.getChild("chart_window") xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0") - self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "FormatTrendline"})) - xDialog = self.xUITest.getTopFocusWindow() - #Click on tab "Type". - tabcontrol = xDialog.getChild("tabcontrol") - select_pos(tabcontrol, "0") - - logarithmic = xDialog.getChild("logarithmic") #type regression logarithmic - xentryname = xDialog.getChild("entry_name") #add name - extrapolateForward = xDialog.getChild("extrapolateForward") - extrapolateBackward = xDialog.getChild("extrapolateBackward") - setIntercept = xDialog.getChild("setIntercept") - interceptValue = xDialog.getChild("interceptValue") - showEquation = xDialog.getChild("showEquation") - showCorrelationCoefficient = xDialog.getChild("showCorrelationCoefficient") - xVarname = xDialog.getChild("entry_Xname") - yVarName = xDialog.getChild("entry_Yname") - - self.assertEqual(get_state_as_dict(logarithmic)["Checked"], "true") - self.assertEqual(get_state_as_dict(xentryname)["Text"], "Name") - self.assertEqual(get_state_as_dict(extrapolateForward)["Text"], "1") - self.assertEqual(get_state_as_dict(extrapolateBackward)["Text"], "1") - self.assertEqual(get_state_as_dict(showEquation)["Selected"], "true") - self.assertEqual(get_state_as_dict(showCorrelationCoefficient)["Selected"], "true") - self.assertEqual(get_state_as_dict(xVarname)["Text"], "a") - self.assertEqual(get_state_as_dict(yVarName)["Text"], "f(a)") - - #Click on tab "Line". - select_pos(tabcontrol, "1") - xWidth = xDialog.getChild("MTR_FLD_LINE_WIDTH") - xTransparent = xDialog.getChild("MTR_LINE_TRANSPARENT") - - self.assertEqual(get_state_as_dict(xWidth)["Text"], "0.10 cm") - self.assertEqual(get_state_as_dict(xTransparent)["Text"], "5%") - - xOKBtn = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOKBtn) + with self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "FormatTrendline"})) as xDialog: + #Click on tab "Type". + tabcontrol = xDialog.getChild("tabcontrol") + select_pos(tabcontrol, "0") + + logarithmic = xDialog.getChild("logarithmic") #type regression logarithmic + xentryname = xDialog.getChild("entry_name") #add name + extrapolateForward = xDialog.getChild("extrapolateForward") + extrapolateBackward = xDialog.getChild("extrapolateBackward") + setIntercept = xDialog.getChild("setIntercept") + interceptValue = xDialog.getChild("interceptValue") + showEquation = xDialog.getChild("showEquation") + showCorrelationCoefficient = xDialog.getChild("showCorrelationCoefficient") + xVarname = xDialog.getChild("entry_Xname") + yVarName = xDialog.getChild("entry_Yname") + + self.assertEqual(get_state_as_dict(logarithmic)["Checked"], "true") + self.assertEqual(get_state_as_dict(xentryname)["Text"], "Name") + self.assertEqual(get_state_as_dict(extrapolateForward)["Text"], "1") + self.assertEqual(get_state_as_dict(extrapolateBackward)["Text"], "1") + self.assertEqual(get_state_as_dict(showEquation)["Selected"], "true") + self.assertEqual(get_state_as_dict(showCorrelationCoefficient)["Selected"], "true") + self.assertEqual(get_state_as_dict(xVarname)["Text"], "a") + self.assertEqual(get_state_as_dict(yVarName)["Text"], "f(a)") + + #Click on tab "Line". + select_pos(tabcontrol, "1") + xWidth = xDialog.getChild("MTR_FLD_LINE_WIDTH") + xTransparent = xDialog.getChild("MTR_LINE_TRANSPARENT") + + self.assertEqual(get_state_as_dict(xWidth)["Text"], "0.10 cm") + self.assertEqual(get_state_as_dict(xTransparent)["Text"], "5%") + #Now change regression Type to Exponential gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"})) @@ -121,38 +115,35 @@ class tdf93506(UITestCase): xChartMainTop = self.xUITest.getTopFocusWindow() xChartMain = xChartMainTop.getChild("chart_window") xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0") - self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "FormatTrendline"})) - xDialog = self.xUITest.getTopFocusWindow() - #Click on tab "Type". - tabcontrol = xDialog.getChild("tabcontrol") - select_pos(tabcontrol, "0") - logarithmic = xDialog.getChild("logarithmic") #type regression logarithmic - exponential = xDialog.getChild("exponential") #type regression exponential - xentryname = xDialog.getChild("entry_name") #add name - extrapolateForward = xDialog.getChild("extrapolateForward") - extrapolateBackward = xDialog.getChild("extrapolateBackward") - setIntercept = xDialog.getChild("setIntercept") - interceptValue = xDialog.getChild("interceptValue") - showEquation = xDialog.getChild("showEquation") - showCorrelationCoefficient = xDialog.getChild("showCorrelationCoefficient") - xVarname = xDialog.getChild("entry_Xname") - yVarName = xDialog.getChild("entry_Yname") - - exponential.executeAction("CLICK", tuple()) #set exponential - #set Force intercept - setIntercept.executeAction("CLICK", tuple()) - interceptValue.executeAction("UP", tuple()) - - #Click on tab "Line". - select_pos(tabcontrol, "1") - xWidth = xDialog.getChild("MTR_FLD_LINE_WIDTH") - xTransparent = xDialog.getChild("MTR_LINE_TRANSPARENT") - - self.assertEqual(get_state_as_dict(xWidth)["Text"], "0.10 cm") - self.assertEqual(get_state_as_dict(xTransparent)["Text"], "5%") - - xOKBtn = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOKBtn) + with self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "FormatTrendline"})) as xDialog: + #Click on tab "Type". + tabcontrol = xDialog.getChild("tabcontrol") + select_pos(tabcontrol, "0") + logarithmic = xDialog.getChild("logarithmic") #type regression logarithmic + exponential = xDialog.getChild("exponential") #type regression exponential + xentryname = xDialog.getChild("entry_name") #add name + extrapolateForward = xDialog.getChild("extrapolateForward") + extrapolateBackward = xDialog.getChild("extrapolateBackward") + setIntercept = xDialog.getChild("setIntercept") + interceptValue = xDialog.getChild("interceptValue") + showEquation = xDialog.getChild("showEquation") + showCorrelationCoefficient = xDialog.getChild("showCorrelationCoefficient") + xVarname = xDialog.getChild("entry_Xname") + yVarName = xDialog.getChild("entry_Yname") + + exponential.executeAction("CLICK", tuple()) #set exponential + #set Force intercept + setIntercept.executeAction("CLICK", tuple()) + interceptValue.executeAction("UP", tuple()) + + #Click on tab "Line". + select_pos(tabcontrol, "1") + xWidth = xDialog.getChild("MTR_FLD_LINE_WIDTH") + xTransparent = xDialog.getChild("MTR_LINE_TRANSPARENT") + + self.assertEqual(get_state_as_dict(xWidth)["Text"], "0.10 cm") + self.assertEqual(get_state_as_dict(xTransparent)["Text"], "5%") + #reopen and verify Exponential gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"})) @@ -160,45 +151,42 @@ class tdf93506(UITestCase): xChartMainTop = self.xUITest.getTopFocusWindow() xChartMain = xChartMainTop.getChild("chart_window") xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0") - self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "FormatTrendline"})) - xDialog = self.xUITest.getTopFocusWindow() - #Click on tab "Type". - tabcontrol = xDialog.getChild("tabcontrol") - select_pos(tabcontrol, "0") - - logarithmic = xDialog.getChild("logarithmic") #type regression logarithmic - exponential = xDialog.getChild("exponential") #type regression exponential - xentryname = xDialog.getChild("entry_name") #add name - extrapolateForward = xDialog.getChild("extrapolateForward") - extrapolateBackward = xDialog.getChild("extrapolateBackward") - setIntercept = xDialog.getChild("setIntercept") - interceptValue = xDialog.getChild("interceptValue") - showEquation = xDialog.getChild("showEquation") - showCorrelationCoefficient = xDialog.getChild("showCorrelationCoefficient") - xVarname = xDialog.getChild("entry_Xname") - yVarName = xDialog.getChild("entry_Yname") - - self.assertEqual(get_state_as_dict(exponential)["Checked"], "true") - self.assertEqual(get_state_as_dict(xentryname)["Text"], "Name") - self.assertEqual(get_state_as_dict(extrapolateForward)["Text"], "1") - self.assertEqual(get_state_as_dict(extrapolateBackward)["Text"], "1") - self.assertEqual(get_state_as_dict(showEquation)["Selected"], "true") - self.assertEqual(get_state_as_dict(setIntercept)["Selected"], "true") - self.assertEqual(get_state_as_dict(interceptValue)["Text"], "1") - self.assertEqual(get_state_as_dict(showCorrelationCoefficient)["Selected"], "true") - self.assertEqual(get_state_as_dict(xVarname)["Text"], "a") - self.assertEqual(get_state_as_dict(yVarName)["Text"], "f(a)") - - #Click on tab "Line". - select_pos(tabcontrol, "1") - xWidth = xDialog.getChild("MTR_FLD_LINE_WIDTH") - xTransparent = xDialog.getChild("MTR_LINE_TRANSPARENT") - - self.assertEqual(get_state_as_dict(xWidth)["Text"], "0.10 cm") - self.assertEqual(get_state_as_dict(xTransparent)["Text"], "5%") - - xOKBtn = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOKBtn) + with self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "FormatTrendline"})) as xDialog: + #Click on tab "Type". + tabcontrol = xDialog.getChild("tabcontrol") + select_pos(tabcontrol, "0") + + logarithmic = xDialog.getChild("logarithmic") #type regression logarithmic + exponential = xDialog.getChild("exponential") #type regression exponential + xentryname = xDialog.getChild("entry_name") #add name + extrapolateForward = xDialog.getChild("extrapolateForward") + extrapolateBackward = xDialog.getChild("extrapolateBackward") + setIntercept = xDialog.getChild("setIntercept") + interceptValue = xDialog.getChild("interceptValue") + showEquation = xDialog.getChild("showEquation") + showCorrelationCoefficient = xDialog.getChild("showCorrelationCoefficient") + xVarname = xDialog.getChild("entry_Xname") + yVarName = xDialog.getChild("entry_Yname") + + self.assertEqual(get_state_as_dict(exponential)["Checked"], "true") + self.assertEqual(get_state_as_dict(xentryname)["Text"], "Name") + self.assertEqual(get_state_as_dict(extrapolateForward)["Text"], "1") + self.assertEqual(get_state_as_dict(extrapolateBackward)["Text"], "1") + self.assertEqual(get_state_as_dict(showEquation)["Selected"], "true") + self.assertEqual(get_state_as_dict(setIntercept)["Selected"], "true") + self.assertEqual(get_state_as_dict(interceptValue)["Text"], "1") + self.assertEqual(get_state_as_dict(showCorrelationCoefficient)["Selected"], "true") + self.assertEqual(get_state_as_dict(xVarname)["Text"], "a") + self.assertEqual(get_state_as_dict(yVarName)["Text"], "f(a)") + + #Click on tab "Line". + select_pos(tabcontrol, "1") + xWidth = xDialog.getChild("MTR_FLD_LINE_WIDTH") + xTransparent = xDialog.getChild("MTR_LINE_TRANSPARENT") + + self.assertEqual(get_state_as_dict(xWidth)["Text"], "0.10 cm") + self.assertEqual(get_state_as_dict(xTransparent)["Text"], "5%") + #Now change regression Type to Power gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"})) @@ -206,36 +194,33 @@ class tdf93506(UITestCase): xChartMainTop = self.xUITest.getTopFocusWindow() xChartMain = xChartMainTop.getChild("chart_window") xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0") - self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "FormatTrendline"})) - xDialog = self.xUITest.getTopFocusWindow() - #Click on tab "Type". - tabcontrol = xDialog.getChild("tabcontrol") - select_pos(tabcontrol, "0") - logarithmic = xDialog.getChild("logarithmic") #type regression logarithmic - exponential = xDialog.getChild("exponential") #type regression exponential - power = xDialog.getChild("exponential") #type regression power - xentryname = xDialog.getChild("entry_name") #add name - extrapolateForward = xDialog.getChild("extrapolateForward") - extrapolateBackward = xDialog.getChild("extrapolateBackward") - setIntercept = xDialog.getChild("setIntercept") - interceptValue = xDialog.getChild("interceptValue") - showEquation = xDialog.getChild("showEquation") - showCorrelationCoefficient = xDialog.getChild("showCorrelationCoefficient") - xVarname = xDialog.getChild("entry_Xname") - yVarName = xDialog.getChild("entry_Yname") - - power.executeAction("CLICK", tuple()) #set power - - #Click on tab "Line". - select_pos(tabcontrol, "1") - xWidth = xDialog.getChild("MTR_FLD_LINE_WIDTH") - xTransparent = xDialog.getChild("MTR_LINE_TRANSPARENT") - - self.assertEqual(get_state_as_dict(xWidth)["Text"], "0.10 cm") - self.assertEqual(get_state_as_dict(xTransparent)["Text"], "5%") - - xOKBtn = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOKBtn) + with self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "FormatTrendline"})) as xDialog: + #Click on tab "Type". + tabcontrol = xDialog.getChild("tabcontrol") + select_pos(tabcontrol, "0") + logarithmic = xDialog.getChild("logarithmic") #type regression logarithmic + exponential = xDialog.getChild("exponential") #type regression exponential + power = xDialog.getChild("exponential") #type regression power + xentryname = xDialog.getChild("entry_name") #add name + extrapolateForward = xDialog.getChild("extrapolateForward") + extrapolateBackward = xDialog.getChild("extrapolateBackward") + setIntercept = xDialog.getChild("setIntercept") + interceptValue = xDialog.getChild("interceptValue") + showEquation = xDialog.getChild("showEquation") + showCorrelationCoefficient = xDialog.getChild("showCorrelationCoefficient") + xVarname = xDialog.getChild("entry_Xname") + yVarName = xDialog.getChild("entry_Yname") + + power.executeAction("CLICK", tuple()) #set power + + #Click on tab "Line". + select_pos(tabcontrol, "1") + xWidth = xDialog.getChild("MTR_FLD_LINE_WIDTH") + xTransparent = xDialog.getChild("MTR_LINE_TRANSPARENT") + + self.assertEqual(get_state_as_dict(xWidth)["Text"], "0.10 cm") + self.assertEqual(get_state_as_dict(xTransparent)["Text"], "5%") + #reopen and verify Power gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"})) @@ -243,46 +228,43 @@ class tdf93506(UITestCase): xChartMainTop = self.xUITest.getTopFocusWindow() xChartMain = xChartMainTop.getChild("chart_window") xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0") - self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "FormatTrendline"})) - xDialog = self.xUITest.getTopFocusWindow() - #Click on tab "Type". - tabcontrol = xDialog.getChild("tabcontrol") - select_pos(tabcontrol, "0") - - logarithmic = xDialog.getChild("logarithmic") #type regression logarithmic - exponential = xDialog.getChild("exponential") #type regression exponential - power = xDialog.getChild("exponential") #type regression power - xentryname = xDialog.getChild("entry_name") #add name - extrapolateForward = xDialog.getChild("extrapolateForward") - extrapolateBackward = xDialog.getChild("extrapolateBackward") - setIntercept = xDialog.getChild("setIntercept") - interceptValue = xDialog.getChild("interceptValue") - showEquation = xDialog.getChild("showEquation") - showCorrelationCoefficient = xDialog.getChild("showCorrelationCoefficient") - xVarname = xDialog.getChild("entry_Xname") - yVarName = xDialog.getChild("entry_Yname") - - self.assertEqual(get_state_as_dict(power)["Checked"], "true") - self.assertEqual(get_state_as_dict(xentryname)["Text"], "Name") - self.assertEqual(get_state_as_dict(extrapolateForward)["Text"], "1") - self.assertEqual(get_state_as_dict(extrapolateBackward)["Text"], "1") - self.assertEqual(get_state_as_dict(showEquation)["Selected"], "true") - # self.assertEqual(get_state_as_dict(setIntercept)["Selected"], "true") - # self.assertEqual(get_state_as_dict(interceptValue)["Text"], "1") - self.assertEqual(get_state_as_dict(showCorrelationCoefficient)["Selected"], "true") - self.assertEqual(get_state_as_dict(xVarname)["Text"], "a") - self.assertEqual(get_state_as_dict(yVarName)["Text"], "f(a)") - - #Click on tab "Line". - select_pos(tabcontrol, "1") - xWidth = xDialog.getChild("MTR_FLD_LINE_WIDTH") - xTransparent = xDialog.getChild("MTR_LINE_TRANSPARENT") - - self.assertEqual(get_state_as_dict(xWidth)["Text"], "0.10 cm") - self.assertEqual(get_state_as_dict(xTransparent)["Text"], "5%") - - xOKBtn = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOKBtn) + with self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "FormatTrendline"})) as xDialog: + #Click on tab "Type". + tabcontrol = xDialog.getChild("tabcontrol") + select_pos(tabcontrol, "0") + + logarithmic = xDialog.getChild("logarithmic") #type regression logarithmic + exponential = xDialog.getChild("exponential") #type regression exponential + power = xDialog.getChild("exponential") #type regression power + xentryname = xDialog.getChild("entry_name") #add name + extrapolateForward = xDialog.getChild("extrapolateForward") + extrapolateBackward = xDialog.getChild("extrapolateBackward") + setIntercept = xDialog.getChild("setIntercept") + interceptValue = xDialog.getChild("interceptValue") + showEquation = xDialog.getChild("showEquation") + showCorrelationCoefficient = xDialog.getChild("showCorrelationCoefficient") + xVarname = xDialog.getChild("entry_Xname") + yVarName = xDialog.getChild("entry_Yname") + + self.assertEqual(get_state_as_dict(power)["Checked"], "true") + self.assertEqual(get_state_as_dict(xentryname)["Text"], "Name") + self.assertEqual(get_state_as_dict(extrapolateForward)["Text"], "1") + self.assertEqual(get_state_as_dict(extrapolateBackward)["Text"], "1") + self.assertEqual(get_state_as_dict(showEquation)["Selected"], "true") + # self.assertEqual(get_state_as_dict(setIntercept)["Selected"], "true") + # self.assertEqual(get_state_as_dict(interceptValue)["Text"], "1") + self.assertEqual(get_state_as_dict(showCorrelationCoefficient)["Selected"], "true") + self.assertEqual(get_state_as_dict(xVarname)["Text"], "a") + self.assertEqual(get_state_as_dict(yVarName)["Text"], "f(a)") + + #Click on tab "Line". + select_pos(tabcontrol, "1") + xWidth = xDialog.getChild("MTR_FLD_LINE_WIDTH") + xTransparent = xDialog.getChild("MTR_LINE_TRANSPARENT") + + self.assertEqual(get_state_as_dict(xWidth)["Text"], "0.10 cm") + self.assertEqual(get_state_as_dict(xTransparent)["Text"], "5%") + #Now change regression Type to Polynomial gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"})) @@ -290,39 +272,36 @@ class tdf93506(UITestCase): xChartMainTop = self.xUITest.getTopFocusWindow() xChartMain = xChartMainTop.getChild("chart_window") xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0") - self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "FormatTrendline"})) - xDialog = self.xUITest.getTopFocusWindow() - #Click on tab "Type". - tabcontrol = xDialog.getChild("tabcontrol") - select_pos(tabcontrol, "0") - logarithmic = xDialog.getChild("logarithmic") #type regression logarithmic - exponential = xDialog.getChild("exponential") #type regression exponential - power = xDialog.getChild("exponential") #type regression power - polynomial = xDialog.getChild("polynomial") #type regression polynomial - degree = xDialog.getChild("degree") - xentryname = xDialog.getChild("entry_name") #add name - extrapolateForward = xDialog.getChild("extrapolateForward") - extrapolateBackward = xDialog.getChild("extrapolateBackward") - setIntercept = xDialog.getChild("setIntercept") - interceptValue = xDialog.getChild("interceptValue") - showEquation = xDialog.getChild("showEquation") - showCorrelationCoefficient = xDialog.getChild("showCorrelationCoefficient") - xVarname = xDialog.getChild("entry_Xname") - yVarName = xDialog.getChild("entry_Yname") - - polynomial.executeAction("CLICK", tuple()) #set polynomial - degree.executeAction("UP", tuple()) - - #Click on tab "Line". - select_pos(tabcontrol, "1") - xWidth = xDialog.getChild("MTR_FLD_LINE_WIDTH") - xTransparent = xDialog.getChild("MTR_LINE_TRANSPARENT") - - self.assertEqual(get_state_as_dict(xWidth)["Text"], "0.10 cm") - self.assertEqual(get_state_as_dict(xTransparent)["Text"], "5%") - - xOKBtn = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOKBtn) + with self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "FormatTrendline"})) as xDialog: + #Click on tab "Type". + tabcontrol = xDialog.getChild("tabcontrol") + select_pos(tabcontrol, "0") + logarithmic = xDialog.getChild("logarithmic") #type regression logarithmic + exponential = xDialog.getChild("exponential") #type regression exponential + power = xDialog.getChild("exponential") #type regression power + polynomial = xDialog.getChild("polynomial") #type regression polynomial + degree = xDialog.getChild("degree") + xentryname = xDialog.getChild("entry_name") #add name + extrapolateForward = xDialog.getChild("extrapolateForward") + extrapolateBackward = xDialog.getChild("extrapolateBackward") + setIntercept = xDialog.getChild("setIntercept") + interceptValue = xDialog.getChild("interceptValue") + showEquation = xDialog.getChild("showEquation") + showCorrelationCoefficient = xDialog.getChild("showCorrelationCoefficient") + xVarname = xDialog.getChild("entry_Xname") + yVarName = xDialog.getChild("entry_Yname") + + polynomial.executeAction("CLICK", tuple()) #set polynomial + degree.executeAction("UP", tuple()) + + #Click on tab "Line". + select_pos(tabcontrol, "1") + xWidth = xDialog.getChild("MTR_FLD_LINE_WIDTH") + xTransparent = xDialog.getChild("MTR_LINE_TRANSPARENT") + + self.assertEqual(get_state_as_dict(xWidth)["Text"], "0.10 cm") + self.assertEqual(get_state_as_dict(xTransparent)["Text"], "5%") + #reopen and verify Polynomial gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"})) @@ -330,49 +309,46 @@ class tdf93506(UITestCase): xChartMainTop = self.xUITest.getTopFocusWindow() xChartMain = xChartMainTop.getChild("chart_window") xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0") - self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "FormatTrendline"})) - xDialog = self.xUITest.getTopFocusWindow() - #Click on tab "Type". - tabcontrol = xDialog.getChild("tabcontrol") - select_pos(tabcontrol, "0") - - logarithmic = xDialog.getChild("logarithmic") #type regression logarithmic - exponential = xDialog.getChild("exponential") #type regression exponential - power = xDialog.getChild("exponential") #type regression power - polynomial = xDialog.getChild("polynomial") #type regression polynomial - degree = xDialog.getChild("degree") - xentryname = xDialog.getChild("entry_name") #add name - extrapolateForward = xDialog.getChild("extrapolateForward") - extrapolateBackward = xDialog.getChild("extrapolateBackward") - setIntercept = xDialog.getChild("setIntercept") - interceptValue = xDialog.getChild("interceptValue") - showEquation = xDialog.getChild("showEquation") - showCorrelationCoefficient = xDialog.getChild("showCorrelationCoefficient") - xVarname = xDialog.getChild("entry_Xname") - yVarName = xDialog.getChild("entry_Yname") - - self.assertEqual(get_state_as_dict(polynomial)["Checked"], "true") - self.assertEqual(get_state_as_dict(degree)["Text"], "3") - self.assertEqual(get_state_as_dict(xentryname)["Text"], "Name") - self.assertEqual(get_state_as_dict(extrapolateForward)["Text"], "1") - self.assertEqual(get_state_as_dict(extrapolateBackward)["Text"], "1") - self.assertEqual(get_state_as_dict(showEquation)["Selected"], "true") - self.assertEqual(get_state_as_dict(setIntercept)["Selected"], "true") - self.assertEqual(get_state_as_dict(interceptValue)["Text"], "1") - self.assertEqual(get_state_as_dict(showCorrelationCoefficient)["Selected"], "true") - self.assertEqual(get_state_as_dict(xVarname)["Text"], "a") - self.assertEqual(get_state_as_dict(yVarName)["Text"], "f(a)") - - #Click on tab "Line". - select_pos(tabcontrol, "1") - xWidth = xDialog.getChild("MTR_FLD_LINE_WIDTH") - xTransparent = xDialog.getChild("MTR_LINE_TRANSPARENT") - - self.assertEqual(get_state_as_dict(xWidth)["Text"], "0.10 cm") - self.assertEqual(get_state_as_dict(xTransparent)["Text"], "5%") - - xOKBtn = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOKBtn) + with self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "FormatTrendline"})) as xDialog: + #Click on tab "Type". + tabcontrol = xDialog.getChild("tabcontrol") + select_pos(tabcontrol, "0") + + logarithmic = xDialog.getChild("logarithmic") #type regression logarithmic + exponential = xDialog.getChild("exponential") #type regression exponential + power = xDialog.getChild("exponential") #type regression power + polynomial = xDialog.getChild("polynomial") #type regression polynomial + degree = xDialog.getChild("degree") + xentryname = xDialog.getChild("entry_name") #add name + extrapolateForward = xDialog.getChild("extrapolateForward") + extrapolateBackward = xDialog.getChild("extrapolateBackward") + setIntercept = xDialog.getChild("setIntercept") + interceptValue = xDialog.getChild("interceptValue") + showEquation = xDialog.getChild("showEquation") + showCorrelationCoefficient = xDialog.getChild("showCorrelationCoefficient") + xVarname = xDialog.getChild("entry_Xname") + yVarName = xDialog.getChild("entry_Yname") + + self.assertEqual(get_state_as_dict(polynomial)["Checked"], "true") + self.assertEqual(get_state_as_dict(degree)["Text"], "3") + self.assertEqual(get_state_as_dict(xentryname)["Text"], "Name") + self.assertEqual(get_state_as_dict(extrapolateForward)["Text"], "1") + self.assertEqual(get_state_as_dict(extrapolateBackward)["Text"], "1") + self.assertEqual(get_state_as_dict(showEquation)["Selected"], "true") + self.assertEqual(get_state_as_dict(setIntercept)["Selected"], "true") + self.assertEqual(get_state_as_dict(interceptValue)["Text"], "1") + self.assertEqual(get_state_as_dict(showCorrelationCoefficient)["Selected"], "true") + self.assertEqual(get_state_as_dict(xVarname)["Text"], "a") + self.assertEqual(get_state_as_dict(yVarName)["Text"], "f(a)") + + #Click on tab "Line". + select_pos(tabcontrol, "1") + xWidth = xDialog.getChild("MTR_FLD_LINE_WIDTH") + xTransparent = xDialog.getChild("MTR_LINE_TRANSPARENT") + + self.assertEqual(get_state_as_dict(xWidth)["Text"], "0.10 cm") + self.assertEqual(get_state_as_dict(xTransparent)["Text"], "5%") + #Now change regression Type to Moving average gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"})) @@ -380,41 +356,38 @@ class tdf93506(UITestCase): xChartMainTop = self.xUITest.getTopFocusWindow() xChartMain = xChartMainTop.getChild("chart_window") xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0") - self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "FormatTrendline"})) - xDialog = self.xUITest.getTopFocusWindow() - #Click on tab "Type". - tabcontrol = xDialog.getChild("tabcontrol") - select_pos(tabcontrol, "0") - logarithmic = xDialog.getChild("logarithmic") #type regression logarithmic - exponential = xDialog.getChild("exponential") #type regression exponential - power = xDialog.getChild("exponential") #type regression power - movingAverage = xDialog.getChild("movingAverage") #type regression Moving average - movingAverageType = xDialog.getChild("combo_moving_type") #type regression Moving average type - period = xDialog.getChild("period") - xentryname = xDialog.getChild("entry_name") #add name - extrapolateForward = xDialog.getChild("extrapolateForward") - extrapolateBackward = xDialog.getChild("extrapolateBackward") - setIntercept = xDialog.getChild("setIntercept") - interceptValue = xDialog.getChild("interceptValue") - showEquation = xDialog.getChild("showEquation") - showCorrelationCoefficient = xDialog.getChild("showCorrelationCoefficient") - xVarname = xDialog.getChild("entry_Xname") - yVarName = xDialog.getChild("entry_Yname") - - movingAverage.executeAction("CLICK", tuple()) #set polynomial - select_by_text(movingAverageType, "Averaged Abscissa") - period.executeAction("UP", tuple()) - - #Click on tab "Line". - select_pos(tabcontrol, "1") - xWidth = xDialog.getChild("MTR_FLD_LINE_WIDTH") - xTransparent = xDialog.getChild("MTR_LINE_TRANSPARENT") - - self.assertEqual(get_state_as_dict(xWidth)["Text"], "0.10 cm") - self.assertEqual(get_state_as_dict(xTransparent)["Text"], "5%") - - xOKBtn = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOKBtn) + with self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "FormatTrendline"})) as xDialog: + #Click on tab "Type". + tabcontrol = xDialog.getChild("tabcontrol") + select_pos(tabcontrol, "0") + logarithmic = xDialog.getChild("logarithmic") #type regression logarithmic + exponential = xDialog.getChild("exponential") #type regression exponential + power = xDialog.getChild("exponential") #type regression power + movingAverage = xDialog.getChild("movingAverage") #type regression Moving average + movingAverageType = xDialog.getChild("combo_moving_type") #type regression Moving average type + period = xDialog.getChild("period") + xentryname = xDialog.getChild("entry_name") #add name + extrapolateForward = xDialog.getChild("extrapolateForward") + extrapolateBackward = xDialog.getChild("extrapolateBackward") + setIntercept = xDialog.getChild("setIntercept") + interceptValue = xDialog.getChild("interceptValue") + showEquation = xDialog.getChild("showEquation") + showCorrelationCoefficient = xDialog.getChild("showCorrelationCoefficient") + xVarname = xDialog.getChild("entry_Xname") + yVarName = xDialog.getChild("entry_Yname") + + movingAverage.executeAction("CLICK", tuple()) #set polynomial + select_by_text(movingAverageType, "Averaged Abscissa") + period.executeAction("UP", tuple()) + + #Click on tab "Line". + select_pos(tabcontrol, "1") + xWidth = xDialog.getChild("MTR_FLD_LINE_WIDTH") + xTransparent = xDialog.getChild("MTR_LINE_TRANSPARENT") + + self.assertEqual(get_state_as_dict(xWidth)["Text"], "0.10 cm") + self.assertEqual(get_state_as_dict(xTransparent)["Text"], "5%") + #reopen and verify Moving average gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"})) @@ -422,44 +395,41 @@ class tdf93506(UITestCase): xChartMainTop = self.xUITest.getTopFocusWindow() xChartMain = xChartMainTop.getChild("chart_window") xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0") - self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "FormatTrendline"})) - xDialog = self.xUITest.getTopFocusWindow() - #Click on tab "Type". - tabcontrol = xDialog.getChild("tabcontrol") - select_pos(tabcontrol, "0") - - logarithmic = xDialog.getChild("logarithmic") #type regression logarithmic - exponential = xDialog.getChild("exponential") #type regression exponential - power = xDialog.getChild("exponential") #type regression power - polynomial = xDialog.getChild("polynomial") #type regression polynomial - movingAverage = xDialog.getChild("movingAverage") #type regression Moving average - movingAverageType = xDialog.getChild("combo_moving_type") #type regression Moving average type - degree = xDialog.getChild("degree") - period = xDialog.getChild("period") - xentryname = xDialog.getChild("entry_name") #add name - extrapolateForward = xDialog.getChild("extrapolateForward") - extrapolateBackward = xDialog.getChild("extrapolateBackward") - setIntercept = xDialog.getChild("setIntercept") - interceptValue = xDialog.getChild("interceptValue") - showEquation = xDialog.getChild("showEquation") - showCorrelationCoefficient = xDialog.getChild("showCorrelationCoefficient") - xVarname = xDialog.getChild("entry_Xname") - yVarName = xDialog.getChild("entry_Yname") - - self.assertEqual(get_state_as_dict(movingAverage)["Checked"], "true") - self.assertEqual(get_state_as_dict(movingAverageType)["SelectEntryText"], "Averaged Abscissa") - self.assertEqual(get_state_as_dict(period)["Text"], "3") - self.assertEqual(get_state_as_dict(xentryname)["Text"], "Name") - - #Click on tab "Line". - select_pos(tabcontrol, "1") - xWidth = xDialog.getChild("MTR_FLD_LINE_WIDTH") - xTransparent = xDialog.getChild("MTR_LINE_TRANSPARENT") - - self.assertEqual(get_state_as_dict(xWidth)["Text"], "0.10 cm") - self.assertEqual(get_state_as_dict(xTransparent)["Text"], "5%") - - xOKBtn = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOKBtn) + with self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "FormatTrendline"})) as xDialog: + #Click on tab "Type". + tabcontrol = xDialog.getChild("tabcontrol") + select_pos(tabcontrol, "0") + + logarithmic = xDialog.getChild("logarithmic") #type regression logarithmic + exponential = xDialog.getChild("exponential") #type regression exponential + power = xDialog.getChild("exponential") #type regression power + polynomial = xDialog.getChild("polynomial") #type regression polynomial + movingAverage = xDialog.getChild("movingAverage") #type regression Moving average + movingAverageType = xDialog.getChild("combo_moving_type") #type regression Moving average type + degree = xDialog.getChild("degree") + period = xDialog.getChild("period") + xentryname = xDialog.getChild("entry_name") #add name + extrapolateForward = xDialog.getChild("extrapolateForward") + extrapolateBackward = xDialog.getChild("extrapolateBackward") + setIntercept = xDialog.getChild("setIntercept") + interceptValue = xDialog.getChild("interceptValue") + showEquation = xDialog.getChild("showEquation") + showCorrelationCoefficient = xDialog.getChild("showCorrelationCoefficient") + xVarname = xDialog.getChild("entry_Xname") + yVarName = xDialog.getChild("entry_Yname") + + self.assertEqual(get_state_as_dict(movingAverage)["Checked"], "true") + self.assertEqual(get_state_as_dict(movingAverageType)["SelectEntryText"], "Averaged Abscissa") + self.assertEqual(get_state_as_dict(period)["Text"], "3") + self.assertEqual(get_state_as_dict(xentryname)["Text"], "Name") + + #Click on tab "Line". + select_pos(tabcontrol, "1") + xWidth = xDialog.getChild("MTR_FLD_LINE_WIDTH") + xTransparent = xDialog.getChild("MTR_LINE_TRANSPARENT") + + self.assertEqual(get_state_as_dict(xWidth)["Text"], "0.10 cm") + self.assertEqual(get_state_as_dict(xTransparent)["Text"], "5%") + # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/chart/tdf96432.py b/sc/qa/uitest/chart/tdf96432.py index 6d8a5e4c2f91..b05afbf89690 100644 --- a/sc/qa/uitest/chart/tdf96432.py +++ b/sc/qa/uitest/chart/tdf96432.py @@ -29,16 +29,13 @@ class tdf96432(UITestCase): #Right-click on the chart; from the pop-up menu select "Format Y bars # The program presents dialog "Format Y bars", tab "Line". xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0") - self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "FormatYErrorBars"})) - xDialog = self.xUITest.getTopFocusWindow() - #Click on tab "Line". - tabcontrol = xDialog.getChild("tabcontrol") - select_pos(tabcontrol, "1") - #Type a non-zero integer into the "Transparency:" Edit Field, or use the up arrow to select one - xTransparency = xDialog.getChild("MTR_LINE_TRANSPARENT") - xTransparency.executeAction("UP", tuple()) - xOKBtn = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOKBtn) + with self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "FormatYErrorBars"})) as xDialog: + #Click on tab "Line". + tabcontrol = xDialog.getChild("tabcontrol") + select_pos(tabcontrol, "1") + #Type a non-zero integer into the "Transparency:" Edit Field, or use the up arrow to select one + xTransparency = xDialog.getChild("MTR_LINE_TRANSPARENT") + xTransparency.executeAction("UP", tuple()) #verify - we didn't crash gridwin.executeAction("DESELECT", mkPropertyValues({"OBJECT": ""})) @@ -55,17 +52,14 @@ class tdf96432(UITestCase): #Right-click on the chart; from the pop-up menu select "Format Y bars # The program presents dialog "Format Y bars", tab "Line". xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0") - self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "FormatYErrorBars"})) - xDialog = self.xUITest.getTopFocusWindow() - #Click on tab "Line". - tabcontrol = xDialog.getChild("tabcontrol") - select_pos(tabcontrol, "1") - #Type a non-zero integer into the "Transparency:" Edit Field, or use the up arrow to select one - xTransparency = xDialog.getChild("MTR_LINE_TRANSPARENT") - self.assertEqual(get_state_as_dict(xTransparency)["Text"][0], "5") - xTransparency.executeAction("UP", tuple()) - xOKBtn = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOKBtn) + with self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "FormatYErrorBars"})) as xDialog: + #Click on tab "Line". + tabcontrol = xDialog.getChild("tabcontrol") + select_pos(tabcontrol, "1") + #Type a non-zero integer into the "Transparency:" Edit Field, or use the up arrow to select one + xTransparency = xDialog.getChild("MTR_LINE_TRANSPARENT") + self.assertEqual(get_state_as_dict(xTransparency)["Text"][0], "5") + xTransparency.executeAction("UP", tuple()) #verify - we didn't crash gridwin.executeAction("DESELECT", mkPropertyValues({"OBJECT": ""})) diff --git a/sc/qa/uitest/chart/tdf99069.py b/sc/qa/uitest/chart/tdf99069.py index e8d805d82355..1de912e6b5cd 100644 --- a/sc/qa/uitest/chart/tdf99069.py +++ b/sc/qa/uitest/chart/tdf99069.py @@ -44,23 +44,20 @@ class tdf99069(UITestCase): #(6) Right-click on the chart; from the pop-up menu select "Data # Ranges...". The program presents dialog "Data Ranges", tab "Data Range". xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0") - self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DataRanges"})) - xDialog = self.xUITest.getTopFocusWindow() + with self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DataRanges"}), close_button="cancel") as xDialog: - #(7) Click on tab "Data Series". (Actually, tab "Data Range" crashes, - # too. This step is just a remnant of what I was doing when I - # stumbled over the bug.) - notebook = xDialog.getChild("tabcontrol") - select_pos(notebook, "0") - select_pos(notebook, "1") + #(7) Click on tab "Data Series". (Actually, tab "Data Range" crashes, + # too. This step is just a remnant of what I was doing when I + # stumbled over the bug.) + notebook = xDialog.getChild("tabcontrol") + select_pos(notebook, "0") + select_pos(notebook, "1") - #(8) Click <Cancel>. In the versions that I deemed bad while - # bibisecting, the program crashed here five times out of seven. - # The other two attempts, both on daily bibisect version 2016-02-18, - # crashed after I closed the Data Ranges dialog an additional three - # times, one of those times using by typing <Esc>. - xCancelBtn = xDialog.getChild("cancel") - self.ui_test.close_dialog_through_button(xCancelBtn) + #(8) Click <Cancel>. In the versions that I deemed bad while + # bibisecting, the program crashed here five times out of seven. + # The other two attempts, both on daily bibisect version 2016-02-18, + # crashed after I closed the Data Ranges dialog an additional three + # times, one of those times using by typing <Esc>. #verify - we didn't crash gridwin.executeAction("DESELECT", mkPropertyValues({"OBJECT": ""})) diff --git a/sc/qa/uitest/conditional_format/tdf100793.py b/sc/qa/uitest/conditional_format/tdf100793.py index 516090076ec8..24a658f2cf4c 100644 --- a/sc/qa/uitest/conditional_format/tdf100793.py +++ b/sc/qa/uitest/conditional_format/tdf100793.py @@ -37,31 +37,28 @@ class tdf100793(UITestCase): #3) Click Edit & try to change to intended one, F18:K33 xEditBtn = xCondFormatMgr.getChild("edit") - self.ui_test.execute_dialog_through_action(xEditBtn, "CLICK", event_name = "ModelessDialogVisible") - xCondFormatDlg = self.xUITest.getTopFocusWindow() + with self.ui_test.execute_dialog_through_action(xEditBtn, "CLICK", event_name = "ModelessDialogVisible") as xCondFormatDlg: - #modify textbox - xedassign = xCondFormatDlg.getChild("edassign") - #go at the beginning - xedassign.executeAction("TYPE", mkPropertyValues({"KEYCODE": "END"})) - xedassign.executeAction("TYPE", mkPropertyValues({"KEYCODE": "HOME"})) - # 11x right - xedassign.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RIGHT"})) - xedassign.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RIGHT"})) - xedassign.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RIGHT"})) - xedassign.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RIGHT"})) - xedassign.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RIGHT"})) - xedassign.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RIGHT"})) - xedassign.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RIGHT"})) - xedassign.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RIGHT"})) - xedassign.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RIGHT"})) - xedassign.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RIGHT"})) - xedassign.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RIGHT"})) - #now I'm at F18 - write :K33 - xedassign.executeAction("TYPE", mkPropertyValues({"TEXT":":K33"})) + #modify textbox + xedassign = xCondFormatDlg.getChild("edassign") + #go at the beginning + xedassign.executeAction("TYPE", mkPropertyValues({"KEYCODE": "END"})) + xedassign.executeAction("TYPE", mkPropertyValues({"KEYCODE": "HOME"})) + # 11x right + xedassign.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RIGHT"})) + xedassign.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RIGHT"})) + xedassign.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RIGHT"})) + xedassign.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RIGHT"})) + xedassign.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RIGHT"})) + xedassign.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RIGHT"})) + xedassign.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RIGHT"})) + xedassign.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RIGHT"})) + xedassign.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RIGHT"})) + xedassign.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RIGHT"})) + xedassign.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RIGHT"})) + #now I'm at F18 - write :K33 + xedassign.executeAction("TYPE", mkPropertyValues({"TEXT":":K33"})) - xCondFormatOkBtn = xCondFormatDlg.getChild("ok") - self.ui_test.close_dialog_through_button(xCondFormatOkBtn) # we need to get a pointer again as the old window has been deleted xCondFormatMgr = self.xUITest.getTopFocusWindow() @@ -82,12 +79,9 @@ class tdf100793(UITestCase): self.ui_test.execute_dialog_through_command(".uno:ConditionalFormatManagerDialog") xCondFormatMgr = self.xUITest.getTopFocusWindow() xEditBtn = xCondFormatMgr.getChild("edit") - self.ui_test.execute_dialog_through_action(xEditBtn, "CLICK", event_name = "ModelessDialogVisible") - xCondFormatDlg = self.xUITest.getTopFocusWindow() - xedassign = xCondFormatDlg.getChild("edassign") - self.assertEqual(get_state_as_dict(xedassign)["Text"], "G18:K29,F18:K33,F20:F29") - xCondFormatOkBtn = xCondFormatDlg.getChild("ok") - self.ui_test.close_dialog_through_button(xCondFormatOkBtn) + with self.ui_test.execute_dialog_through_action(xEditBtn, "CLICK", event_name = "ModelessDialogVisible") as xCondFormatDlg: + xedassign = xCondFormatDlg.getChild("edassign") + self.assertEqual(get_state_as_dict(xedassign)["Text"], "G18:K29,F18:K33,F20:F29") xCondFormatMgr = self.xUITest.getTopFocusWindow() xCancelBtn = xCondFormatMgr.getChild("cancel") self.ui_test.close_dialog_through_button(xCancelBtn) diff --git a/sc/qa/uitest/conditional_format/tdf105544.py b/sc/qa/uitest/conditional_format/tdf105544.py index 0099ed682ac7..45af6a736af4 100644 --- a/sc/qa/uitest/conditional_format/tdf105544.py +++ b/sc/qa/uitest/conditional_format/tdf105544.py @@ -32,11 +32,8 @@ class tdf105544(UITestCase): #select B3:B37 range and click edit, then click yes xList.executeAction("TYPE", mkPropertyValues({"KEYCODE": "DOWN"})) #2nd position in the list xEditBtn = xCondFormatMgr.getChild("edit") - self.ui_test.execute_dialog_through_action(xEditBtn, "CLICK", event_name = "ModelessDialogVisible") - xCondFormatDlg = self.xUITest.getTopFocusWindow() - - xCondFormatOkBtn = xCondFormatDlg.getChild("ok") - self.ui_test.close_dialog_through_button(xCondFormatOkBtn) + with self.ui_test.execute_dialog_through_action(xEditBtn, "CLICK", event_name = "ModelessDialogVisible"): + pass # we need to get a pointer again as the old window has been deleted xCondFormatMgr = self.xUITest.getTopFocusWindow() diff --git a/sc/qa/uitest/conditional_format/tdf96453.py b/sc/qa/uitest/conditional_format/tdf96453.py index c20cf15c2393..0b6e5753f88a 100644 --- a/sc/qa/uitest/conditional_format/tdf96453.py +++ b/sc/qa/uitest/conditional_format/tdf96453.py @@ -42,11 +42,8 @@ class ConditionalFormatDlgTest(UITestCase): # add a new conditional format through the add button xAddBtn = xCondFormatMgr.getChild("add") - self.ui_test.execute_dialog_through_action(xAddBtn, "CLICK", event_name = "ModelessDialogVisible") - - xCondFormatDlg = self.xUITest.getTopFocusWindow() - xCondFormatOkBtn = xCondFormatDlg.getChild("ok") - self.ui_test.close_dialog_through_button(xCondFormatOkBtn) + with self.ui_test.execute_dialog_through_action(xAddBtn, "CLICK", event_name = "ModelessDialogVisible"): + pass # we need to get a pointer again as the old window has been deleted xCondFormatMgr = self.xUITest.getTopFocusWindow() diff --git a/sw/qa/uitest/chart/tdf138556.py b/sw/qa/uitest/chart/tdf138556.py index 4a7f325c8df4..14dbc8675f41 100644 --- a/sw/qa/uitest/chart/tdf138556.py +++ b/sw/qa/uitest/chart/tdf138556.py @@ -28,23 +28,15 @@ class tdf138556( UITestCase ): #Change Chart Type to Stock 1 #TODO: test other subtypes - self.ui_test.execute_dialog_through_action( xChart, "COMMAND", - mkPropertyValues({ "COMMAND" : "DiagramType" })) - xDialog = self.xUITest.getTopFocusWindow() - xChartType = xDialog.getChild( "charttype" ) - xStockType = xChartType.getChild( "8" ) - xStockType.executeAction( "SELECT", tuple()) - xOKBtn = xDialog.getChild( "ok" ) - self.ui_test.close_dialog_through_button( xOKBtn ) + with self.ui_test.execute_dialog_through_action( xChart, "COMMAND", mkPropertyValues({ "COMMAND" : "DiagramType" })) as xDialog: + xChartType = xDialog.getChild( "charttype" ) + xStockType = xChartType.getChild( "8" ) + xStockType.executeAction( "SELECT", tuple()) #Insert Data Series - self.ui_test.execute_dialog_through_action( xChart, "COMMAND", - mkPropertyValues({ "COMMAND" : "DiagramData" })) - xDialog = self.xUITest.getTopFocusWindow() - xToolbar = xDialog.getChild( "toolbar" ) - xToolbar.executeAction( "CLICK", mkPropertyValues({ "POS" : "1" })) - xOKBtn = xDialog.getChild( "close" ) - self.ui_test.close_dialog_through_button( xOKBtn ) + with self.ui_test.execute_dialog_through_action( xChart, "COMMAND", mkPropertyValues({ "COMMAND" : "DiagramData" }), close_button="close") as xDialog: + xToolbar = xDialog.getChild( "toolbar" ) + xToolbar.executeAction( "CLICK", mkPropertyValues({ "POS" : "1" })) #Check Number of Sequences xDocument = self.ui_test.get_component() diff --git a/sw/qa/uitest/writer_tests4/tdf134439.py b/sw/qa/uitest/writer_tests4/tdf134439.py index 6086ae289a12..8d2d7a1a62f9 100644 --- a/sw/qa/uitest/writer_tests4/tdf134439.py +++ b/sw/qa/uitest/writer_tests4/tdf134439.py @@ -23,23 +23,20 @@ class tdf134439(UITestCase): self.assertEqual("Chap 1", xCursor.PageStyleName) xPageBreak = self.ui_test.wait_until_child_is_available('PageBreak') - self.ui_test.execute_dialog_through_action(xPageBreak, "EDIT") + with self.ui_test.execute_dialog_through_action(xPageBreak, "EDIT") as xDialog: - xDialog = self.xUITest.getTopFocusWindow() - self.assertEqual("Page", get_state_as_dict(xDialog.getChild("comboBreakType"))["SelectEntryText"]) - self.assertEqual("Before", get_state_as_dict(xDialog.getChild("comboBreakPosition"))["SelectEntryText"]) + self.assertEqual("Page", get_state_as_dict(xDialog.getChild("comboBreakType"))["SelectEntryText"]) + self.assertEqual("Before", get_state_as_dict(xDialog.getChild("comboBreakPosition"))["SelectEntryText"]) - xPageStyle = xDialog.getChild("comboPageStyle") - self.assertEqual("Chap 2", get_state_as_dict(xPageStyle)["SelectEntryText"]) + xPageStyle = xDialog.getChild("comboPageStyle") + self.assertEqual("Chap 2", get_state_as_dict(xPageStyle)["SelectEntryText"]) - select_by_text(xPageStyle, "Chap 3") + select_by_text(xPageStyle, "Chap 3") - self.assertEqual("Chap 3", get_state_as_dict(xPageStyle)["SelectEntryText"]) + self.assertEqual("Chap 3", get_state_as_dict(xPageStyle)["SelectEntryText"]) - # tdf#116070: Without the fix in place, this test would have crashed here - okBtn = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(okBtn) + # tdf#116070: Without the fix in place, this test would have crashed here # Without the fix in place, this test would have failed with # AssertionError: 'Chap 1' != 'Chap 3' diff --git a/sw/qa/uitest/writer_tests4/tdf135636.py b/sw/qa/uitest/writer_tests4/tdf135636.py index f4efcddb3c2e..70f2e4e239dc 100644 --- a/sw/qa/uitest/writer_tests4/tdf135636.py +++ b/sw/qa/uitest/writer_tests4/tdf135636.py @@ -18,19 +18,16 @@ class tdf135636(UITestCase): self.assertEqual(document.CurrentController.PageCount, 2) xPageBreak = self.ui_test.wait_until_child_is_available('PageBreak') - self.ui_test.execute_dialog_through_action(xPageBreak, "EDIT") + with self.ui_test.execute_dialog_through_action(xPageBreak, "EDIT") as xDialog: - xDialog = self.xUITest.getTopFocusWindow() - xBreak = xDialog.getChild("break") - self.assertEqual("true", get_state_as_dict(xBreak)["Selected"]) + xBreak = xDialog.getChild("break") + self.assertEqual("true", get_state_as_dict(xBreak)["Selected"]) - xBreak.executeAction("CLICK", tuple()) + xBreak.executeAction("CLICK", tuple()) - self.assertEqual("false", get_state_as_dict(xBreak)["Selected"]) + self.assertEqual("false", get_state_as_dict(xBreak)["Selected"]) - okBtn = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(okBtn) # Without the fix in place, this test would have failed with # AssertionError: 2 != 1 diff --git a/sw/qa/uitest/writer_tests6/tdf131041.py b/sw/qa/uitest/writer_tests6/tdf131041.py index 94a6f2b750e7..aa0df0aa1d10 100644 --- a/sw/qa/uitest/writer_tests6/tdf131041.py +++ b/sw/qa/uitest/writer_tests6/tdf131041.py @@ -29,17 +29,14 @@ class tdf131041(UITestCase): self.assertEqual(get_state_as_dict(xHeaderOn)["Selected"], "true") self.assertEqual(get_state_as_dict(xMoreBtn)["Enabled"], "true") - self.ui_test.execute_dialog_through_action(xMoreBtn, "CLICK") + with self.ui_test.execute_dialog_through_action(xMoreBtn, "CLICK") as xBorderDlg: - xBorderDlg = self.xUITest.getTopFocusWindow() - #modify any property - bottomft = xBorderDlg.getChild("bottommf") - bottomft.executeAction("UP", tuple()) + #modify any property + bottomft = xBorderDlg.getChild("bottommf") + bottomft.executeAction("UP", tuple()) - #it would crash here - okBtn = xBorderDlg.getChild("ok") - self.ui_test.close_dialog_through_button(okBtn) + #it would crash here xDialog = self.xUITest.getTopFocusWindow() okBtn = xDialog.getChild("ok") diff --git a/uitest/uitest/test.py b/uitest/uitest/test.py index c601116d2a6b..833f5a726049 100644 --- a/uitest/uitest/test.py +++ b/uitest/uitest/test.py @@ -128,7 +128,9 @@ class UITest(object): raise DialogNotExecutedException(command) - def execute_dialog_through_action(self, ui_object, action, parameters = None, event_name = "DialogExecute"): + # Calls UITest.close_dialog_through_button at exit + @contextmanager + def execute_dialog_through_action(self, ui_object, action, parameters = None, event_name = "DialogExecute", close_button = "ok"): if parameters is None: parameters = tuple() @@ -137,7 +139,11 @@ class UITest(object): time_ = 0 while time_ < MAX_WAIT: if event.executed: - time.sleep(DEFAULT_SLEEP) + xDialog = self._xUITest.getTopFocusWindow() + try: + yield xDialog + finally: + self.close_dialog_through_button(xDialog.getChild(close_button)) return time_ += DEFAULT_SLEEP time.sleep(DEFAULT_SLEEP) diff --git a/uitest/uitest/uihelper/guarded.py b/uitest/uitest/uihelper/guarded.py index 5cfed2d49e1a..f6e91b0f5088 100644 --- a/uitest/uitest/uihelper/guarded.py +++ b/uitest/uitest/uihelper/guarded.py @@ -21,16 +21,6 @@ def create_doc_in_start_center(testCase, app): # Calls UITest.close_dialog_through_button at exit @contextmanager -def execute_dialog_through_action(testCase, ui_object, action, parameters = None, event_name = "DialogExecute", close_button = "ok"): - testCase.ui_test.execute_dialog_through_action(ui_object, action, parameters, event_name) - xDialog = testCase.xUITest.getTopFocusWindow() - try: - yield xDialog - finally: - testCase.ui_test.close_dialog_through_button(xDialog.getChild(close_button)) - -# Calls UITest.close_dialog_through_button at exit -@contextmanager def execute_dialog_through_command(testCase, command, printNames=False, close_button = "ok"): testCase.ui_test.execute_dialog_through_command(command, printNames) xDialog = testCase.xUITest.getTopFocusWindow() |