Version 7.6.3.2-android, tag libreoffice-7.6.3.2-android
[LibreOffice.git] / sd / qa / unit / HtmlExportTest.cxx
blob93c1a21339d152c788dfb3f8ab8254f4807f42b3
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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/.
8 */
10 #include <test/unoapixml_test.hxx>
11 #include <test/htmltesttools.hxx>
13 using namespace css;
15 class SdHTMLFilterTest : public UnoApiXmlTest, public HtmlTestTools
17 public:
18 SdHTMLFilterTest()
19 : UnoApiXmlTest("/sd/qa/unit/data/")
23 void testHTMLExport()
25 loadFromURL(u"HtmlExportTestDocument.odp");
26 save("impress_html_Export");
27 htmlDocUniquePtr htmlDoc = parseHtml(maTempFile);
29 assertXPath(htmlDoc, "/html", 1);
30 assertXPath(htmlDoc, "/html/body", 1);
31 assertXPath(htmlDoc, "/html/body/h1", 4);
32 assertXPath(htmlDoc, "/html/body/table", 1);
33 assertXPath(htmlDoc, "/html/body/table/tr", 5);
34 assertXPath(htmlDoc, "/html/body/ul", 1);
35 assertXPath(htmlDoc, "/html/body/ul/li", 2);
37 assertXPath(htmlDoc, "/html/head/meta[1]", "content", "text/html; charset=utf-8");
38 assertXPath(htmlDoc, "/html/head/meta[2]", "name", "generator");
39 assertXPath(htmlDoc, "/html/head/meta[3]", "name", "created");
40 assertXPath(htmlDoc, "/html/head/meta[3]", "content", "2014-04-09T17:05:41.987922038");
43 void testTdf154989()
45 loadFromURL(u"tdf154989.odg");
46 save("XHTML Draw File");
47 xmlDocUniquePtr pXmlDoc = parseXml(maTempFile);
49 assertXPath(pXmlDoc, "/xhtml:html", 1);
50 // 1 page
51 assertXPath(pXmlDoc, "/xhtml:html/xhtml:body/xhtml:div", 1);
52 // 4 shapes
53 assertXPath(pXmlDoc, "/xhtml:html/xhtml:body/xhtml:div[1]/xhtml:div", 4);
54 // 3 of them are text boxes
55 assertXPath(pXmlDoc, "/xhtml:html/xhtml:body/xhtml:div[1]/xhtml:div/xhtml:div", 3);
56 // not sure if the order of these is stable?
57 assertXPathContent(pXmlDoc,
58 "/xhtml:html/xhtml:body/xhtml:div[1]/xhtml:div[2]/xhtml:div/xhtml:p",
59 "before");
60 assertXPathContent(
61 pXmlDoc, "/xhtml:html/xhtml:body/xhtml:div[1]/xhtml:div[3]/xhtml:div/xhtml:p", "above");
62 assertXPathContent(
63 pXmlDoc, "/xhtml:html/xhtml:body/xhtml:div[1]/xhtml:div[4]/xhtml:div/xhtml:p", "below");
66 CPPUNIT_TEST_SUITE(SdHTMLFilterTest);
67 CPPUNIT_TEST(testHTMLExport);
68 CPPUNIT_TEST(testTdf154989);
69 CPPUNIT_TEST_SUITE_END();
72 CPPUNIT_TEST_SUITE_REGISTRATION(SdHTMLFilterTest);
74 CPPUNIT_PLUGIN_IMPLEMENT();
76 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */