Kaydet (Commit) b8983459 authored tarafından Samuel Mehrbrodt's avatar Samuel Mehrbrodt

Unit test for tdf#113696

Change-Id: I566cd5d38cf86547b664f0ae9a1c2f8c37edc0ca
Reviewed-on: https://gerrit.libreoffice.org/45560Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarSamuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>
Reviewed-on: https://gerrit.libreoffice.org/45680
üst e96f95fd
# -*- 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_fodfexport))
$(eval $(call gb_CppunitTest_add_exception_objects,sw_fodfexport, \
sw/qa/extras/fodfexport/fodfexport \
))
$(eval $(call gb_CppunitTest_use_libraries,sw_fodfexport, \
comphelper \
cppu \
cppuhelper \
sal \
sfx \
sw \
test \
tl \
unotest \
utl \
vcl \
))
$(eval $(call gb_CppunitTest_use_externals,sw_fodfexport,\
boost_headers \
libxml2 \
))
$(eval $(call gb_CppunitTest_set_include,sw_fodfexport,\
-I$(SRCDIR)/sw/inc \
-I$(SRCDIR)/sw/source/core/inc \
-I$(SRCDIR)/sw/qa/extras/inc \
$$(INCLUDE) \
))
$(eval $(call gb_CppunitTest_use_sdk_api,sw_fodfexport))
$(eval $(call gb_CppunitTest_use_ure,sw_fodfexport))
$(eval $(call gb_CppunitTest_use_vcl,sw_fodfexport))
$(eval $(call gb_CppunitTest_use_rdb,sw_fodfexport,services))
$(eval $(call gb_CppunitTest_use_custom_headers,sw_fodfexport,\
officecfg/registry \
))
$(eval $(call gb_CppunitTest_use_configuration,sw_fodfexport))
# vim: set noet sw=4 ts=4:
......@@ -52,6 +52,7 @@ $(eval $(call gb_Module_add_slowcheck_targets,sw,\
$(if $(and $(filter $(COM),MSC),$(MERGELIBS)),, \
CppunitTest_sw_uwriter) \
CppunitTest_sw_docbookexport \
CppunitTest_sw_fodfexport \
CppunitTest_sw_htmlexport \
CppunitTest_sw_htmlimport \
CppunitTest_sw_macros_test \
......
/* -*- 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 <swmodeltestbase.hxx>
class Test : public SwModelTestBase
{
public:
Test()
: SwModelTestBase("/sw/qa/extras/fodfexport/data/", "OpenDocument Text Flat XML")
{
}
/**
* Blacklist handling
*/
bool mustTestImportOf(const char* filename) const override
{
// Only test import of .fodt document
return OString(filename).endsWith(".odt") || OString(filename).endsWith(".fodt");
}
};
DECLARE_FODFEXPORT_TEST(testTdf113696, "tdf113696.odt")
{
// Test that an image which is written in svm format (image/x-vclgraphic)
// is accompanied by a png fallback graphic.
if (xmlDocPtr pXmlDoc = parseExportedFile())
{
assertXPath(pXmlDoc, "/office:document/office:body/office:text/text:p/draw:frame/"
"draw:image[@loext:mime-type='image/x-vclgraphic']");
assertXPath(pXmlDoc, "/office:document/office:body/office:text/text:p/draw:frame/"
"draw:image[@loext:mime-type='image/png']");
}
}
CPPUNIT_PLUGIN_IMPLEMENT();
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
......@@ -94,6 +94,7 @@ using namespace css;
#define DECLARE_RTFEXPORT_TEST(TestName, filename) DECLARE_SW_ROUNDTRIP_TEST(TestName, filename, nullptr, Test)
#define DECLARE_ODFIMPORT_TEST(TestName, filename) DECLARE_SW_IMPORT_TEST(TestName, filename, nullptr, Test)
#define DECLARE_ODFEXPORT_TEST(TestName, filename) DECLARE_SW_ROUNDTRIP_TEST(TestName, filename, nullptr, Test)
#define DECLARE_FODFEXPORT_TEST(TestName, filename) DECLARE_SW_ROUNDTRIP_TEST(TestName, filename, nullptr, Test)
#define DECLARE_WW8EXPORT_TEST(TestName, filename) DECLARE_SW_ROUNDTRIP_TEST(TestName, filename, nullptr, Test)
#define DECLARE_SW_IMPORT_TEST(TestName, filename, password, BaseClass) \
......@@ -783,6 +784,16 @@ protected:
return parseExportInternal( maTempFile.GetURL(), rStreamName );
}
/**
* Returns an xml stream of a an exported file.
* To be used when the exporter doesn't create zip archives, but single files
* (like Flat ODF Export)
*/
xmlDocPtr parseExportedFile()
{
return parseXmlStream(maTempFile.GetStream(StreamMode::READ));
}
xmlDocPtr parseExportInternal( const OUString& url, const OUString& rStreamName )
{
// Read the XML stream we're interested in.
......
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