Kaydet (Commit) fa8d10ad authored tarafından Tomaž Vajngerl's avatar Tomaž Vajngerl

sc html export: HTML export test fixture & "SkipImages" test

Change-Id: I8a419f535570924d508e1ce5f0c6bb1fbdd829a7
üst dde83357
# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
#
# 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/.
#
$(eval $(call gb_CppunitTest_CppunitTest,sc_html_export_test))
$(eval $(call gb_CppunitTest_add_exception_objects,sc_html_export_test, \
sc/qa/extras/htmlexporttest \
))
$(eval $(call gb_CppunitTest_use_externals,sc_html_export_test, \
boost_headers \
libxml2 \
))
$(eval $(call gb_CppunitTest_use_libraries,sc_html_export_test, \
basegfx \
comphelper \
cppu \
cppuhelper \
drawinglayer \
editeng \
for \
forui \
i18nlangtag \
msfilter \
oox \
sal \
salhelper \
sax \
sc \
scqahelper \
sfx \
sot \
svl \
svt \
svx \
svxcore \
test \
tl \
tk \
ucbhelper \
unotest \
utl \
vcl \
xo \
$(gb_UWINAPI) \
))
$(eval $(call gb_CppunitTest_set_include,sc_html_export_test,\
-I$(SRCDIR)/sc/source/ui/inc \
-I$(SRCDIR)/sc/inc \
$$(INCLUDE) \
))
$(eval $(call gb_CppunitTest_use_api,sc_html_export_test,\
offapi \
udkapi \
))
$(eval $(call gb_CppunitTest_use_ure,sc_html_export_test))
$(eval $(call gb_CppunitTest_use_components,sc_html_export_test,\
basic/util/sb \
comphelper/util/comphelp \
configmgr/source/configmgr \
dbaccess/util/dba \
filter/source/config/cache/filterconfig1 \
forms/util/frm \
framework/util/fwk \
i18npool/util/i18npool \
linguistic/source/lng \
oox/util/oox \
package/source/xstor/xstor \
package/util/package2 \
sax/source/expatwrap/expwrap \
sc/util/sc \
sc/util/scd \
sc/util/scfilt \
$(if $(filter TRUE,$(DISABLE_SCRIPTING)),, \
sc/util/vbaobj) \
scripting/source/basprov/basprov \
scripting/util/scriptframe \
scripting/source/vbaevents/vbaevents \
scripting/source/dlgprov/dlgprov \
sfx2/util/sfx \
sot/util/sot \
svl/source/fsstor/fsstorage \
svtools/util/svt \
svx/util/svx \
svx/util/svxcore \
toolkit/util/tk \
ucb/source/core/ucb1 \
ucb/source/ucp/file/ucpfile1 \
ucb/source/ucp/tdoc/ucptdoc1 \
unotools/util/utl \
unoxml/source/rdf/unordf \
unoxml/source/service/unoxml \
xmloff/util/xo \
eventattacher/source/evtatt \
i18npool/source/search/i18nsearch \
vbahelper/util/msforms \
))
$(eval $(call gb_CppunitTest_use_configuration,sc_html_export_test))
$(eval $(call gb_CppunitTest_use_unittest_configuration,sc_html_export_test))
# vim: set noet sw=4 ts=4:
...@@ -54,6 +54,7 @@ $(eval $(call gb_Module_add_check_targets,sc,\ ...@@ -54,6 +54,7 @@ $(eval $(call gb_Module_add_check_targets,sc,\
CppunitTest_sc_ucalc \ CppunitTest_sc_ucalc \
CppunitTest_sc_filters_test \ CppunitTest_sc_filters_test \
CppunitTest_sc_rangelst_test \ CppunitTest_sc_rangelst_test \
CppunitTest_sc_html_export_test \
)) ))
$(eval $(call gb_Module_add_slowcheck_targets,sc, \ $(eval $(call gb_Module_add_slowcheck_targets,sc, \
......
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* 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 <sal/config.h>
#include <com/sun/star/frame/Desktop.hpp>
#include <com/sun/star/frame/XStorable.hpp>
#include <com/sun/star/lang/XComponent.hpp>
#include <test/bootstrapfixture.hxx>
#include <test/htmltesttools.hxx>
#include <test/xmltesttools.hxx>
#include <comphelper/processfactory.hxx>
#include <unotools/mediadescriptor.hxx>
#include <unotools/ucbstreamhelper.hxx>
#include <unotest/macros_test.hxx>
#include <sfx2/docfilt.hxx>
#include <sfx2/docfile.hxx>
#include "docsh.hxx"
using namespace css::uno;
using namespace css::lang;
using namespace css::frame;
using namespace utl;
class ScHTMLExportTest : public test::BootstrapFixture, public unotest::MacrosTest, public XmlTestTools, public HtmlTestTools
{
Reference<XComponent> mxComponent;
TempFile maTempFile;
OUString maFilterOptions;
void load(const char* pDir, const char* pName)
{
if (mxComponent.is())
mxComponent->dispose();
mxComponent = loadFromDesktop(getURLFromSrc(pDir) + OUString::createFromAscii(pName), "com.sun.star.comp.Calc.SpreadsheetDocument");
}
void save(const OUString& aFilterName, TempFile& rTempFile)
{
rTempFile.EnableKillingFile();
Reference<XStorable> xStorable(mxComponent, UNO_QUERY);
MediaDescriptor aMediaDescriptor;
aMediaDescriptor["FilterName"] <<= aFilterName;
if (!maFilterOptions.isEmpty())
aMediaDescriptor["FilterOptions"] <<= maFilterOptions;
xStorable->storeToURL(rTempFile.GetURL(), aMediaDescriptor.getAsConstPropertyValueList());
}
public:
ScHTMLExportTest()
{}
virtual void setUp() SAL_OVERRIDE
{
test::BootstrapFixture::setUp();
mxDesktop.set(css::frame::Desktop::create(comphelper::getComponentContext(getMultiServiceFactory())));
}
void testHtmlSkipImage()
{
htmlDocPtr pDoc;
load("/sc/qa/extras/testdocuments/", "BaseForHTMLExport.ods");
save("HTML (StarCalc)", maTempFile);
pDoc = parseHtml(maTempFile);
CPPUNIT_ASSERT (pDoc);
assertXPath(pDoc, "/html/body", 1);
assertXPath(pDoc, "/html/body/table/tr/td/img", 1);
load("/sc/qa/extras/testdocuments/", "BaseForHTMLExport.ods");
maFilterOptions = OUString("SkipImages");
save("HTML (StarCalc)", maTempFile);
pDoc = parseHtml(maTempFile);
CPPUNIT_ASSERT (pDoc);
assertXPath(pDoc, "/html/body", 1);
assertXPath(pDoc, "/html/body/table/tr/td/img", 0);
}
CPPUNIT_TEST_SUITE(ScHTMLExportTest);
CPPUNIT_TEST(testHtmlSkipImage);
CPPUNIT_TEST_SUITE_END();
};
CPPUNIT_TEST_SUITE_REGISTRATION(ScHTMLExportTest);
CPPUNIT_PLUGIN_IMPLEMENT();
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment