LCOV - code coverage report
Current view: top level - chart2/qa/extras - chart2import.cxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 718 718 100.0 %
Date: 2015-06-13 12:38:46 Functions: 60 61 98.4 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       5             :  * This Source Code Form is subject to the terms of the Mozilla Public
       6             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       7             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       8             :  */
       9             : 
      10             : #include "charttest.hxx"
      11             : #include <com/sun/star/style/XStyleFamiliesSupplier.hpp>
      12             : #include <com/sun/star/chart2/CurveStyle.hpp>
      13             : #include <com/sun/star/chart2/DataPointLabel.hpp>
      14             : #include <com/sun/star/chart/ErrorBarStyle.hpp>
      15             : #include <com/sun/star/chart2/XRegressionCurveContainer.hpp>
      16             : #include <com/sun/star/chart2/XChartDocument.hpp>
      17             : #include <com/sun/star/chart/XChartDocument.hpp>
      18             : #include <com/sun/star/chart/XChartData.hpp>
      19             : #include <com/sun/star/chart2/XInternalDataProvider.hpp>
      20             : #include <com/sun/star/chart/XChartDataArray.hpp>
      21             : #include <com/sun/star/drawing/FillStyle.hpp>
      22             : #include <com/sun/star/chart/XTwoAxisXSupplier.hpp>
      23             : #include <com/sun/star/chart/MissingValueTreatment.hpp>
      24             : #include <com/sun/star/chart2/TickmarkStyle.hpp>
      25             : 
      26             : #include <com/sun/star/util/Color.hpp>
      27             : 
      28             : 
      29         138 : class Chart2ImportTest : public ChartTest
      30             : {
      31             : public:
      32             :     void Fdo60083();
      33             :     void testSteppedLines();
      34             :     void testErrorBarRange();
      35             :     void testErrorBarFormatting();
      36             :     void testODSChartSeries();
      37             :     void testXLSXChartSeries();
      38             :     void testXLSChartSeries();
      39             :     void testODTChartSeries();
      40             :     void testDOCChartSeries();
      41             :     void testDOCXChartSeries();
      42             :     void testPPTXChartSeries();
      43             :     /**
      44             :      * Original data contains 3 series but 2 of them are hidden. For now, we
      45             :      * detect and skip those hidden series on import (since we don't support
      46             :      * hidden columns for internal data table yet).
      47             :      */
      48             :     void testPPTXHiddenDataSeries();
      49             :     void testPPTXPercentageNumberFormats();
      50             :     void testPPTXStackedNonStackedYAxis();
      51             :     void testPPTChartSeries();
      52             :     void testODPChartSeries();
      53             :     void testBnc864396();
      54             :     void testBnc882383();
      55             :     void testSimpleStrictXLSX();
      56             :     void testDelayedCellImport(); // chart range referencing content on later sheets
      57             :     void testFlatODSStackedColumnChart();
      58             :     void testFdo78080();
      59             :     void testFdo54361();
      60             :     void testFdo54361_1();
      61             :     void testTdf86624(); // manualy placed legends
      62             :     void testAutoBackgroundXLSX();
      63             :     void testChartAreaStyleBackgroundXLSX();
      64             :     void testAxisTextRotationXLSX();
      65             :     // void testTextCanOverlapXLSX(); // TODO : temporarily disabled.
      66             :     void testNumberFormatsXLSX();
      67             : 
      68             :     void testTransparentBackground(OUString const & filename);
      69             : 
      70             :     // below are OOXML default value tests for cases
      71             :     // where we fixed the handling of MSO 2007 vs OOXML
      72             :     void testAutoTitleDelDefaultValue2007XLSX();
      73             :     void testAutoTitleDelDefaultValue2013XLSX();
      74             :     void testDispBlanksAsDefaultValue2007XLSX();
      75             :     void testDispBlanksAsDefaultValue2013XLSX();
      76             : 
      77             :     void testSmoothDefaultValue2007XLSX();
      78             :     void testSmoothDefaultValue2013XLSX();
      79             :     void testTrendlineDefaultValue2007XLSX();
      80             :     void testTrendlineDefaultValue2013XLSX();
      81             :     void testVaryColorDefaultValues2007XLSX();
      82             :     void testVaryColorDefaultValues2013XLSX();
      83             :     void testPlotVisOnlyDefaultValue2013XLSX();
      84             :     void testRAngAxDefaultValue2013XLSX();
      85             :     void testMajorTickMarksDefaultValue2013XLSX();
      86             :     void testMinorTickMarksDefaultValue2013XLSX();
      87             : 
      88             :     void testAxisTitleDefaultRotationXLSX();
      89             :     void testSecondaryAxisTitleDefaultRotationXLSX();
      90             :     void testAxisTitleRotationXLSX();
      91             : 
      92           2 :     CPPUNIT_TEST_SUITE(Chart2ImportTest);
      93           1 :     CPPUNIT_TEST(Fdo60083);
      94           1 :     CPPUNIT_TEST(testSteppedLines);
      95           1 :     CPPUNIT_TEST(testErrorBarRange);
      96           1 :     CPPUNIT_TEST(testErrorBarFormatting);
      97           1 :     CPPUNIT_TEST(testODSChartSeries);
      98           1 :     CPPUNIT_TEST(testXLSXChartSeries);
      99           1 :     CPPUNIT_TEST(testXLSChartSeries);
     100           1 :     CPPUNIT_TEST(testODTChartSeries);
     101           1 :     CPPUNIT_TEST(testDOCChartSeries);
     102           1 :     CPPUNIT_TEST(testDOCXChartSeries);
     103           1 :     CPPUNIT_TEST(testPPTChartSeries);
     104           1 :     CPPUNIT_TEST(testPPTXChartSeries);
     105           1 :     CPPUNIT_TEST(testPPTXHiddenDataSeries);
     106           1 :     CPPUNIT_TEST(testPPTXPercentageNumberFormats);
     107           1 :     CPPUNIT_TEST(testPPTXStackedNonStackedYAxis);
     108           1 :     CPPUNIT_TEST(testODPChartSeries);
     109           1 :     CPPUNIT_TEST(testBnc864396);
     110           1 :     CPPUNIT_TEST(testBnc882383);
     111           1 :     CPPUNIT_TEST(testSimpleStrictXLSX);
     112           1 :     CPPUNIT_TEST(testDelayedCellImport);
     113           1 :     CPPUNIT_TEST(testFlatODSStackedColumnChart);
     114           1 :     CPPUNIT_TEST(testFdo78080);
     115           1 :     CPPUNIT_TEST(testFdo54361);
     116           1 :     CPPUNIT_TEST(testFdo54361_1);
     117           1 :     CPPUNIT_TEST(testTdf86624);
     118           1 :     CPPUNIT_TEST(testAutoBackgroundXLSX);
     119           1 :     CPPUNIT_TEST(testChartAreaStyleBackgroundXLSX);
     120           1 :     CPPUNIT_TEST(testAxisTextRotationXLSX);
     121             :     // CPPUNIT_TEST(testTextCanOverlapXLSX); // TODO : temporarily disabled.
     122           1 :     CPPUNIT_TEST(testNumberFormatsXLSX);
     123           1 :     CPPUNIT_TEST(testAutoTitleDelDefaultValue2007XLSX);
     124           1 :     CPPUNIT_TEST(testAutoTitleDelDefaultValue2013XLSX);
     125           1 :     CPPUNIT_TEST(testDispBlanksAsDefaultValue2007XLSX);
     126           1 :     CPPUNIT_TEST(testDispBlanksAsDefaultValue2013XLSX);
     127           1 :     CPPUNIT_TEST(testSmoothDefaultValue2007XLSX);
     128           1 :     CPPUNIT_TEST(testSmoothDefaultValue2013XLSX);
     129           1 :     CPPUNIT_TEST(testTrendlineDefaultValue2007XLSX);
     130           1 :     CPPUNIT_TEST(testTrendlineDefaultValue2013XLSX);
     131           1 :     CPPUNIT_TEST(testVaryColorDefaultValues2007XLSX);
     132           1 :     CPPUNIT_TEST(testVaryColorDefaultValues2013XLSX);
     133           1 :     CPPUNIT_TEST(testPlotVisOnlyDefaultValue2013XLSX);
     134           1 :     CPPUNIT_TEST(testRAngAxDefaultValue2013XLSX);
     135           1 :     CPPUNIT_TEST(testMajorTickMarksDefaultValue2013XLSX);
     136           1 :     CPPUNIT_TEST(testMinorTickMarksDefaultValue2013XLSX);
     137           1 :     CPPUNIT_TEST(testAxisTitleDefaultRotationXLSX);
     138           1 :     CPPUNIT_TEST(testSecondaryAxisTitleDefaultRotationXLSX);
     139           1 :     CPPUNIT_TEST(testAxisTitleRotationXLSX);
     140           5 :     CPPUNIT_TEST_SUITE_END();
     141             : 
     142             : private:
     143             : 
     144             : };
     145             : 
     146             : // error bar import
     147             : // split method up into smaller chunks for more detailed tests
     148           1 : void Chart2ImportTest::Fdo60083()
     149             : {
     150           1 :     load("/chart2/qa/extras/data/ods/", "fdo60083.ods");
     151           1 :     uno::Reference< chart2::XChartDocument > xChartDoc = getChartDocFromSheet( 0, mxComponent );
     152           1 :     CPPUNIT_ASSERT(xChartDoc.is());
     153             : 
     154           2 :     Reference< chart2::XDataSeries > xDataSeries = getDataSeriesFromDoc( xChartDoc, 0 );
     155           1 :     CPPUNIT_ASSERT( xDataSeries.is() );
     156             : 
     157           2 :     Reference< beans::XPropertySet > xPropSet( xDataSeries, UNO_QUERY_THROW );
     158           1 :     CPPUNIT_ASSERT( xPropSet.is() );
     159             : 
     160             :     // test that y error bars are there
     161           2 :     Reference< beans::XPropertySet > xErrorBarYProps;
     162           1 :     xPropSet->getPropertyValue(CHART_UNONAME_ERRORBAR_Y) >>= xErrorBarYProps;
     163           1 :     CPPUNIT_ASSERT(xErrorBarYProps.is());
     164             :     {
     165             :         sal_Int32 nErrorBarStyle;
     166           2 :         CPPUNIT_ASSERT(
     167             :             xErrorBarYProps->getPropertyValue("ErrorBarStyle")
     168           1 :             >>= nErrorBarStyle);
     169           2 :         CPPUNIT_ASSERT_EQUAL(
     170             :             static_cast<sal_Int32>(chart::ErrorBarStyle::RELATIVE),
     171           1 :             nErrorBarStyle);
     172             : 
     173           1 :         double nVal = 0.0;
     174           2 :         CPPUNIT_ASSERT(
     175           1 :             xErrorBarYProps->getPropertyValue("PositiveError") >>= nVal);
     176           1 :         CPPUNIT_ASSERT_DOUBLES_EQUAL(5.0, nVal, 1e-8);
     177             : 
     178           2 :         CPPUNIT_ASSERT(
     179           1 :             xErrorBarYProps->getPropertyValue("NegativeError") >>= nVal);
     180           1 :         CPPUNIT_ASSERT_DOUBLES_EQUAL(5.0, nVal, 1e-8);
     181             : 
     182             :         bool bVal;
     183           2 :         CPPUNIT_ASSERT(
     184           1 :             xErrorBarYProps->getPropertyValue("ShowPositiveError") >>= bVal);
     185           1 :         CPPUNIT_ASSERT_EQUAL(bVal, true);
     186             : 
     187           2 :         CPPUNIT_ASSERT(
     188           1 :             xErrorBarYProps->getPropertyValue("ShowNegativeError") >>= bVal);
     189           1 :         CPPUNIT_ASSERT_EQUAL(bVal, true);
     190             :     }
     191             : 
     192             :     // test that x error bars are not imported
     193           2 :     Reference< beans::XPropertySet > xErrorBarXProps;
     194           1 :     xPropSet->getPropertyValue(CHART_UNONAME_ERRORBAR_X) >>= xErrorBarXProps;
     195           2 :     CPPUNIT_ASSERT(!xErrorBarXProps.is());
     196           1 : }
     197             : 
     198           1 : void Chart2ImportTest::testErrorBarRange()
     199             : {
     200           1 :     load("/chart2/qa/extras/data/ods/", "error_bar_range.ods");
     201           1 :     uno::Reference< chart2::XChartDocument > xChartDoc = getChartDocFromSheet( 0, mxComponent );
     202           1 :     CPPUNIT_ASSERT(xChartDoc.is());
     203             : 
     204           2 :     Reference< chart2::XDataSeries > xDataSeries = getDataSeriesFromDoc( xChartDoc, 0 );
     205           1 :     CPPUNIT_ASSERT( xDataSeries.is() );
     206             : 
     207           2 :     Reference< beans::XPropertySet > xPropSet( xDataSeries, UNO_QUERY_THROW );
     208           1 :     CPPUNIT_ASSERT( xPropSet.is() );
     209             : 
     210             :     // test that y error bars are there
     211           2 :     Reference< beans::XPropertySet > xErrorBarYProps;
     212           1 :     xPropSet->getPropertyValue(CHART_UNONAME_ERRORBAR_Y) >>= xErrorBarYProps;
     213           1 :     CPPUNIT_ASSERT(xErrorBarYProps.is());
     214             : 
     215             :     sal_Int32 nErrorBarStyle;
     216           2 :     CPPUNIT_ASSERT(
     217             :             xErrorBarYProps->getPropertyValue("ErrorBarStyle")
     218           1 :             >>= nErrorBarStyle);
     219           2 :     CPPUNIT_ASSERT_EQUAL(
     220             :             static_cast<sal_Int32>(chart::ErrorBarStyle::FROM_DATA),
     221           1 :             nErrorBarStyle);
     222             : 
     223           2 :     OUString aRangePos;
     224           1 :     CPPUNIT_ASSERT(xErrorBarYProps->getPropertyValue("ErrorBarRangePositive") >>= aRangePos);
     225           2 :     CPPUNIT_ASSERT_EQUAL(aRangePos, OUString("$Sheet1.$C$2:$C$4"));
     226           1 : }
     227             : 
     228           1 : void Chart2ImportTest::testErrorBarFormatting()
     229             : {
     230           1 :     load("/chart2/qa/extras/data/ods/", "error_bar_properties.ods");
     231           1 :     uno::Reference< chart2::XChartDocument > xChartDoc = getChartDocFromSheet( 0, mxComponent );
     232           1 :     CPPUNIT_ASSERT(xChartDoc.is());
     233             : 
     234           2 :     Reference< chart2::XDataSeries > xDataSeries = getDataSeriesFromDoc( xChartDoc, 0 );
     235           1 :     CPPUNIT_ASSERT( xDataSeries.is() );
     236             : 
     237           2 :     Reference< beans::XPropertySet > xPropSet( xDataSeries, UNO_QUERY_THROW );
     238           1 :     CPPUNIT_ASSERT( xPropSet.is() );
     239             : 
     240             :     // test that y error bars are there
     241           2 :     Reference< beans::XPropertySet > xErrorBarYProps;
     242           1 :     xPropSet->getPropertyValue(CHART_UNONAME_ERRORBAR_Y) >>= xErrorBarYProps;
     243           1 :     CPPUNIT_ASSERT(xErrorBarYProps.is());
     244             : 
     245           1 :     util::Color aColor(0);
     246           1 :     xErrorBarYProps->getPropertyValue("LineColor") >>= aColor;
     247           1 :     sal_uInt32 nColorValue = aColor;
     248           2 :     CPPUNIT_ASSERT_EQUAL(sal_uInt32(0xff3333), nColorValue);
     249           1 : }
     250             : 
     251             : // stepped line interpolation
     252           1 : void Chart2ImportTest::testSteppedLines()
     253             : {
     254           1 :     const sal_Int32 MAXSHEET = 14;
     255             :     chart2::CurveStyle curveStyle[] = {
     256             :         chart2::CurveStyle_LINES,
     257             :         chart2::CurveStyle_CUBIC_SPLINES,
     258             :         chart2::CurveStyle_B_SPLINES,
     259             :         chart2::CurveStyle_STEP_START,
     260             :         chart2::CurveStyle_STEP_END,
     261             :         chart2::CurveStyle_STEP_CENTER_X,
     262             :         chart2::CurveStyle_STEP_CENTER_Y,
     263             :         chart2::CurveStyle_LINES,
     264             :         chart2::CurveStyle_CUBIC_SPLINES,
     265             :         chart2::CurveStyle_B_SPLINES,
     266             :         chart2::CurveStyle_STEP_START,
     267             :         chart2::CurveStyle_STEP_END,
     268             :         chart2::CurveStyle_STEP_CENTER_X,
     269             :         chart2::CurveStyle_STEP_CENTER_Y
     270           1 :     };
     271             : 
     272           1 :     load("/chart2/qa/extras/data/ods/", "stepped_lines.ods");
     273          15 :     for(sal_Int32 nSheet = 0; nSheet < MAXSHEET; ++nSheet)
     274             :     {
     275          14 :         uno::Reference< chart2::XChartDocument > xChart2Doc = getChartDocFromSheet( nSheet, mxComponent );
     276          14 :         CPPUNIT_ASSERT(xChart2Doc.is());
     277             : 
     278          28 :         Reference< chart2::XChartType > xChartType = getChartTypeFromDoc( xChart2Doc, 0 );
     279          14 :         CPPUNIT_ASSERT(xChartType.is());
     280             : 
     281          28 :         Reference< beans::XPropertySet > xPropSet( xChartType, UNO_QUERY );
     282          14 :         CPPUNIT_ASSERT(xPropSet.is());
     283             : 
     284             :         chart2::CurveStyle eCurveStyle;
     285          14 :         xPropSet->getPropertyValue("CurveStyle") >>= eCurveStyle;
     286          14 :         CPPUNIT_ASSERT_EQUAL(eCurveStyle, curveStyle[nSheet]);
     287          14 :     }
     288           1 : }
     289             : 
     290           3 : uno::Sequence < OUString > getChartColumnDescriptions( uno::Reference< chart::XChartDocument > xChart1Doc)
     291             : {
     292           3 :     CPPUNIT_ASSERT(xChart1Doc.is());
     293           3 :     uno::Reference< chart::XChartDataArray > xChartData ( xChart1Doc->getData(), UNO_QUERY_THROW);
     294           3 :     CPPUNIT_ASSERT(xChartData.is());
     295           3 :     uno::Sequence < OUString > seriesList = xChartData->getColumnDescriptions();
     296           3 :     return seriesList;
     297             : }
     298             : 
     299           1 : void Chart2ImportTest::testODSChartSeries()
     300             : {
     301           1 :     load("/chart2/qa/extras/data/ods/", "chart.ods");
     302           1 :     uno::Reference< chart::XChartDocument > xChart1Doc ( getChartCompFromSheet( 0, mxComponent ), UNO_QUERY_THROW);
     303           2 :     uno::Sequence < OUString > seriesList = getChartColumnDescriptions( xChart1Doc);
     304           1 :     CPPUNIT_ASSERT_EQUAL(OUString("Col 1"), seriesList[0]);
     305           1 :     CPPUNIT_ASSERT_EQUAL(OUString("Col2"), seriesList[1]);
     306           2 :     CPPUNIT_ASSERT_EQUAL(OUString("Col 33"), seriesList[2]);
     307             : 
     308           1 : }
     309             : 
     310           1 : void Chart2ImportTest::testXLSXChartSeries()
     311             : {
     312           1 :     load("/chart2/qa/extras/data/xlsx/", "chart.xlsx");
     313           1 :     uno::Reference< chart::XChartDocument > xChart1Doc ( getChartCompFromSheet( 0, mxComponent ), UNO_QUERY_THROW);
     314           2 :     uno::Sequence < OUString > seriesList = getChartColumnDescriptions(xChart1Doc );
     315           1 :     CPPUNIT_ASSERT_EQUAL(OUString("Col 1"), seriesList[0]);
     316           1 :     CPPUNIT_ASSERT_EQUAL(OUString("Col2"), seriesList[1]);
     317           2 :     CPPUNIT_ASSERT_EQUAL(OUString("Col 33"), seriesList[2]);
     318             : 
     319           1 : }
     320             : 
     321           1 : void Chart2ImportTest::testXLSChartSeries()
     322             : {
     323           1 :     load("/chart2/qa/extras/data/xls/", "chart.xls");
     324           1 :     uno::Reference< chart::XChartDocument > xChart1Doc ( getChartCompFromSheet( 0, mxComponent ), UNO_QUERY_THROW);
     325           2 :     uno::Sequence < OUString > seriesList = getChartColumnDescriptions(xChart1Doc );
     326           1 :     CPPUNIT_ASSERT_EQUAL(OUString("Col 1"), seriesList[0]);
     327           1 :     CPPUNIT_ASSERT_EQUAL(OUString("Col 2"), seriesList[1]);
     328           2 :     CPPUNIT_ASSERT_EQUAL(OUString("Col 3"), seriesList[2]);
     329             : 
     330           1 : }
     331             : 
     332           1 : void Chart2ImportTest::testODTChartSeries()
     333             : {
     334           1 :     load("/chart2/qa/extras/data/odt/", "chart.odt");
     335           1 :     uno::Sequence< OUString > seriesList = getWriterChartColumnDescriptions(mxComponent);
     336           1 :     CPPUNIT_ASSERT_EQUAL(OUString("Column 1"), seriesList[0]);
     337           1 :     CPPUNIT_ASSERT_EQUAL(OUString("Column 2"), seriesList[1]);
     338           1 :     CPPUNIT_ASSERT_EQUAL(OUString("Column 3"), seriesList[2]);
     339             : 
     340           1 : }
     341             : 
     342           1 : void Chart2ImportTest::testDOCChartSeries()
     343             : {
     344           1 :     load("/chart2/qa/extras/data/doc/", "chart.doc");
     345           1 :     uno::Sequence< OUString > seriesList = getWriterChartColumnDescriptions(mxComponent);
     346           1 :     CPPUNIT_ASSERT_EQUAL(OUString("Column 1"), seriesList[0]);
     347           1 :     CPPUNIT_ASSERT_EQUAL(OUString("Column 2"), seriesList[1]);
     348           1 :     CPPUNIT_ASSERT_EQUAL(OUString("Column 3"), seriesList[2]);
     349           1 : }
     350             : 
     351           1 : void Chart2ImportTest::testDOCXChartSeries()
     352             : {
     353           1 :     load("/chart2/qa/extras/data/docx/", "chart.docx");
     354           1 :     Reference<chart2::XChartDocument> xChartDoc(getChartDocFromWriter(0), uno::UNO_QUERY);
     355           1 :     CPPUNIT_ASSERT(xChartDoc.is());
     356             : 
     357           2 :     Reference<chart2::XChartType> xCT = getChartTypeFromDoc(xChartDoc, 0, 0);
     358           1 :     CPPUNIT_ASSERT(xCT.is());
     359             : 
     360           2 :     std::vector<uno::Sequence<uno::Any> > aLabels = getDataSeriesLabelsFromChartType(xCT);
     361           1 :     CPPUNIT_ASSERT_EQUAL(size_t(3), aLabels.size());
     362           1 :     CPPUNIT_ASSERT_EQUAL(OUString("Series 1"), aLabels[0][0].get<OUString>());
     363           1 :     CPPUNIT_ASSERT_EQUAL(OUString("Series 2"), aLabels[1][0].get<OUString>());
     364           2 :     CPPUNIT_ASSERT_EQUAL(OUString("Series 3"), aLabels[2][0].get<OUString>());
     365           1 : }
     366             : 
     367           1 : void Chart2ImportTest::testPPTChartSeries()
     368             : {
     369             :     //test chart series names for ppt
     370           1 :     uno::Sequence < OUString > seriesList = getImpressChartColumnDescriptions("/chart2/qa/extras/data/ppt/", "chart.ppt");
     371             : 
     372           1 :     CPPUNIT_ASSERT_EQUAL(OUString("Column 1"), seriesList[0]);
     373           1 :     CPPUNIT_ASSERT_EQUAL(OUString("Column 2"), seriesList[1]);
     374           1 :     CPPUNIT_ASSERT_EQUAL(OUString("Column 3"), seriesList[2]);
     375             : 
     376           1 : }
     377             : 
     378           1 : void Chart2ImportTest::testPPTXChartSeries()
     379             : {
     380             :     //test chart series names for pptx
     381           1 :     load("/chart2/qa/extras/data/pptx/", "chart.pptx");
     382           1 :     Reference<chart2::XChartDocument> xChartDoc(getChartDocFromDrawImpress(0, 0), uno::UNO_QUERY);
     383           1 :     CPPUNIT_ASSERT(xChartDoc.is());
     384             : 
     385           2 :     Reference<chart2::XChartType> xCT = getChartTypeFromDoc(xChartDoc, 0, 0);
     386           1 :     CPPUNIT_ASSERT(xCT.is());
     387             : 
     388           2 :     std::vector<uno::Sequence<uno::Any> > aLabels = getDataSeriesLabelsFromChartType(xCT);
     389           1 :     CPPUNIT_ASSERT_EQUAL(size_t(3), aLabels.size());
     390           1 :     CPPUNIT_ASSERT_EQUAL(OUString("Column 1"), aLabels[0][0].get<OUString>());
     391           1 :     CPPUNIT_ASSERT_EQUAL(OUString("Column 2"), aLabels[1][0].get<OUString>());
     392           2 :     CPPUNIT_ASSERT_EQUAL(OUString("Column 3"), aLabels[2][0].get<OUString>());
     393           1 : }
     394             : 
     395           1 : void Chart2ImportTest::testPPTXHiddenDataSeries()
     396             : {
     397           1 :     load("/chart2/qa/extras/data/pptx/", "stacked-bar-chart-hidden-series.pptx");
     398           1 :     Reference<chart2::XChartDocument> xChartDoc(getChartDocFromDrawImpress(0, 0), uno::UNO_QUERY);
     399           1 :     CPPUNIT_ASSERT(xChartDoc.is());
     400             : 
     401             :     // "Automatic" chart background fill in pptx should be loaded as no fill.
     402           2 :     Reference<beans::XPropertySet> xPropSet = xChartDoc->getPageBackground();
     403           1 :     CPPUNIT_ASSERT(xPropSet.is());
     404           1 :     drawing::FillStyle eStyle = xPropSet->getPropertyValue("FillStyle").get<drawing::FillStyle>();
     405           2 :     CPPUNIT_ASSERT_MESSAGE("'Automatic' chart background fill in pptx should be loaded as no fill (transparent).",
     406           1 :         eStyle == drawing::FillStyle_NONE);
     407             : 
     408           2 :     Reference<chart2::XChartType> xCT = getChartTypeFromDoc(xChartDoc, 0, 0);
     409           1 :     CPPUNIT_ASSERT(xCT.is());
     410             : 
     411             :     // There should be only one data series present.
     412           2 :     std::vector<uno::Sequence<uno::Any> > aLabels = getDataSeriesLabelsFromChartType(xCT);
     413           1 :     CPPUNIT_ASSERT_EQUAL(size_t(1), aLabels.size());
     414           1 :     CPPUNIT_ASSERT_EQUAL(OUString("Series 3"), aLabels[0][0].get<OUString>());
     415             : 
     416             :     // Test the internal data.
     417           1 :     CPPUNIT_ASSERT(xChartDoc->hasInternalDataProvider());
     418             : 
     419           2 :     Reference<chart2::XInternalDataProvider> xInternalProvider(xChartDoc->getDataProvider(), uno::UNO_QUERY);
     420           1 :     CPPUNIT_ASSERT(xInternalProvider.is());
     421             : 
     422           2 :     Reference<chart::XComplexDescriptionAccess> xDescAccess(xInternalProvider, uno::UNO_QUERY);
     423           1 :     CPPUNIT_ASSERT(xDescAccess.is());
     424             : 
     425             :     // Get the category labels.
     426           2 :     Sequence<Sequence<OUString> > aCategories = xDescAccess->getComplexRowDescriptions();
     427           1 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(4), aCategories.getLength());
     428           1 :     CPPUNIT_ASSERT_EQUAL(OUString("Category 1"), aCategories[0][0]);
     429           1 :     CPPUNIT_ASSERT_EQUAL(OUString("Category 2"), aCategories[1][0]);
     430           1 :     CPPUNIT_ASSERT_EQUAL(OUString("Category 3"), aCategories[2][0]);
     431           2 :     CPPUNIT_ASSERT_EQUAL(OUString("Category 4"), aCategories[3][0]);
     432           1 : }
     433             : 
     434           1 : void Chart2ImportTest::testPPTXPercentageNumberFormats()
     435             : {
     436           1 :     load("/chart2/qa/extras/data/pptx/", "percentage-number-formats.pptx");
     437             : 
     438             :     // 1st chart
     439           1 :     Reference<chart2::XChartDocument> xChartDoc(getChartDocFromDrawImpress(0, 0), uno::UNO_QUERY);
     440           1 :     CPPUNIT_ASSERT(xChartDoc.is());
     441             : 
     442           2 :     uno::Reference<chart2::XDataSeries> xDataSeries(getDataSeriesFromDoc(xChartDoc, 0));
     443           1 :     CPPUNIT_ASSERT(xDataSeries.is());
     444           2 :     uno::Reference<beans::XPropertySet> xPropertySet;
     445           1 :     chart2::DataPointLabel aLabel;
     446             :     sal_Int32 nNumberFormat;
     447           1 :     const sal_Int32 nPercentFormatSimple = getNumberFormat(xChartDoc, "0%");
     448           1 :     const sal_Int32 nPercentFormatDecimal = getNumberFormat(xChartDoc, "0.00%");
     449             : 
     450           1 :     xPropertySet.set(xDataSeries->getDataPointByIndex(0), uno::UNO_QUERY_THROW);
     451           1 :     xPropertySet->getPropertyValue("Label") >>= aLabel;
     452           1 :     CPPUNIT_ASSERT_EQUAL(sal_True, aLabel.ShowNumber);
     453           1 :     CPPUNIT_ASSERT_EQUAL(sal_True, aLabel.ShowNumberInPercent);
     454           1 :     xPropertySet->getPropertyValue("PercentageNumberFormat") >>= nNumberFormat;
     455           1 :     CPPUNIT_ASSERT_EQUAL(nPercentFormatSimple, nNumberFormat);
     456             : 
     457           1 :     xPropertySet.set(xDataSeries->getDataPointByIndex(1), uno::UNO_QUERY_THROW);
     458           1 :     xPropertySet->getPropertyValue("Label") >>= aLabel;
     459           1 :     CPPUNIT_ASSERT_EQUAL(sal_True, aLabel.ShowNumber);
     460           1 :     CPPUNIT_ASSERT_EQUAL(sal_True, aLabel.ShowNumberInPercent);
     461           1 :     xPropertySet->getPropertyValue("PercentageNumberFormat") >>= nNumberFormat;
     462           1 :     CPPUNIT_ASSERT_EQUAL(nPercentFormatDecimal, nNumberFormat);
     463             : 
     464           1 :     xPropertySet.set(xDataSeries->getDataPointByIndex(2), uno::UNO_QUERY_THROW);
     465           1 :     xPropertySet->getPropertyValue("Label") >>= aLabel;
     466           1 :     CPPUNIT_ASSERT_EQUAL(sal_False, aLabel.ShowNumber);
     467           1 :     CPPUNIT_ASSERT_EQUAL(sal_True, aLabel.ShowNumberInPercent);
     468           1 :     xPropertySet->getPropertyValue("PercentageNumberFormat") >>= nNumberFormat;
     469           1 :     CPPUNIT_ASSERT_EQUAL(nPercentFormatSimple, nNumberFormat);
     470             : 
     471           1 :     xPropertySet.set(xDataSeries->getDataPointByIndex(3), uno::UNO_QUERY_THROW);
     472           1 :     xPropertySet->getPropertyValue("Label") >>= aLabel;
     473           1 :     CPPUNIT_ASSERT_EQUAL(sal_False, aLabel.ShowNumber);
     474           1 :     CPPUNIT_ASSERT_EQUAL(sal_True, aLabel.ShowNumberInPercent);
     475           1 :     xPropertySet->getPropertyValue("PercentageNumberFormat") >>= nNumberFormat;
     476           1 :     CPPUNIT_ASSERT_EQUAL(nPercentFormatDecimal, nNumberFormat);
     477             : 
     478             :     // 2nd chart
     479           1 :     xChartDoc.set(getChartDocFromDrawImpress(1, 0), uno::UNO_QUERY);
     480           1 :     CPPUNIT_ASSERT(xChartDoc.is());
     481             : 
     482           2 :     Reference<chart2::XAxis> xYAxis = getAxisFromDoc(xChartDoc, 0, 1, 0);
     483           1 :     CPPUNIT_ASSERT(xYAxis.is());
     484             : 
     485           2 :     Reference<beans::XPropertySet> xPS(xYAxis, uno::UNO_QUERY_THROW);
     486           1 :     bool bLinkNumberFormatToSource = true;
     487           1 :     bool bSuccess = xPS->getPropertyValue(CHART_UNONAME_LINK_TO_SRC_NUMFMT) >>= bLinkNumberFormatToSource;
     488           1 :     CPPUNIT_ASSERT_MESSAGE("\"LinkNumberFormatToSource\" should be set to false.", bSuccess && !bLinkNumberFormatToSource);
     489             : 
     490             :     // FIXME: This should be in fact "0.00%".
     491             :     // see TODO in oox/source/drawingml/chart/modelbase.cxx
     492           1 :     const sal_Int32 nPercentFormatDecimalShort = getNumberFormat(xChartDoc, "0.0%");
     493           1 :     nNumberFormat = getNumberFormatFromAxis(xYAxis);
     494           1 :     CPPUNIT_ASSERT_EQUAL(nPercentFormatDecimalShort, nNumberFormat);
     495           1 :     sal_Int16 nType = getNumberFormatType(xChartDoc, nNumberFormat);
     496           2 :     CPPUNIT_ASSERT_MESSAGE("Y axis should be a percent format.", (nType & util::NumberFormat::PERCENT));
     497           1 : }
     498             : 
     499           1 : void Chart2ImportTest::testPPTXStackedNonStackedYAxis()
     500             : {
     501           1 :     load("/chart2/qa/extras/data/pptx/", "stacked-non-stacked-mix-y-axis.pptx");
     502             : 
     503             :     // 1st chart is a normal stacked column.
     504           1 :     Reference<chart2::XChartDocument> xChartDoc(getChartDocFromDrawImpress(0, 0), uno::UNO_QUERY);
     505           1 :     CPPUNIT_ASSERT(xChartDoc.is());
     506             : 
     507           2 :     Reference<chart2::XTitled> xTitled(xChartDoc, uno::UNO_QUERY_THROW);
     508           2 :     OUString aTitle = getTitleString(xTitled);
     509           1 :     CPPUNIT_ASSERT_EQUAL(OUString("Stacked"), aTitle);
     510             : 
     511             :     // Get the Y-axis.
     512           2 :     Reference<chart2::XAxis> xYAxis = getAxisFromDoc(xChartDoc, 0, 1, 0);
     513           1 :     CPPUNIT_ASSERT(xYAxis.is());
     514             : 
     515           1 :     sal_Int32 nNumberFormat = getNumberFormatFromAxis(xYAxis);
     516           1 :     sal_Int16 nType = getNumberFormatType(xChartDoc, nNumberFormat);
     517           1 :     CPPUNIT_ASSERT_MESSAGE("Y axis should be a normal number format.", (nType & util::NumberFormat::NUMBER));
     518           1 :     CPPUNIT_ASSERT_MESSAGE("Y axis should NOT be a percent format.", !(nType & util::NumberFormat::PERCENT));
     519             : 
     520             :     // 2nd chart is a percent-stacked column.
     521           1 :     xChartDoc.set(getChartDocFromDrawImpress(1, 0), uno::UNO_QUERY);
     522           1 :     CPPUNIT_ASSERT(xChartDoc.is());
     523             : 
     524           1 :     xTitled.set(xChartDoc, uno::UNO_QUERY_THROW);
     525           1 :     aTitle = getTitleString(xTitled);
     526           1 :     CPPUNIT_ASSERT_EQUAL(OUString("100% Stacked"), aTitle);
     527             : 
     528             :     // Get the Y-axis.
     529           1 :     xYAxis = getAxisFromDoc(xChartDoc, 0, 1, 0);
     530           1 :     CPPUNIT_ASSERT(xYAxis.is());
     531             : 
     532             :     // Get the number format of the Y-axis.
     533           1 :     nNumberFormat = getNumberFormatFromAxis(xYAxis);
     534           1 :     nType = getNumberFormatType(xChartDoc, nNumberFormat);
     535           1 :     CPPUNIT_ASSERT_MESSAGE("Y axis should be a percent format.", (nType & util::NumberFormat::PERCENT));
     536             : 
     537             :     // 3rd chart is a mixture of normal-stacked column with a percent-stacked
     538             :     // area chart series.  Excel in this case sets the Y-axis to be
     539             :     // non-percent axis and we should do the same for interoperability.
     540           1 :     xChartDoc.set(getChartDocFromDrawImpress(2, 0), uno::UNO_QUERY);
     541           1 :     CPPUNIT_ASSERT(xChartDoc.is());
     542             : 
     543           1 :     xTitled.set(xChartDoc, uno::UNO_QUERY_THROW);
     544           1 :     aTitle = getTitleString(xTitled);
     545           1 :     CPPUNIT_ASSERT_EQUAL(OUString("Stacked column mixed with 100% stacked area"), aTitle);
     546             : 
     547             :     // Get the Y-axis.
     548           1 :     xYAxis = getAxisFromDoc(xChartDoc, 0, 1, 0);
     549           1 :     CPPUNIT_ASSERT(xYAxis.is());
     550             : 
     551             :     // Get the number format of the Y-axis.
     552           1 :     nNumberFormat = getNumberFormatFromAxis(xYAxis);
     553           1 :     nType = getNumberFormatType(xChartDoc, nNumberFormat);
     554           1 :     CPPUNIT_ASSERT_MESSAGE("Y axis should be a normal number format.", (nType & util::NumberFormat::NUMBER));
     555           2 :     CPPUNIT_ASSERT_MESSAGE("Y axis should NOT be a percent format.", !(nType & util::NumberFormat::PERCENT));
     556           1 : }
     557             : 
     558           1 : void Chart2ImportTest::testODPChartSeries()
     559             : {
     560             :     //test chart series names for odp
     561           1 :     uno::Sequence < OUString > seriesList = getImpressChartColumnDescriptions("/chart2/qa/extras/data/odp/", "chart.odp");
     562           1 :     CPPUNIT_ASSERT_EQUAL(OUString("Column 1"), seriesList[0]);
     563           1 :     CPPUNIT_ASSERT_EQUAL(OUString("Column 2"), seriesList[1]);
     564           1 :     CPPUNIT_ASSERT_EQUAL(OUString("Column 3"), seriesList[2]);
     565             : 
     566           1 : }
     567             : 
     568           1 : void Chart2ImportTest::testBnc864396()
     569             : {
     570           1 :     uno::Reference< chart2::XChartDocument > xChartDoc(getChartDocFromImpress("/chart2/qa/extras/data/pptx/", "bnc864396.pptx"), uno::UNO_QUERY_THROW);
     571           1 :     CPPUNIT_ASSERT(xChartDoc->hasInternalDataProvider());
     572             : 
     573           2 :     uno::Reference< chart2::XInternalDataProvider > xDataProvider( xChartDoc->getDataProvider(), uno::UNO_QUERY_THROW );
     574           2 :     uno::Reference< chart::XChartDataArray > xChartDataArray(xDataProvider, uno::UNO_QUERY_THROW);
     575           2 :     uno::Sequence< OUString > aRowLabels = xChartDataArray->getRowDescriptions();
     576           4 :     for(sal_Int32 i = 0; i < aRowLabels.getLength(); ++i)
     577             :     {
     578           3 :         OUString aExpected = "cat" + OUString::number(i+1);
     579           3 :         CPPUNIT_ASSERT_EQUAL(aExpected, aRowLabels[i]);
     580           4 :     }
     581           1 : }
     582             : 
     583           1 : void Chart2ImportTest::testBnc882383()
     584             : {
     585           1 :     load("/chart2/qa/extras/data/pptx/", "bnc882383.pptx");
     586           1 :     uno::Reference<chart2::XChartDocument> xChartDoc(getChartDocFromDrawImpress(0, 0), uno::UNO_QUERY_THROW);
     587           2 :     uno::Reference<chart2::XDataSeries> xDataSeries(getDataSeriesFromDoc(xChartDoc, 0));
     588           1 :     CPPUNIT_ASSERT(xDataSeries.is());
     589             : 
     590           2 :     uno::Reference<beans::XPropertySet> xPropertySet(xDataSeries->getDataPointByIndex(0), uno::UNO_QUERY_THROW);
     591           2 :     OUString sGradientName;
     592           1 :     xPropertySet->getPropertyValue("GradientName") >>= sGradientName;
     593           2 :     CPPUNIT_ASSERT(!sGradientName.isEmpty());
     594           1 : }
     595             : 
     596           1 : void Chart2ImportTest::testSimpleStrictXLSX()
     597             : {
     598           1 :     load("/chart2/qa/extras/data/xlsx/", "strict_chart.xlsx");
     599           1 :     uno::Reference< chart2::XChartDocument > xChartDoc = getChartDocFromSheet( 0, mxComponent );
     600           1 :     CPPUNIT_ASSERT(xChartDoc.is());
     601             : 
     602           2 :     Reference< chart2::XDataSeries > xDataSeries = getDataSeriesFromDoc( xChartDoc, 0 );
     603           2 :     CPPUNIT_ASSERT(xDataSeries.is());
     604             : 
     605           1 : }
     606             : 
     607           1 : void Chart2ImportTest::testDelayedCellImport()
     608             : {
     609           1 :     load("/chart2/qa/extras/data/xlsx/", "fdo70609.xlsx");
     610           1 :     uno::Reference< chart2::XChartDocument > xChartDoc = getChartDocFromSheet( 0, mxComponent );
     611             :     Reference< chart2::data::XDataSequence > xDataSeq =
     612           2 :         getDataSequenceFromDocByRole(xChartDoc, "values-x");
     613             : 
     614           2 :     OUString aRange = xDataSeq->getSourceRangeRepresentation();
     615           2 :     CPPUNIT_ASSERT_EQUAL(OUString("$Sheet2.$C$5:$C$9"), aRange);
     616           1 : }
     617             : 
     618           1 : void Chart2ImportTest::testFlatODSStackedColumnChart()
     619             : {
     620           1 :     load("/chart2/qa/extras/data/fods/", "stacked-column-chart.fods");
     621           1 :     Reference<chart2::XChartDocument> xChartDoc = getChartDocFromSheet(0, mxComponent);
     622           1 :     CPPUNIT_ASSERT(xChartDoc.is());
     623             : 
     624           2 :     Reference<chart2::XChartType> xChartType = getChartTypeFromDoc(xChartDoc, 0, 0);
     625           1 :     CPPUNIT_ASSERT(xChartType.is());
     626             : 
     627           2 :     Reference<chart2::XDataSeriesContainer> xDSCont(xChartType, UNO_QUERY);
     628           1 :     CPPUNIT_ASSERT(xDSCont.is());
     629           2 :     Sequence<Reference<chart2::XDataSeries> > aSeriesSeq = xDSCont->getDataSeries();
     630             : 
     631             :     // The stacked column chart should consist of 5 data series.
     632           2 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(5), aSeriesSeq.getLength());
     633           1 : }
     634             : 
     635           1 : void Chart2ImportTest::testFdo78080()
     636             : {
     637           1 :     load("/chart2/qa/extras/data/xlsx/", "fdo78080.xlsx");
     638           1 :     Reference<chart2::XChartDocument> xChartDoc = getChartDocFromSheet(0, mxComponent);
     639           1 :     CPPUNIT_ASSERT(xChartDoc.is());
     640             : 
     641           2 :     Reference<chart2::XTitled> xTitled(xChartDoc, uno::UNO_QUERY_THROW);
     642           2 :     Reference<chart2::XTitle> xTitle = xTitled->getTitleObject();
     643           2 :     CPPUNIT_ASSERT(!xTitle.is());
     644           1 : }
     645             : 
     646           1 : void Chart2ImportTest::testTdf86624()
     647             : {
     648           1 :     load("/chart2/qa/extras/data/ods/", "tdf86624.ods");
     649           1 :     uno::Reference< chart2::XChartDocument > xChart2Doc = getChartDocFromSheet(0, mxComponent);
     650           2 :     uno::Reference< chart::XChartDocument > xChartDoc (xChart2Doc, uno::UNO_QUERY);
     651           2 :     uno::Reference<drawing::XShape> xLegend = xChartDoc->getLegend();
     652           1 :     awt::Point aPos = xLegend->getPosition();
     653           1 :     CPPUNIT_ASSERT(aPos.X > 5000); // real value for me is above 8000 but before bug fix is below 1000
     654           2 :     CPPUNIT_ASSERT(aPos.Y > 4000); // real value for ms is above 7000
     655           1 : }
     656             : 
     657           2 : void Chart2ImportTest::testTransparentBackground(OUString const & filename)
     658             : {
     659           2 :     load("/chart2/qa/extras/data/xlsx/", filename);
     660           2 :     uno::Reference< chart2::XChartDocument > xChartDoc = getChartDocFromSheet(0, mxComponent);
     661           2 :     CPPUNIT_ASSERT_MESSAGE("failed to load chart", xChartDoc.is());
     662             : 
     663           4 :     uno::Reference< chart::XChartDocument > xChart2Doc (xChartDoc, uno::UNO_QUERY);
     664           2 :     CPPUNIT_ASSERT_MESSAGE("failed to load chart", xChart2Doc.is());
     665             : 
     666           4 :     Reference< beans::XPropertySet > xPropSet( xChart2Doc->getArea(), uno::UNO_QUERY);
     667           2 :     CPPUNIT_ASSERT_MESSAGE("failed to get Area", xPropSet.is());
     668             : 
     669             :     css::drawing::FillStyle aStyle;
     670           2 :     xPropSet -> getPropertyValue("FillStyle") >>= aStyle;
     671             : 
     672           4 :     CPPUNIT_ASSERT_MESSAGE("Background needs to be with solid fill style", aStyle == 1);
     673           2 : }
     674             : // 2 test methods here so that tearDown() can dispose the document
     675           1 : void Chart2ImportTest::testFdo54361()
     676             : {
     677           1 :     testTransparentBackground("fdo54361.xlsx");
     678           1 : }
     679           1 : void Chart2ImportTest::testFdo54361_1()
     680             : {
     681           1 :     testTransparentBackground("fdo54361-1.xlsx");
     682           1 : }
     683             : 
     684           1 : void Chart2ImportTest::testAutoBackgroundXLSX()
     685             : {
     686           1 :     load("/chart2/qa/extras/data/xlsx/", "chart-auto-background.xlsx");
     687           1 :     uno::Reference<chart2::XChartDocument> xChartDoc = getChartDocFromSheet(0, mxComponent);
     688           1 :     CPPUNIT_ASSERT_MESSAGE("failed to load chart", xChartDoc.is());
     689             : 
     690             :     // "Automatic" chart background fill in xlsx should be loaded as solid white.
     691           2 :     Reference<beans::XPropertySet> xPropSet = xChartDoc->getPageBackground();
     692           1 :     CPPUNIT_ASSERT(xPropSet.is());
     693           1 :     drawing::FillStyle eStyle = xPropSet->getPropertyValue("FillStyle").get<drawing::FillStyle>();
     694           1 :     sal_Int32 nColor = xPropSet->getPropertyValue("FillColor").get<sal_Int32>();
     695           2 :     CPPUNIT_ASSERT_MESSAGE("'Automatic' chart background fill in xlsx should be loaded as solid fill.",
     696           1 :         eStyle == drawing::FillStyle_SOLID);
     697           2 :     CPPUNIT_ASSERT_MESSAGE("'Automatic' chart background fill in xlsx should be loaded as solid white.",
     698           2 :         (nColor & 0x00FFFFFF) == 0x00FFFFFF); // highest 2 bytes are transparency which we ignore here.
     699           1 : }
     700             : 
     701           1 : void Chart2ImportTest::testChartAreaStyleBackgroundXLSX()
     702             : {
     703           1 :     load("/chart2/qa/extras/data/xlsx/", "chart-area-style-background.xlsx");
     704           1 :     uno::Reference<chart2::XChartDocument> xChartDoc = getChartDocFromSheet(0, mxComponent);
     705           1 :     CPPUNIT_ASSERT_MESSAGE("failed to load chart", xChartDoc.is());
     706             : 
     707             :     // "Automatic" chart background fill in xlsx should be loaded as solid white.
     708           2 :     Reference<beans::XPropertySet> xPropSet = xChartDoc->getPageBackground();
     709           1 :     CPPUNIT_ASSERT(xPropSet.is());
     710           1 :     drawing::FillStyle eStyle = xPropSet->getPropertyValue("FillStyle").get<drawing::FillStyle>();
     711           1 :     sal_Int32 nColor = xPropSet->getPropertyValue("FillColor").get<sal_Int32>();
     712           2 :     CPPUNIT_ASSERT_MESSAGE("'Automatic' chart background fill in xlsx should be loaded as solid fill.",
     713           1 :         eStyle == drawing::FillStyle_SOLID);
     714           2 :     CPPUNIT_ASSERT_EQUAL_MESSAGE("'Automatic' chart background fill in xlsx should be loaded as solid white.",
     715           2 :         sal_Int32(0), nColor);
     716           1 : }
     717             : 
     718           1 : void Chart2ImportTest::testAxisTextRotationXLSX()
     719             : {
     720           1 :     load("/chart2/qa/extras/data/xlsx/", "axis-label-rotation.xlsx");
     721           1 :     uno::Reference<chart2::XChartDocument> xChartDoc = getChartDocFromSheet(0, mxComponent);
     722           1 :     CPPUNIT_ASSERT_MESSAGE("failed to load chart", xChartDoc.is());
     723             : 
     724           2 :     Reference<chart2::XAxis> xYAxis = getAxisFromDoc(xChartDoc, 0, 0, 0);
     725           1 :     CPPUNIT_ASSERT(xYAxis.is());
     726             : 
     727           2 :     Reference<beans::XPropertySet> xPS(xYAxis, uno::UNO_QUERY_THROW);
     728           1 :     double nRotation = 0;
     729           1 :     bool bSuccess = xPS->getPropertyValue("TextRotation") >>= nRotation;
     730             : 
     731           1 :     CPPUNIT_ASSERT(bSuccess);
     732           2 :     CPPUNIT_ASSERT_DOUBLES_EQUAL(90, nRotation, 1e-10);
     733           1 : }
     734             : 
     735             : /* TODO : temporarily disabled.
     736             : void Chart2ImportTest::testTextCanOverlapXLSX()
     737             : {
     738             :     // fdo#84647 : To check textoverlap value is imported correclty.
     739             :     load("/chart2/qa/extras/data/xlsx/", "chart-text-can-overlap.xlsx");
     740             :     uno::Reference< chart::XDiagram > mxDiagram;
     741             :     uno::Reference< beans::XPropertySet > xAxisProp;
     742             :     bool textCanOverlap = false;
     743             :     uno::Reference< chart::XChartDocument > xChartDoc ( getChartCompFromSheet( 0, mxComponent ), UNO_QUERY_THROW);
     744             :     CPPUNIT_ASSERT(xChartDoc.is());
     745             :     mxDiagram.set(xChartDoc->getDiagram());
     746             :     CPPUNIT_ASSERT(mxDiagram.is());
     747             :     uno::Reference< chart::XAxisXSupplier > xAxisXSupp( mxDiagram, uno::UNO_QUERY );
     748             :     CPPUNIT_ASSERT(xAxisXSupp.is());
     749             :     xAxisProp = xAxisXSupp->getXAxis();
     750             :     xAxisProp->getPropertyValue("TextCanOverlap") >>= textCanOverlap;
     751             :     // Expected value of 'TextCanOverlap' is true
     752             :     CPPUNIT_ASSERT(textCanOverlap);
     753             : }
     754             : */
     755             : 
     756           1 : void Chart2ImportTest::testNumberFormatsXLSX()
     757             : {
     758           1 :     load("/chart2/qa/extras/data/xlsx/", "number-formats.xlsx");
     759           1 :     Reference<chart2::XChartDocument> xChartDoc = getChartDocFromSheet(0, mxComponent);
     760           1 :     CPPUNIT_ASSERT_MESSAGE("failed to load chart", xChartDoc.is());
     761             : 
     762           2 :     uno::Reference<chart2::XDataSeries> xDataSeries(getDataSeriesFromDoc(xChartDoc, 0));
     763           1 :     CPPUNIT_ASSERT(xDataSeries.is());
     764           2 :     uno::Reference<beans::XPropertySet> xPropertySet;
     765           1 :     chart2::DataPointLabel aLabel;
     766             :     sal_Int32 nNumberFormat;
     767           1 :     bool bLinkNumberFormatToSource = false;
     768           1 :     bool bSuccess = false;
     769             :     const sal_Int32 nChartDataNumberFormat = getNumberFormat(
     770           1 :             xChartDoc, "_(\"$\"* #,##0_);_(\"$\"* \\(#,##0\\);_(\"$\"* \"-\"??_);_(@_)");
     771             : 
     772           1 :     xPropertySet.set(xDataSeries->getDataPointByIndex(0), uno::UNO_QUERY_THROW);
     773           1 :     xPropertySet->getPropertyValue("Label") >>= aLabel;
     774           1 :     CPPUNIT_ASSERT_EQUAL(sal_True, aLabel.ShowNumber);
     775           1 :     CPPUNIT_ASSERT_EQUAL(sal_True, aLabel.ShowNumberInPercent);
     776           1 :     xPropertySet->getPropertyValue(CHART_UNONAME_NUMFMT) >>= nNumberFormat;
     777           1 :     CPPUNIT_ASSERT_EQUAL(nChartDataNumberFormat, nNumberFormat);
     778           1 :     bSuccess = xPropertySet->getPropertyValue("PercentageNumberFormat") >>= nNumberFormat;
     779           1 :     CPPUNIT_ASSERT_EQUAL(false, bSuccess);
     780           1 :     bSuccess = xPropertySet->getPropertyValue(CHART_UNONAME_LINK_TO_SRC_NUMFMT) >>= bLinkNumberFormatToSource;
     781           1 :     CPPUNIT_ASSERT_MESSAGE("\"LinkNumberFormatToSource\" should be set to true.", bSuccess && bLinkNumberFormatToSource);
     782             : 
     783           1 :     xPropertySet.set(xDataSeries->getDataPointByIndex(1), uno::UNO_QUERY_THROW);
     784           1 :     xPropertySet->getPropertyValue("Label") >>= aLabel;
     785           1 :     CPPUNIT_ASSERT_EQUAL(sal_True, aLabel.ShowNumber);
     786           1 :     CPPUNIT_ASSERT_EQUAL(sal_False, aLabel.ShowNumberInPercent);
     787           1 :     xPropertySet->getPropertyValue(CHART_UNONAME_NUMFMT) >>= nNumberFormat;
     788           1 :     CPPUNIT_ASSERT_EQUAL(nChartDataNumberFormat, nNumberFormat);
     789           1 :     bSuccess = xPropertySet->getPropertyValue("PercentageNumberFormat") >>= nNumberFormat;
     790           1 :     CPPUNIT_ASSERT_EQUAL(false, bSuccess);
     791           1 :     bSuccess = xPropertySet->getPropertyValue(CHART_UNONAME_LINK_TO_SRC_NUMFMT) >>= bLinkNumberFormatToSource;
     792           1 :     CPPUNIT_ASSERT_MESSAGE("\"LinkNumberFormatToSource\" should be set to true.", bSuccess && bLinkNumberFormatToSource);
     793             : 
     794           1 :     xPropertySet.set(xDataSeries->getDataPointByIndex(2), uno::UNO_QUERY_THROW);
     795           1 :     xPropertySet->getPropertyValue("Label") >>= aLabel;
     796           1 :     CPPUNIT_ASSERT_EQUAL(sal_False, aLabel.ShowNumber);
     797           1 :     CPPUNIT_ASSERT_EQUAL(sal_True, aLabel.ShowNumberInPercent);
     798           1 :     xPropertySet->getPropertyValue(CHART_UNONAME_NUMFMT) >>= nNumberFormat;
     799           1 :     CPPUNIT_ASSERT_EQUAL(nChartDataNumberFormat, nNumberFormat);
     800           1 :     bSuccess = xPropertySet->getPropertyValue("PercentageNumberFormat") >>= nNumberFormat;
     801           1 :     CPPUNIT_ASSERT_EQUAL(false, bSuccess);
     802           1 :     bSuccess = xPropertySet->getPropertyValue(CHART_UNONAME_LINK_TO_SRC_NUMFMT) >>= bLinkNumberFormatToSource;
     803           2 :     CPPUNIT_ASSERT_MESSAGE("\"LinkNumberFormatToSource\" should be set to true.", bSuccess && bLinkNumberFormatToSource);
     804           1 : }
     805             : 
     806           1 : void Chart2ImportTest::testAutoTitleDelDefaultValue2007XLSX()
     807             : {
     808           1 :     load("/chart2/qa/extras/data/xlsx/", "autotitledel_2007.xlsx");
     809           1 :     Reference<chart2::XChartDocument> xChartDoc = getChartDocFromSheet(0, mxComponent);
     810           1 :     CPPUNIT_ASSERT_MESSAGE("failed to load chart", xChartDoc.is());
     811             : 
     812           2 :     Reference<chart2::XTitled> xTitled(xChartDoc, uno::UNO_QUERY_THROW);
     813           2 :     OUString aTitle = getTitleString(xTitled);
     814           2 :     CPPUNIT_ASSERT_MESSAGE("autoTitleDel default value is false in MSO 2007 documents",
     815           2 :             !aTitle.isEmpty());
     816           1 : }
     817             : 
     818           1 : void Chart2ImportTest::testAutoTitleDelDefaultValue2013XLSX()
     819             : {
     820           1 :     load("/chart2/qa/extras/data/xlsx/", "autotitledel_2013.xlsx");
     821           1 :     Reference<chart2::XChartDocument> xChartDoc = getChartDocFromSheet(0, mxComponent);
     822           1 :     CPPUNIT_ASSERT_MESSAGE("failed to load chart", xChartDoc.is());
     823             : 
     824           2 :     Reference<chart2::XTitled> xTitled(xChartDoc, uno::UNO_QUERY_THROW);
     825           2 :     uno::Reference<chart2::XTitle> xTitle = xTitled->getTitleObject();
     826           2 :     CPPUNIT_ASSERT_MESSAGE("autoTitleDel default value is true in the OOXML spec",
     827           2 :             !xTitle.is());
     828           1 : }
     829             : 
     830           1 : void Chart2ImportTest::testDispBlanksAsDefaultValue2007XLSX()
     831             : {
     832           1 :     load("/chart2/qa/extras/data/xlsx/", "dispBlanksAs_2007.xlsx");
     833           1 :     Reference<chart2::XChartDocument> xChartDoc = getChartDocFromSheet(0, mxComponent);
     834           1 :     CPPUNIT_ASSERT_MESSAGE("failed to load chart", xChartDoc.is());
     835             : 
     836           2 :     Reference<beans::XPropertySet> xDiagram(xChartDoc->getFirstDiagram(), UNO_QUERY);
     837           1 :     CPPUNIT_ASSERT(xDiagram.is());
     838           2 :     uno::Any aAny = xDiagram->getPropertyValue("MissingValueTreatment");
     839           1 :     sal_Int32 nMissingValueTreatment = -2;
     840           1 :     CPPUNIT_ASSERT(aAny >>= nMissingValueTreatment);
     841           2 :     CPPUNIT_ASSERT_EQUAL(chart::MissingValueTreatment::LEAVE_GAP, nMissingValueTreatment);
     842           1 : }
     843             : 
     844           1 : void Chart2ImportTest::testDispBlanksAsDefaultValue2013XLSX()
     845             : {
     846           1 :     load("/chart2/qa/extras/data/xlsx/", "dispBlanksAs_2013.xlsx");
     847           1 :     Reference<chart2::XChartDocument> xChartDoc = getChartDocFromSheet(0, mxComponent);
     848           1 :     CPPUNIT_ASSERT_MESSAGE("failed to load chart", xChartDoc.is());
     849             : 
     850           2 :     Reference<beans::XPropertySet> xDiagram(xChartDoc->getFirstDiagram(), UNO_QUERY);
     851           1 :     CPPUNIT_ASSERT(xDiagram.is());
     852           2 :     uno::Any aAny = xDiagram->getPropertyValue("MissingValueTreatment");
     853           1 :     sal_Int32 nMissingValueTreatment = -2;
     854           1 :     CPPUNIT_ASSERT(aAny >>= nMissingValueTreatment);
     855           2 :     CPPUNIT_ASSERT_EQUAL(chart::MissingValueTreatment::USE_ZERO, nMissingValueTreatment);
     856           1 : }
     857             : 
     858           1 : void Chart2ImportTest::testSmoothDefaultValue2007XLSX()
     859             : {
     860           1 :     load("/chart2/qa/extras/data/xlsx/", "smoothed_series2007.xlsx");
     861           1 :     Reference<chart2::XChartDocument> xChartDoc = getChartDocFromSheet(0, mxComponent);
     862           1 :     CPPUNIT_ASSERT_MESSAGE("failed to load chart", xChartDoc.is());
     863           1 :     CPPUNIT_ASSERT(xChartDoc.is());
     864             : 
     865           2 :     Reference< chart2::XChartType > xChartType = getChartTypeFromDoc( xChartDoc, 0 );
     866           1 :     CPPUNIT_ASSERT(xChartType.is());
     867             : 
     868           2 :     Reference< beans::XPropertySet > xPropSet( xChartType, UNO_QUERY );
     869           1 :     CPPUNIT_ASSERT(xPropSet.is());
     870             : 
     871             :     chart2::CurveStyle eCurveStyle;
     872           1 :     xPropSet->getPropertyValue("CurveStyle") >>= eCurveStyle;
     873           2 :     CPPUNIT_ASSERT_EQUAL(eCurveStyle, chart2::CurveStyle_LINES);
     874           1 : }
     875             : 
     876           1 : void Chart2ImportTest::testSmoothDefaultValue2013XLSX()
     877             : {
     878           1 :     load("/chart2/qa/extras/data/xlsx/", "smoothed_series.xlsx");
     879           1 :     Reference<chart2::XChartDocument> xChartDoc = getChartDocFromSheet(0, mxComponent);
     880           1 :     CPPUNIT_ASSERT_MESSAGE("failed to load chart", xChartDoc.is());
     881           1 :     CPPUNIT_ASSERT(xChartDoc.is());
     882             : 
     883           2 :     Reference< chart2::XChartType > xChartType = getChartTypeFromDoc( xChartDoc, 0 );
     884           1 :     CPPUNIT_ASSERT(xChartType.is());
     885             : 
     886           2 :     Reference< beans::XPropertySet > xPropSet( xChartType, UNO_QUERY );
     887           1 :     CPPUNIT_ASSERT(xPropSet.is());
     888             : 
     889             :     chart2::CurveStyle eCurveStyle;
     890           1 :     xPropSet->getPropertyValue("CurveStyle") >>= eCurveStyle;
     891           2 :     CPPUNIT_ASSERT(eCurveStyle != chart2::CurveStyle_LINES);
     892           1 : }
     893             : 
     894           1 : void Chart2ImportTest::testTrendlineDefaultValue2007XLSX()
     895             : {
     896           1 :     load("/chart2/qa/extras/data/xlsx/", "trendline2007.xlsx");
     897           1 :     Reference<chart2::XChartDocument> xChartDoc = getChartDocFromSheet(0, mxComponent);
     898           1 :     CPPUNIT_ASSERT_MESSAGE("failed to load chart", xChartDoc.is());
     899           1 :     CPPUNIT_ASSERT(xChartDoc.is());
     900           2 :     Reference<chart2::XDataSeries> xDataSeries = getDataSeriesFromDoc(xChartDoc, 0);
     901           1 :     CPPUNIT_ASSERT(xDataSeries.is());
     902           2 :     Reference<chart2::XRegressionCurveContainer> xRegressionCurveContainer(xDataSeries, UNO_QUERY_THROW);
     903           2 :     Sequence< Reference<chart2::XRegressionCurve> > xRegressionCurveSequence = xRegressionCurveContainer->getRegressionCurves();
     904           1 :     CPPUNIT_ASSERT_EQUAL((sal_Int32) 1, xRegressionCurveSequence.getLength());
     905             : 
     906           2 :     Reference<chart2::XRegressionCurve> xCurve = xRegressionCurveSequence[0];
     907             : 
     908           2 :     Reference<beans::XPropertySet> xPropSet(xCurve->getEquationProperties(), uno::UNO_QUERY_THROW);
     909           2 :     uno::Any aAny = xPropSet->getPropertyValue("ShowEquation");
     910           1 :     bool bShowEquation = true;
     911           1 :     CPPUNIT_ASSERT(aAny >>= bShowEquation);
     912           1 :     CPPUNIT_ASSERT(!bShowEquation);
     913             : 
     914           1 :     aAny = xPropSet->getPropertyValue("ShowCorrelationCoefficient");
     915           1 :     bool bShowCorrelation = true;
     916           1 :     CPPUNIT_ASSERT(aAny >>= bShowCorrelation);
     917           2 :     CPPUNIT_ASSERT(!bShowCorrelation);
     918           1 : }
     919             : 
     920           1 : void Chart2ImportTest::testTrendlineDefaultValue2013XLSX()
     921             : {
     922           1 :     load("/chart2/qa/extras/data/xlsx/", "trendline.xlsx");
     923           1 :     Reference<chart2::XChartDocument> xChartDoc = getChartDocFromSheet(0, mxComponent);
     924           1 :     CPPUNIT_ASSERT_MESSAGE("failed to load chart", xChartDoc.is());
     925           1 :     CPPUNIT_ASSERT(xChartDoc.is());
     926           2 :     Reference<chart2::XDataSeries> xDataSeries = getDataSeriesFromDoc(xChartDoc, 0);
     927           1 :     CPPUNIT_ASSERT(xDataSeries.is());
     928           2 :     Reference<chart2::XRegressionCurveContainer> xRegressionCurveContainer(xDataSeries, UNO_QUERY_THROW);
     929           2 :     Sequence< Reference<chart2::XRegressionCurve> > xRegressionCurveSequence = xRegressionCurveContainer->getRegressionCurves();
     930           1 :     CPPUNIT_ASSERT_EQUAL((sal_Int32) 1, xRegressionCurveSequence.getLength());
     931             : 
     932           2 :     Reference<chart2::XRegressionCurve> xCurve = xRegressionCurveSequence[0];
     933             : 
     934           2 :     Reference<beans::XPropertySet> xPropSet(xCurve->getEquationProperties(), uno::UNO_QUERY_THROW);
     935           2 :     uno::Any aAny = xPropSet->getPropertyValue("ShowEquation");
     936           1 :     bool bShowEquation = false;
     937           1 :     CPPUNIT_ASSERT(aAny >>= bShowEquation);
     938           1 :     CPPUNIT_ASSERT(bShowEquation);
     939             : 
     940           1 :     aAny = xPropSet->getPropertyValue("ShowCorrelationCoefficient");
     941           1 :     bool bShowCorrelation = false;
     942           1 :     CPPUNIT_ASSERT(aAny >>= bShowCorrelation);
     943           2 :     CPPUNIT_ASSERT(bShowCorrelation);
     944           1 : }
     945             : 
     946           1 : void Chart2ImportTest::testVaryColorDefaultValues2007XLSX()
     947             : {
     948           1 :     load("/chart2/qa/extras/data/xlsx/", "vary_color2007.xlsx");
     949           1 :     Reference<chart2::XChartDocument> xChartDoc = getChartDocFromSheet(0, mxComponent);
     950           1 :     CPPUNIT_ASSERT_MESSAGE("failed to load chart", xChartDoc.is());
     951           1 :     CPPUNIT_ASSERT(xChartDoc.is());
     952           2 :     Reference<chart2::XDataSeries> xDataSeries = getDataSeriesFromDoc(xChartDoc, 0);
     953           1 :     CPPUNIT_ASSERT(xDataSeries.is());
     954           2 :     Reference<beans::XPropertySet> xPropSet(xDataSeries, uno::UNO_QUERY_THROW);
     955           2 :     uno::Any aAny = xPropSet->getPropertyValue("VaryColorsByPoint");
     956           1 :     bool bVaryColor = true;
     957           1 :     CPPUNIT_ASSERT(aAny >>= bVaryColor);
     958           2 :     CPPUNIT_ASSERT(!bVaryColor);
     959           1 : }
     960             : 
     961           1 : void Chart2ImportTest::testVaryColorDefaultValues2013XLSX()
     962             : {
     963           1 :     load("/chart2/qa/extras/data/xlsx/", "vary_color.xlsx");
     964           1 :     Reference<chart2::XChartDocument> xChartDoc = getChartDocFromSheet(0, mxComponent);
     965           1 :     CPPUNIT_ASSERT_MESSAGE("failed to load chart", xChartDoc.is());
     966           1 :     CPPUNIT_ASSERT(xChartDoc.is());
     967           2 :     Reference<chart2::XDataSeries> xDataSeries = getDataSeriesFromDoc(xChartDoc, 0);
     968           1 :     CPPUNIT_ASSERT(xDataSeries.is());
     969           2 :     Reference<beans::XPropertySet> xPropSet(xDataSeries, uno::UNO_QUERY_THROW);
     970           2 :     uno::Any aAny = xPropSet->getPropertyValue("VaryColorsByPoint");
     971           1 :     bool bVaryColor = false;
     972           1 :     CPPUNIT_ASSERT(aAny >>= bVaryColor);
     973           2 :     CPPUNIT_ASSERT(bVaryColor);
     974           1 : }
     975             : 
     976           1 : void Chart2ImportTest::testPlotVisOnlyDefaultValue2013XLSX()
     977             : {
     978           1 :     load("/chart2/qa/extras/data/xlsx/", "plotVisOnly.xlsx");
     979           1 :     uno::Reference< chart::XChartDocument > xChart1Doc ( getChartCompFromSheet( 0, mxComponent ), UNO_QUERY_THROW);
     980           1 :     CPPUNIT_ASSERT_MESSAGE("failed to load chart", xChart1Doc.is());
     981           2 :     Reference<beans::XPropertySet> xPropSet(xChart1Doc->getDiagram(), uno::UNO_QUERY_THROW);
     982           2 :     uno::Any aAny = xPropSet->getPropertyValue("IncludeHiddenCells");
     983           1 :     CPPUNIT_ASSERT(aAny.hasValue());
     984           1 :     bool bShowHiddenValues = true;
     985           1 :     CPPUNIT_ASSERT(aAny >>= bShowHiddenValues);
     986           2 :     CPPUNIT_ASSERT(!bShowHiddenValues);
     987           1 : }
     988             : 
     989           1 : void Chart2ImportTest::testRAngAxDefaultValue2013XLSX()
     990             : {
     991           1 :     load("/chart2/qa/extras/data/xlsx/", "rAngAx.xlsx");
     992           1 :     uno::Reference< chart::XChartDocument > xChart1Doc ( getChartCompFromSheet( 0, mxComponent ), UNO_QUERY_THROW);
     993           1 :     CPPUNIT_ASSERT_MESSAGE("failed to load chart", xChart1Doc.is());
     994           2 :     Reference<beans::XPropertySet> xPropSet(xChart1Doc->getDiagram(), uno::UNO_QUERY_THROW);
     995           2 :     uno::Any aAny = xPropSet->getPropertyValue("RightAngledAxes");
     996           1 :     CPPUNIT_ASSERT(aAny.hasValue());
     997           1 :     bool bRightAngleAxes = false;
     998           1 :     CPPUNIT_ASSERT(aAny >>= bRightAngleAxes);
     999           2 :     CPPUNIT_ASSERT(bRightAngleAxes);
    1000           1 : }
    1001             : 
    1002           1 : void Chart2ImportTest::testMajorTickMarksDefaultValue2013XLSX()
    1003             : {
    1004           1 :     load("/chart2/qa/extras/data/xlsx/", "majorTickMark.xlsx");
    1005           1 :     Reference<chart2::XChartDocument> xChartDoc = getChartDocFromSheet(0, mxComponent);
    1006           1 :     CPPUNIT_ASSERT_MESSAGE("failed to load chart", xChartDoc.is());
    1007           2 :     Reference<chart2::XAxis> xXAxis = getAxisFromDoc(xChartDoc, 0, 0, 0);
    1008           1 :     CPPUNIT_ASSERT(xXAxis.is());
    1009           2 :     Reference<beans::XPropertySet> xPropSet(xXAxis, uno::UNO_QUERY_THROW);
    1010           2 :     uno::Any aAny = xPropSet->getPropertyValue("MajorTickmarks");
    1011           1 :     sal_Int32 nMajorTickmarks = chart2::TickmarkStyle::NONE;
    1012           1 :     CPPUNIT_ASSERT(aAny.hasValue());
    1013           1 :     CPPUNIT_ASSERT(aAny >>= nMajorTickmarks);
    1014           2 :     CPPUNIT_ASSERT_EQUAL(chart2::TickmarkStyle::INNER | chart2::TickmarkStyle::OUTER, nMajorTickmarks);
    1015           1 : }
    1016             : 
    1017           1 : void Chart2ImportTest::testMinorTickMarksDefaultValue2013XLSX()
    1018             : {
    1019           1 :     load("/chart2/qa/extras/data/xlsx/", "minorTickMark.xlsx");
    1020           1 :     Reference<chart2::XChartDocument> xChartDoc = getChartDocFromSheet(0, mxComponent);
    1021           1 :     CPPUNIT_ASSERT_MESSAGE("failed to load chart", xChartDoc.is());
    1022           2 :     Reference<chart2::XAxis> xXAxis = getAxisFromDoc(xChartDoc, 0, 0, 0);
    1023           1 :     CPPUNIT_ASSERT(xXAxis.is());
    1024           2 :     Reference<beans::XPropertySet> xPropSet(xXAxis, uno::UNO_QUERY_THROW);
    1025           2 :     uno::Any aAny = xPropSet->getPropertyValue("MinorTickmarks");
    1026           1 :     sal_Int32 nMajorTickmarks = chart2::TickmarkStyle::NONE;
    1027           1 :     CPPUNIT_ASSERT(aAny.hasValue());
    1028           1 :     CPPUNIT_ASSERT(aAny >>= nMajorTickmarks);
    1029           2 :     CPPUNIT_ASSERT_EQUAL(chart2::TickmarkStyle::INNER | chart2::TickmarkStyle::OUTER, nMajorTickmarks);
    1030           1 : }
    1031             : 
    1032           1 : void Chart2ImportTest::testAxisTitleDefaultRotationXLSX()
    1033             : {
    1034           1 :     load("/chart2/qa/extras/data/xlsx/", "axis_title_default_rotation.xlsx");
    1035           1 :     Reference<chart2::XChartDocument> xChartDoc = getChartDocFromSheet(0, mxComponent);
    1036           1 :     CPPUNIT_ASSERT_MESSAGE("failed to load chart", xChartDoc.is());
    1037           2 :     Reference<chart2::XAxis> xYAxis = getAxisFromDoc(xChartDoc, 0, 1, 0);
    1038           1 :     CPPUNIT_ASSERT(xYAxis.is());
    1039           2 :     Reference<chart2::XTitled> xTitled(xYAxis, uno::UNO_QUERY_THROW);
    1040           2 :     Reference<chart2::XTitle> xTitle = xTitled->getTitleObject();
    1041           1 :     CPPUNIT_ASSERT(xTitle.is());
    1042           2 :     Reference<beans::XPropertySet> xPropSet(xTitle, uno::UNO_QUERY_THROW);
    1043           2 :     uno::Any aAny = xPropSet->getPropertyValue("TextRotation");
    1044           1 :     double nRotation = 0;
    1045           1 :     CPPUNIT_ASSERT(aAny >>= nRotation);
    1046           2 :     CPPUNIT_ASSERT_EQUAL(90.0, nRotation);
    1047           1 : }
    1048             : 
    1049           1 : void Chart2ImportTest::testSecondaryAxisTitleDefaultRotationXLSX()
    1050             : {
    1051           1 :     load("/chart2/qa/extras/data/xlsx/", "secondary_axis_title_default_rotation.xlsx");
    1052           1 :     Reference<chart2::XChartDocument> xChartDoc = getChartDocFromSheet(0, mxComponent);
    1053           1 :     CPPUNIT_ASSERT_MESSAGE("failed to load chart", xChartDoc.is());
    1054           2 :     Reference<chart2::XAxis> xYAxis = getAxisFromDoc(xChartDoc, 0, 1, 1);
    1055           1 :     CPPUNIT_ASSERT(xYAxis.is());
    1056           2 :     Reference<chart2::XTitled> xTitled(xYAxis, uno::UNO_QUERY_THROW);
    1057           2 :     Reference<chart2::XTitle> xTitle = xTitled->getTitleObject();
    1058           1 :     CPPUNIT_ASSERT(xTitle.is());
    1059           2 :     Reference<beans::XPropertySet> xPropSet(xTitle, uno::UNO_QUERY_THROW);
    1060           2 :     uno::Any aAny = xPropSet->getPropertyValue("TextRotation");
    1061           1 :     double nRotation = 0;
    1062           1 :     CPPUNIT_ASSERT(aAny >>= nRotation);
    1063           2 :     CPPUNIT_ASSERT_EQUAL(90.0, nRotation);
    1064           1 : }
    1065             : 
    1066           1 : void Chart2ImportTest::testAxisTitleRotationXLSX()
    1067             : {
    1068           1 :     load("/chart2/qa/extras/data/xlsx/", "axis_title_rotated.xlsx");
    1069           1 :     Reference<chart2::XChartDocument> xChartDoc = getChartDocFromSheet(0, mxComponent);
    1070           1 :     CPPUNIT_ASSERT_MESSAGE("failed to load chart", xChartDoc.is());
    1071             :     {
    1072           1 :         Reference<chart2::XAxis> xYAxis = getAxisFromDoc(xChartDoc, 0, 1, 0);
    1073           1 :         CPPUNIT_ASSERT(xYAxis.is());
    1074           2 :         Reference<chart2::XTitled> xTitled(xYAxis, uno::UNO_QUERY_THROW);
    1075           2 :         Reference<chart2::XTitle> xTitle = xTitled->getTitleObject();
    1076           1 :         CPPUNIT_ASSERT(xTitle.is());
    1077           2 :         Reference<beans::XPropertySet> xPropSet(xTitle, uno::UNO_QUERY_THROW);
    1078           2 :         uno::Any aAny = xPropSet->getPropertyValue("TextRotation");
    1079           1 :         double nRotation = 0;
    1080           1 :         CPPUNIT_ASSERT(aAny >>= nRotation);
    1081           2 :         CPPUNIT_ASSERT_EQUAL(340.0, nRotation);
    1082             :     }
    1083             :     {
    1084           1 :         Reference<chart2::XAxis> xYAxis = getAxisFromDoc(xChartDoc, 0, 1, 1);
    1085           1 :         CPPUNIT_ASSERT(xYAxis.is());
    1086           2 :         Reference<chart2::XTitled> xTitled(xYAxis, uno::UNO_QUERY_THROW);
    1087           2 :         Reference<chart2::XTitle> xTitle = xTitled->getTitleObject();
    1088           1 :         CPPUNIT_ASSERT(xTitle.is());
    1089           2 :         Reference<beans::XPropertySet> xPropSet(xTitle, uno::UNO_QUERY_THROW);
    1090           2 :         uno::Any aAny = xPropSet->getPropertyValue("TextRotation");
    1091           1 :         double nRotation = 0;
    1092           1 :         CPPUNIT_ASSERT(aAny >>= nRotation);
    1093           2 :         CPPUNIT_ASSERT_EQUAL(270.0, nRotation);
    1094           1 :     }
    1095             : 
    1096           1 : }
    1097             : 
    1098           1 : CPPUNIT_TEST_SUITE_REGISTRATION(Chart2ImportTest);
    1099             : 
    1100           4 : CPPUNIT_PLUGIN_IMPLEMENT();
    1101             : 
    1102             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11