summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2016-03-09 11:32:12 +0100
committerMiklos Vajna <vmiklos@collabora.co.uk>2016-03-09 14:18:28 +0100
commit38dd218425b3e4a56d71af7082eea1dda24b48da (patch)
treeca758beee55c3958d4e67436b4309b3d285b92d4 /sw
parent76e2cede5a415df8d3e7a874f56be7a0b5953e12 (diff)
CppunitTest_sw_uiwriter: add classification copy/paste testcase
Change-Id: Ic3ac02fe28bee0ea3189fb2c9d3548f5ca13fe5c
Diffstat (limited to 'sw')
-rw-r--r--sw/qa/extras/uiwriter/uiwriter.cxx27
1 files changed, 27 insertions, 0 deletions
diff --git a/sw/qa/extras/uiwriter/uiwriter.cxx b/sw/qa/extras/uiwriter/uiwriter.cxx
index 96e8cd597a9f..fced549e4585 100644
--- a/sw/qa/extras/uiwriter/uiwriter.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter.cxx
@@ -89,6 +89,7 @@
#include <txtfrm.hxx>
#include <editeng/svxenum.hxx>
#include <comphelper/propertysequence.hxx>
+#include <sfx2/classificationhelper.hxx>
#include <LibreOfficeKit/LibreOfficeKitEnums.h>
static const char* DATA_DIRECTORY = "/sw/qa/extras/uiwriter/data/";
@@ -187,6 +188,7 @@ public:
void testTdf96536();
void testTdf96479();
void testTdf96961();
+ void testClassificationPaste();
CPPUNIT_TEST_SUITE(SwUiWriterTest);
CPPUNIT_TEST(testReplaceForward);
@@ -277,6 +279,7 @@ public:
CPPUNIT_TEST(testTdf96536);
CPPUNIT_TEST(testTdf96479);
CPPUNIT_TEST(testTdf96961);
+ CPPUNIT_TEST(testClassificationPaste);
CPPUNIT_TEST_SUITE_END();
private:
@@ -3246,6 +3249,30 @@ void SwUiWriterTest::testTdf96961()
CPPUNIT_ASSERT(nLast > nOther);
}
+void SwUiWriterTest::testClassificationPaste()
+{
+ SwDocShell* pSourceShell = createDoc()->GetDocShell();
+ uno::Reference<lang::XComponent> xSourceComponent = mxComponent;
+ mxComponent.clear();
+
+ SwDocShell* pDestinationShell = createDoc()->GetDocShell();
+
+ // Not classified source, not classified destination.
+ CPPUNIT_ASSERT_EQUAL(int(SfxClassificationCheckPasteResult::None), int(SfxClassificationHelper::CheckPaste(*pSourceShell, *pDestinationShell)));
+
+ // Classified source, not classified destination.
+ uno::Sequence<beans::PropertyValue> aInternalOnly = comphelper::InitPropertySequence({{"Name", uno::makeAny(OUString("Internal Only"))}});
+ lcl_dispatchCommand(xSourceComponent, ".uno:ClassificationApply", aInternalOnly);
+ CPPUNIT_ASSERT_EQUAL(int(SfxClassificationCheckPasteResult::TargetDocNotClassified), int(SfxClassificationHelper::CheckPaste(*pSourceShell, *pDestinationShell)));
+
+ // Classified source and classified destination -- internal only has a higher level than confidential.
+ uno::Sequence<beans::PropertyValue> aConfidential = comphelper::InitPropertySequence({{"Name", uno::makeAny(OUString("Confidential"))}});
+ lcl_dispatchCommand(mxComponent, ".uno:ClassificationApply", aConfidential);
+ CPPUNIT_ASSERT_EQUAL(int(SfxClassificationCheckPasteResult::DocClassificationTooLow), int(SfxClassificationHelper::CheckPaste(*pSourceShell, *pDestinationShell)));
+
+ xSourceComponent->dispose();
+}
+
CPPUNIT_TEST_SUITE_REGISTRATION(SwUiWriterTest);
CPPUNIT_PLUGIN_IMPLEMENT();