/* -*- 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/.
*/
// test that x error bars are not imported
Reference< beans::XPropertySet > xErrorBarXProps;
xPropSet->getPropertyValue(CHART_UNONAME_ERRORBAR_X) >>= xErrorBarXProps;
CPPUNIT_ASSERT(!xErrorBarXProps.is());
}
// test that y error bars are there
Reference< beans::XPropertySet > xErrorBarYProps;
xPropSet->getPropertyValue(CHART_UNONAME_ERRORBAR_Y) >>= xErrorBarYProps;
CPPUNIT_ASSERT(xErrorBarYProps.is());
// test that y error bars are there
Reference< beans::XPropertySet > xErrorBarYProps;
xPropSet->getPropertyValue(CHART_UNONAME_ERRORBAR_Y) >>= xErrorBarYProps;
CPPUNIT_ASSERT(xErrorBarYProps.is());
//test chart series sparse data for docx
std::vector<std::vector<double> > aValues = getDataSeriesYValuesFromChartType(xCT);
CPPUNIT_ASSERT_EQUAL(size_t(3), aValues.size()); //test the second series values
CPPUNIT_ASSERT_EQUAL(2.4, aValues[1][0]);
CPPUNIT_ASSERT_EQUAL(4.4, aValues[1][1]); //test the third series (empty) values
CPPUNIT_ASSERT(std::isnan(aValues[2][0]));
CPPUNIT_ASSERT(std::isnan(aValues[2][1]));
}
// Without the fix in place, this test would have failed with // - Expected: 105.210801910481 // - Actual : nan
CPPUNIT_ASSERT_EQUAL(105.210801910481, aDataSeriesYValues[0][0]);
}
uno::Reference< chart::XChartDataArray > xDataArray(xChartDoc->getDataProvider(), UNO_QUERY_THROW);
Sequence<OUString> aColumnDesc = xDataArray->getColumnDescriptions(); // Number of columns = 4 (Y-values, X-values and positive/negative error bars). // Without the fix there would only be 2 columns (no error range).
CPPUNIT_ASSERT_EQUAL_MESSAGE("There must be 4 columns and descriptions", static_cast<sal_Int32>(4), aColumnDesc.getLength());
}
uno::Reference< chart::XChartDataArray > xDataArray( xChartDoc->getDataProvider(), UNO_QUERY_THROW );
Sequence<OUString> aColumnDesc = xDataArray->getColumnDescriptions(); // Number of columns = 3 (Y-values, X-values and bubble sizes). // Without the fix there would only be 2 columns (no bubble sizes).
CPPUNIT_ASSERT_EQUAL_MESSAGE( "There must be 3 columns and descriptions", static_cast<sal_Int32>(3), aColumnDesc.getLength() );
Sequence<Sequence<double>> aData = xDataArray->getData();
CPPUNIT_ASSERT_EQUAL_MESSAGE( "There must be exactly 3 data points", static_cast<sal_Int32>(3), aData.getLength() );
CPPUNIT_TEST_FIXTURE(Chart2ImportTest, testPPTXHiddenDataSeries)
{ /** * Original data contains 3 series but 2 of them are hidden. For now, we * detect and skip those hidden series on import (since we don't support * hidden columns for internal data table yet).
*/
loadFromFile(u"pptx/stacked-bar-chart-hidden-series.pptx");
Reference<chart2::XChartDocument> xChartDoc(getChartDocFromDrawImpress(0, 0), uno::UNO_QUERY);
CPPUNIT_ASSERT(xChartDoc.is());
// "Automatic" chart background fill in pptx should be loaded as no fill.
Reference<beans::XPropertySet> xPropSet = xChartDoc->getPageBackground();
CPPUNIT_ASSERT(xPropSet.is());
drawing::FillStyle eStyle = xPropSet->getPropertyValue(u"FillStyle"_ustr).get<drawing::FillStyle>();
CPPUNIT_ASSERT_EQUAL_MESSAGE("'Automatic' chart background fill in pptx should be loaded as no fill (transparent).",
drawing::FillStyle_NONE, eStyle);
// There should be only one data series present.
std::vector<uno::Sequence<uno::Any> > aLabels = getDataSeriesLabelsFromChartType(xCT);
CPPUNIT_ASSERT_EQUAL(size_t(1), aLabels.size());
CPPUNIT_ASSERT_EQUAL(u"Series 3"_ustr, aLabels[0][0].get<OUString>());
// Test the internal data.
CPPUNIT_ASSERT(xChartDoc->hasInternalDataProvider());
Reference<beans::XPropertySet> xPS(xYAxis, uno::UNO_QUERY_THROW); bool bLinkNumberFormatToSource = true; bool bSuccess = xPS->getPropertyValue(CHART_UNONAME_LINK_TO_SRC_NUMFMT) >>= bLinkNumberFormatToSource;
CPPUNIT_ASSERT_MESSAGE("\"LinkNumberFormatToSource\" should be set to false.", bSuccess);
CPPUNIT_ASSERT_MESSAGE("\"LinkNumberFormatToSource\" should be set to false.", !bLinkNumberFormatToSource);
// FIXME: This should be in fact "0.00%". // see TODO in oox/source/drawingml/chart/modelbase.cxx const sal_Int32 nPercentFormatDecimalShort = getNumberFormat(xChartDoc, u"0.0%"_ustr);
nNumberFormat = getNumberFormatFromAxis(xYAxis);
CPPUNIT_ASSERT_EQUAL(nPercentFormatDecimalShort, nNumberFormat);
sal_Int16 nType = getNumberFormatType(xChartDoc, nNumberFormat);
CPPUNIT_ASSERT_MESSAGE("Y axis should be a percent format.", (nType & util::NumberFormat::PERCENT));
}
CPPUNIT_TEST_FIXTURE(Chart2ImportTest, testPieChartLabelsNumFormat)
{
loadFromFile(u"xlsx/tdfPieNumFormat.xlsx");
uno::Reference< chart::XChartDocument > xChartDoc(getChartCompFromSheet(0, 0), UNO_QUERY_THROW);
CPPUNIT_ASSERT(xChartDoc.is()); // test data point labels format
Reference<beans::XPropertySet> xDataPointPropSet(xChartDoc->getDiagram()->getDataPointProperties(0, 0), uno::UNO_SET_THROW);
chart2::DataPointLabel aLabel;
xDataPointPropSet->getPropertyValue(u"Label"_ustr) >>= aLabel;
CPPUNIT_ASSERT_EQUAL(sal_True, aLabel.ShowNumber);
}
// 1st chart is a normal stacked column.
Reference<chart2::XChartDocument> xChartDoc(getChartDocFromDrawImpress(0, 0), uno::UNO_QUERY);
CPPUNIT_ASSERT(xChartDoc.is());
// Get the Y-axis.
Reference<chart2::XAxis> xYAxis = getAxisFromDoc(xChartDoc, 0, 1, 0);
CPPUNIT_ASSERT(xYAxis.is());
sal_Int32 nNumberFormat = getNumberFormatFromAxis(xYAxis);
sal_Int16 nType = getNumberFormatType(xChartDoc, nNumberFormat);
CPPUNIT_ASSERT_MESSAGE("Y axis should be a normal number format.", (nType & util::NumberFormat::NUMBER));
CPPUNIT_ASSERT_MESSAGE("Y axis should NOT be a percent format.", !(nType & util::NumberFormat::PERCENT));
// 2nd chart is a percent-stacked column.
xChartDoc.set(getChartDocFromDrawImpress(1, 0), uno::UNO_QUERY);
CPPUNIT_ASSERT(xChartDoc.is());
// Get the Y-axis.
xYAxis = getAxisFromDoc(xChartDoc, 0, 1, 0);
CPPUNIT_ASSERT(xYAxis.is());
// Get the number format of the Y-axis.
nNumberFormat = getNumberFormatFromAxis(xYAxis);
nType = getNumberFormatType(xChartDoc, nNumberFormat);
CPPUNIT_ASSERT_MESSAGE("Y axis should be a percent format.", (nType & util::NumberFormat::PERCENT));
// 3rd chart is a mixture of normal-stacked column with a percent-stacked // area chart series. Excel in this case sets the Y-axis to be // non-percent axis and we should do the same for interoperability.
xChartDoc.set(getChartDocFromDrawImpress(2, 0), uno::UNO_QUERY);
CPPUNIT_ASSERT(xChartDoc.is());
// Get the Y-axis.
xYAxis = getAxisFromDoc(xChartDoc, 0, 1, 0);
CPPUNIT_ASSERT(xYAxis.is());
// Get the number format of the Y-axis.
nNumberFormat = getNumberFormatFromAxis(xYAxis);
nType = getNumberFormatType(xChartDoc, nNumberFormat);
CPPUNIT_ASSERT_MESSAGE("Y axis should be a normal number format.", (nType & util::NumberFormat::NUMBER));
CPPUNIT_ASSERT_MESSAGE("Y axis should NOT be a percent format.", !(nType & util::NumberFormat::PERCENT));
}
//tdf#139940 - the title's gradient was lost and was filled with solid blue, instead of a "blue underline".
uno::Reference<drawing::XDrawPagesSupplier> xDoc(mxComponent, uno::UNO_QUERY_THROW);
uno::Reference<drawing::XDrawPage> xPage(xDoc->getDrawPages()->getByIndex(0), uno::UNO_QUERY_THROW);
// Shape "Title 3" // MCGR: Use the whole completely imported transparency gradient to check for correctness
uno::Reference<beans::XPropertySet> xShapeProps(xPage->getByIndex(4), uno::UNO_QUERY_THROW);
awt::Gradient2 aTransparence;
xShapeProps->getPropertyValue(u"FillTransparenceGradient"_ustr) >>= aTransparence; const basegfx::BColorStops aColorStops = model::gradient::getColorStopsFromUno(aTransparence.ColorStops);
// Without the fix in place, this test would have failed with // - Expected: 1. first // - Actual : 2. second
CPPUNIT_ASSERT_EQUAL(u"1. first"_ustr, aLabels[0][0].get<OUString>());
CPPUNIT_ASSERT_EQUAL(u"2. second"_ustr, aLabels[1][0].get<OUString>());
}
CPPUNIT_TEST_FIXTURE(Chart2ImportTest, testTdf86624)
{ // manually placed legends
loadFromFile(u"ods/tdf86624.ods");
uno::Reference< chart2::XChartDocument > xChart2Doc = getChartDocFromSheet(0);
uno::Reference< chart::XChartDocument > xChartDoc (xChart2Doc, uno::UNO_QUERY);
uno::Reference<drawing::XShape> xLegend = xChartDoc->getLegend();
awt::Point aPos = xLegend->getPosition();
CPPUNIT_ASSERT(aPos.X > 5000); // real value for me is above 8000 but before bug fix is below 1000
CPPUNIT_ASSERT(aPos.Y > 4000); // real value for ms is above 7000
}
tools::Long lineColor;
xPropSet1->getPropertyValue(u"Color"_ustr) >>= lineColor; // incorrect line color was 0x4a7ebb due to not handling themeOverride
CPPUNIT_ASSERT_EQUAL(tools::Long(0xeaa700), lineColor);
xPropSet2->getPropertyValue(u"Color"_ustr) >>= lineColor; // incorrect line color was 0x98b855
CPPUNIT_ASSERT_EQUAL(tools::Long(0x1e69a8), lineColor);
}
CPPUNIT_TEST_FIXTURE(Chart2ImportTest, testTdf108021)
{ // Tdf108021 : To check TextBreak value is true.
loadFromFile(u"ods/tdf108021.ods");
uno::Reference< chart::XDiagram > mxDiagram;
uno::Reference< beans::XPropertySet > xAxisProp; bool bTextBreak = false;
uno::Reference< chart::XChartDocument > xChartDoc ( getChartCompFromSheet( 0, 0), UNO_QUERY_THROW);
mxDiagram.set(xChartDoc->getDiagram());
CPPUNIT_ASSERT(mxDiagram.is());
uno::Reference< chart::XAxisXSupplier > xAxisXSupp( mxDiagram, uno::UNO_QUERY );
CPPUNIT_ASSERT(xAxisXSupp.is());
xAxisProp = xAxisXSupp->getXAxis();
xAxisProp->getPropertyValue(u"TextBreak"_ustr) >>= bTextBreak; // Expected value of 'TextBreak' is true
CPPUNIT_ASSERT(bTextBreak);
}
CPPUNIT_TEST_FIXTURE(Chart2ImportTest, testTdf100084)
{ // The test file was created with IBM Cognos, make sure there is a diagram.
loadFromFile(u"xlsx/tdf100084.xlsx");
Reference<chart2::XChartDocument> xChartDoc = getChartDocFromSheet(0);
CPPUNIT_ASSERT_MESSAGE("failed to load chart", xChartDoc.is());
Reference<beans::XPropertySet> xDiagram(xChartDoc->getFirstDiagram(), UNO_QUERY);
CPPUNIT_ASSERT_MESSAGE("There should be a Diagram.", xDiagram.is());
}
// Check the symbol of data series 1 (marker style none)
xDataSeries = getDataSeriesFromDoc(xChartDoc, 0);
CPPUNIT_ASSERT(xDataSeries.is());
uno::Reference<beans::XPropertySet> xPropSet_0(xDataSeries, uno::UNO_QUERY_THROW);
CPPUNIT_ASSERT((xPropSet_0->getPropertyValue(u"Symbol"_ustr) >>= aSymblProp));
CPPUNIT_ASSERT_EQUAL(chart2::SymbolStyle_NONE, aSymblProp.Style);
// Check the symbol of data series 2 (marker style square)
xDataSeries = getDataSeriesFromDoc(xChartDoc, 1);
CPPUNIT_ASSERT(xDataSeries.is());
uno::Reference<beans::XPropertySet> xPropSet_1(xDataSeries, uno::UNO_QUERY_THROW);
CPPUNIT_ASSERT((xPropSet_1->getPropertyValue(u"Symbol"_ustr) >>= aSymblProp));
CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(0xED7D31), aSymblProp.FillColor);
// Check the symbol of data series 3 (marker style diagonal cross)
xDataSeries = getDataSeriesFromDoc(xChartDoc, 2);
CPPUNIT_ASSERT(xDataSeries.is());
uno::Reference<beans::XPropertySet> xPropSet_2(xDataSeries, uno::UNO_QUERY_THROW);
CPPUNIT_ASSERT((xPropSet_2->getPropertyValue(u"Symbol"_ustr) >>= aSymblProp));
CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(0xFF0000), aSymblProp.BorderColor);
}
CPPUNIT_ASSERT_EQUAL_MESSAGE("Background needs to be with solid fill style", css::drawing::FillStyle_SOLID, aStyle);
}
// 2 test methods here so that tearDown() can dispose the document
CPPUNIT_TEST_FIXTURE(Chart2ImportTest, testFdo54361)
{
testTransparentBackground(u"xlsx/fdo54361.xlsx");
}
CPPUNIT_TEST_FIXTURE(Chart2ImportTest, testFdo54361_1)
{
testTransparentBackground(u"xlsx/fdo54361-1.xlsx");
}
// "Automatic" chart background fill in xlsx should be loaded as solid white.
Reference<beans::XPropertySet> xPropSet = xChartDoc->getPageBackground();
CPPUNIT_ASSERT(xPropSet.is());
drawing::FillStyle eStyle = xPropSet->getPropertyValue(u"FillStyle"_ustr).get<drawing::FillStyle>();
sal_Int32 nColor = xPropSet->getPropertyValue(u"FillColor"_ustr).get<sal_Int32>();
CPPUNIT_ASSERT_EQUAL_MESSAGE("'Automatic' chart background fill in xlsx should be loaded as solid fill.",
drawing::FillStyle_SOLID, eStyle);
CPPUNIT_ASSERT_EQUAL_MESSAGE("'Automatic' chart background fill in xlsx should be loaded as solid white.",
sal_Int32(0x00FFFFFF), sal_Int32(nColor & 0x00FFFFFF)); // highest 2 bytes are transparency which we ignore here.
}
// "Automatic" chart background fill in xlsx should be loaded as solid white.
Reference<beans::XPropertySet> xPropSet = xChartDoc->getPageBackground();
CPPUNIT_ASSERT(xPropSet.is());
drawing::FillStyle eStyle = xPropSet->getPropertyValue(u"FillStyle"_ustr).get<drawing::FillStyle>();
sal_Int32 nColor = xPropSet->getPropertyValue(u"FillColor"_ustr).get<sal_Int32>();
CPPUNIT_ASSERT_EQUAL_MESSAGE("'Automatic' chart background fill in xlsx should be loaded as solid fill.",
drawing::FillStyle_SOLID, eStyle);
CPPUNIT_ASSERT_EQUAL_MESSAGE("'Automatic' chart background fill in xlsx should be loaded as solid white.",
sal_Int32(0), nColor);
}
// Check the chart background FillStyle is HATCH
Reference<beans::XPropertySet> xPropSet = xChartDoc->getPageBackground();
CPPUNIT_ASSERT(xPropSet.is());
drawing::FillStyle eStyle = xPropSet->getPropertyValue(u"FillStyle"_ustr).get<drawing::FillStyle>();
CPPUNIT_ASSERT_EQUAL_MESSAGE("Chart background fill in this xlsx should be loaded as hatch fill.",
drawing::FillStyle_HATCH, eStyle);
// Check the FillBackground of chart background bool bBackgroundFill = false;
xPropSet->getPropertyValue(u"FillBackground"_ustr) >>= bBackgroundFill;
CPPUNIT_ASSERT(bBackgroundFill);
Color nBackgroundColor;
xPropSet->getPropertyValue(u"FillColor"_ustr) >>= nBackgroundColor;
CPPUNIT_ASSERT_EQUAL(COL_WHITE, nBackgroundColor);
// Check the datapoint has HatchName value
uno::Reference<chart2::XDataSeries> xDataSeries(getDataSeriesFromDoc(xChartDoc, 0));
CPPUNIT_ASSERT(xDataSeries.is());
xPropertySet.set(xDataSeries->getDataPointByIndex(0), uno::UNO_SET_THROW);
xPropertySet->getPropertyValue(u"Label"_ustr) >>= aLabel;
CPPUNIT_ASSERT_EQUAL(sal_True, aLabel.ShowNumber);
CPPUNIT_ASSERT_EQUAL(sal_True, aLabel.ShowNumberInPercent);
xPropertySet->getPropertyValue(CHART_UNONAME_NUMFMT) >>= nNumberFormat;
CPPUNIT_ASSERT_EQUAL(nChartDataNumberFormat, nNumberFormat); bool bSuccess = xPropertySet->getPropertyValue(u"PercentageNumberFormat"_ustr) >>= nNumberFormat;
CPPUNIT_ASSERT_EQUAL(false, bSuccess);
bSuccess = xPropertySet->getPropertyValue(CHART_UNONAME_LINK_TO_SRC_NUMFMT) >>= bLinkNumberFormatToSource;
CPPUNIT_ASSERT_MESSAGE("\"LinkNumberFormatToSource\" should be set to true.", bSuccess);
CPPUNIT_ASSERT_MESSAGE("\"LinkNumberFormatToSource\" should be set to true.", bLinkNumberFormatToSource);
xPropertySet.set(xDataSeries->getDataPointByIndex(1), uno::UNO_SET_THROW);
xPropertySet->getPropertyValue(u"Label"_ustr) >>= aLabel;
CPPUNIT_ASSERT_EQUAL(sal_True, aLabel.ShowNumber);
CPPUNIT_ASSERT_EQUAL(sal_False, aLabel.ShowNumberInPercent);
xPropertySet->getPropertyValue(CHART_UNONAME_NUMFMT) >>= nNumberFormat;
CPPUNIT_ASSERT_EQUAL(nChartDataNumberFormat, nNumberFormat);
bSuccess = xPropertySet->getPropertyValue(u"PercentageNumberFormat"_ustr) >>= nNumberFormat;
CPPUNIT_ASSERT_EQUAL(false, bSuccess);
bSuccess = xPropertySet->getPropertyValue(CHART_UNONAME_LINK_TO_SRC_NUMFMT) >>= bLinkNumberFormatToSource;
CPPUNIT_ASSERT_MESSAGE("\"LinkNumberFormatToSource\" should be set to true.", bSuccess);
CPPUNIT_ASSERT_MESSAGE("\"LinkNumberFormatToSource\" should be set to true.", bLinkNumberFormatToSource);
xPropertySet.set(xDataSeries->getDataPointByIndex(2), uno::UNO_SET_THROW);
xPropertySet->getPropertyValue(u"Label"_ustr) >>= aLabel;
CPPUNIT_ASSERT_EQUAL(sal_False, aLabel.ShowNumber);
CPPUNIT_ASSERT_EQUAL(sal_True, aLabel.ShowNumberInPercent);
xPropertySet->getPropertyValue(CHART_UNONAME_NUMFMT) >>= nNumberFormat;
CPPUNIT_ASSERT_EQUAL(nChartDataNumberFormat, nNumberFormat);
bSuccess = xPropertySet->getPropertyValue(u"PercentageNumberFormat"_ustr) >>= nNumberFormat;
CPPUNIT_ASSERT_EQUAL(false, bSuccess);
bSuccess = xPropertySet->getPropertyValue(CHART_UNONAME_LINK_TO_SRC_NUMFMT) >>= bLinkNumberFormatToSource;
CPPUNIT_ASSERT_MESSAGE("\"LinkNumberFormatToSource\" should be set to true.", bSuccess);
CPPUNIT_ASSERT_MESSAGE("\"LinkNumberFormatToSource\" should be set to true.", bLinkNumberFormatToSource);
}
sal_Int32 nNumberFormat; bool bLinkNumberFormatToSource = true; const sal_Int32 nChartDataNumberFormat = getNumberFormat(xChartDoc, u"0%"_ustr);
xPropertySet->getPropertyValue(CHART_UNONAME_NUMFMT) >>= nNumberFormat;
CPPUNIT_ASSERT_EQUAL(nChartDataNumberFormat, nNumberFormat);
xPropertySet->getPropertyValue(CHART_UNONAME_LINK_TO_SRC_NUMFMT) >>= bLinkNumberFormatToSource; // LinkNumberFormatToSource should be set to false even if the original OOXML contain a true value, // because the inner data table of charts have no own number format!
CPPUNIT_ASSERT_MESSAGE("\"LinkNumberFormatToSource\" should be set to false.", !bLinkNumberFormatToSource);
}
sal_Int32 nNumberFormat; bool bLinkNumberFormatToSource = true; const sal_Int32 nChartDataNumberFormat = getNumberFormat(xChartDoc, u"0%"_ustr);
xPropertySet->getPropertyValue(CHART_UNONAME_NUMFMT) >>= nNumberFormat;
CPPUNIT_ASSERT_EQUAL(nChartDataNumberFormat, nNumberFormat);
xPropertySet->getPropertyValue(CHART_UNONAME_LINK_TO_SRC_NUMFMT) >>= bLinkNumberFormatToSource; // LinkNumberFormatToSource should be set to false even if the original OOXML file contain a true value, // because the inner data table of charts have no own number format!
CPPUNIT_ASSERT_MESSAGE("\"LinkNumberFormatToSource\" should be set to false.", !bLinkNumberFormatToSource);
}
}
CPPUNIT_TEST_FIXTURE(Chart2ImportTest, testShapePropsDefaultStrokeWidthXLSX)
{ // Bar chart, for which rendering code is implemented
loadFromFile(u"xlsx/bartest-stroke.xlsx");
{
uno::Reference< chart2::XChartDocument > xChartDoc = getChartDocFromSheet(0);
CPPUNIT_ASSERT(xChartDoc.is());
css::uno::Reference<chart2::XDiagram> xDiagram(xChartDoc->getFirstDiagram(), UNO_SET_THROW);
Reference<chart2::XDataSeries> xDataSeries = getDataSeriesFromDoc(xChartDoc, 0);
uno::Reference<beans::XPropertySet> xPropertySet(xDataSeries, uno::UNO_QUERY_THROW);
CPPUNIT_ASSERT(xPropertySet.is());
sal_Int32 nWidth = xPropertySet->getPropertyValue(u"BorderWidth"_ustr).get<sal_Int32>();
CPPUNIT_ASSERT_EQUAL_MESSAGE("Default bar stroke width should be 12700 emu (0.35mm)", sal_Int32(35), nWidth);
}
// Funnel chart, for which rendering code is not yet implemented
loadFromFile(u"xlsx/color_funnel.xlsx");
{
uno::Reference< chart2::XChartDocument > xChartDoc = getChartDocFromSheet(0);
CPPUNIT_ASSERT(xChartDoc.is());
css::uno::Reference<chart2::XDiagram> xDiagram(xChartDoc->getFirstDiagram(), UNO_SET_THROW);
Reference<chart2::XDataSeries> xDataSeries = getDataSeriesFromDoc(xChartDoc, 0);
uno::Reference<beans::XPropertySet> xPropertySet(xDataSeries, uno::UNO_QUERY_THROW);
CPPUNIT_ASSERT(xPropertySet.is());
sal_Int32 nWidth = xPropertySet->getPropertyValue(u"BorderWidth"_ustr).get<sal_Int32>();
CPPUNIT_ASSERT_EQUAL_MESSAGE("Default bar stroke width should be 12700 emu (0.35mm)", sal_Int32(35), nWidth);
}
}
bool bLinkNumberFormatToSource = false;
chart2::DataPointLabel aLabel;
xPropertySet->getPropertyValue(u"Label"_ustr) >>= aLabel;
CPPUNIT_ASSERT_EQUAL(sal_False, aLabel.ShowNumber);
CPPUNIT_ASSERT_EQUAL(sal_True, aLabel.ShowNumberInPercent); bool bSuccess = xPropertySet->getPropertyValue(CHART_UNONAME_LINK_TO_SRC_NUMFMT) >>= bLinkNumberFormatToSource;
CPPUNIT_ASSERT_MESSAGE("\"LinkNumberFormatToSource\" should be set to true.", bSuccess);
CPPUNIT_ASSERT_MESSAGE("\"LinkNumberFormatToSource\" should be set to true.", bLinkNumberFormatToSource);
}
CPPUNIT_TEST_FIXTURE(Chart2ImportTest, testAutoTitleDelDefaultValue2007XLSX)
{ // below are OOXML default value tests for cases // where we fixed the handling of MSO 2007 vs OOXML
loadFromFile(u"xlsx/autotitledel_2007.xlsx");
Reference<chart2::XChartDocument> xChartDoc = getChartDocFromSheet(0);
CPPUNIT_ASSERT_MESSAGE("failed to load chart", xChartDoc.is());
Reference<chart2::XTitled> xTitled(xChartDoc, uno::UNO_QUERY_THROW);
OUString aTitle = getTitleString(xTitled);
CPPUNIT_ASSERT_MESSAGE("autoTitleDel default value is false in MSO 2007 documents",
!aTitle.isEmpty());
}
Reference<chart2::XTitled> xTitled(xChartDoc, uno::UNO_QUERY_THROW);
uno::Reference<chart2::XTitle> xTitle = xTitled->getTitleObject();
CPPUNIT_ASSERT_MESSAGE("autoTitleDel default value is true in the OOXML spec",
!xTitle.is());
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.