svtools/source/svhtml/parhtml.cxx                |    1 
 sw/qa/extras/htmlimport/data/meta-changedby.html |   21 +++++++++++++++++++
 sw/qa/extras/htmlimport/htmlimport.cxx           |   25 +++++++++++++++++++++++
 3 files changed, 47 insertions(+)

New commits:
commit b5a64a8ce15f3b9dacd527f1e7663300af6e2ad2
Author: Jan Holesovsky <ke...@collabora.com>
Date:   Wed May 17 18:35:53 2017 +0200

    html import: Don't create HTML: <meta name="changedby" content="..."> 
postit.
    
    Change-Id: I8deea3b60d9bb86c20539be2ad23e6b07f44e51b
    Reviewed-on: https://gerrit.libreoffice.org/37728
    Reviewed-by: Aron Budea <aron.bu...@collabora.com>
    Tested-by: Aron Budea <aron.bu...@collabora.com>

diff --git a/svtools/source/svhtml/parhtml.cxx 
b/svtools/source/svhtml/parhtml.cxx
index 971821384827..becae25e904b 100644
--- a/svtools/source/svhtml/parhtml.cxx
+++ b/svtools/source/svhtml/parhtml.cxx
@@ -1989,6 +1989,7 @@ bool HTMLParser::ParseMetaOptionsImpl(
         case HTML_META_CHANGEDBY:
             if (i_xDocProps.is()) {
                 i_xDocProps->setModifiedBy( aContent );
+                bChanged = true;
             }
             break;
 
diff --git a/sw/qa/extras/htmlimport/data/meta-changedby.html 
b/sw/qa/extras/htmlimport/data/meta-changedby.html
new file mode 100644
index 000000000000..b228b31073f7
--- /dev/null
+++ b/sw/qa/extras/htmlimport/data/meta-changedby.html
@@ -0,0 +1,21 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+<head>
+       <meta http-equiv="content-type" content="text/html; charset=utf-8"/>
+       <title></title>
+       <meta name="generator" content="LibreOfficeDev 5.4.0.0.alpha1 (Linux)"/>
+       <meta name="created" content="2017-05-07T12:34:03.921000000"/>
+       <meta name="changed" content="20170508;124700386000000"/>
+       <meta name="changedby" content="Blah">
+       <style type="text/css">
+               @page { size: 21cm 29.7cm; margin: 2cm }
+               p { margin-bottom: 0.25cm; line-height: 120% }
+               td p { margin-bottom: 0cm }
+       </style>
+</head>
+<body>
+<p>
+Test
+</p>
+</body>
+</html>
diff --git a/sw/qa/extras/htmlimport/htmlimport.cxx 
b/sw/qa/extras/htmlimport/htmlimport.cxx
index f32bdb4b2a4b..55c2a9c38a23 100644
--- a/sw/qa/extras/htmlimport/htmlimport.cxx
+++ b/sw/qa/extras/htmlimport/htmlimport.cxx
@@ -148,6 +148,31 @@ DECLARE_HTMLIMPORT_TEST(testMetaIsoDates, 
"meta-ISO8601-dates.html")
     CPPUNIT_ASSERT_EQUAL(DateTime(Date(8, 5, 2017), tools::Time(12, 47, 0, 
386000000)), aModified);
 }
 
+DECLARE_HTMLIMPORT_TEST(testChangedby, "meta-changedby.html")
+{
+    SwXTextDocument* pTextDoc = dynamic_cast<SwXTextDocument 
*>(mxComponent.get());
+    CPPUNIT_ASSERT(pTextDoc);
+    SwDocShell* pDocShell(pTextDoc->GetDocShell());
+    uno::Reference<document::XDocumentProperties> xDocProps;
+
+    CPPUNIT_ASSERT(pDocShell);
+    uno::Reference<document::XDocumentPropertiesSupplier> 
xDPS(pDocShell->GetModel(), uno::UNO_QUERY);
+    xDocProps.set(xDPS->getDocumentProperties());
+
+    // get the document properties
+    CPPUNIT_ASSERT(xDocProps.is());
+
+    // the doc's property ModifiedBy is set correctly, ...
+    CPPUNIT_ASSERT_EQUAL(OUString("Blah"), xDocProps->getModifiedBy());
+
+    uno::Reference<text::XTextFieldsSupplier> xTextFieldsSupplier(mxComponent, 
uno::UNO_QUERY);
+    uno::Reference<container::XEnumerationAccess> 
xFieldsAccess(xTextFieldsSupplier->getTextFields());
+    uno::Reference<container::XEnumeration> 
xFields(xFieldsAccess->createEnumeration());
+
+    // ...but there is no comment 'HTML: <meta name="changedby" 
content="Blah">'
+    CPPUNIT_ASSERT(!xFields->hasMoreElements());
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to