diff options
author | Matúš Kukan <matus.kukan@collabora.com> | 2014-09-17 11:56:24 +0200 |
---|---|---|
committer | Matúš Kukan <matus.kukan@collabora.com> | 2014-09-17 19:08:15 +0200 |
commit | bcf8dc3d9b9d2df6f6a67c71efc52630ff65371b (patch) | |
tree | 344d8804358b5b91433ae88d5fe1f0cdc108e08b /sw/qa/extras/htmlimport | |
parent | 3914a711060341345f15b83656457f90095f32d6 (diff) |
sw: html import test: local images shouldn't be file links (bnc#580834)
Change-Id: Id35e03a3f814609e40e4beea778e66cce39054d1
Diffstat (limited to 'sw/qa/extras/htmlimport')
-rw-r--r-- | sw/qa/extras/htmlimport/data/picture.html | 23 | ||||
-rw-r--r-- | sw/qa/extras/htmlimport/htmlimport.cxx | 35 |
2 files changed, 58 insertions, 0 deletions
diff --git a/sw/qa/extras/htmlimport/data/picture.html b/sw/qa/extras/htmlimport/data/picture.html new file mode 100644 index 000000000000..c0b2e6cdb376 --- /dev/null +++ b/sw/qa/extras/htmlimport/data/picture.html @@ -0,0 +1,23 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> +<html xmlns="http://www.w3.org/1999/xhtml" lang="en"> + <body> + <div> + <p> + This document should contain only one link. (Edit -> Links...) + </p> + <p> + The picture below is supposed to be fully inserted into the document, not just as a link. + <br/> + <a style="display:inline-block;" href="http://www.libreoffice.org/" title="Go to the Home of LibreOffice and the LibreOffice Community page"> + <img src="../../../../../odk/docs/images/sdk_head-1.png" width="377" height="120px"/> + </a> + </p> + This one is supposed to be inserted as a link, since the source is "http://..." URL. + <br/> + <a style="display:inline-block;" href="http://www.libreoffice.org/" title="Go to the Home of LibreOffice and the LibreOffice Community page"> + <img src="http://www.libreoffice.org/themes/libo/images/logo.png" width="218px" height="45px"/> + </a> + </p> + </div> + </body> +</html> diff --git a/sw/qa/extras/htmlimport/htmlimport.cxx b/sw/qa/extras/htmlimport/htmlimport.cxx new file mode 100644 index 000000000000..86b7b86372b8 --- /dev/null +++ b/sw/qa/extras/htmlimport/htmlimport.cxx @@ -0,0 +1,35 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +#include <swmodeltestbase.hxx> + +#include <sfx2/linkmgr.hxx> + +#include <docsh.hxx> +#include <editsh.hxx> + +class HtmlImportTest : public SwModelTestBase +{ + public: + HtmlImportTest() : SwModelTestBase("sw/qa/extras/htmlimport/data/", "HTML (StarWriter)") {} +}; + +#define DECLARE_HTMLIMPORT_TEST(TestName, filename) DECLARE_SW_IMPORT_TEST(TestName, filename, HtmlImportTest) + +DECLARE_HTMLIMPORT_TEST(testPictureImport, "picture.html") +{ + SwXTextDocument* pTxtDoc = dynamic_cast<SwXTextDocument *>(mxComponent.get()); + CPPUNIT_ASSERT(pTxtDoc); + // The document contains one embeded picture and one stored as a link. + const sfx2::LinkManager& rLinkManager = pTxtDoc->GetDocShell()->GetDoc()->GetEditShell()->GetLinkManager(); + CPPUNIT_ASSERT_EQUAL(size_t(1), rLinkManager.GetLinks().size()); +} + +CPPUNIT_PLUGIN_IMPLEMENT(); + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |