1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
10 #ifndef INCLUDED_UNOTEST_MACROS_TEST_HXX
11 #define INCLUDED_UNOTEST_MACROS_TEST_HXX
13 #include <sal/config.h>
17 #include <config_gpgme.h>
18 #include <rtl/ustring.hxx>
19 #include <unotest/detail/unotestdllapi.hxx>
21 #include <com/sun/star/lang/XComponent.hpp>
22 #include <com/sun/star/frame/XDesktop2.hpp>
23 #include <com/sun/star/uno/XComponentContext.hpp>
24 #include <com/sun/star/uno/Any.h>
29 OUString sFileBaseName
;
41 namespace com::sun::star::security
45 namespace com::sun::star::xml::crypto
47 class XSecurityEnvironment
;
52 class OOO_DLLPUBLIC_UNOTEST MacrosTest
58 std::function
<void()> m_Func
;
61 Resetter(std::function
<void()> aFunc
)
62 : m_Func(std::move(aFunc
))
71 catch (...) // has to be reliable
73 fprintf(stderr
, "resetter failed with exception\n");
82 css::uno::Reference
<css::lang::XComponent
>
83 loadFromDesktop(const OUString
& rURL
, const OUString
& rDocService
= OUString(),
84 const css::uno::Sequence
<css::beans::PropertyValue
>& rExtra_args
85 = css::uno::Sequence
<css::beans::PropertyValue
>());
88 dispatchCommand(const css::uno::Reference
<css::lang::XComponent
>& xComponent
,
89 const OUString
& rCommand
,
90 const css::uno::Sequence
<css::beans::PropertyValue
>& rPropertyValues
);
93 queryDispatchStatus(css::uno::Reference
<css::lang::XComponent
> const& xComponent
,
94 css::uno::Reference
<css::uno::XComponentContext
> const& xContext
,
95 OUString
const& rURL
);
97 /// Opens rStreamName from rTempFile, assuming it's a ZIP storage.
98 static std::unique_ptr
<SvStream
> parseExportStream(const OUString
& url
,
99 const OUString
& rStreamName
);
101 // note: there is no tearDownX509
102 void setUpX509(const test::Directories
& rDirectories
, const OUString
& rTestName
);
103 static void setUpGpg(const test::Directories
& rDirectories
, std::u16string_view rTestName
);
104 static void tearDownGpg();
106 static bool IsValid(const css::uno::Reference
<css::security::XCertificate
>& cert
,
107 const css::uno::Reference
<css::xml::crypto::XSecurityEnvironment
>& env
);
108 static css::uno::Reference
<css::security::XCertificate
> GetValidCertificate(
109 const css::uno::Sequence
<css::uno::Reference
<css::security::XCertificate
>>& certs
,
110 const css::uno::Reference
<css::xml::crypto::XSecurityEnvironment
>& env
,
111 const css::uno::Sequence
<css::beans::PropertyValue
>& rFilterData
= {});
114 css::uno::Reference
<css::frame::XDesktop2
> mxDesktop
;
117 std::unique_ptr
<BasicDLL
> mpDll
;
123 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */