Hey guys, after we enabled subsequenttests in sc again we have now a lot of failing tests. Instead of debugging the java based tests I plan to rewrite them in c++ and fix them during that.
I have attached a first patch that is only porting one part of a failing test to c++. It would be nice if someone could have a look at it and comment on my concept. The test itself is a bit ridiculous and I think the original author did some concept mistakes in this test. Here are some comments from me: - based on macros_test, and therefore loads a testfile through Desktop::loadComponentFromURL - inits the UI like the old subsequenttests - having test files instead of code that fills the cells make it easier to use the test data outside of the test ( e.g. debugging a problem, having a testdocument with known result for some actions) - only a little bit of code needed for a new test, most code is shared with our in-build tests - porting old tests is straightforward - does not need an installation - needs much more makefile lines than the old tests ( there might be a solution to this ) The concept needs still a lot of love and is only intended as starting point. I hope that this makes debugging subsequenttests easier and writing new tests as easy as writing in-build tests. Do you have comments or suggestions? Regards, Markus
From bbce3329e791a0c9c5c1594bc215c466c3bfb294 Mon Sep 17 00:00:00 2001 From: Markus Mohrhard <markus.mohrh...@googlemail.com> Date: Wed, 30 Nov 2011 14:40:29 +0100 Subject: [PATCH] first try to replace failing subsequentest with c++ test --- sc/Module_sc.mk | 3 +- sc/qa/unoapi/testdocuments/xcellrangesquery.ods | Bin 0 -> 8851 bytes sc/qa/unoapi/xcellrangesquery.cxx | 156 +++++++++++++++++++++++ test/inc/test/unoapi_test.hxx | 64 +++++++++ test/prj/d.lst | 2 +- test/source/makefile.mk | 2 +- test/source/unoapi_test.cxx | 67 ++++++++++ 7 files changed, 290 insertions(+), 4 deletions(-) create mode 100644 sc/qa/unoapi/testdocuments/xcellrangesquery.ods create mode 100644 sc/qa/unoapi/xcellrangesquery.cxx create mode 100644 test/inc/test/unoapi_test.hxx create mode 100644 test/source/unoapi_test.cxx diff --git a/sc/Module_sc.mk b/sc/Module_sc.mk index 0e15220..8619c9d 100644 --- a/sc/Module_sc.mk +++ b/sc/Module_sc.mk @@ -35,8 +35,7 @@ $(eval $(call gb_Module_add_targets,sc,\ )) $(eval $(call gb_Module_add_check_targets,sc,\ - CppunitTest_sc_filters_test \ - CppunitTest_sc_ucalc \ + CppunitTest_sc_unoapi_xcellrangesquery \ )) $(eval $(call gb_Module_add_subsequentcheck_targets,sc,\ diff --git a/sc/qa/unoapi/testdocuments/xcellrangesquery.ods b/sc/qa/unoapi/testdocuments/xcellrangesquery.ods new file mode 100644 index 0000000000000000000000000000000000000000..0435fee9a74e55106d82d9d162564ff532c97fa2 GIT binary patch literal 8851 zcmeHsc|6oz)c9D+mMz+BAt7SMl4WdJvzzR)HI2bAo0+jEAw)uyipVY!2`RFdeTzzV zvQsGgmfwu>@buL4d)|NF&wKdt{oZ@dx#ymH?z!ij3(=vVWCZ}I0RVaDD@uV#*-%jc z06=<(O#l=E1t)l7;ZQ6ViGV=~2n-tNhPD&MK=BB?C<Y5h+hJg?C^(uRipS#MP&>RM z98Q4zjc1Z_)59nV0D$yt^Mn(iq8=!uyb|#bw;LRXCvsKb6%z&Va>LOuj2!~)pulTl ztRW)9tE5OPkFmE$z~JDWfkcQBLAi;fXgv5wmjbUV4h`NG35<rK;CL_r2Hq<hcrP}1 zd!QdJ9!Lb*S%KG)K)`~5KzDa{QFjSZ49)>4CMzoo-0tQ5Ig}mjFFdR(4!MnG2Lr;9 zaMJAYKrvA<;0`WH!v88133snZ7!2mGfk<=sF~#lS#6ciQ;E(T}ksNS#cF4c*_e_9@ zD*<!>+Cd3W5jO<f{RA)fPd)BYxHzxkj&@06D9UdOgFqt)2q;nnMqEz<2B)Y8#W}m; zx%DuPI7cYXP9FGMtRJ-7G{of;Ar1^z6bFfki4cD!K*nMqFh~|GCi#>4?|AZdFz`PJ zB*Efmz-Of7fjgZftUt=Mr|*X(a695G&<-MYuDETpRfHIe=}C$k{S@FI-G8TodBTuz zyrS4I*gu<p;QnQhcmi<*JOKgY-qs8OdI<>^fni+H1fo^*{%C~3kwlIDXp{WehPmVf zhY@yKLA=193*Z1p!-+x@Rj-S<go7Jw+doi3RFcmGjqu>!(`bvuVMsiH5|SX47@vwO z0%<2ACJrKMZCjLGPVzqu2TW>L{OjwlIczuo*t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e+5{X3`9H!hKS%unPgd;qr&fVaF<WnC?9!NSVSebQ78G<_*8n?e%a(#67Ue{)Ynv VqO)&536F*NLql|o1WwY|{{ydkUo!vz literal 0 HcmV?d00001 diff --git a/sc/qa/unoapi/xcellrangesquery.cxx b/sc/qa/unoapi/xcellrangesquery.cxx new file mode 100644 index 0000000..18ffda8 --- /dev/null +++ b/sc/qa/unoapi/xcellrangesquery.cxx @@ -0,0 +1,156 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * Version: MPL 1.1 / GPLv3+ / LGPLv3+ + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License or as specified alternatively below. You may obtain a copy of + * the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * Major Contributor(s): + * [ Copyright (C) 2011 Markus Mohrhard <markus.mohrh...@googlemail.com> (initial developer) ] + * + * All Rights Reserved. + * + * For minor contributions see the git repository. + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 3 or later (the "GPLv3+"), or + * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"), + * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable + * instead of those above. + */ + +#include <test/unoapi_test.hxx> + +#include <com/sun/star/sheet/XSpreadsheetDocument.hpp> +#include <com/sun/star/sheet/XSpreadsheet.hpp> +#include <com/sun/star/sheet/XCellRangesQuery.hpp> +#include <com/sun/star/sheet/XSheetCellRanges.hpp> +#include <com/sun/star/table/CellAddress.hpp> +#include <com/sun/star/sheet/CellFlags.hpp> + +using namespace com::sun::star; + + +namespace ScCellRangeObj { + +class ScXCellRangesQuery : public UnoApiTest +{ +public: + ScXCellRangesQuery(); + + uno::Reference<sheet::XCellRangesQuery> init(); + + void testQueryColumnDifference(); + void testQueryContentDifference(); + void testQueryEmptyCells(); + void testQueryFormulaCells(); + void testQueryIntersection(); + void testQueryRowDifference(); + void testQueryVisibleCells(); + void testSetRowVisible(); + + CPPUNIT_TEST_SUITE(ScXCellRangesQuery); + CPPUNIT_TEST(testQueryColumnDifference); + CPPUNIT_TEST(testQueryContentDifference); + CPPUNIT_TEST(testQueryFormulaCells); + CPPUNIT_TEST_SUITE_END(); + +}; + +ScXCellRangesQuery::ScXCellRangesQuery() +{ + +} + +uno::Reference<sheet::XCellRangesQuery> ScXCellRangesQuery::init() +{ + rtl::OUString aFileURL; + const rtl::OUString aFileBase(RTL_CONSTASCII_USTRINGPARAM("xcellrangesquery.ods")); + createFileURL(aFileBase, aFileURL); + std::cout << rtl::OUStringToOString(aFileURL, RTL_TEXTENCODING_UTF8).getStr() << std::endl; + uno::Reference< lang::XComponent > xComponent = loadFromDesktop(aFileURL); + uno::Reference< sheet::XSpreadsheetDocument> xDoc (xComponent, UNO_QUERY_THROW); + uno::Reference< container::XIndexAccess > xIndex (xDoc->getSheets(), UNO_QUERY_THROW); + uno::Reference< sheet::XSpreadsheet > xSheet( xIndex->getByIndex(0), UNO_QUERY_THROW); + + CPPUNIT_ASSERT_MESSAGE("Could not create interface of type XSpreadsheet", xSheet.is()); + + uno::Reference<sheet::XCellRangesQuery> xReturn(xSheet->getCellRangeByPosition(0,0,3,4), UNO_QUERY_THROW); + + CPPUNIT_ASSERT_MESSAGE("Could not create object of type XCellRangesQuery", xReturn.is()); + return xReturn; +} + +void ScXCellRangesQuery::testQueryColumnDifference() +{ + rtl::OUString aExpected(RTL_CONSTASCII_USTRINGPARAM("Sheet1.B1:C1,Sheet1.B3:C5")); + uno::Reference<sheet::XCellRangesQuery> xCellRangesQuery = init(); + uno::Reference<sheet::XSheetCellRanges> xRanges = xCellRangesQuery->queryColumnDifferences(table::CellAddress(0, 1, 1)); + rtl::OUString aResult = xRanges->getRangeAddressesAsString(); + std::cout << "testQueryColumnDifference: Result: " << rtl::OUStringToOString(aResult, RTL_TEXTENCODING_UTF8).getStr() << std::endl; + CPPUNIT_ASSERT_MESSAGE("testQueryColumnDifference", aResult == aExpected); +} + +void ScXCellRangesQuery::testQueryContentDifference() +{ + rtl::OUString aExpected(RTL_CONSTASCII_USTRINGPARAM("Sheet1.B2:B3")); + uno::Reference<sheet::XCellRangesQuery> xCellRangesQuery = init(); + uno::Reference<sheet::XSheetCellRanges> xRanges = xCellRangesQuery->queryContentCells(sheet::CellFlags::VALUE); + rtl::OUString aResult = xRanges->getRangeAddressesAsString(); + std::cout << "testQueryContentDifference: Result: " << rtl::OUStringToOString(aResult, RTL_TEXTENCODING_UTF8).getStr() << std::endl; + CPPUNIT_ASSERT_MESSAGE("testQueryContentDifference", aResult == aExpected); +} + +void ScXCellRangesQuery::testQueryEmptyCells() +{ + rtl::OUString aExpected(RTL_CONSTASCII_USTRINGPARAM("")); + uno::Reference<sheet::XCellRangesQuery> xCellRangesQuery = init(); + uno::Reference<sheet::XSheetCellRanges> xRanges = xCellRangesQuery->queryEmptyCells(); + rtl::OUString aResult = xRanges->getRangeAddressesAsString(); + //CPPUNIT_ASSERT_MESSAGE("testQueryEmptyCells", aResult == aExpected); +} + +void ScXCellRangesQuery::testQueryFormulaCells() +{ + rtl::OUString aExpected(RTL_CONSTASCII_USTRINGPARAM("Sheet1.C2")); + uno::Reference<sheet::XCellRangesQuery> xCellRangesQuery = init(); + uno::Reference<sheet::XSheetCellRanges> xRanges = xCellRangesQuery->queryContentCells(sheet::CellFlags::FORMULA); + rtl::OUString aResult = xRanges->getRangeAddressesAsString(); + std::cout << "testQueryFormulaCells: Result: " << rtl::OUStringToOString(aResult, RTL_TEXTENCODING_UTF8).getStr() << std::endl; + CPPUNIT_ASSERT_MESSAGE("testQueryFormulaCells", aResult == aExpected); +} + +void ScXCellRangesQuery::testQueryIntersection() +{ + +} + +void ScXCellRangesQuery::testQueryRowDifference() +{ + +} + +void ScXCellRangesQuery::testQueryVisibleCells() +{ + +} + +void ScXCellRangesQuery::testSetRowVisible() +{ + +} + +CPPUNIT_TEST_SUITE_REGISTRATION(ScXCellRangesQuery); + +CPPUNIT_PLUGIN_IMPLEMENT(); + +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/test/inc/test/unoapi_test.hxx b/test/inc/test/unoapi_test.hxx new file mode 100644 index 0000000..54dcff8 --- /dev/null +++ b/test/inc/test/unoapi_test.hxx @@ -0,0 +1,64 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * Version: MPL 1.1 / GPLv3+ / LGPLv3+ + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License or as specified alternatively below. You may obtain a copy of + * the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * Major Contributor(s): + * [ Copyright (C) 2011 Markus Mohrhard <markus.mohrh...@googlemail.com> (initial developer) ] + * + * All Rights Reserved. + * + * For minor contributions see the git repository. + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 3 or later (the "GPLv3+"), or + * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"), + * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable + * instead of those above. + */ + +#include <sal/config.h> +#include <test/bootstrapfixture.hxx> +#include <unotest/macros_test.hxx> +#include <rtl/ustrbuf.hxx> +#include <osl/file.hxx> + +#define ODS_FORMAT_TYPE 50331943 +#define XLS_FORMAT_TYPE 318767171 +#define XLSX_FORMAT_TYPE 268959811 + +#define ODS 0 +#define XLS 1 +#define XLSX 2 + +using namespace ::com::sun::star; +using namespace ::com::sun::star::uno; + +// basic uno api test class + +class OOO_DLLPUBLIC_TEST UnoApiTest : public test::BootstrapFixture, public unotest::MacrosTest +{ +public: + UnoApiTest(); + + void createFileURL(const rtl::OUString& aFileBase, rtl::OUString& rFilePath); + + virtual void setUp(); + virtual void tearDown(); + + +private: + uno::Reference<uno::XInterface> m_xCalcComponent; + rtl::OUString m_aBaseString; +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/test/prj/d.lst b/test/prj/d.lst index 49b0f95..a021852 100644 --- a/test/prj/d.lst +++ b/test/prj/d.lst @@ -6,7 +6,7 @@ mkdir: %_DEST%\inc\test ..\%__SRC%\lib\libtest.dll.a %_DEST%\lib\libtest.dll.a ..\inc\test\testdllapi.hxx %_DEST%\inc\test\testdllapi.hxx ..\inc\test\bootstrapfixture.hxx %_DEST%\inc\test\bootstrapfixture.hxx -..\inc\test\unoapitest.hxx %_DEST%\inc\test\unoapitest.hxx +..\inc\test\unoapi_test.hxx %_DEST%\inc\test\unoapi_test.hxx mkdir: %_DEST%\unittest mkdir: %_DEST%\unittest\user\ mkdir: %_DEST%\unittest\user\autocorr diff --git a/test/source/makefile.mk b/test/source/makefile.mk index 876e263..43f32a6 100644 --- a/test/source/makefile.mk +++ b/test/source/makefile.mk @@ -39,7 +39,7 @@ CFLAGSCXX += $(CPPUNIT_CFLAGS) SLOFILES = \ $(SLO)/bootstrapfixture.obj \ - $(SLO)/unoapitest.obj + $(SLO)/unoapi_test.obj .IF "$(CROSS_COMPILING)" == "YES" SHL1IMPLIB = $(SHL1TARGET) diff --git a/test/source/unoapi_test.cxx b/test/source/unoapi_test.cxx new file mode 100644 index 0000000..0a8213e --- /dev/null +++ b/test/source/unoapi_test.cxx @@ -0,0 +1,67 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * Version: MPL 1.1 / GPLv3+ / LGPLv3+ + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License or as specified alternatively below. You may obtain a copy of + * the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * Major Contributor(s): + * [ Copyright (C) 2011 Markus Mohrhard <markus.mohrh...@googlemail.com> (initial developer) ] + * + * All Rights Reserved. + * + * For minor contributions see the git repository. + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 3 or later (the "GPLv3+"), or + * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"), + * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable + * instead of those above. + */ + +#include "test/unoapi_test.hxx" + +UnoApiTest::UnoApiTest() + : m_aBaseString(RTL_CONSTASCII_USTRINGPARAM("/sc/qa/unoapi/testdocuments")) +{ +} + +void UnoApiTest::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(rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.Calc.SpreadsheetDocument"))); + CPPUNIT_ASSERT_MESSAGE("no calc component!", m_xCalcComponent.is()); + mxDesktop = Reference<com::sun::star::frame::XDesktop>( getMultiServiceFactory()->createInstance( + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.frame.Desktop" ))), UNO_QUERY ); + CPPUNIT_ASSERT_MESSAGE("", mxDesktop.is()); +} + +void UnoApiTest::tearDown() +{ + uno::Reference< lang::XComponent >( m_xCalcComponent, UNO_QUERY_THROW )->dispose(); + test::BootstrapFixture::tearDown(); +} + +void UnoApiTest::createFileURL(const rtl::OUString& aFileBase, rtl::OUString& rFilePath) +{ + rtl::OUString aSep(RTL_CONSTASCII_USTRINGPARAM("/")); + rtl::OUStringBuffer aBuffer( getSrcRootURL() ); + rtl::OUString aFileExtension(RTL_CONSTASCII_USTRINGPARAM("ods")); + aBuffer.append(m_aBaseString).append(aSep); + aBuffer.append(aFileBase); + rFilePath = aBuffer.makeStringAndClear(); +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ -- 1.7.3.4
_______________________________________________ LibreOffice mailing list LibreOffice@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice