1# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- 2# 3# This file is part of the LibreOffice project. 4# 5# This Source Code Form is subject to the terms of the Mozilla Public 6# License, v. 2.0. If a copy of the MPL was not distributed with this 7# file, You can obtain one at http://mozilla.org/MPL/2.0/. 8# 9from uitest.framework import UITestCase 10from uitest.uihelper.common import select_by_text, select_pos 11 12from uitest.uihelper.common import get_state_as_dict, get_url_for_data_file 13 14 15# Bug 123508 - "Fit print range(s) to width/height" value falls back to default when window closes 16class tdf123508(UITestCase): 17 def test_tdf123508_format_page_scale(self): 18 with self.ui_test.load_file(get_url_for_data_file("tdf123508.ods")): 19 #open "Format > Page - Sheet > Scale 20 with self.ui_test.execute_dialog_through_command(".uno:PageFormatDialog") as xDialog: 21 xTabs = xDialog.getChild("tabcontrol") 22 select_pos(xTabs, "6") #tab Scale 23 scalingMode = xDialog.getChild("comboLB_SCALEMODE") 24 spinEDSCALEPAGEWIDTH = xDialog.getChild("spinED_SCALEPAGEWIDTH") 25 spinEDSCALEPAGEHEIGHT = xDialog.getChild("spinED_SCALEPAGEHEIGHT") 26 #select "Shrink print range(s) to width/height" from the scale mode drop-down list 27 select_by_text(scalingMode, "Shrink print range(s) to width/height") 28 #define a value for the page, e.g.: width 2; height 2 29 spinEDSCALEPAGEWIDTH.executeAction("UP", tuple()) 30 spinEDSCALEPAGEHEIGHT.executeAction("UP", tuple()) 31 32 33 #verify 34 with self.ui_test.execute_dialog_through_command(".uno:PageFormatDialog", close_button="cancel") as xDialog: 35 xTabs = xDialog.getChild("tabcontrol") 36 select_pos(xTabs, "6") #tab Scale 37 scalingMode = xDialog.getChild("comboLB_SCALEMODE") 38 spinEDSCALEPAGEWIDTH = xDialog.getChild("spinED_SCALEPAGEWIDTH") 39 spinEDSCALEPAGEHEIGHT = xDialog.getChild("spinED_SCALEPAGEHEIGHT") 40 41 self.assertEqual(get_state_as_dict(scalingMode)["SelectEntryText"], "Shrink print range(s) to width/height") 42 self.assertEqual(get_state_as_dict(spinEDSCALEPAGEWIDTH)["Text"], "2") 43 self.assertEqual(get_state_as_dict(spinEDSCALEPAGEHEIGHT)["Text"], "2") 44 45 46# vim: set shiftwidth=4 softtabstop=4 expandtab: 47
