1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
10 #include "sdmodeltestbase.hxx"
12 #include <test/htmltesttools.hxx>
13 #include <test/xmltesttools.hxx>
17 class SdHTMLFilterTest
: public SdModelTestBase
, public XmlTestTools
, public HtmlTestTools
20 htmlDocPtr
exportAndParseHtml(sd::DrawDocShellRef
& xDocShRef
)
22 FileFormat
* pFormat
= getFormat(HTML
);
23 OUString aExt
= "." + OUString::createFromAscii(pFormat
->pName
);
24 utl::TempFile
aTempFile(OUString(), true, &aExt
);
25 aTempFile
.EnableKillingFile();
26 exportTo(xDocShRef
, pFormat
, aTempFile
);
27 return parseHtml(aTempFile
);
34 sd::DrawDocShellRef xDocShRef
= loadURL(getURLFromSrc("/sd/qa/unit/data/HtmlExportTestDocument.odp"), ODP
);
35 htmlDocPtr htmlDoc
= exportAndParseHtml(xDocShRef
);
37 assertXPath(htmlDoc
, "/html", 1);
38 assertXPath(htmlDoc
, "/html/body", 1);
39 assertXPath(htmlDoc
, "/html/body/h1", 4);
40 assertXPath(htmlDoc
, "/html/body/table", 1);
41 assertXPath(htmlDoc
, "/html/body/table/tr", 5);
42 assertXPath(htmlDoc
, "/html/body/ul", 1);
43 assertXPath(htmlDoc
, "/html/body/ul/li", 2);
45 assertXPath(htmlDoc
, "/html/head/meta[1]", "content", "text/html; charset=utf-8");
46 assertXPath(htmlDoc
, "/html/head/meta[2]", "name", "generator");
47 assertXPath(htmlDoc
, "/html/head/meta[3]", "name", "created");
48 assertXPath(htmlDoc
, "/html/head/meta[3]", "content", "2014-04-09T17:05:41.987922038");
51 CPPUNIT_TEST_SUITE(SdHTMLFilterTest
);
52 CPPUNIT_TEST(testHTMLExport
);
53 CPPUNIT_TEST_SUITE_END();
56 CPPUNIT_TEST_SUITE_REGISTRATION(SdHTMLFilterTest
);
58 CPPUNIT_PLUGIN_IMPLEMENT();
60 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */