summaryrefslogtreecommitdiff
path: root/chart2/qa
diff options
context:
space:
mode:
authorMarkus Mohrhard <markus.mohrhard@googlemail.com>2013-05-01 19:30:04 +0200
committerMarkus Mohrhard <markus.mohrhard@googlemail.com>2013-05-01 20:29:19 +0200
commit14c2ab30201d97f733375b4e3e88e5919701be25 (patch)
tree9c8209acfd9c5d347511e79f691e531ae5aec3a1 /chart2/qa
parent84a8f817e174855ef72f0bafc734847690c5d736 (diff)
add export test for charts
Change-Id: I176f7967d37f3032057758d9aaa5f39c46d29c3d
Diffstat (limited to 'chart2/qa')
-rw-r--r--chart2/qa/extras/chart2export.cxx34
-rw-r--r--chart2/qa/extras/charttest.hxx23
-rw-r--r--chart2/qa/extras/data/ods/simple_export_chart.odsbin0 -> 13269 bytes
3 files changed, 57 insertions, 0 deletions
diff --git a/chart2/qa/extras/chart2export.cxx b/chart2/qa/extras/chart2export.cxx
new file mode 100644
index 000000000000..d17416f7a27d
--- /dev/null
+++ b/chart2/qa/extras/chart2export.cxx
@@ -0,0 +1,34 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#include "charttest.hxx"
+
+class Chart2ExportTest : public ChartTest
+{
+public:
+ void test();
+
+ CPPUNIT_TEST_SUITE(Chart2ExportTest);
+ CPPUNIT_TEST(test);
+ CPPUNIT_TEST_SUITE_END();
+
+private:
+};
+
+void Chart2ExportTest::test()
+{
+ load("/chart2/qa/extras/data/ods/", "simple_export_chart.ods");
+ reload("Calc Office Open XML");
+}
+
+CPPUNIT_TEST_SUITE_REGISTRATION(Chart2ExportTest);
+
+CPPUNIT_PLUGIN_IMPLEMENT();
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/qa/extras/charttest.hxx b/chart2/qa/extras/charttest.hxx
index e4968f1fde01..8fe76e2288ce 100644
--- a/chart2/qa/extras/charttest.hxx
+++ b/chart2/qa/extras/charttest.hxx
@@ -22,6 +22,10 @@
#include <com/sun/star/table/XTableChart.hpp>
#include <com/sun/star/document/XEmbeddedObjectSupplier.hpp>
#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/frame/XStorable.hpp>
+#include <com/sun/star/beans/PropertyValue.hpp>
+
+#include <unotools/tempfile.hxx>
#include <com/sun/star/chart2/XChartDocument.hpp>
#include <com/sun/star/chart2/XDiagram.hpp>
@@ -30,6 +34,8 @@
#include <com/sun/star/chart2/XCoordinateSystemContainer.hpp>
#include <com/sun/star/chart2/XDataSeriesContainer.hpp>
+#include <iostream>
+
using namespace com::sun::star;
using namespace com::sun::star::uno;
@@ -37,6 +43,7 @@ class ChartTest : public test::BootstrapFixture, public unotest::MacrosTest
{
public:
void load( const char* pDir, const char* pName );
+ void reload( const OUString& rFilterName );
virtual void setUp();
virtual void tearDown();
@@ -50,6 +57,22 @@ void ChartTest::load( const char* pDir, const char* pName )
CPPUNIT_ASSERT(mxComponent.is());
}
+void ChartTest::reload(const OUString& rFilterName)
+{
+ uno::Reference<frame::XStorable> xStorable(mxComponent, uno::UNO_QUERY);
+ uno::Sequence<beans::PropertyValue> aArgs(1);
+ aArgs[0].Name = "FilterName";
+ aArgs[0].Value <<= rFilterName;
+ utl::TempFile aTempFile;
+ aTempFile.EnableKillingFile();
+ xStorable->storeToURL(aTempFile.GetURL(), aArgs);
+ uno::Reference<lang::XComponent> xComponent(xStorable, uno::UNO_QUERY);
+ xComponent->dispose();
+ mxComponent = loadFromDesktop(aTempFile.GetURL(), "com.sun.star.sheet.SpreadsheetDocument");
+ std::cout << aTempFile.GetURL();
+ CPPUNIT_ASSERT(mxComponent.is());
+}
+
void ChartTest::setUp()
{
test::BootstrapFixture::setUp();
diff --git a/chart2/qa/extras/data/ods/simple_export_chart.ods b/chart2/qa/extras/data/ods/simple_export_chart.ods
new file mode 100644
index 000000000000..b944c360c1f7
--- /dev/null
+++ b/chart2/qa/extras/data/ods/simple_export_chart.ods
Binary files differ