Kaydet (Commit) d2242cb1 authored tarafından Tomaž Vajngerl's avatar Tomaž Vajngerl Kaydeden (comit) Tomaž Vajngerl

lokit: test for the new signing API functions

Change-Id: I3ab2f3986955eb82451704fc2386b64f208da554
Reviewed-on: https://gerrit.libreoffice.org/61782
Tested-by: Jenkins
Reviewed-by: 's avatarTomaž Vajngerl <quikee@gmail.com>
üst 2077c5e4
......@@ -29,6 +29,7 @@ $(eval $(call gb_CppunitTest_use_libraries,desktop_lib, \
test \
unotest \
utl \
tl \
vcl \
))
......@@ -48,37 +49,7 @@ $(eval $(call gb_CppunitTest_use_ure,desktop_lib))
$(eval $(call gb_CppunitTest_use_vcl,desktop_lib))
$(eval $(call gb_CppunitTest_use_components,desktop_lib,\
comphelper/util/comphelp \
configmgr/source/configmgr \
dtrans/util/mcnttype \
filter/source/config/cache/filterconfig1 \
filter/source/storagefilterdetect/storagefd \
framework/util/fwk \
i18npool/util/i18npool \
package/source/xstor/xstor \
package/util/package2 \
sax/source/expatwrap/expwrap \
sfx2/util/sfx \
svl/source/fsstor/fsstorage \
svtools/util/svt \
sw/util/sw \
sw/util/swd \
sc/util/sc \
sc/util/scd \
sd/util/sd \
sd/util/sdd \
toolkit/util/tk \
ucb/source/core/ucb1 \
ucb/source/ucp/file/ucpfile1 \
unoxml/source/service/unoxml \
uui/util/uui \
vcl/vcl.common \
xmloff/util/xo \
i18npool/source/search/i18nsearch \
filter/source/graphic/graphicfilter \
linguistic/source/lng \
))
$(eval $(call gb_CppunitTest_use_rdb,desktop_lib,services))
$(eval $(call gb_CppunitTest_use_configuration,desktop_lib))
......
......@@ -19,6 +19,8 @@
#include <com/sun/star/text/TextContentAnchorType.hpp>
#include <boost/property_tree/json_parser.hpp>
#include <com/sun/star/frame/XStorable.hpp>
#include <vcl/scheduler.hxx>
#include <comphelper/processfactory.hxx>
#include <rtl/uri.hxx>
......@@ -116,6 +118,8 @@ public:
void testCommentsCallbacksWriter();
void testRunMacro();
void testExtractParameter();
void testGetSignatureState();
void testInsertCertificate();
void testABI();
CPPUNIT_TEST_SUITE(DesktopLOKTest);
......@@ -159,6 +163,8 @@ public:
CPPUNIT_TEST(testCommentsCallbacksWriter);
CPPUNIT_TEST(testRunMacro);
CPPUNIT_TEST(testExtractParameter);
CPPUNIT_TEST(testGetSignatureState);
CPPUNIT_TEST(testInsertCertificate);
CPPUNIT_TEST(testABI);
CPPUNIT_TEST_SUITE_END();
......@@ -2240,6 +2246,43 @@ void DesktopLOKTest::testExtractParameter()
comphelper::LibreOfficeKit::setActive(false);
}
void DesktopLOKTest::testGetSignatureState()
{
comphelper::LibreOfficeKit::setActive();
LibLODocument_Impl* pDocument = loadDoc("blank_text.odt");
Scheduler::ProcessEventsToIdle();
pDocument->m_pDocumentClass->initializeForRendering(pDocument, "{}");
int nState = pDocument->m_pDocumentClass->getSignatureState(pDocument);
CPPUNIT_ASSERT_EQUAL(int(0), nState);
comphelper::LibreOfficeKit::setActive(false);
}
void DesktopLOKTest::testInsertCertificate()
{
comphelper::LibreOfficeKit::setActive();
LibLODocument_Impl* pDocument = loadDoc("blank_text.odt");
Scheduler::ProcessEventsToIdle();
CPPUNIT_ASSERT(mxComponent.is());
pDocument->m_pDocumentClass->initializeForRendering(pDocument, "{}");
OUString aFileURL;
createFileURL("certificate.der", aFileURL);
SvFileStream aStream(aFileURL, StreamMode::READ);
sal_uInt64 nSize = aStream.remainingSize();
std::vector<unsigned char> aCertificate;
aCertificate.resize(nSize);
aStream.ReadBytes(aCertificate.data(), nSize);
bool bResult = pDocument->m_pDocumentClass->insertCertificate(pDocument, aCertificate.data(), int(aCertificate.size()));
CPPUNIT_ASSERT(bResult);
comphelper::LibreOfficeKit::setActive(false);
}
namespace {
constexpr size_t documentClassOffset(int i)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment