diff options
author | Tomaž Vajngerl <tomaz.vajngerl@collabora.com> | 2014-05-15 16:17:54 +0200 |
---|---|---|
committer | Tomaž Vajngerl <tomaz.vajngerl@collabora.com> | 2014-05-15 19:51:08 +0200 |
commit | f9e81786f43a91f8cb562552ea0b379ea73ba08a (patch) | |
tree | 07e74cfee5293fdca69522529ccb9ba7903070e9 | |
parent | fb688d64466b56ad7804c8ecf66aecae7f1faafa (diff) |
wmf: test that non-placeable WMF uses correct sizes
Change-Id: I546d654726483b40ce4d981bc66377c8a3df6194
-rw-r--r-- | vcl/CppunitTest_vcl_wmf_test.mk | 57 | ||||
-rw-r--r-- | vcl/Module_vcl.mk | 1 | ||||
-rw-r--r-- | vcl/qa/cppunit/wmf/data/visio_import_source.wmf | bin | 0 -> 13801 bytes | |||
-rw-r--r-- | vcl/qa/cppunit/wmf/wmfimporttest.cxx | 84 |
4 files changed, 142 insertions, 0 deletions
diff --git a/vcl/CppunitTest_vcl_wmf_test.mk b/vcl/CppunitTest_vcl_wmf_test.mk new file mode 100644 index 000000000000..f7272c9f6e0d --- /dev/null +++ b/vcl/CppunitTest_vcl_wmf_test.mk @@ -0,0 +1,57 @@ +# -*- 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,vcl_wmf_test)) + +$(eval $(call gb_CppunitTest_add_exception_objects,vcl_wmf_test, \ + vcl/qa/cppunit/wmf/wmfimporttest \ +)) + +$(eval $(call gb_CppunitTest_use_externals,vcl_wmf_test,\ + boost_headers \ + libxml2 \ +)) + + +$(eval $(call gb_CppunitTest_set_include,vcl_wmf_test,\ + $$(INCLUDE) \ + -I$(SRCDIR)/vcl/inc \ +)) + +$(eval $(call gb_CppunitTest_use_libraries,vcl_wmf_test, \ + comphelper \ + cppu \ + cppuhelper \ + sal \ + svt \ + test \ + tl \ + unotest \ + vcl \ + utl \ + $(gb_UWINAPI) \ +)) + +$(eval $(call gb_CppunitTest_use_api,vcl_wmf_test,\ + udkapi \ + offapi \ +)) + +$(eval $(call gb_CppunitTest_use_ure,vcl_wmf_test)) + +$(eval $(call gb_CppunitTest_use_components,vcl_wmf_test,\ + configmgr/source/configmgr \ + i18npool/util/i18npool \ + ucb/source/core/ucb1 \ + unotools/util/utl \ +)) + +$(eval $(call gb_CppunitTest_use_configuration,vcl_wmf_test)) + +# vim: set noet sw=4 ts=4: diff --git a/vcl/Module_vcl.mk b/vcl/Module_vcl.mk index 5f302a83fe69..254fe0d9e96e 100644 --- a/vcl/Module_vcl.mk +++ b/vcl/Module_vcl.mk @@ -92,6 +92,7 @@ $(eval $(call gb_Module_add_check_targets,vcl,\ CppunitTest_vcl_complextext \ CppunitTest_vcl_filters_test \ CppunitTest_vcl_app_test \ + CppunitTest_vcl_wmf_test \ )) # vim: set noet sw=4 ts=4: diff --git a/vcl/qa/cppunit/wmf/data/visio_import_source.wmf b/vcl/qa/cppunit/wmf/data/visio_import_source.wmf Binary files differnew file mode 100644 index 000000000000..88deac9d248d --- /dev/null +++ b/vcl/qa/cppunit/wmf/data/visio_import_source.wmf diff --git a/vcl/qa/cppunit/wmf/wmfimporttest.cxx b/vcl/qa/cppunit/wmf/wmfimporttest.cxx new file mode 100644 index 000000000000..e75f5a123714 --- /dev/null +++ b/vcl/qa/cppunit/wmf/wmfimporttest.cxx @@ -0,0 +1,84 @@ +/* -*- 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/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#include <test/bootstrapfixture.hxx> +#include <test/xmltesttools.hxx> +#include <test/mtfxmldump.hxx> +#include <vcl/wmf.hxx> +#include <vcl/metaact.hxx> + +using namespace css; + +class WmfTest : public test::BootstrapFixture, public XmlTestTools +{ +public: + WmfTest() : + BootstrapFixture(true, false) + {} + + void runTest(); + void testNonPlaceableWmf(); + + CPPUNIT_TEST_SUITE(WmfTest); + CPPUNIT_TEST(testNonPlaceableWmf); + CPPUNIT_TEST_SUITE_END(); +}; + +void WmfTest::testNonPlaceableWmf() +{ + OUString aUrl = getURLFromSrc("/vcl/qa/cppunit/wmf/data/"); + + SvFileStream aFileStream(aUrl + "visio_import_source.wmf", STREAM_READ); + GDIMetaFile aGDIMetaFile; + ReadWindowMetafile(aFileStream, aGDIMetaFile); + + boost::scoped_ptr<SvMemoryStream> aStream(new SvMemoryStream); + + MetafileXmlDump dumper(*aStream); + dumper.filterAllActionTypes(); + dumper.filterActionType(META_POLYLINE_ACTION, false); + dumper.dump(aGDIMetaFile); + + aStream->Seek(STREAM_SEEK_TO_BEGIN); + + xmlDocPtr pDoc = parseXmlStream(aStream.get()); + + CPPUNIT_ASSERT (pDoc); + + assertXPath(pDoc, "/metafile/polyline[1]/point[1]", "x", "16798"); + assertXPath(pDoc, "/metafile/polyline[1]/point[1]", "y", "1003"); + + assertXPath(pDoc, "/metafile/polyline[1]/point[2]", "x", "16798"); + assertXPath(pDoc, "/metafile/polyline[1]/point[2]", "y", "7507"); + + assertXPath(pDoc, "/metafile/polyline[1]/point[3]", "x", "26090"); + assertXPath(pDoc, "/metafile/polyline[1]/point[3]", "y", "7507"); + + assertXPath(pDoc, "/metafile/polyline[1]/point[4]", "x", "26090"); + assertXPath(pDoc, "/metafile/polyline[1]/point[4]", "y", "1003"); + + assertXPath(pDoc, "/metafile/polyline[1]/point[5]", "x", "16798"); + assertXPath(pDoc, "/metafile/polyline[1]/point[5]", "y", "1003"); +} + +CPPUNIT_TEST_SUITE_REGISTRATION(WmfTest); + +CPPUNIT_PLUGIN_IMPLEMENT(); + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |