diff options
author | Michael Stahl <mstahl@redhat.com> | 2013-01-09 15:45:32 +0100 |
---|---|---|
committer | Michael Stahl <mstahl@redhat.com> | 2013-01-09 15:57:50 +0100 |
commit | 68d40d2cae3700f4134375fcaf9649ac626ada7d (patch) | |
tree | 769a8d4e32158088725ab7d35904873ab36e8656 /sw/qa | |
parent | 11b380874a36869452246cc77c392d1767e60e95 (diff) |
fdo#58242: sw: fix more crashes when not on SwTxtNode
In getCrsrPropertyValue etc.; also add a unit test for the problem.
Change-Id: Ibd459a43393c39b4fed9fb89aae4a5f7bacff007
Diffstat (limited to 'sw/qa')
-rw-r--r-- | sw/qa/complex/writer/CheckTable.java | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/sw/qa/complex/writer/CheckTable.java b/sw/qa/complex/writer/CheckTable.java index 449dc1ad45da..6fe9b28034d4 100644 --- a/sw/qa/complex/writer/CheckTable.java +++ b/sw/qa/complex/writer/CheckTable.java @@ -10,12 +10,16 @@ package complex.writer; import com.sun.star.uno.UnoRuntime; +import com.sun.star.uno.RuntimeException; import com.sun.star.uno.XComponentContext; import com.sun.star.lang.XMultiServiceFactory; import com.sun.star.beans.XPropertySet; +import com.sun.star.beans.XPropertySetInfo; +import com.sun.star.beans.Property; import com.sun.star.text.XText; import com.sun.star.text.XTextDocument; import com.sun.star.text.XTextCursor; +import com.sun.star.text.XTextRange; import com.sun.star.text.XTextTable; import com.sun.star.table.TableBorder; import com.sun.star.table.TableBorder2; @@ -258,6 +262,34 @@ public class CheckTable assertTrue(border2.IsDistanceValid); assertEquals(97, border2.Distance); } + + @Test + public void test_fdo58242() throws Exception + { + // insert table + XMultiServiceFactory xDocF = + UnoRuntime.queryInterface(XMultiServiceFactory.class, m_xDoc); + XTextTable xTable = UnoRuntime.queryInterface(XTextTable.class, + xDocF.createInstance("com.sun.star.text.TextTable")); + xTable.initialize(3, 3); + XText xText = m_xDoc.getText(); + XTextCursor xCursor = xText.createTextCursor(); + xText.insertTextContent(xCursor, xTable, false); + // get anchor + XTextRange xAnchor = xTable.getAnchor(); + // check all properties on the anchor - shouldn't crash despite + // pointing to a non-SwTxtNode + XPropertySet xProps = (XPropertySet) + UnoRuntime.queryInterface(XPropertySet.class, xAnchor); + XPropertySetInfo xPropsInfo = xProps.getPropertySetInfo(); + Property[] props = xPropsInfo.getProperties(); + for (int i = 0; i < props.length; ++i) + { + try { + xProps.getPropertyValue(props[i].Name); + } catch (RuntimeException e) { } + } + } } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |