diff --git a/sw/UITest_sw_ui_frmdlg.mk b/sw/UITest_sw_ui_frmdlg.mk index 0fae8bf25f1d..219a72ddfae3 100644 --- a/sw/UITest_sw_ui_frmdlg.mk +++ b/sw/UITest_sw_ui_frmdlg.mk @@ -15,4 +15,6 @@ $(eval $(call gb_UITest_set_defs,sw_ui_frmdlg, \ TDOC="$(SRCDIR)/sw/qa/uitest/data" \ )) +$(eval $(call gb_UITest_avoid_oneprocess,sw_ui_frmdlg)) + # vim: set noet sw=4 ts=4: diff --git a/sw/qa/uitest/ui/frmdlg/frmdlg.py b/sw/qa/uitest/ui/frmdlg/frmdlg.py index e3aeb67c569c..e30b67ff5313 100644 --- a/sw/qa/uitest/ui/frmdlg/frmdlg.py +++ b/sw/qa/uitest/ui/frmdlg/frmdlg.py @@ -62,4 +62,22 @@ class Test(UITestCase): # and floating tables. self.assertEqual(get_state_as_dict(xFlysplit)['Visible'], "false") + def test_insert_frame_dialog(self): + # Change from inch to cm to hit the rounding error. 2 means Centimeter, see + # officecfg/registry/schema/org/openoffice/Office/Writer.xcs. + with self.ui_test.set_config('/org.openoffice.Office.Writer/Layout/Other/MeasureUnit', 2): + # Given a Writer document: + with self.ui_test.create_doc_in_start_center("writer") as xComponent: + # When inserting a new frame with the default width: + with self.ui_test.execute_dialog_through_command(".uno:InsertFrame") as xDialog: + xWidth = xDialog.getChild("width") + frame_width = float(get_state_as_dict(xWidth)["Value"]) + # Then make sure the width is not zero: + # cm -> mm100 + expected_mm100 = frame_width * 1000 + # Without the accompanying fix in place, this test would have failed with: + # AssertionError: 0 != 2000.0 + # i.e. the width was empty instead of the size from the UI. + self.assertEqual(xComponent.TextFrames.Frame1.Size.Width, expected_mm100) + # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/source/ui/frmdlg/frmpage.cxx b/sw/source/ui/frmdlg/frmpage.cxx index 352dc15df463..b38ac22d0d11 100644 --- a/sw/source/ui/frmdlg/frmpage.cxx +++ b/sw/source/ui/frmdlg/frmpage.cxx @@ -1264,7 +1264,13 @@ bool SwFramePage::FillItemSet(SfxItemSet *rSet) pOldItem = GetOldItem(*rSet, RES_FRM_SIZE); - if ((pOldItem && aSz != *pOldItem) || (!pOldItem && !m_bFormat) || + bool bSizeChanged = pOldItem && aSz != *pOldItem; + if (!bSizeChanged && m_bNew) + { + // If no custom size is provided, always set a size for a new frame, to avoid ~zero width. + bSizeChanged = true; + } + if (bSizeChanged || (!pOldItem && !m_bFormat) || (m_bFormat && (aSz.GetWidth() > 0 || aSz.GetWidthPercent() > 0) && (aSz.GetHeight() > 0 || aSz.GetHeightPercent() > 0)))