summaryrefslogtreecommitdiffstats
path: root/desktop/qa
diff options
context:
space:
mode:
Diffstat (limited to 'desktop/qa')
-rw-r--r--desktop/qa/data/certificate.derbin0 -> 1306 bytes
-rw-r--r--desktop/qa/desktop_lib/test_desktop_lib.cxx43
2 files changed, 43 insertions, 0 deletions
diff --git a/desktop/qa/data/certificate.der b/desktop/qa/data/certificate.der
new file mode 100644
index 000000000000..2a750ab281af
--- /dev/null
+++ b/desktop/qa/data/certificate.der
Binary files differ
diff --git a/desktop/qa/desktop_lib/test_desktop_lib.cxx b/desktop/qa/desktop_lib/test_desktop_lib.cxx
index 9a8d7b88b0b7..bd8b08f9fac8 100644
--- a/desktop/qa/desktop_lib/test_desktop_lib.cxx
+++ b/desktop/qa/desktop_lib/test_desktop_lib.cxx
@@ -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)