tdf#152295 sw sd UI: don't reset tiled image size by Area tab

The background tiling images become larger when
opening and closing Area tab: reopening the image
properties in the Area tab shows that the Width
and Height got reset to the original values of the
image.

Regression from commit 686349476e
"[GSoC] Move all fill style tabs inside area tab".

Change-Id: Ibc4dfd73dedd81b1b7fe17574198dd4999aab967
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143819
Tested-by: László Németh <nemeth@numbertext.org>
Reviewed-by: László Németh <nemeth@numbertext.org>
This commit is contained in:
Tibor Nagy 2022-12-08 11:37:47 +01:00 committed by László Németh
parent b12e38c1cc
commit 4a4f58f06f
4 changed files with 63 additions and 12 deletions

View file

@ -316,15 +316,9 @@ void SvxBitmapTabPage::Reset( const SfxItemSet* rAttrs )
if(rAttrs->GetItemState(XATTR_FILLBMP_SIZELOG) != SfxItemState::DONTCARE)
{
if (rAttrs->Get( XATTR_FILLBMP_SIZELOG ).GetValue())
{
m_xTsbScale->set_state(TRISTATE_FALSE);
m_bLogicalSize = true;
}
else
{
m_xTsbScale->set_state(TRISTATE_TRUE);
m_bLogicalSize = false;
}
}
else
m_xTsbScale->set_state(TRISTATE_INDET);
@ -337,6 +331,7 @@ void SvxBitmapTabPage::Reset( const SfxItemSet* rAttrs )
nWidth = rBitmapSize.Width();
else if(nWidth < 0)
{
m_bLogicalSize = true;
eRelative = TRISTATE_TRUE;
nWidth = std::abs(nWidth);
}
@ -349,6 +344,7 @@ void SvxBitmapTabPage::Reset( const SfxItemSet* rAttrs )
nHeight = rBitmapSize.Height();
else if(nHeight < 0)
{
m_bLogicalSize = true;
eRelative = TRISTATE_TRUE;
nHeight = std::abs(nHeight);
}

View file

@ -0,0 +1,55 @@
# -*- 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, select_pos
from uitest.uihelper.common import change_measurement_unit
class tdf152295(UITestCase):
def test_tdf152295(self):
with self.ui_test.create_doc_in_start_center("impress") as document:
change_measurement_unit(self, "Centimeter")
TemplateDialog = self.xUITest.getTopFocusWindow()
close = TemplateDialog.getChild("close")
self.ui_test.close_dialog_through_button(close)
with self.ui_test.execute_dialog_through_command(".uno:PageSetup") as DrawPageDialog:
xTabs = DrawPageDialog.getChild("tabcontrol")
select_pos(xTabs, "1")
btnbitmap = DrawPageDialog.getChild("btnbitmap")
btnbitmap.executeAction("CLICK",tuple())
width = DrawPageDialog.getChild("width")
for _ in range(50):
width.executeAction("UP",tuple())
height = DrawPageDialog.getChild("height")
for _ in range(50):
height.executeAction("UP",tuple())
with self.ui_test.execute_dialog_through_command(".uno:PageSetup") as DrawPageDialog:
xTabs = DrawPageDialog.getChild("tabcontrol")
select_pos(xTabs, "1")
btnbitmap = DrawPageDialog.getChild("btnbitmap")
btnbitmap.executeAction("CLICK",tuple())
with self.ui_test.execute_dialog_through_command(".uno:PageSetup") as DrawPageDialog:
xTabs = DrawPageDialog.getChild("tabcontrol")
select_pos(xTabs, "1")
btnbitmap = DrawPageDialog.getChild("btnbitmap")
btnbitmap.executeAction("CLICK",tuple())
width = DrawPageDialog.getChild("width")
height = DrawPageDialog.getChild("height")
# Without the fix in place, this test would have failed with
# AssertionError: '6.00 cm' != '13.55 cm'
# AssertionError: '6.00 cm' != '13.55 cm'
self.assertEqual("6.00 cm", get_state_as_dict(width)['Text'])
self.assertEqual("6.00 cm", get_state_as_dict(height)['Text'])
# vim: set shiftwidth=4 softtabstop=4 expandtab:

View file

@ -83,9 +83,9 @@ class WriterPageDialog(UITestCase):
self.assertEqual(
document.StyleFamilies.PageStyles.Standard.FillBitmapLogicalSize, True)
self.assertEqual(
document.StyleFamilies.PageStyles.Standard.FillBitmapSizeX, 0)
document.StyleFamilies.PageStyles.Standard.FillBitmapSizeX, 1000)
self.assertEqual(
document.StyleFamilies.PageStyles.Standard.FillBitmapSizeY, 0)
document.StyleFamilies.PageStyles.Standard.FillBitmapSizeY, 1000)
self.assertEqual(
document.StyleFamilies.PageStyles.Standard.FillBitmapName, 'Painted White')
elif btn == 'btnpattern':
@ -108,9 +108,9 @@ class WriterPageDialog(UITestCase):
self.assertEqual(
document.StyleFamilies.PageStyles.Standard.FillBitmapLogicalSize, True)
self.assertEqual(
document.StyleFamilies.PageStyles.Standard.FillBitmapSizeX, 0)
document.StyleFamilies.PageStyles.Standard.FillBitmapSizeX, 1000)
self.assertEqual(
document.StyleFamilies.PageStyles.Standard.FillBitmapSizeY, 0)
document.StyleFamilies.PageStyles.Standard.FillBitmapSizeY, 1000)
self.assertEqual(
document.StyleFamilies.PageStyles.Standard.FillBitmapName, '5 Percent')

View file

@ -75,9 +75,9 @@ class ImpressBackgrounds(UITestCase):
self.assertEqual(
document.DrawPages.getByIndex(0).Background.FillBitmapLogicalSize, True)
self.assertEqual(
document.DrawPages.getByIndex(0).Background.FillBitmapSizeX, 0)
document.DrawPages.getByIndex(0).Background.FillBitmapSizeX, 2540)
self.assertEqual(
document.DrawPages.getByIndex(0).Background.FillBitmapSizeY, 0)
document.DrawPages.getByIndex(0).Background.FillBitmapSizeY, 2540)
self.assertEqual(document.DrawPages.getByIndex(0).Background.FillBitmapName, 'Painted White')
elif btn == 'btnpattern':
self.assertEqual(