[Libreoffice-commits] core.git: 4 commits - chart2/CppunitTest_chart2_importtest.mk chart2/qa chart2/source xmloff/source
Markus Mohrhard
markus.mohrhard at googlemail.com
Wed Apr 24 03:20:14 PDT 2013
chart2/CppunitTest_chart2_importtest.mk | 2
chart2/qa/extras/chart2import.cxx | 131 ------------------------------
chart2/qa/extras/charttest.hxx | 139 ++++++++++++++++++++++++++++++++
chart2/source/tools/ErrorBar.cxx | 11 ++
xmloff/source/chart/PropertyMap.hxx | 2
5 files changed, 153 insertions(+), 132 deletions(-)
New commits:
commit b3bf16a5c4f863798adca8d322d63e9face64686
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date: Wed Apr 24 12:08:09 2013 +0200
fix a problem with error bar weight
Change-Id: I812bbcdc346bffd2f0c968077a3fe86a241cf231
diff --git a/chart2/source/tools/ErrorBar.cxx b/chart2/source/tools/ErrorBar.cxx
index 92c3265..cb78f8e 100644
--- a/chart2/source/tools/ErrorBar.cxx
+++ b/chart2/source/tools/ErrorBar.cxx
@@ -155,6 +155,10 @@ void ErrorBar::setPropertyValue( const OUString& rPropName, const uno::Any& rAny
rAny >>= mfPositiveError;
rAny >>= mfNegativeError;
}
+ else if(rPropName == "Weight")
+ {
+ rAny >>= mfWeight;
+ }
else if(rPropName == "NegativeError")
rAny >>= mfNegativeError;
else if(rPropName == "ShowPositiveError")
@@ -228,6 +232,8 @@ uno::Any ErrorBar::getPropertyValue(const OUString& rPropName)
aRet <<= mbShowPositiveError;
else if(rPropName == "ShowNegativeError")
aRet <<= mbShowNegativeError;
+ else if(rPropName == "Weight")
+ aRet <<= mfWeight;
else if(rPropName == "ErrorBarRangePositive")
{
OUString aRange;
diff --git a/xmloff/source/chart/PropertyMap.hxx b/xmloff/source/chart/PropertyMap.hxx
index d1ec843..f19b365 100644
--- a/xmloff/source/chart/PropertyMap.hxx
+++ b/xmloff/source/chart/PropertyMap.hxx
@@ -189,7 +189,7 @@ const XMLPropertyMapEntry aXMLChartPropMap[] =
MAP_SPECIAL_ODF12( "ErrorBarRangeNegative", CHART, XML_ERROR_LOWER_RANGE, XML_TYPE_STRING, XML_SCH_CONTEXT_SPECIAL_ERRORBAR_RANGE ), // export only
// errorbars properties (chart2)
- MAP_ENTRY_ODF_EXT( "Weigth", CHART, XML_ERROR_STANDARD_WEIGHT, XML_TYPE_DOUBLE),
+ MAP_ENTRY_ODF_EXT( "Weight", CHART, XML_ERROR_STANDARD_WEIGHT, XML_TYPE_DOUBLE),
// series/data-point properties
MAP_SPECIAL( "DataCaption", CHART, XML_DATA_LABEL_NUMBER, XML_TYPE_NUMBER | MID_FLAG_MERGE_PROPERTY, XML_SCH_CONTEXT_SPECIAL_DATA_LABEL_NUMBER ), // convert one constant
commit a172ed9837d1c52eebd9336e5262f459920e525b
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date: Tue Apr 23 07:11:57 2013 +0200
extract common chart test parts into own header
Change-Id: Id41b9c3cd241de9bc5fa1da885bc9a206bca093d
diff --git a/chart2/qa/extras/chart2import.cxx b/chart2/qa/extras/chart2import.cxx
index b498c69..decd18e 100644
--- a/chart2/qa/extras/chart2import.cxx
+++ b/chart2/qa/extras/chart2import.cxx
@@ -7,45 +7,18 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
-#include <test/bootstrapfixture.hxx>
-#include <unotest/macros_test.hxx>
+#include "charttest.hxx"
-#include <com/sun/star/lang/XComponent.hpp>
-#include <com/sun/star/frame/Desktop.hpp>
-#include <com/sun/star/sheet/XSpreadsheetDocument.hpp>
-#include <com/sun/star/sheet/XSpreadsheet.hpp>
-#include <com/sun/star/container/XIndexAccess.hpp>
-#include <com/sun/star/table/XTableChartsSupplier.hpp>
-#include <com/sun/star/table/XTableCharts.hpp>
-#include <com/sun/star/table/XTableChart.hpp>
-#include <com/sun/star/document/XEmbeddedObjectSupplier.hpp>
-#include <com/sun/star/beans/XPropertySet.hpp>
-
-#include <com/sun/star/chart2/XChartDocument.hpp>
-#include <com/sun/star/chart2/XDiagram.hpp>
-#include <com/sun/star/chart2/XDataSeries.hpp>
-#include <com/sun/star/chart2/XChartTypeContainer.hpp>
-#include <com/sun/star/chart2/XCoordinateSystemContainer.hpp>
-#include <com/sun/star/chart2/XDataSeriesContainer.hpp>
#include <com/sun/star/chart2/CurveStyle.hpp>
#include <com/sun/star/chart/ErrorBarStyle.hpp>
-#include <com/sun/star/chart/XChartDocument.hpp>
-
-#include <comphelper/processfactory.hxx>
-
-using namespace com::sun::star;
-using namespace com::sun::star::uno;
-class Chart2ImportTest : public test::BootstrapFixture, public unotest::MacrosTest
+class Chart2ImportTest : public ChartTest
{
public:
void Fdo60083();
void testSteppedLines();
void testErrorBarRange();
- virtual void setUp();
- virtual void tearDown();
-
CPPUNIT_TEST_SUITE(Chart2ImportTest);
CPPUNIT_TEST(Fdo60083);
CPPUNIT_TEST(testSteppedLines);
@@ -53,15 +26,7 @@ public:
CPPUNIT_TEST_SUITE_END();
private:
- void load( const char* pDir, const char* pName );
-
- Reference< chart2::XChartDocument > getChartDocFromSheet( sal_Int32 nSheet, uno::Reference< lang::XComponent > xComponent );
- Reference< chart2::XDataSeries > getDataSeriesFromDoc( Reference< chart2::XChartDocument > xChartDoc,
- sal_Int32 nDataSeries, sal_Int32 nChartType = 0, sal_Int32 nCooSys = 0 );
- Reference< chart2::XChartType > getChartTypeFromDoc( Reference< chart2::XChartDocument > xChartDoc,
- sal_Int32 nChartType, sal_Int32 nCooSys = 0 );
- Reference< lang::XComponent > mxComponent;
};
// error bar import
@@ -186,98 +151,6 @@ void Chart2ImportTest::testSteppedLines()
}
}
-Reference< chart2::XChartDocument > Chart2ImportTest::getChartDocFromSheet( sal_Int32 nSheet, uno::Reference< lang::XComponent > xComponent )
-{
- // let us assume that we only have one chart per sheet
-
- uno::Reference< sheet::XSpreadsheetDocument > xDoc(xComponent, UNO_QUERY_THROW);
- CPPUNIT_ASSERT(xDoc.is());
-
- uno::Reference< container::XIndexAccess > xIA(xDoc->getSheets(), UNO_QUERY_THROW);
- CPPUNIT_ASSERT(xIA.is());
-
- uno::Reference< table::XTableChartsSupplier > xChartSupplier( xIA->getByIndex(nSheet), UNO_QUERY_THROW);
- CPPUNIT_ASSERT(xChartSupplier.is());
-
- uno::Reference< table::XTableCharts > xCharts = xChartSupplier->getCharts();
- CPPUNIT_ASSERT(xCharts.is());
-
- uno::Reference< container::XIndexAccess > xIACharts(xCharts, UNO_QUERY_THROW);
- uno::Reference< table::XTableChart > xChart( xIACharts->getByIndex(0), UNO_QUERY_THROW);
- CPPUNIT_ASSERT(xChart.is());
-
- uno::Reference< document::XEmbeddedObjectSupplier > xEmbObjectSupplier(xChart, UNO_QUERY_THROW);
- CPPUNIT_ASSERT(xEmbObjectSupplier.is());
-
- uno::Reference< lang::XComponent > xChartComp( xEmbObjectSupplier->getEmbeddedObject(), UNO_QUERY_THROW );
- CPPUNIT_ASSERT(xChartComp.is());
-
- uno::Reference< chart2::XChartDocument > xChartDoc ( xChartComp, UNO_QUERY_THROW );
-
- CPPUNIT_ASSERT(xChartDoc.is());
- return xChartDoc;
-}
-
-Reference< chart2::XChartType > Chart2ImportTest::getChartTypeFromDoc( Reference< chart2::XChartDocument > xChartDoc,
- sal_Int32 nChartType, sal_Int32 nCooSys )
-{
- CPPUNIT_ASSERT( xChartDoc.is() );
-
- Reference <chart2::XDiagram > xDiagram = xChartDoc->getFirstDiagram();
- CPPUNIT_ASSERT( xDiagram.is() );
-
- Reference< chart2::XCoordinateSystemContainer > xCooSysContainer( xDiagram, UNO_QUERY_THROW );
- CPPUNIT_ASSERT( xCooSysContainer.is() );
-
- Sequence< Reference< chart2::XCoordinateSystem > > xCooSysSequence( xCooSysContainer->getCoordinateSystems());
- CPPUNIT_ASSERT( xCooSysSequence.getLength() > nCooSys );
-
- Reference< chart2::XChartTypeContainer > xChartTypeContainer( xCooSysSequence[nCooSys], UNO_QUERY_THROW );
- CPPUNIT_ASSERT( xChartTypeContainer.is() );
-
- Sequence< Reference< chart2::XChartType > > xChartTypeSequence( xChartTypeContainer->getChartTypes() );
- CPPUNIT_ASSERT( xChartTypeSequence.getLength() > nChartType );
-
- return xChartTypeSequence[nChartType];
-}
-
-Reference< chart2::XDataSeries > Chart2ImportTest::getDataSeriesFromDoc( uno::Reference< chart2::XChartDocument > xChartDoc,
- sal_Int32 nDataSeries, sal_Int32 nChartType, sal_Int32 nCooSys )
-{
- Reference< chart2::XChartType > xChartType = getChartTypeFromDoc( xChartDoc, nChartType, nCooSys );
- Reference< chart2::XDataSeriesContainer > xDataSequenceContainer( xChartType, UNO_QUERY_THROW );
- CPPUNIT_ASSERT ( xDataSequenceContainer.is() );
-
- Sequence< Reference< chart2::XDataSeries > > xSeriesSequence( xDataSequenceContainer->getDataSeries() );
- CPPUNIT_ASSERT( xSeriesSequence.getLength() > nDataSeries );
-
- Reference< chart2::XDataSeries > xSeries = xSeriesSequence[nDataSeries];
-
- return xSeries;
-}
-
-void Chart2ImportTest::load( const char* pDir, const char* pName )
-{
- mxComponent = loadFromDesktop(getURLFromSrc(pDir) + OUString::createFromAscii(pName), "com.sun.star.sheet.SpreadsheetDocument");
- CPPUNIT_ASSERT(mxComponent.is());
-}
-
-void Chart2ImportTest::setUp()
-{
- test::BootstrapFixture::setUp();
-
- mxDesktop.set( com::sun::star::frame::Desktop::create( comphelper::getComponentContext(getMultiServiceFactory()) ) );
-}
-
-void Chart2ImportTest::tearDown()
-{
- if(mxComponent.is())
- mxComponent->dispose();
-
- test::BootstrapFixture::tearDown();
-
-}
-
CPPUNIT_TEST_SUITE_REGISTRATION(Chart2ImportTest);
CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/chart2/qa/extras/charttest.hxx b/chart2/qa/extras/charttest.hxx
new file mode 100644
index 0000000..e4968f1
--- /dev/null
+++ b/chart2/qa/extras/charttest.hxx
@@ -0,0 +1,139 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-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/.
+ */
+
+#include <test/bootstrapfixture.hxx>
+#include <unotest/macros_test.hxx>
+#include <comphelper/processfactory.hxx>
+
+#include <com/sun/star/lang/XComponent.hpp>
+#include <com/sun/star/frame/Desktop.hpp>
+
+#include <com/sun/star/sheet/XSpreadsheetDocument.hpp>
+#include <com/sun/star/sheet/XSpreadsheet.hpp>
+#include <com/sun/star/container/XIndexAccess.hpp>
+#include <com/sun/star/table/XTableChartsSupplier.hpp>
+#include <com/sun/star/table/XTableCharts.hpp>
+#include <com/sun/star/table/XTableChart.hpp>
+#include <com/sun/star/document/XEmbeddedObjectSupplier.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+
+#include <com/sun/star/chart2/XChartDocument.hpp>
+#include <com/sun/star/chart2/XDiagram.hpp>
+#include <com/sun/star/chart2/XDataSeries.hpp>
+#include <com/sun/star/chart2/XChartTypeContainer.hpp>
+#include <com/sun/star/chart2/XCoordinateSystemContainer.hpp>
+#include <com/sun/star/chart2/XDataSeriesContainer.hpp>
+
+using namespace com::sun::star;
+using namespace com::sun::star::uno;
+
+class ChartTest : public test::BootstrapFixture, public unotest::MacrosTest
+{
+public:
+ void load( const char* pDir, const char* pName );
+
+ virtual void setUp();
+ virtual void tearDown();
+protected:
+ Reference< lang::XComponent > mxComponent;
+};
+
+void ChartTest::load( const char* pDir, const char* pName )
+{
+ mxComponent = loadFromDesktop(getURLFromSrc(pDir) + OUString::createFromAscii(pName), "com.sun.star.sheet.SpreadsheetDocument");
+ CPPUNIT_ASSERT(mxComponent.is());
+}
+
+void ChartTest::setUp()
+{
+ test::BootstrapFixture::setUp();
+
+ mxDesktop.set( com::sun::star::frame::Desktop::create( comphelper::getComponentContext(getMultiServiceFactory()) ) );
+}
+
+void ChartTest::tearDown()
+{
+ if(mxComponent.is())
+ mxComponent->dispose();
+
+ test::BootstrapFixture::tearDown();
+
+}
+
+Reference< chart2::XChartDocument > getChartDocFromSheet( sal_Int32 nSheet, uno::Reference< lang::XComponent > xComponent )
+{
+ // let us assume that we only have one chart per sheet
+
+ uno::Reference< sheet::XSpreadsheetDocument > xDoc(xComponent, UNO_QUERY_THROW);
+ CPPUNIT_ASSERT(xDoc.is());
+
+ uno::Reference< container::XIndexAccess > xIA(xDoc->getSheets(), UNO_QUERY_THROW);
+ CPPUNIT_ASSERT(xIA.is());
+
+ uno::Reference< table::XTableChartsSupplier > xChartSupplier( xIA->getByIndex(nSheet), UNO_QUERY_THROW);
+ CPPUNIT_ASSERT(xChartSupplier.is());
+
+ uno::Reference< table::XTableCharts > xCharts = xChartSupplier->getCharts();
+ CPPUNIT_ASSERT(xCharts.is());
+
+ uno::Reference< container::XIndexAccess > xIACharts(xCharts, UNO_QUERY_THROW);
+ uno::Reference< table::XTableChart > xChart( xIACharts->getByIndex(0), UNO_QUERY_THROW);
+ CPPUNIT_ASSERT(xChart.is());
+
+ uno::Reference< document::XEmbeddedObjectSupplier > xEmbObjectSupplier(xChart, UNO_QUERY_THROW);
+ CPPUNIT_ASSERT(xEmbObjectSupplier.is());
+
+ uno::Reference< lang::XComponent > xChartComp( xEmbObjectSupplier->getEmbeddedObject(), UNO_QUERY_THROW );
+ CPPUNIT_ASSERT(xChartComp.is());
+
+ uno::Reference< chart2::XChartDocument > xChartDoc ( xChartComp, UNO_QUERY_THROW );
+
+ CPPUNIT_ASSERT(xChartDoc.is());
+ return xChartDoc;
+}
+
+Reference< chart2::XChartType > getChartTypeFromDoc( Reference< chart2::XChartDocument > xChartDoc,
+ sal_Int32 nChartType, sal_Int32 nCooSys = 0 )
+{
+ CPPUNIT_ASSERT( xChartDoc.is() );
+
+ Reference <chart2::XDiagram > xDiagram = xChartDoc->getFirstDiagram();
+ CPPUNIT_ASSERT( xDiagram.is() );
+
+ Reference< chart2::XCoordinateSystemContainer > xCooSysContainer( xDiagram, UNO_QUERY_THROW );
+ CPPUNIT_ASSERT( xCooSysContainer.is() );
+
+ Sequence< Reference< chart2::XCoordinateSystem > > xCooSysSequence( xCooSysContainer->getCoordinateSystems());
+ CPPUNIT_ASSERT( xCooSysSequence.getLength() > nCooSys );
+
+ Reference< chart2::XChartTypeContainer > xChartTypeContainer( xCooSysSequence[nCooSys], UNO_QUERY_THROW );
+ CPPUNIT_ASSERT( xChartTypeContainer.is() );
+
+ Sequence< Reference< chart2::XChartType > > xChartTypeSequence( xChartTypeContainer->getChartTypes() );
+ CPPUNIT_ASSERT( xChartTypeSequence.getLength() > nChartType );
+
+ return xChartTypeSequence[nChartType];
+}
+
+Reference< chart2::XDataSeries > getDataSeriesFromDoc( uno::Reference< chart2::XChartDocument > xChartDoc,
+ sal_Int32 nDataSeries, sal_Int32 nChartType = 0, sal_Int32 nCooSys = 0 )
+{
+ Reference< chart2::XChartType > xChartType = getChartTypeFromDoc( xChartDoc, nChartType, nCooSys );
+ Reference< chart2::XDataSeriesContainer > xDataSequenceContainer( xChartType, UNO_QUERY_THROW );
+ CPPUNIT_ASSERT ( xDataSequenceContainer.is() );
+
+ Sequence< Reference< chart2::XDataSeries > > xSeriesSequence( xDataSequenceContainer->getDataSeries() );
+ CPPUNIT_ASSERT( xSeriesSequence.getLength() > nDataSeries );
+
+ Reference< chart2::XDataSeries > xSeries = xSeriesSequence[nDataSeries];
+
+ return xSeries;
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit 4b520d2ee8732d24d882ac965078f54e5ae5d418
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date: Tue Apr 23 06:55:38 2013 +0200
protect the properties with a mutex
Change-Id: Iaf9752cc3abd7ac1b3b569928368dcb0a4d6a197
diff --git a/chart2/source/tools/ErrorBar.cxx b/chart2/source/tools/ErrorBar.cxx
index a2dd95c..92c3265 100644
--- a/chart2/source/tools/ErrorBar.cxx
+++ b/chart2/source/tools/ErrorBar.cxx
@@ -26,6 +26,7 @@
#include "CloneHelper.hxx"
#include <svl/itemprop.hxx>
+#include <vcl/svapp.hxx>
#include <com/sun/star/beans/PropertyAttribute.hpp>
#include <com/sun/star/chart/ErrorBarStyle.hpp>
@@ -143,6 +144,8 @@ void ErrorBar::setPropertyValue( const OUString& rPropName, const uno::Any& rAny
throw (beans::UnknownPropertyException, beans::PropertyVetoException,
lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException)
{
+ SolarMutexGuard aGuard;
+
if(rPropName == "ErrorBarStyle")
rAny >>= meStyle;
else if(rPropName == "PositiveError")
@@ -210,6 +213,8 @@ OUString getSourceRangeStrFromLabeledSequences( uno::Sequence< uno::Reference< c
uno::Any ErrorBar::getPropertyValue(const OUString& rPropName)
throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
{
+ SolarMutexGuard aGuard;
+
uno::Any aRet;
if(rPropName == "ErrorBarStyle")
aRet <<= meStyle;
commit 8a943663db717aaae9fb09dadd31a4cbf593b7bb
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date: Tue Apr 23 06:41:42 2013 +0200
we don't need the sc includes in this test
Change-Id: I82608d6ce2e42724d0c5d8be484d3c1c00f33622
diff --git a/chart2/CppunitTest_chart2_importtest.mk b/chart2/CppunitTest_chart2_importtest.mk
index 60985fd..8cc849f 100644
--- a/chart2/CppunitTest_chart2_importtest.mk
+++ b/chart2/CppunitTest_chart2_importtest.mk
@@ -55,8 +55,6 @@ $(eval $(call gb_CppunitTest_use_libraries,chart2_import, \
))
$(eval $(call gb_CppunitTest_set_include,chart2_import,\
- -I$(SRCDIR)/sc/source/ui/inc \
- -I$(SRCDIR)/sc/inc \
$$(INCLUDE) \
))
More information about the Libreoffice-commits
mailing list