LCOV - code coverage report
Current view: top level - sd/qa/unit - HtmlExportTest.cxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 28 28 100.0 %
Date: 2014-11-03 Functions: 11 12 91.7 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       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             :  */
       9             : 
      10             : #include "sdmodeltestbase.hxx"
      11             : 
      12             : #include <test/htmltesttools.hxx>
      13             : #include <test/xmltesttools.hxx>
      14             : 
      15             : using namespace css;
      16             : 
      17           6 : class SdHTMLFilterTest : public SdModelTestBase, public XmlTestTools, public HtmlTestTools
      18             : {
      19             : private:
      20           2 :     htmlDocPtr exportAndParseHtml(sd::DrawDocShellRef& xDocShRef)
      21             :     {
      22           2 :         FileFormat* pFormat = getFormat(HTML);
      23           2 :         OUString aExt = OUString( "." ) + OUString::createFromAscii(pFormat->pName);
      24           4 :         utl::TempFile aTempFile(OUString(), true, &aExt);
      25           2 :         aTempFile.EnableKillingFile();
      26           2 :         exportTo(xDocShRef, pFormat, aTempFile);
      27           4 :         return parseHtml(aTempFile);
      28             :     }
      29             : 
      30             : public:
      31             : 
      32           2 :     void testHTMLExport()
      33             :     {
      34           2 :         sd::DrawDocShellRef xDocShRef = loadURL(getURLFromSrc("/sd/qa/unit/data/HtmlExportTestDocument.odp"), ODP);
      35           2 :         htmlDocPtr htmlDoc = exportAndParseHtml(xDocShRef);
      36             : 
      37           2 :         assertXPath(htmlDoc, "/html", 1);
      38           2 :         assertXPath(htmlDoc, "/html/body", 1);
      39           2 :         assertXPath(htmlDoc, "/html/body/h1", 4);
      40           2 :         assertXPath(htmlDoc, "/html/body/table", 1);
      41           2 :         assertXPath(htmlDoc, "/html/body/table/tr", 5);
      42           2 :         assertXPath(htmlDoc, "/html/body/ul", 1);
      43           2 :         assertXPath(htmlDoc, "/html/body/ul/li", 2);
      44             : 
      45           2 :         assertXPath(htmlDoc, "/html/head/meta[1]", "content", "text/html; charset=utf-8");
      46           2 :         assertXPath(htmlDoc, "/html/head/meta[2]", "name", "generator");
      47           2 :         assertXPath(htmlDoc, "/html/head/meta[3]", "name", "created");
      48           2 :         assertXPath(htmlDoc, "/html/head/meta[3]", "content", "2014-04-09T17:05:41.987922038");
      49           2 :     }
      50             : 
      51           4 :     CPPUNIT_TEST_SUITE(SdHTMLFilterTest);
      52           2 :     CPPUNIT_TEST(testHTMLExport);
      53           4 :     CPPUNIT_TEST_SUITE_END();
      54             : };
      55             : 
      56           2 : CPPUNIT_TEST_SUITE_REGISTRATION(SdHTMLFilterTest);
      57             : 
      58           8 : CPPUNIT_PLUGIN_IMPLEMENT();
      59             : 
      60             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10