diff options
author | Attila Bakos (NISZ) <bakos.attilakaroly@nisz.hu> | 2020-12-10 10:36:12 +0100 |
---|---|---|
committer | László Németh <nemeth@numbertext.org> | 2021-01-26 13:59:48 +0100 |
commit | 26bd8f5a1d39801f69232c22673cb0da7c76d3d5 (patch) | |
tree | a36e71fcedcf9122c20d925459a5231f6d4fc631 /sw/qa/uitest | |
parent | eea523b686b27b4807ab21b62805ce9fbddf74ef (diff) |
tdf#137803 sw: fix AutoSize and Wrap of textboxes
When autosize (AutoGrowHeight) turned on
the textbox fell apart. After changing the text
of the textbox the positions still were different
for the shape and the textframe.
Now this fix solves, if the text changes,
the positions (with the size what worked only
before) synchronized so the textboxes are kept together.
Also Wrap text inside the shape now works like
the editeng text did, except in the case of empty
text boxes.
Note: this fixes only editing (without positioning
the textboxes by the mouse before or after the setting),
but not import/export, yet.
The ooxmlimport test has been restored to its original
state, because the fix for the tdf#135198 is fixed
by this commit.
To start the unit test just give the following command:
$ (cd sw && make UITest_writer_tests7 UITEST_TEST_NAME="tdf137803.tdf137803.test_tdf137803" SAL_USE_VCLPLUGIN=gen)
Change-Id: Ie13a7a1e81e4099cd8540edd7e008118e58134bf
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107515
Tested-by: László Németh <nemeth@numbertext.org>
Reviewed-by: László Németh <nemeth@numbertext.org>
Diffstat (limited to 'sw/qa/uitest')
-rw-r--r-- | sw/qa/uitest/data/tdf137803.odt | bin | 0 -> 9416 bytes | |||
-rw-r--r-- | sw/qa/uitest/writer_tests7/tdf137803.py | 61 |
2 files changed, 61 insertions, 0 deletions
diff --git a/sw/qa/uitest/data/tdf137803.odt b/sw/qa/uitest/data/tdf137803.odt Binary files differnew file mode 100644 index 000000000000..8f2f7d5dc49b --- /dev/null +++ b/sw/qa/uitest/data/tdf137803.odt diff --git a/sw/qa/uitest/writer_tests7/tdf137803.py b/sw/qa/uitest/writer_tests7/tdf137803.py new file mode 100644 index 000000000000..249dbbb7cacc --- /dev/null +++ b/sw/qa/uitest/writer_tests7/tdf137803.py @@ -0,0 +1,61 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# 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 libreoffice.uno.propertyvalue import mkPropertyValues +from uitest.uihelper.common import get_state_as_dict +import importlib +import time +import org.libreoffice.unotest +import pathlib + +def get_url_for_data_file(file_name): + return pathlib.Path(org.libreoffice.unotest.makeCopyFromTDOC(file_name)).as_uri() + +class tdf137803(UITestCase): + def test_tdf137803(self): + # load the sample file + self.ui_test.load_file(get_url_for_data_file("tdf137803.odt")) + xWriterDoc = self.xUITest.getTopFocusWindow() + xWriterEdit = xWriterDoc.getChild("writer_edit") + document = self.ui_test.get_component() + + # select the shape + self.xUITest.executeCommand(".uno:JumpToNextFrame") + self.ui_test.wait_until_child_is_available(xWriterEdit, 'metricfield') + + # open textattrs dialog + self.ui_test.execute_dialog_through_command(".uno:TextAttributes") + TextDialog = self.xUITest.getTopFocusWindow(); + + # check autosize on + TSB_AUTOGROW_SIZE = TextDialog.getChild('TSB_AUTOGROW_SIZE') + TSB_AUTOGROW_SIZE.executeAction("CLICK",tuple()) + ok = TextDialog.getChild("ok") + self.ui_test.close_dialog_through_button(ok) + + # get the shape + drawPage = document.getDrawPages().getByIndex(0) + shape = drawPage.getByIndex(0) + + # and the textbox + frame = shape.getText() + + # get the positions + shapeYPos = shape.getPropertyValue("VertOrientPosition") + frameYPos = frame.getPropertyValue("VertOrientPosition") + shpsize = shape.getSize().Height + + xToolkit = self.xContext.ServiceManager.createInstance('com.sun.star.awt.Toolkit') + xToolkit.processEventsToIdle() + + # without the fix, at this point the textbox falls apart so this won't be passed + self.assertLess(frameYPos, shapeYPos + shpsize) + + # close the doc + self.ui_test.close_doc() + +# vim: set shiftwidth=4 softtabstop=4 expandtab: |