diff options
author | Bjoern Michaelsen <bjoern.michaelsen@canonical.com> | 2013-04-18 18:26:28 +0200 |
---|---|---|
committer | Bjoern Michaelsen <bjoern.michaelsen@canonical.com> | 2013-04-23 22:20:31 +0200 |
commit | b9337e22ce1dbf2eba0e8c8db294ae99f4111f91 (patch) | |
tree | 53ee1bd3dfd213815a21579151983cb997922b05 /include/unotest | |
parent | f4e1642a1761d5eab6ccdd89928869c2b2f1528a (diff) |
execute move of global headers
see https://gerrit.libreoffice.org/#/c/3367/
and Change-Id: I00c96fa77d04b33a6f8c8cd3490dfcd9bdc9e84a for details
Change-Id: I199a75bc4042af20817265d5ef85b1134a96ff5a
Diffstat (limited to 'include/unotest')
-rw-r--r-- | include/unotest/bootstrapfixturebase.hxx | 81 | ||||
-rw-r--r-- | include/unotest/detail/unotestdllapi.hxx | 34 | ||||
-rw-r--r-- | include/unotest/filters-test.hxx | 74 | ||||
-rw-r--r-- | include/unotest/gettestargument.hxx | 39 | ||||
-rw-r--r-- | include/unotest/macros_test.hxx | 40 | ||||
-rw-r--r-- | include/unotest/officeconnection.hxx | 64 | ||||
-rw-r--r-- | include/unotest/toabsolutefileurl.hxx | 39 | ||||
-rw-r--r-- | include/unotest/uniquepipename.hxx | 37 |
8 files changed, 408 insertions, 0 deletions
diff --git a/include/unotest/bootstrapfixturebase.hxx b/include/unotest/bootstrapfixturebase.hxx new file mode 100644 index 000000000000..3753350f7e21 --- /dev/null +++ b/include/unotest/bootstrapfixturebase.hxx @@ -0,0 +1,81 @@ +/* -*- 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/. + */ +#ifndef INCLUDED_UNOUNOTEST_BOOTSTRAPFIXTUREBASE_HXX +#define INCLUDED_UNOUNOTEST_BOOTSTRAPFIXTUREBASE_HXX + +#include <sal/config.h> + +#include <rtl/string.hxx> +#include <com/sun/star/uno/XComponentContext.hpp> +#include <com/sun/star/lang/XMultiServiceFactory.hpp> +#include <com/sun/star/lang/XMultiComponentFactory.hpp> + +#include "cppunit/TestAssert.h" +#include "cppunit/TestFixture.h" +#include "cppunit/extensions/HelperMacros.h" +#include "cppunit/plugin/TestPlugIn.h" +#include "unotest/detail/unotestdllapi.hxx" + +namespace test { + +// Class to do lots of heavy-lifting UNO & environment +// bootstrapping for unit tests, such that we can use +// almost an entire LibreOffice during compile - so +// that we can get pieces of code alone to beat them up. + +// NB. this class is instantiated multiple times during a +// run of unit tests ... +class OOO_DLLPUBLIC_UNOTEST BootstrapFixtureBase : public CppUnit::TestFixture +{ +protected: + OUString m_aSrcRootURL; + OUString m_aSrcRootPath; + OUString m_aSolverRootURL; + OUString m_aSolverRootPath; + OUString m_aWorkdirRootURL; + OUString m_aWorkdirRootPath; + + com::sun::star::uno::Reference<com::sun::star::uno::XComponentContext> m_xContext; + com::sun::star::uno::Reference<com::sun::star::lang::XMultiServiceFactory> m_xSFactory; + com::sun::star::uno::Reference<com::sun::star::lang::XMultiComponentFactory> m_xFactory; + +public: + BootstrapFixtureBase(); + virtual ~BootstrapFixtureBase(); + + com::sun::star::uno::Reference<com::sun::star::uno::XComponentContext> + getComponentContext() { return m_xContext; } + com::sun::star::uno::Reference<com::sun::star::lang::XMultiServiceFactory> + getMultiServiceFactory() { return m_xSFactory; } + + OUString getSrcRootURL() { return m_aSrcRootURL; } + OUString getSrcRootPath() { return m_aSrcRootPath; } + + // return a URL to a given c-str path from the source directory + OUString getURLFromSrc( const char *pPath ); + + // return a Path to a given c-str path from the source directory + OUString getPathFromSrc( const char *pPath ); + + + // return a URL to a given c-str path from the workdir directory + OUString getURLFromWorkdir( const char *pPath ); + + // return a Path to a given c-str path from the workdir directory + OUString getPathFromWorkdir( const char *pPath ); + virtual void setUp(); + virtual void tearDown(); + +}; + +} + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/unotest/detail/unotestdllapi.hxx b/include/unotest/detail/unotestdllapi.hxx new file mode 100644 index 000000000000..fb850650713f --- /dev/null +++ b/include/unotest/detail/unotestdllapi.hxx @@ -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/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef INCLUDED_UNOTEST_DETAIL_UNOTESTDLLAPI_HXX +#define INCLUDED_UNOTEST_DETAIL_UNOTESTDLLAPI_HXX + +#include "sal/config.h" +#include "sal/types.h" + +#if defined OOO_DLLIMPLEMENTATION_UNOTEST +#define OOO_DLLPUBLIC_UNOTEST SAL_DLLPUBLIC_EXPORT +#else +#define OOO_DLLPUBLIC_UNOTEST SAL_DLLPUBLIC_IMPORT +#endif + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/unotest/filters-test.hxx b/include/unotest/filters-test.hxx new file mode 100644 index 000000000000..7b080c223a11 --- /dev/null +++ b/include/unotest/filters-test.hxx @@ -0,0 +1,74 @@ +/* -*- 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/. + * + * This file incorporates work covered by the following license notice: + * + */ + +#include <comphelper/documentconstants.hxx> +#include <rtl/ustring.hxx> +#include "unotest/detail/unotestdllapi.hxx" + +namespace test { + +enum filterStatus +{ + fail = 0, + pass = 1, + indeterminate = 2 +}; + +/* + * NOTE, any files beginning with CVE-, BID- or EDB- will be assumed to be + * encrypted using arcfour with key 0x435645, this is to silence panicky + * virus/malware-checkers + * + * e.g. m[de]crypt --bare -a arcfour -o hex -k 435645 -s 3 + */ +/* Implementation of Filters test */ +class OOO_DLLPUBLIC_UNOTEST FiltersTest +{ +public: + void testDir( + //filter name + const OUString &rFilter, + //root dir of test files, must contain pass, fail, indeterminate + const OUString &rURL, + //additional filter data for SfxFilter + const OUString &rUserData = OUString(), + //SfxFilterFlags for SfxFilter + unsigned int nFilterFlags = SFX_FILTER_IMPORT, + //Clipboard id for SfxFilter + unsigned int nClipboardID = 0, + //additional filter version for SfxFilter + unsigned int nFilterVersion = 0); + + virtual bool load( + const OUString &rFilter, + const OUString &rURL, + const OUString &rUserData, + unsigned int nFilterFlags, + unsigned int nClipboardID, + unsigned int nFilterVersion) = 0; + +protected: + ~FiltersTest() {} + + void recursiveScan( + filterStatus nExpected, + const OUString &rFilter, + const OUString &rURL, + const OUString &rUserData, + unsigned int nFilterFlags, + unsigned int nClipboardID, + unsigned int nFilterVersion); +}; + +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/unotest/gettestargument.hxx b/include/unotest/gettestargument.hxx new file mode 100644 index 000000000000..3364c5666600 --- /dev/null +++ b/include/unotest/gettestargument.hxx @@ -0,0 +1,39 @@ +/* -*- 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/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef INCLUDED_TEST_GETTESTARGUMENT_HXX +#define INCLUDED_TEST_GETTESTARGUMENT_HXX + +#include "sal/config.h" + +#include "unotest/detail/unotestdllapi.hxx" + + +namespace test { + +// Obtain the value of a test argument (tunneled in via an "arg-testarg.<name>" +// bootstrap variable): +OOO_DLLPUBLIC_UNOTEST bool getTestArgument( + OUString const & name, OUString * value); + +} + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/unotest/macros_test.hxx b/include/unotest/macros_test.hxx new file mode 100644 index 000000000000..f771a6f33634 --- /dev/null +++ b/include/unotest/macros_test.hxx @@ -0,0 +1,40 @@ +/* -*- 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/. + */ + +#ifndef INCLUDED_UNOTEST_MACROS_TEST_HXX +#define INCLUDED_UNOTEST_MACROS_TEST_HXX + +#include <rtl/ustring.hxx> +#include "unotest/detail/unotestdllapi.hxx" + +#include <com/sun/star/lang/XComponent.hpp> +#include <com/sun/star/frame/XDesktop2.hpp> + +struct TestMacroInfo +{ + OUString sFileBaseName; + OUString sMacroUrl; +}; + +namespace unotest { + +class OOO_DLLPUBLIC_UNOTEST MacrosTest +{ +public: + com::sun::star::uno::Reference< com::sun::star::lang::XComponent > loadFromDesktop(const OUString& rURL, const char* pDocService = NULL); + +protected: + com::sun::star::uno::Reference< com::sun::star::frame::XDesktop2> mxDesktop; +}; + +} + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/unotest/officeconnection.hxx b/include/unotest/officeconnection.hxx new file mode 100644 index 000000000000..edef6628ab3a --- /dev/null +++ b/include/unotest/officeconnection.hxx @@ -0,0 +1,64 @@ +/* -*- 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/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef INCLUDED_TEST_OFFICECONNECTION_HXX +#define INCLUDED_TEST_OFFICECONNECTION_HXX + +#include "sal/config.h" + +#include "boost/noncopyable.hpp" +#include "com/sun/star/uno/Reference.hxx" +#include "osl/process.h" +#include "unotest/detail/unotestdllapi.hxx" + +namespace com { namespace sun { namespace star { namespace uno { + class XComponentContext; +} } } } + +namespace test { + +// Start up and shut down an OOo instance (details about the OOo instance are +// tunneled in via "arg-..." bootstrap variables): +class OOO_DLLPUBLIC_UNOTEST OfficeConnection: private boost::noncopyable { +public: + OfficeConnection(); + + ~OfficeConnection(); + + void setUp(); + + void tearDown(); + + com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext > + getComponentContext() const; + + // Must not be called before setUp or after tearDown: + bool isStillAlive() const; + +private: + oslProcess process_; + com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext > + context_; +}; + +} + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/unotest/toabsolutefileurl.hxx b/include/unotest/toabsolutefileurl.hxx new file mode 100644 index 000000000000..1f68c665ed33 --- /dev/null +++ b/include/unotest/toabsolutefileurl.hxx @@ -0,0 +1,39 @@ +/* -*- 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/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef INCLUDED_TEST_TOABSOLUTEFILEURL_HXX +#define INCLUDED_TEST_TOABSOLUTEFILEURL_HXX + +#include "sal/config.h" + +#include "unotest/detail/unotestdllapi.hxx" + + +namespace test { + +// Convert a pathname in system notation, potentially relative to the process's +// current working directory, to an absolute file URL: +OOO_DLLPUBLIC_UNOTEST OUString toAbsoluteFileUrl( + OUString const & relativePathname); + +} + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/unotest/uniquepipename.hxx b/include/unotest/uniquepipename.hxx new file mode 100644 index 000000000000..732856228d6a --- /dev/null +++ b/include/unotest/uniquepipename.hxx @@ -0,0 +1,37 @@ +/* -*- 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/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef INCLUDED_TEST_UNIQUEPIPENAME_HXX +#define INCLUDED_TEST_UNIQUEPIPENAME_HXX + +#include "sal/config.h" + +#include "unotest/detail/unotestdllapi.hxx" + + +namespace test { + +// Create a system-wide unique name (for use with osl::Pipe): +OOO_DLLPUBLIC_UNOTEST OUString uniquePipeName(OUString const & name); + +} + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |