cui/source/tabpages/tpbitmap.cxx         |    8 +---
 sd/qa/uitest/impress_tests/tdf152295.py  |   55 +++++++++++++++++++++++++++++++
 sw/qa/uitest/writer_tests3/pageDialog.py |    8 ++--
 uitest/impress_tests/backgrounds.py      |    4 +-
 4 files changed, 63 insertions(+), 12 deletions(-)

New commits:
commit 4a4f58f06f802e7bc057e0a6e7180b595bd4a379
Author:     Tibor Nagy <nagy.tib...@nisz.hu>
AuthorDate: Thu Dec 8 11:37:47 2022 +0100
Commit:     László Németh <nem...@numbertext.org>
CommitDate: Mon Dec 19 12:20:08 2022 +0000

    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 686349476e03f951f4a9ff9755b9f71951b64ea5
    "[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 <nem...@numbertext.org>
    Reviewed-by: László Németh <nem...@numbertext.org>

diff --git a/cui/source/tabpages/tpbitmap.cxx b/cui/source/tabpages/tpbitmap.cxx
index bf3b742a19d2..b515d6bd9a36 100644
--- a/cui/source/tabpages/tpbitmap.cxx
+++ b/cui/source/tabpages/tpbitmap.cxx
@@ -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);
         }
diff --git a/sd/qa/uitest/impress_tests/tdf152295.py 
b/sd/qa/uitest/impress_tests/tdf152295.py
new file mode 100644
index 000000000000..e6994d09ee61
--- /dev/null
+++ b/sd/qa/uitest/impress_tests/tdf152295.py
@@ -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:
diff --git a/sw/qa/uitest/writer_tests3/pageDialog.py 
b/sw/qa/uitest/writer_tests3/pageDialog.py
index f0011ed69f94..dc323cbb7eae 100644
--- a/sw/qa/uitest/writer_tests3/pageDialog.py
+++ b/sw/qa/uitest/writer_tests3/pageDialog.py
@@ -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')
 
diff --git a/uitest/impress_tests/backgrounds.py 
b/uitest/impress_tests/backgrounds.py
index b1b2f950f16d..e427995bfac2 100644
--- a/uitest/impress_tests/backgrounds.py
+++ b/uitest/impress_tests/backgrounds.py
@@ -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(

Reply via email to