diff options
author | Xisco Fauli <anistenis@gmail.com> | 2017-06-13 14:56:31 +0200 |
---|---|---|
committer | Xisco FaulĂ <xiscofauli@libreoffice.org> | 2017-06-13 19:19:00 +0200 |
commit | a7309f17b34b97816b7d8f9ada5e8563d033aa82 (patch) | |
tree | b6427871392781f94f3f67e001306320933a32de /uitest | |
parent | a5b4cb3f836c991d0647f55e1ef4920ce6115eac (diff) |
uitest: Check default paper formats
Change-Id: Iaf889339f6a757fa5a3e992fb4438df842ea76eb
Reviewed-on: https://gerrit.libreoffice.org/38738
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Xisco FaulĂ <xiscofauli@libreoffice.org>
Diffstat (limited to 'uitest')
-rw-r--r-- | uitest/writer_tests/pageDialog.py (renamed from uitest/writer_tests/backgrounds.py) | 83 |
1 files changed, 58 insertions, 25 deletions
diff --git a/uitest/writer_tests/backgrounds.py b/uitest/writer_tests/pageDialog.py index da49a7526dc2..738f799f852b 100644 --- a/uitest/writer_tests/backgrounds.py +++ b/uitest/writer_tests/pageDialog.py @@ -12,11 +12,26 @@ from com.sun.star.drawing.HatchStyle import SINGLE from com.sun.star.drawing.BitmapMode import REPEAT from com.sun.star.drawing.RectanglePoint import MIDDLE_MIDDLE -class WriterBackgrounds(UITestCase): +from libreoffice.uno.propertyvalue import mkPropertyValues - def checkDefaultBackground(self, btn): +class WriterPageDialog(UITestCase): + + def launch_dialog_and_select_tab(self, tab): + self.ui_test.execute_dialog_through_command(".uno:PageDialog") + + xDialog = self.xUITest.getTopFocusWindow() + tabcontrol = xDialog.getChild("tabcontrol") + select_pos(tabcontrol, str(tab)) + + return xDialog + + def click_button(self, dialog, button): + xButton = dialog.getChild(button) + xButton.executeAction("CLICK", tuple()) + + def check_default_area(self, btn): document = self.ui_test.get_component() - if btn == 'btnnone': + if btn == 'btnnone': self.assertEqual( document.StyleFamilies.PageStyles.Standard.BackColor, -1) elif btn == 'btncolor': @@ -107,41 +122,59 @@ class WriterBackgrounds(UITestCase): self.assertEqual( document.StyleFamilies.PageStyles.Standard.FillBitmapName, '5 Percent') - - def test_background_dialog(self): + def test_area_tab(self): self.ui_test.create_doc_in_start_center("writer") buttons = ['btnbitmap', 'btncolor', 'btngradient', 'btnhatch', 'btnpattern'] for index, button in enumerate(buttons): - self.ui_test.execute_dialog_through_command(".uno:PageStyleName") - xPageStyleDlg = self.xUITest.getTopFocusWindow() - tabcontrol = xPageStyleDlg.getChild("tabcontrol") - select_pos(tabcontrol, "2") + xDialog = self.launch_dialog_and_select_tab(2) + + self.click_button(xDialog, button) + + self.click_button(xDialog, 'ok') + + self.check_default_area(button) - xBtn = xPageStyleDlg.getChild(button) - xBtn.executeAction("CLICK", tuple()) + xDialog = self.launch_dialog_and_select_tab(2) + + self.click_button(xDialog, 'btnnone') + + self.click_button(xDialog, 'ok') + + self.check_default_area('btnnone') + + self.ui_test.close_doc() + + def test_page_tab(self): + + size_list = [[10500,14801], [14801,21001], [21001,29700], [29700,42000], + [12501,17600], [17600,25000], [25000,35301], [21590,27940], + [21590,35560], [21590,33020], [27940,43180], [12801,18200], + [18200,25700], [25700,36400], [18399,26000], [13000,18399], + [14000,20301], [14000,20301], [11000,21999], [11400,16200], + [11400,22901], [16200,22901], [22901,32401], [9208,16510], + [9843,19050], [9843,22543], [10478,24130], [11430,26353]] + + self.ui_test.create_doc_in_start_center("writer") - xOkBtn = xPageStyleDlg.getChild("ok") - xOkBtn.executeAction("CLICK", tuple()) + for i in range(28): + with self.subTest(i=i): + xDialog = self.launch_dialog_and_select_tab(1) - self.checkDefaultBackground(button) - - self.ui_test.execute_dialog_through_command(".uno:PageStyleName") + xFormatList = xDialog.getChild("comboPageFormat") + select_pos(xFormatList, str(i)) - xPageStyleDlg = self.xUITest.getTopFocusWindow() - tabcontrol = xPageStyleDlg.getChild("tabcontrol") - select_pos(tabcontrol, "2") + self.click_button(xDialog, 'ok') - xBtn = xPageStyleDlg.getChild('btnnone') - xBtn.executeAction("CLICK", tuple()) + document = self.ui_test.get_component() - xOkBtn = xPageStyleDlg.getChild("ok") - xOkBtn.executeAction("CLICK", tuple()) + self.assertEqual( + document.StyleFamilies.PageStyles.Standard.Width, size_list[i][0]) + self.assertEqual( + document.StyleFamilies.PageStyles.Standard.Height, size_list[i][1]) - self.checkDefaultBackground('btnnone') - self.ui_test.close_doc() # vim: set shiftwidth=4 softtabstop=4 expandtab: |