LCOV - code coverage report
Current view: top level - test/source - htmltesttools.cxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 12 12 100.0 %
Date: 2014-11-03 Functions: 2 2 100.0 %
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 <test/htmltesttools.hxx>
      11             : 
      12             : #include <boost/scoped_array.hpp>
      13             : 
      14          18 : htmlDocPtr HtmlTestTools::parseHtml(utl::TempFile& aTempFile)
      15             : {
      16          18 :     SvFileStream aFileStream(aTempFile.GetURL(), STREAM_READ);
      17          18 :     htmlDocPtr doc = parseHtmlStream(&aFileStream);
      18          18 :     xmlFree(doc->name);
      19             :     doc->name = reinterpret_cast<char *>(
      20             :         xmlStrdup(
      21             :             reinterpret_cast<xmlChar const *>(
      22             :                 OUStringToOString(
      23          18 :                     aTempFile.GetURL(), RTL_TEXTENCODING_UTF8).getStr())));
      24          18 :     return doc;
      25             : }
      26             : 
      27          18 : htmlDocPtr HtmlTestTools::parseHtmlStream(SvStream* pStream)
      28             : {
      29          18 :     sal_Size nSize = pStream->remainingSize();
      30          18 :     boost::scoped_array<sal_uInt8> pBuffer(new sal_uInt8[nSize + 1]);
      31          18 :     pStream->Read(pBuffer.get(), nSize);
      32          18 :     pBuffer[nSize] = 0;
      33          18 :     return htmlParseDoc(reinterpret_cast<xmlChar*>(pBuffer.get()), NULL);
      34             : }
      35             : 
      36             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10