summaryrefslogtreecommitdiff
path: root/sw/qa/extras
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2016-11-18 11:17:40 +0300
committerMiklos Vajna <vmiklos@collabora.co.uk>2016-11-21 10:04:44 +0100
commit79e518039504496aa8ce1c6b2b36ede88de0fe1c (patch)
treee818370f2f261309203878901d7039cf7d6fe3c9 /sw/qa/extras
parent78531c664163f54a9116b06b35a85243110d8352 (diff)
tdf#95699: allow copy FORMCHECKBOX and FORMDROPDOWN ...
... when they are selected alone (no adjacent text selected). Unit test included. Change-Id: Ia278ae2ea86a3e6d83e1a628880f770f1eb11cd7 Reviewed-on: https://gerrit.libreoffice.org/30954 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com> Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk> (cherry picked from commit de524d2051abd700f93da4e0e9f273504b12515a)
Diffstat (limited to 'sw/qa/extras')
-rw-r--r--sw/qa/extras/uiwriter/data/tdf95699.odtbin0 -> 8925 bytes
-rw-r--r--sw/qa/extras/uiwriter/uiwriter.cxx20
2 files changed, 20 insertions, 0 deletions
diff --git a/sw/qa/extras/uiwriter/data/tdf95699.odt b/sw/qa/extras/uiwriter/data/tdf95699.odt
new file mode 100644
index 000000000000..79cf8586ced2
--- /dev/null
+++ b/sw/qa/extras/uiwriter/data/tdf95699.odt
Binary files differ
diff --git a/sw/qa/extras/uiwriter/uiwriter.cxx b/sw/qa/extras/uiwriter/uiwriter.cxx
index 531d15ebac17..1a37476f21e2 100644
--- a/sw/qa/extras/uiwriter/uiwriter.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter.cxx
@@ -198,6 +198,7 @@ public:
void testRedlineTimestamp();
void testCursorWindows();
void testLandscape();
+ void testTdf95699();
CPPUNIT_TEST_SUITE(SwUiWriterTest);
CPPUNIT_TEST(testReplaceForward);
@@ -297,6 +298,7 @@ public:
CPPUNIT_TEST(testRedlineTimestamp);
CPPUNIT_TEST(testCursorWindows);
CPPUNIT_TEST(testLandscape);
+ CPPUNIT_TEST(testTdf95699);
CPPUNIT_TEST_SUITE_END();
private:
@@ -3464,6 +3466,24 @@ void SwUiWriterTest::testLandscape()
CPPUNIT_ASSERT(pWrtShell->GetPageDesc(nPageDesc).GetLandscape());
}
+void SwUiWriterTest::testTdf95699()
+{
+ // Open the document with single FORMCHECKBOX field, select all and copy to clipboard
+ // then check that clipboard contains the FORMCHECKBOX in text body.
+ // Previously that failed.
+ SwDoc* pDoc = createDoc("tdf95699.odt");
+ IDocumentMarkAccess* pMarkAccess = pDoc->getIDocumentMarkAccess();
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(1), pMarkAccess->getAllMarksCount());
+ SwDoc aClipboard;
+ SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
+ pWrtShell->SelAll();
+ pWrtShell->Copy(&aClipboard);
+ pMarkAccess = aClipboard.getIDocumentMarkAccess();
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(1), pMarkAccess->getAllMarksCount());
+ ::sw::mark::IFieldmark* pFieldMark = pMarkAccess->getFieldmarkAfter(SwPosition(pDoc->GetNodes().GetEndOfExtras()));
+ CPPUNIT_ASSERT_EQUAL(OUString("vnd.oasis.opendocument.field.FORMCHECKBOX"), pFieldMark->GetFieldname());
+}
+
CPPUNIT_TEST_SUITE_REGISTRATION(SwUiWriterTest);
CPPUNIT_PLUGIN_IMPLEMENT();