summaryrefslogtreecommitdiff
path: root/sfx2/qa/cppunit
diff options
context:
space:
mode:
Diffstat (limited to 'sfx2/qa/cppunit')
-rw-r--r--sfx2/qa/cppunit/view.cxx11
1 files changed, 10 insertions, 1 deletions
diff --git a/sfx2/qa/cppunit/view.cxx b/sfx2/qa/cppunit/view.cxx
index 4c8e47582643..e481d7186ce0 100644
--- a/sfx2/qa/cppunit/view.cxx
+++ b/sfx2/qa/cppunit/view.cxx
@@ -24,6 +24,8 @@
#include <sfx2/lokhelper.hxx>
#include <sfx2/sfxbasemodel.hxx>
#include <tools/json_writer.hxx>
+#include <rtl/ustrbuf.hxx>
+#include <comphelper/base64.hxx>
using namespace com::sun::star;
@@ -123,7 +125,7 @@ CPPUNIT_TEST_FIXTURE(Sfx2ViewTest, testLokHelperCommandValuesSignature)
SfxLokHelper::getCommandValues(aWriter, ".uno:Signature");
OString aJson = aWriter.finishAndGetAsOString();
- // Then make sure that we get a signature time:
+ // Then make sure that we get a signature time and a hash:
CPPUNIT_ASSERT(SfxLokHelper::supportsCommand(u"Signature"));
std::stringstream aStream{ std::string(aJson) };
boost::property_tree::ptree aTree;
@@ -133,6 +135,13 @@ CPPUNIT_TEST_FIXTURE(Sfx2ViewTest, testLokHelperCommandValuesSignature)
CPPUNIT_ASSERT(it != aTree.not_found());
auto nSignatureTime = it->second.get_value<sal_Int64>();
CPPUNIT_ASSERT(nSignatureTime != 0);
+ // Base64 encoded hash, that has the SHA-256 length:
+ it = aTree.find("digest");
+ CPPUNIT_ASSERT(it != aTree.not_found());
+ auto aDigest = OUString::fromUtf8(it->second.get_value<std::string>());
+ uno::Sequence<sal_Int8> aBytes;
+ comphelper::Base64::decode(aBytes, aDigest);
+ CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(32), aBytes.getLength());
}
#endif