Kaydet (Commit) a7309f17 authored tarafından Xisco Fauli's avatar Xisco Fauli Kaydeden (comit) Xisco Faulí

uitest: Check default paper formats

Change-Id: Iaf889339f6a757fa5a3e992fb4438df842ea76eb
Reviewed-on: https://gerrit.libreoffice.org/38738Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarXisco Faulí <xiscofauli@libreoffice.org>
üst a5b4cb3f
......@@ -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:
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment