diff --git a/cui/qa/uitest/tabpages/page.py b/cui/qa/uitest/tabpages/page.py new file mode 100644 index 000000000000..74cf5c2a6011 --- /dev/null +++ b/cui/qa/uitest/tabpages/page.py @@ -0,0 +1,42 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# + +from uitest.framework import UITestCase +from uitest.uihelper.common import get_state_as_dict + + +class PageTabTest(UITestCase): + # Tests that the “Resize all pages” checkbox is only visible when the dialog is opened from a + # Draw or Impress document and not from Writer or Calc. See tdf#173170 + def test_resize_all_visibility(self): + with self.ui_test.create_doc_in_start_center("impress") as xComponent: + xTemplate = self.xUITest.getTopFocusWindow() + self.ui_test.close_dialog_through_button(xTemplate.getChild("close")) + + with self.ui_test.execute_dialog_through_command(".uno:PageSetup") as xDialog: + xResizeCheckBox = xDialog.getChild("checkResizeAllPages") + self.assertEqual(get_state_as_dict(xResizeCheckBox)["ReallyVisible"], "true") + + with self.ui_test.create_doc_in_start_center("draw") as xComponent: + with self.ui_test.execute_dialog_through_command(".uno:PageSetup") as xDialog: + xResizeCheckBox = xDialog.getChild("checkResizeAllPages") + self.assertEqual(get_state_as_dict(xResizeCheckBox)["ReallyVisible"], "true") + + with self.ui_test.create_doc_in_start_center("writer") as xComponent: + with self.ui_test.execute_dialog_through_command(".uno:PageDialog") as xDialog: + xResizeCheckBox = xDialog.getChild("checkResizeAllPages") + self.assertEqual(get_state_as_dict(xResizeCheckBox)["ReallyVisible"], "false") + + with self.ui_test.create_doc_in_start_center("calc") as xComponent: + with self.ui_test.execute_dialog_through_command(".uno:PageFormatDialog") as xDialog: + xResizeCheckBox = xDialog.getChild("checkResizeAllPages") + self.assertEqual(get_state_as_dict(xResizeCheckBox)["ReallyVisible"], "false") + + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/cui/source/tabpages/page.cxx b/cui/source/tabpages/page.cxx index 3a8e4f4cf261..a9e45343bee3 100644 --- a/cui/source/tabpages/page.cxx +++ b/cui/source/tabpages/page.cxx @@ -300,6 +300,10 @@ SvxPageDescPage::SvxPageDescPage(weld::Container* pPage, weld::DialogController* // Get the i18n framework numberings and add them to the listbox. SvxNumOptionsTabPageHelper::GetI18nNumbering(m_xNumberFormatBox->get_widget(), std::numeric_limits::max()); + + // Hide the “resize all pages” checkbox if the attribute isn’t used. tdf#173170 + if (!rAttr.HasItem(SID_ATTR_RESIZE_ALL_PAGES)) + m_xResizeAllPages->set_visible(false); } SvxPageDescPage::~SvxPageDescPage()