diff options
-rw-r--r-- | chart2/source/controller/dialogs/DialogModel.cxx | 17 | ||||
-rw-r--r-- | sw/qa/uitest/writer_tests7/tdf132714.py | 28 |
2 files changed, 40 insertions, 5 deletions
diff --git a/chart2/source/controller/dialogs/DialogModel.cxx b/chart2/source/controller/dialogs/DialogModel.cxx index 564343c62671..d6d1fbd71b97 100644 --- a/chart2/source/controller/dialogs/DialogModel.cxx +++ b/chart2/source/controller/dialogs/DialogModel.cxx @@ -631,13 +631,20 @@ void DialogModel::setCategories( const Reference< chart2::data::XLabeledDataSequ OUString DialogModel::getCategoriesRange() const { - uno::Reference< chart2::data::XLabeledDataSequence > xLSeq( getCategories()); OUString aRange; - if( xLSeq.is()) + try + { + uno::Reference< chart2::data::XLabeledDataSequence > xLSeq( getCategories()); + if( xLSeq.is()) + { + Reference< data::XDataSequence > xSeq( xLSeq->getValues()); + if( xSeq.is()) + aRange = xSeq->getSourceRangeRepresentation(); + } + } + catch (const lang::DisposedException&) { - Reference< data::XDataSequence > xSeq( xLSeq->getValues()); - if( xSeq.is()) - aRange = xSeq->getSourceRangeRepresentation(); + TOOLS_WARN_EXCEPTION( "chart2", "unexpected exception caught" ); } return aRange; } diff --git a/sw/qa/uitest/writer_tests7/tdf132714.py b/sw/qa/uitest/writer_tests7/tdf132714.py index 7ccedbeb6f4d..cad8ff24e80d 100644 --- a/sw/qa/uitest/writer_tests7/tdf132714.py +++ b/sw/qa/uitest/writer_tests7/tdf132714.py @@ -66,4 +66,32 @@ class tdf132714(UITestCase): # Without the fix in place, this test would have crashed here xToolkitRobot.mouseMove(xMouseEvent) + def test_data_ranges(self): + with self.ui_test.load_file(get_url_for_data_file("tdf132714.odt")) as document: + + # delete second row (first data row) in the associated text table of the chart + self.xUITest.executeCommand(".uno:GoDown") + self.xUITest.executeCommand(".uno:GoDown") + # Without the fix in place, at this point crash occurs. + self.xUITest.executeCommand(".uno:DeleteTable") + + # select embedded chart + self.assertEqual(1, document.EmbeddedObjects.Count) + document.CurrentController.select(document.getEmbeddedObjects().getByIndex(0)) + self.assertEqual("SwXTextEmbeddedObject", document.CurrentSelection.getImplementationName()) + + xChartMainTop = self.xUITest.getTopFocusWindow() + xWriterEdit = xChartMainTop.getChild("writer_edit") + # edit object by pressing Enter + xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"RETURN"})) + + # open DataRanges dialog window + xChartMain = xChartMainTop.getChild("chart_window") + xSeriesObj = xChartMain.getChild("CID/Page=") + + # Without the fix in place, this test would have crashed here + with self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DataRanges"})) as xDialog: + pass + + # vim: set shiftwidth=4 softtabstop=4 expandtab: |