chart2/qa/extras/chart2export.cxx | 2 oox/source/export/chartexport.cxx | 2 sc/CppunitTest_sc_copypaste.mk | 127 ++++++++++++++++++++++ sc/CppunitTest_sc_subsequent_filters_test.mk | 1 sc/Module_sc.mk | 1 sc/qa/unit/copy_paste_test.cxx | 151 +++++++++++++++++++++++++++ sc/qa/unit/subsequent_filters-test.cxx | 3 7 files changed, 286 insertions(+), 1 deletion(-)
New commits: commit f61c275f091de4b8b66685dbb5e7f948cc51c158 Author: Markus Mohrhard <[email protected]> Date: Wed May 13 06:21:46 2015 +0200 add test for primary and secondary axis position Change-Id: I8e790153c45c8ec2a4a94d629fbc0e36e60617d8 diff --git a/chart2/qa/extras/chart2export.cxx b/chart2/qa/extras/chart2export.cxx index d90cb64..5b40560 100644 --- a/chart2/qa/extras/chart2export.cxx +++ b/chart2/qa/extras/chart2export.cxx @@ -1458,6 +1458,8 @@ void Chart2ExportTest::testMultipleAxisXLSX() assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:scatterChart[2]/c:ser", 1); assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:valAx", 4); assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:valAx/c:delete[@val='1']", 1); + assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:valAx/c:axPos[@val='l']", 1); + assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:valAx/c:axPos[@val='r']", 1); } CPPUNIT_TEST_SUITE_REGISTRATION(Chart2ExportTest); commit 33dd700085441e0903a1cfdc876f2d6338c76bef Author: Markus Mohrhard <[email protected]> Date: Wed May 13 06:18:10 2015 +0200 extract copy&paste test from import tests It makes more sense to use an independent test for these type of tests. Change-Id: Ied0cf3e42ccd391594f1dc884617f9dc498e700e diff --git a/sc/CppunitTest_sc_copypaste.mk b/sc/CppunitTest_sc_copypaste.mk new file mode 100644 index 0000000..7df4f51 --- /dev/null +++ b/sc/CppunitTest_sc_copypaste.mk @@ -0,0 +1,127 @@ +# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*- +# +# 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/. +# + +$(eval $(call gb_CppunitTest_CppunitTest,sc_copypaste)) + +$(eval $(call gb_CppunitTest_add_exception_objects,sc_copypaste, \ + sc/qa/unit/copy_paste_test \ +)) + +$(eval $(call gb_CppunitTest_use_externals,sc_copypaste, \ + boost_headers \ + mdds_headers \ + orcus \ + orcus-parser \ + libxml2 \ +)) + +$(eval $(call gb_CppunitTest_use_libraries,sc_copypaste, \ + basegfx \ + comphelper \ + cppu \ + cppuhelper \ + drawinglayer \ + editeng \ + for \ + forui \ + i18nlangtag \ + msfilter \ + oox \ + sal \ + salhelper \ + sax \ + sb \ + sc \ + scqahelper \ + sfx \ + sot \ + subsequenttest \ + svl \ + svt \ + svx \ + svxcore \ + test \ + tk \ + tl \ + ucbhelper \ + unotest \ + utl \ + vbahelper \ + vcl \ + xo \ + $(gb_UWINAPI) \ +)) + +$(eval $(call gb_CppunitTest_set_include,sc_copypaste,\ + -I$(SRCDIR)/sc/source/ui/inc \ + -I$(SRCDIR)/sc/inc \ + $$(INCLUDE) \ +)) + +$(eval $(call gb_CppunitTest_use_api,sc_copypaste,\ + offapi \ + udkapi \ +)) + +$(eval $(call gb_CppunitTest_use_ure,sc_copypaste)) +$(eval $(call gb_CppunitTest_use_vcl,sc_copypaste)) + +$(eval $(call gb_CppunitTest_use_components,sc_copypaste,\ + basic/util/sb \ + chart2/source/chartcore \ + chart2/source/controller/chartcontroller \ + comphelper/util/comphelp \ + configmgr/source/configmgr \ + dbaccess/util/dba \ + embeddedobj/util/embobj \ + eventattacher/source/evtatt \ + filter/source/config/cache/filterconfig1 \ + forms/util/frm \ + framework/util/fwk \ + i18npool/source/search/i18nsearch \ + i18npool/util/i18npool \ + linguistic/source/lng \ + oox/util/oox \ + package/source/xstor/xstor \ + package/util/package2 \ + sax/source/expatwrap/expwrap \ + scaddins/source/analysis/analysis \ + scaddins/source/datefunc/date \ + sc/util/sc \ + sc/util/scfilt \ + sfx2/util/sfx \ + sot/util/sot \ + svl/util/svl \ + svl/source/fsstor/fsstorage \ + svtools/util/svt \ + toolkit/util/tk \ + ucb/source/core/ucb1 \ + ucb/source/ucp/file/ucpfile1 \ + ucb/source/ucp/tdoc/ucptdoc1 \ + unotools/util/utl \ + unoxml/source/rdf/unordf \ + unoxml/source/service/unoxml \ + xmloff/util/xo \ + xmlsecurity/util/xmlsecurity \ + xmlsecurity/util/xsec_fw \ +)) + +ifeq ($(OS),WNT) +$(eval $(call gb_CppunitTest_use_components,sc_copypaste,\ + xmlsecurity/util/xsec_xmlsec.windows \ +)) +else +$(eval $(call gb_CppunitTest_use_components,sc_copypaste,\ + xmlsecurity/util/xsec_xmlsec \ +)) +endif + +$(eval $(call gb_CppunitTest_use_configuration,sc_copypaste)) + +# vim: set noet sw=4 ts=4: diff --git a/sc/Module_sc.mk b/sc/Module_sc.mk index 31b2c6d..fc49303 100644 --- a/sc/Module_sc.mk +++ b/sc/Module_sc.mk @@ -59,6 +59,7 @@ $(eval $(call gb_Module_add_slowcheck_targets,sc, \ CppunitTest_sc_bugfix_test \ CppunitTest_sc_html_export_test \ CppunitTest_sc_opencl_test \ + CppunitTest_sc_copypaste \ )) # Disabled to allow the check tinderbox execute the sd tests diff --git a/sc/qa/unit/copy_paste_test.cxx b/sc/qa/unit/copy_paste_test.cxx new file mode 100644 index 0000000..73259e6 --- /dev/null +++ b/sc/qa/unit/copy_paste_test.cxx @@ -0,0 +1,151 @@ +/* -*- 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 <sal/config.h> +#include <unotest/filters-test.hxx> +#include <test/bootstrapfixture.hxx> + +#include "docsh.hxx" +#include "tabvwsh.hxx" + +#include <com/sun/star/frame/Desktop.hpp> +#include <com/sun/star/frame/XModel.hpp> +#include <com/sun/star/frame/XModel2.hpp> + +#include "helper/qahelper.hxx" + +using namespace ::com::sun::star; +using namespace ::com::sun::star::uno; + +class ScCopyPasteTest : public ScBootstrapFixture +{ +public: + ScCopyPasteTest(); + + virtual void setUp() SAL_OVERRIDE; + virtual void tearDown() SAL_OVERRIDE; + + void testCopyPasteXLS(); + + CPPUNIT_TEST_SUITE(ScCopyPasteTest); + CPPUNIT_TEST(testCopyPasteXLS); + CPPUNIT_TEST_SUITE_END(); + +private: + + uno::Reference<uno::XInterface> m_xCalcComponent; +}; + +// tdf#83366 +void ScCopyPasteTest::testCopyPasteXLS() +{ + uno::Reference< frame::XDesktop2 > xDesktop = frame::Desktop::create(::comphelper::getProcessComponentContext()); + CPPUNIT_ASSERT( xDesktop.is() ); + + // create a frame + Reference< frame::XFrame > xTargetFrame = xDesktop->findFrame( OUString("_blank"), 0 ); + CPPUNIT_ASSERT( xTargetFrame.is() ); + + // 1. Open the document + ScDocShellRef xDocSh = loadDoc("chartx.", XLS); + CPPUNIT_ASSERT_MESSAGE("Failed to load chartx.xls.", xDocSh.Is()); + + uno::Reference< frame::XModel2 > xModel2 ( xDocSh->GetModel(), UNO_QUERY ); + CPPUNIT_ASSERT( xModel2.is() ); + + Reference< frame::XController2 > xController ( xModel2->createDefaultViewController( xTargetFrame ), UNO_QUERY ); + CPPUNIT_ASSERT( xController.is() ); + + // introduce model/view/controller to each other + xController->attachModel( xModel2.get() ); + xModel2->connectController( xController.get() ); + xTargetFrame->setComponent( xController->getComponentWindow(), xController.get() ); + xController->attachFrame( xTargetFrame ); + xModel2->setCurrentController( xController.get() ); + + ScDocument& rDoc = xDocSh->GetDocument(); + + // Get the document controller + ScTabViewShell* pViewShell = xDocSh->GetBestViewShell(false); + CPPUNIT_ASSERT(pViewShell != NULL); + + // 2. Highlight B2:C5 + ScRange aSrcRange; + sal_uInt16 nRes = aSrcRange.Parse("B2:C5", &rDoc, rDoc.GetAddressConvention()); + CPPUNIT_ASSERT_MESSAGE("Failed to parse.", (nRes & SCA_VALID) != 0); + + ScMarkData aMark; + aMark.SetMarkArea(aSrcRange); + + pViewShell->GetViewData().GetMarkData().SetMarkArea(aSrcRange); + + // 3. Copy + ScDocument aClipDoc(SCDOCMODE_CLIP); + pViewShell->GetViewData().GetView()->CopyToClip(&aClipDoc, false, false, false, false); + + // 4. Close the document (Ctrl-W) + xDocSh->DoClose(); + + // 5. Create a new Spreadsheet + Sequence < beans::PropertyValue > args(1); + args[0].Name = "Hidden"; + args[0].Value <<= sal_True; + + uno::Reference< lang::XComponent > xComponent = xDesktop->loadComponentFromURL( + OUString("private:factory/scalc"), + OUString("_blank"), + 0, + args ); + CPPUNIT_ASSERT( xComponent.is() ); + + // Get the document model + SfxObjectShell* pFoundShell = SfxObjectShell::GetShellFromComponent(xComponent); + CPPUNIT_ASSERT_MESSAGE("Failed to access document shell", pFoundShell); + + xDocSh = dynamic_cast<ScDocShell*>(pFoundShell); + CPPUNIT_ASSERT(xDocSh != NULL); + + // Get the document controller + pViewShell = xDocSh->GetBestViewShell(false); + CPPUNIT_ASSERT(pViewShell != NULL); + + // 6. Paste + pViewShell->GetViewData().GetView()->PasteFromClip(IDF_ALL, &aClipDoc); + + xDocSh->DoClose(); +} + +ScCopyPasteTest::ScCopyPasteTest() + : ScBootstrapFixture( "/sc/qa/unit/data" ) +{ +} + +void ScCopyPasteTest::setUp() +{ + test::BootstrapFixture::setUp(); + + // This is a bit of a fudge, we do this to ensure that ScGlobals::ensure, + // which is a private symbol to us, gets called + m_xCalcComponent = + getMultiServiceFactory()->createInstance("com.sun.star.comp.Calc.SpreadsheetDocument"); + CPPUNIT_ASSERT_MESSAGE("no calc component!", m_xCalcComponent.is()); +} + +void ScCopyPasteTest::tearDown() +{ + uno::Reference< lang::XComponent >( m_xCalcComponent, UNO_QUERY_THROW )->dispose(); + test::BootstrapFixture::tearDown(); +} + +CPPUNIT_TEST_SUITE_REGISTRATION(ScCopyPasteTest); + +CPPUNIT_PLUGIN_IMPLEMENT(); + + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/qa/unit/subsequent_filters-test.cxx b/sc/qa/unit/subsequent_filters-test.cxx index 61fd98f..12bb93a 100644 --- a/sc/qa/unit/subsequent_filters-test.cxx +++ b/sc/qa/unit/subsequent_filters-test.cxx @@ -194,7 +194,6 @@ public: void testVBAUserFunctionXLSM(); void testEmbeddedImageXLS(); void testEditEngStrikeThroughXLSX(); - void testCopyPasteXLS(); CPPUNIT_TEST_SUITE(ScFiltersTest); CPPUNIT_TEST(testBooleanFormatXLSX); @@ -284,7 +283,6 @@ public: CPPUNIT_TEST(testEmbeddedImageXLS); CPPUNIT_TEST(testErrorOnExternalReferences); CPPUNIT_TEST(testEditEngStrikeThroughXLSX); - CPPUNIT_TEST(testCopyPasteXLS); CPPUNIT_TEST_SUITE_END(); private: @@ -2941,85 +2939,6 @@ void ScFiltersTest::testEditEngStrikeThroughXLSX() } } -// tdf#83366 -void ScFiltersTest::testCopyPasteXLS() -{ - uno::Reference< frame::XDesktop2 > xDesktop = frame::Desktop::create(::comphelper::getProcessComponentContext()); - CPPUNIT_ASSERT( xDesktop.is() ); - - // create a frame - Reference< frame::XFrame > xTargetFrame = xDesktop->findFrame( OUString("_blank"), 0 ); - CPPUNIT_ASSERT( xTargetFrame.is() ); - - // 1. Open the document - ScDocShellRef xDocSh = loadDoc("chartx.", XLS); - CPPUNIT_ASSERT_MESSAGE("Failed to load chartx.xls.", xDocSh.Is()); - - uno::Reference< frame::XModel2 > xModel2 ( xDocSh->GetModel(), UNO_QUERY ); - CPPUNIT_ASSERT( xModel2.is() ); - - Reference< frame::XController2 > xController ( xModel2->createDefaultViewController( xTargetFrame ), UNO_QUERY ); - CPPUNIT_ASSERT( xController.is() ); - - // introduce model/view/controller to each other - xController->attachModel( xModel2.get() ); - xModel2->connectController( xController.get() ); - xTargetFrame->setComponent( xController->getComponentWindow(), xController.get() ); - xController->attachFrame( xTargetFrame ); - xModel2->setCurrentController( xController.get() ); - - ScDocument& rDoc = xDocSh->GetDocument(); - - // Get the document controller - ScTabViewShell* pViewShell = xDocSh->GetBestViewShell(false); - CPPUNIT_ASSERT(pViewShell != NULL); - - // 2. Highlight B2:C5 - ScRange aSrcRange; - sal_uInt16 nRes = aSrcRange.Parse("B2:C5", &rDoc, rDoc.GetAddressConvention()); - CPPUNIT_ASSERT_MESSAGE("Failed to parse.", (nRes & SCA_VALID) != 0); - - ScMarkData aMark; - aMark.SetMarkArea(aSrcRange); - - pViewShell->GetViewData().GetMarkData().SetMarkArea(aSrcRange); - - // 3. Copy - ScDocument aClipDoc(SCDOCMODE_CLIP); - pViewShell->GetViewData().GetView()->CopyToClip(&aClipDoc, false, false, false, false); - - // 4. Close the document (Ctrl-W) - xDocSh->DoClose(); - - // 5. Create a new Spreadsheet - Sequence < beans::PropertyValue > args(1); - args[0].Name = "Hidden"; - args[0].Value <<= sal_True; - - uno::Reference< lang::XComponent > xComponent = xDesktop->loadComponentFromURL( - OUString("private:factory/scalc"), - OUString("_blank"), - 0, - args ); - CPPUNIT_ASSERT( xComponent.is() ); - - // Get the document model - SfxObjectShell* pFoundShell = SfxObjectShell::GetShellFromComponent(xComponent); - CPPUNIT_ASSERT_MESSAGE("Failed to access document shell", pFoundShell); - - xDocSh = dynamic_cast<ScDocShell*>(pFoundShell); - CPPUNIT_ASSERT(xDocSh != NULL); - - // Get the document controller - pViewShell = xDocSh->GetBestViewShell(false); - CPPUNIT_ASSERT(pViewShell != NULL); - - // 6. Paste - pViewShell->GetViewData().GetView()->PasteFromClip(IDF_ALL, &aClipDoc); - - xDocSh->DoClose(); -} - ScFiltersTest::ScFiltersTest() : ScBootstrapFixture( "/sc/qa/unit/data" ) { commit 2c5be9611c3c74d02bd4fd5ac05170ea83d1ba20 Author: Henry Castro <[email protected]> Date: Thu May 7 17:01:36 2015 -0400 Unit test for tdf#83366 Change-Id: If0bea3c3a2b0d098e82fd54c069f99041e6ace81 diff --git a/sc/CppunitTest_sc_subsequent_filters_test.mk b/sc/CppunitTest_sc_subsequent_filters_test.mk index d56fd20..08dedbb 100644 --- a/sc/CppunitTest_sc_subsequent_filters_test.mk +++ b/sc/CppunitTest_sc_subsequent_filters_test.mk @@ -98,6 +98,7 @@ $(eval $(call gb_CppunitTest_use_components,sc_subsequent_filters_test,\ sfx2/util/sfx \ sot/util/sot \ svl/util/svl \ + svl/source/fsstor/fsstorage \ svtools/util/svt \ toolkit/util/tk \ ucb/source/core/ucb1 \ diff --git a/sc/qa/unit/subsequent_filters-test.cxx b/sc/qa/unit/subsequent_filters-test.cxx index dbc5ac1..61fd98f 100644 --- a/sc/qa/unit/subsequent_filters-test.cxx +++ b/sc/qa/unit/subsequent_filters-test.cxx @@ -50,6 +50,7 @@ #include "cellvalue.hxx" #include "attrib.hxx" #include "dpshttab.hxx" +#include "tabvwsh.hxx" #include <scopetools.hxx> #include <columnspanset.hxx> #include <tokenstringcontext.hxx> @@ -63,7 +64,9 @@ #include <com/sun/star/sheet/DataPilotFieldGroupBy.hpp> #include <com/sun/star/sheet/GeneralFunction.hpp> #include <com/sun/star/container/XIndexAccess.hpp> +#include <com/sun/star/frame/Desktop.hpp> #include <com/sun/star/frame/XModel.hpp> +#include <com/sun/star/frame/XModel2.hpp> #include <com/sun/star/text/textfield/Type.hpp> #include <com/sun/star/chart2/XChartDocument.hpp> #include <com/sun/star/chart2/data/XDataReceiver.hpp> @@ -191,6 +194,7 @@ public: void testVBAUserFunctionXLSM(); void testEmbeddedImageXLS(); void testEditEngStrikeThroughXLSX(); + void testCopyPasteXLS(); CPPUNIT_TEST_SUITE(ScFiltersTest); CPPUNIT_TEST(testBooleanFormatXLSX); @@ -280,6 +284,7 @@ public: CPPUNIT_TEST(testEmbeddedImageXLS); CPPUNIT_TEST(testErrorOnExternalReferences); CPPUNIT_TEST(testEditEngStrikeThroughXLSX); + CPPUNIT_TEST(testCopyPasteXLS); CPPUNIT_TEST_SUITE_END(); private: @@ -2936,6 +2941,85 @@ void ScFiltersTest::testEditEngStrikeThroughXLSX() } } +// tdf#83366 +void ScFiltersTest::testCopyPasteXLS() +{ + uno::Reference< frame::XDesktop2 > xDesktop = frame::Desktop::create(::comphelper::getProcessComponentContext()); + CPPUNIT_ASSERT( xDesktop.is() ); + + // create a frame + Reference< frame::XFrame > xTargetFrame = xDesktop->findFrame( OUString("_blank"), 0 ); + CPPUNIT_ASSERT( xTargetFrame.is() ); + + // 1. Open the document + ScDocShellRef xDocSh = loadDoc("chartx.", XLS); + CPPUNIT_ASSERT_MESSAGE("Failed to load chartx.xls.", xDocSh.Is()); + + uno::Reference< frame::XModel2 > xModel2 ( xDocSh->GetModel(), UNO_QUERY ); + CPPUNIT_ASSERT( xModel2.is() ); + + Reference< frame::XController2 > xController ( xModel2->createDefaultViewController( xTargetFrame ), UNO_QUERY ); + CPPUNIT_ASSERT( xController.is() ); + + // introduce model/view/controller to each other + xController->attachModel( xModel2.get() ); + xModel2->connectController( xController.get() ); + xTargetFrame->setComponent( xController->getComponentWindow(), xController.get() ); + xController->attachFrame( xTargetFrame ); + xModel2->setCurrentController( xController.get() ); + + ScDocument& rDoc = xDocSh->GetDocument(); + + // Get the document controller + ScTabViewShell* pViewShell = xDocSh->GetBestViewShell(false); + CPPUNIT_ASSERT(pViewShell != NULL); + + // 2. Highlight B2:C5 + ScRange aSrcRange; + sal_uInt16 nRes = aSrcRange.Parse("B2:C5", &rDoc, rDoc.GetAddressConvention()); + CPPUNIT_ASSERT_MESSAGE("Failed to parse.", (nRes & SCA_VALID) != 0); + + ScMarkData aMark; + aMark.SetMarkArea(aSrcRange); + + pViewShell->GetViewData().GetMarkData().SetMarkArea(aSrcRange); + + // 3. Copy + ScDocument aClipDoc(SCDOCMODE_CLIP); + pViewShell->GetViewData().GetView()->CopyToClip(&aClipDoc, false, false, false, false); + + // 4. Close the document (Ctrl-W) + xDocSh->DoClose(); + + // 5. Create a new Spreadsheet + Sequence < beans::PropertyValue > args(1); + args[0].Name = "Hidden"; + args[0].Value <<= sal_True; + + uno::Reference< lang::XComponent > xComponent = xDesktop->loadComponentFromURL( + OUString("private:factory/scalc"), + OUString("_blank"), + 0, + args ); + CPPUNIT_ASSERT( xComponent.is() ); + + // Get the document model + SfxObjectShell* pFoundShell = SfxObjectShell::GetShellFromComponent(xComponent); + CPPUNIT_ASSERT_MESSAGE("Failed to access document shell", pFoundShell); + + xDocSh = dynamic_cast<ScDocShell*>(pFoundShell); + CPPUNIT_ASSERT(xDocSh != NULL); + + // Get the document controller + pViewShell = xDocSh->GetBestViewShell(false); + CPPUNIT_ASSERT(pViewShell != NULL); + + // 6. Paste + pViewShell->GetViewData().GetView()->PasteFromClip(IDF_ALL, &aClipDoc); + + xDocSh->DoClose(); +} + ScFiltersTest::ScFiltersTest() : ScBootstrapFixture( "/sc/qa/unit/data" ) { commit 12fd50bfdff0f91cb4a7ae2e90049f25838a2433 Author: Markus Mohrhard <[email protected]> Date: Wed May 13 05:33:24 2015 +0200 the secondary axis should be on the right Change-Id: I604acb0b7f0bf8b726ace07c2fa9919c0f0b6aa6 diff --git a/oox/source/export/chartexport.cxx b/oox/source/export/chartexport.cxx index 8a9c30f..b9b9be5 100644 --- a/oox/source/export/chartexport.cxx +++ b/oox/source/export/chartexport.cxx @@ -2585,7 +2585,7 @@ void ChartExport::exportAxis(const AxisIdPair& rAxisIdPair) nAxisType = XML_valAx; // FIXME: axPos, need to check axis direction - sAxPos = "l"; + sAxPos = "r"; break; } } _______________________________________________ Libreoffice-commits mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
