[Libreoffice-commits] core.git: uitest/writer_tests
Xisco Fauli
anistenis at gmail.com
Tue Jun 13 17:19:23 UTC 2017
uitest/writer_tests/pageDialog.py | 83 ++++++++++++++++++++++++++------------
1 file changed, 58 insertions(+), 25 deletions(-)
New commits:
commit a7309f17b34b97816b7d8f9ada5e8563d033aa82
Author: Xisco Fauli <anistenis at gmail.com>
Date: Tue Jun 13 14:56:31 2017 +0200
uitest: Check default paper formats
Change-Id: Iaf889339f6a757fa5a3e992fb4438df842ea76eb
Reviewed-on: https://gerrit.libreoffice.org/38738
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Xisco FaulĂ <xiscofauli at libreoffice.org>
diff --git a/uitest/writer_tests/backgrounds.py b/uitest/writer_tests/pageDialog.py
similarity index 72%
rename from uitest/writer_tests/backgrounds.py
rename to 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:
More information about the Libreoffice-commits
mailing list