summaryrefslogtreecommitdiff
path: root/sw/qa
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2016-03-10 11:23:51 +0100
committerMiklos Vajna <vmiklos@collabora.co.uk>2016-03-10 14:31:54 +0100
commitb1f9369b8181b4f135bfc8a0f1fdf1be7609fd0f (patch)
treec4c830e4f91eada20f2f51687cf68be3291bbfa9 /sw/qa
parente75f6e549eb825c310d16d11babf0fba5ee7fd7a (diff)
RTF import: handle classification during copy&paste
With this, it can't happen that "paste" returns an error, but "paste as rtf" succeeds (from a classification point of view). Change-Id: Ia6807e5a6c065557cdd735a574ea858d29a97160
Diffstat (limited to 'sw/qa')
-rw-r--r--sw/qa/extras/rtfimport/data/classification-confidential.rtf11
-rw-r--r--sw/qa/extras/rtfimport/data/classification-no.rtf1
-rw-r--r--sw/qa/extras/rtfimport/data/classification-yes.rtf11
-rw-r--r--sw/qa/extras/rtfimport/rtfimport.cxx29
4 files changed, 52 insertions, 0 deletions
diff --git a/sw/qa/extras/rtfimport/data/classification-confidential.rtf b/sw/qa/extras/rtfimport/data/classification-confidential.rtf
new file mode 100644
index 000000000000..c7207f9de57d
--- /dev/null
+++ b/sw/qa/extras/rtfimport/data/classification-confidential.rtf
@@ -0,0 +1,11 @@
+{\rtf1{\*\userprops
+{\propname urn:bails:IntellectualProperty:Authorization:StartValidity}\proptype30{\staticval 2016-03-08T10:55:18,531376147}{\propname urn:bails:IntellectualProperty:Authorization:StopValidity}\proptype30{\staticval None}{\propname urn:bails:IntellectualPr
+operty:BusinessAuthorization:Identifier}\proptype30{\staticval urn:example:tscp:1}{\propname urn:bails:IntellectualProperty:BusinessAuthorization:Locator}\proptype30{\staticval None}{\propname urn:bails:IntellectualProperty:BusinessAuthorization:Name}
+\proptype30{\staticval None}{\propname urn:bails:IntellectualProperty:BusinessAuthorizationCategory:Identifier}\proptype30{\staticval urn:example:tscp:1:internal-only}{\propname urn:bails:IntellectualProperty:BusinessAuthorizationCategory:Identifier:OID}
+\proptype30{\staticval None}{\propname urn:bails:IntellectualProperty:BusinessAuthorizationCategory:Locator}\proptype30{\staticval None}{\propname urn:bails:IntellectualProperty:BusinessAuthorizationCategory:Name}\proptype30{\staticval Confidential}
+{\propname urn:bails:IntellectualProperty:Impact:Level:Availability}\proptype30{\staticval 2}{\propname urn:bails:IntellectualProperty:Impact:Level:Confidentiality}\proptype30{\staticval 2}{\propname urn:bails:IntellectualProperty:Impact:Level:Integrity}
+\proptype30{\staticval 2}{\propname urn:bails:IntellectualProperty:Impact:Scale}\proptype30{\staticval UK-Cabinet}{\propname urn:bails:IntellectualProperty:Marking:document-footer}\proptype30{\staticval This content is marked Internal Only. Do not distrib
+ute it outside of the business.}{\propname urn:bails:IntellectualProperty:Marking:document-header}\proptype30{\staticval Classification: Internal Only}{\propname urn:bails:IntellectualProperty:Marking:document-watermark}\proptype30{\staticval Internal Onl
+y}{\propname urn:bails:IntellectualProperty:MarkingPrecedence}\proptype30{\staticval None}{\propname urn:bails:IntellectualProperty:Policy:Identifier}\proptype30{\staticval None}{\propname urn:bails:IntellectualProperty:Policy:Name}\proptype30{\staticval
+TSCP Example Policy}{\propname urn:bails:IntellectualProperty:PolicyAuthority:Country}\proptype30{\staticval None}{\propname urn:bails:IntellectualProperty:PolicyAuthority:Identifier}\proptype30{\staticval None}{\propname urn:bails:IntellectualProperty:Po
+licyAuthority:Name}\proptype30{\staticval TSCP Example Policy Authority}}\par classification-yes\par}
diff --git a/sw/qa/extras/rtfimport/data/classification-no.rtf b/sw/qa/extras/rtfimport/data/classification-no.rtf
new file mode 100644
index 000000000000..7c773d1e2a1c
--- /dev/null
+++ b/sw/qa/extras/rtfimport/data/classification-no.rtf
@@ -0,0 +1 @@
+{\rtf1 \par classification-no\par}
diff --git a/sw/qa/extras/rtfimport/data/classification-yes.rtf b/sw/qa/extras/rtfimport/data/classification-yes.rtf
new file mode 100644
index 000000000000..a40c3d1dbb7b
--- /dev/null
+++ b/sw/qa/extras/rtfimport/data/classification-yes.rtf
@@ -0,0 +1,11 @@
+{\rtf1{\*\userprops
+{\propname urn:bails:IntellectualProperty:Authorization:StartValidity}\proptype30{\staticval 2016-03-08T10:55:18,531376147}{\propname urn:bails:IntellectualProperty:Authorization:StopValidity}\proptype30{\staticval None}{\propname urn:bails:IntellectualPr
+operty:BusinessAuthorization:Identifier}\proptype30{\staticval urn:example:tscp:1}{\propname urn:bails:IntellectualProperty:BusinessAuthorization:Locator}\proptype30{\staticval None}{\propname urn:bails:IntellectualProperty:BusinessAuthorization:Name}
+\proptype30{\staticval None}{\propname urn:bails:IntellectualProperty:BusinessAuthorizationCategory:Identifier}\proptype30{\staticval urn:example:tscp:1:internal-only}{\propname urn:bails:IntellectualProperty:BusinessAuthorizationCategory:Identifier:OID}
+\proptype30{\staticval None}{\propname urn:bails:IntellectualProperty:BusinessAuthorizationCategory:Locator}\proptype30{\staticval None}{\propname urn:bails:IntellectualProperty:BusinessAuthorizationCategory:Name}\proptype30{\staticval Internal Only}
+{\propname urn:bails:IntellectualProperty:Impact:Level:Availability}\proptype30{\staticval 3}{\propname urn:bails:IntellectualProperty:Impact:Level:Confidentiality}\proptype30{\staticval 3}{\propname urn:bails:IntellectualProperty:Impact:Level:Integrity}
+\proptype30{\staticval 3}{\propname urn:bails:IntellectualProperty:Impact:Scale}\proptype30{\staticval UK-Cabinet}{\propname urn:bails:IntellectualProperty:Marking:document-footer}\proptype30{\staticval This content is marked Internal Only. Do not distrib
+ute it outside of the business.}{\propname urn:bails:IntellectualProperty:Marking:document-header}\proptype30{\staticval Classification: Internal Only}{\propname urn:bails:IntellectualProperty:Marking:document-watermark}\proptype30{\staticval Internal Onl
+y}{\propname urn:bails:IntellectualProperty:MarkingPrecedence}\proptype30{\staticval None}{\propname urn:bails:IntellectualProperty:Policy:Identifier}\proptype30{\staticval None}{\propname urn:bails:IntellectualProperty:Policy:Name}\proptype30{\staticval
+TSCP Example Policy}{\propname urn:bails:IntellectualProperty:PolicyAuthority:Country}\proptype30{\staticval None}{\propname urn:bails:IntellectualProperty:PolicyAuthority:Identifier}\proptype30{\staticval None}{\propname urn:bails:IntellectualProperty:Po
+licyAuthority:Name}\proptype30{\staticval TSCP Example Policy Authority}}\par classification-yes\par}
diff --git a/sw/qa/extras/rtfimport/rtfimport.cxx b/sw/qa/extras/rtfimport/rtfimport.cxx
index f8193cdef6b0..a8c8f79a3606 100644
--- a/sw/qa/extras/rtfimport/rtfimport.cxx
+++ b/sw/qa/extras/rtfimport/rtfimport.cxx
@@ -2525,6 +2525,35 @@ DECLARE_RTFIMPORT_TEST(testTdf87034, "tdf87034.rtf")
CPPUNIT_ASSERT_EQUAL(OUString("A1B3C4D"), getParagraph(1)->getString());
}
+DECLARE_RTFIMPORT_TEST(testClassificatonPaste, "hello.rtf")
+{
+ uno::Reference<text::XTextDocument> xTextDocument(mxComponent, uno::UNO_QUERY);
+ uno::Reference<text::XTextRange> xText(xTextDocument->getText(), uno::UNO_QUERY);
+ uno::Reference<text::XTextRange> xEnd = xText->getEnd();
+
+ // Not classified source, not classified destination: OK.
+ paste("classification-no.rtf", xEnd);
+ CPPUNIT_ASSERT_EQUAL(OUString("classification-no"), getParagraph(2)->getString());
+
+ // Classified source, not classified destination: nothing should happen.
+ OUString aOld = xText->getString();
+ paste("classification-yes.rtf", xEnd);
+ CPPUNIT_ASSERT_EQUAL(aOld, xText->getString());
+}
+
+DECLARE_RTFIMPORT_TEST(testClassificatonPasteLevels, "classification-confidential.rtf")
+{
+ uno::Reference<text::XTextDocument> xTextDocument(mxComponent, uno::UNO_QUERY);
+ uno::Reference<text::XTextRange> xText(xTextDocument->getText(), uno::UNO_QUERY);
+ uno::Reference<text::XTextRange> xEnd = xText->getEnd();
+
+ // Classified source and classified destination, but internal only has a
+ // higher level than confidential: nothing should happen.
+ OUString aOld = xText->getString();
+ paste("classification-yes.rtf", xEnd);
+ CPPUNIT_ASSERT_EQUAL(aOld, xText->getString());
+}
+
CPPUNIT_PLUGIN_IMPLEMENT();
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */