Kaydet (Commit) 22d2b332 authored tarafından Thorsten Behrens's avatar Thorsten Behrens

sw: add unit test for the XHTML part of tdf#109202

Change-Id: Ifb1b5b30e1c3586be75ff01f7bc0612a6b8b1f8d
Reviewed-on: https://gerrit.libreoffice.org/59785
Tested-by: Jenkins
Reviewed-by: 's avatarThorsten Behrens <Thorsten.Behrens@CIB.de>
üst 8fbf7589
# -*- 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,sw_xhtmlexport))
$(eval $(call gb_CppunitTest_add_exception_objects,sw_xhtmlexport, \
sw/qa/extras/htmlexport/xhtmlexport \
))
$(eval $(call gb_CppunitTest_use_libraries,sw_xhtmlexport, \
comphelper \
cppu \
cppuhelper \
i18nlangtag \
sal \
sfx \
sw \
test \
tl \
unotest \
utl \
vcl \
))
$(eval $(call gb_CppunitTest_use_externals,sw_xhtmlexport,\
boost_headers \
libxml2 \
))
$(eval $(call gb_CppunitTest_set_include,sw_xhtmlexport,\
-I$(SRCDIR)/sw/inc \
-I$(SRCDIR)/sw/source/core/inc \
-I$(SRCDIR)/sw/source/uibase/inc \
-I$(SRCDIR)/sw/qa/extras/inc \
$$(INCLUDE) \
))
$(eval $(call gb_CppunitTest_use_api,sw_xhtmlexport,\
udkapi \
offapi \
oovbaapi \
))
$(eval $(call gb_CppunitTest_use_ure,sw_xhtmlexport))
$(eval $(call gb_CppunitTest_use_vcl,sw_xhtmlexport))
$(eval $(call gb_CppunitTest_use_rdb,sw_xhtmlexport,services))
$(eval $(call gb_CppunitTest_use_configuration,sw_xhtmlexport))
# vim: set noet sw=4 ts=4:
......@@ -58,6 +58,7 @@ $(eval $(call gb_Module_add_slowcheck_targets,sw,\
CppunitTest_sw_docbookexport \
CppunitTest_sw_fodfexport \
CppunitTest_sw_htmlexport \
CppunitTest_sw_xhtmlexport \
CppunitTest_sw_htmlimport \
CppunitTest_sw_macros_test \
CppunitTest_sw_ooxmlexport \
......
/* -*- 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 <memory>
#include <swmodeltestbase.hxx>
#include <com/sun/star/awt/Gradient.hpp>
#include <com/sun/star/drawing/FillStyle.hpp>
#include <com/sun/star/document/XEmbeddedObjectSupplier2.hpp>
#include <com/sun/star/embed/ElementModes.hpp>
#include <com/sun/star/io/XActiveDataStreamer.hpp>
#include <com/sun/star/io/XSeekable.hpp>
#include <rtl/byteseq.hxx>
#include <swmodule.hxx>
#include <swdll.hxx>
#include <usrpref.hxx>
#include <test/htmltesttools.hxx>
class XHtmlExportTest : public SwModelTestBase, public HtmlTestTools
{
public:
XHtmlExportTest()
: SwModelTestBase("/sw/qa/extras/odfexport/data/", "XHTML Writer File")
{
}
private:
virtual std::unique_ptr<Resetter> preTest(const char*) override
{
setFilterOptions("UTF8");
return nullptr;
}
};
#define DECLARE_HTMLEXPORT_TEST(TestName, filename) \
DECLARE_SW_EXPORT_TEST(TestName, filename, nullptr, XHtmlExportTest)
DECLARE_HTMLEXPORT_TEST(testImageEmbedding, "image-mimetype.odt")
{
htmlDocPtr pDoc = parseHtml(maTempFile);
CPPUNIT_ASSERT(pDoc);
assertXPath(pDoc, "/html/body", 1);
assertXPath(pDoc, "/html/body/div[1]/div[1]/img", 1);
OUString aValue = getXPath(pDoc, "/html/body/div[1]/div[1]/img", "src");
CPPUNIT_ASSERT(aValue.startsWith("data:image/svg+xml;base64"));
}
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