diff options
author | Jan Holesovsky <kendy@collabora.com> | 2014-06-10 19:27:40 +0200 |
---|---|---|
committer | Jan Holesovsky <kendy@collabora.com> | 2014-06-10 19:33:12 +0200 |
commit | 71457cb2cb61f20ef569d1600b430ef41a878ec9 (patch) | |
tree | 3f91698ca7d83186197af14506616b0261c0e085 /filter/qa/cppunit/filters-pict-test.cxx | |
parent | ce90fa303234e9e6628bf9dfcc7f81565a639d06 (diff) |
pct import: Unit test for the clipping import fix.
Change-Id: I8f9df1d92c86c087e37f77209f413ff8c1c6358f
Diffstat (limited to 'filter/qa/cppunit/filters-pict-test.cxx')
-rw-r--r-- | filter/qa/cppunit/filters-pict-test.cxx | 35 |
1 files changed, 34 insertions, 1 deletions
diff --git a/filter/qa/cppunit/filters-pict-test.cxx b/filter/qa/cppunit/filters-pict-test.cxx index 7ba01456fc7f..0512b9b22287 100644 --- a/filter/qa/cppunit/filters-pict-test.cxx +++ b/filter/qa/cppunit/filters-pict-test.cxx @@ -10,12 +10,17 @@ #include <unotest/filters-test.hxx> #include <test/bootstrapfixture.hxx> #include <vcl/FilterConfigItem.hxx> +#include <test/mtfxmldump.hxx> +#include <test/xmltesttools.hxx> #include <tools/stream.hxx> #include <vcl/graph.hxx> +#include <vcl/metaactiontypes.hxx> #include <osl/file.hxx> #include <osl/process.h> +#include "../../source/graphicfilter/ipict/ipict.hxx" + extern "C" { SAL_DLLPUBLIC_EXPORT bool SAL_CALL @@ -30,6 +35,7 @@ using namespace ::com::sun::star; class PictFilterTest : public test::FiltersTest , public test::BootstrapFixture + , public XmlTestTools { public: PictFilterTest() : BootstrapFixture(true, false) {} @@ -38,13 +44,21 @@ public: const OUString &rURL, const OUString &, unsigned int, unsigned int, unsigned int) SAL_OVERRIDE; + OUString pictURL() + { + return getURLFromSrc("/filter/qa/cppunit/data/pict/"); + } + /** * Ensure CVEs remain unbroken */ void testCVEs(); + void testDontClipTooMuch(); + CPPUNIT_TEST_SUITE(PictFilterTest); CPPUNIT_TEST(testCVEs); + CPPUNIT_TEST(testDontClipTooMuch); CPPUNIT_TEST_SUITE_END(); }; @@ -60,10 +74,29 @@ bool PictFilterTest::load(const OUString &, void PictFilterTest::testCVEs() { testDir(OUString(), - getURLFromSrc("/filter/qa/cppunit/data/pict/"), + pictURL(), OUString()); } +void PictFilterTest::testDontClipTooMuch() +{ + SvFileStream aFileStream(pictURL() + "clipping-problem.pct", STREAM_READ); + GDIMetaFile aGDIMetaFile; + pict::ReadPictFile(aFileStream, aGDIMetaFile); + + MetafileXmlDump dumper; + dumper.filterAllActionTypes(); + dumper.filterActionType(META_CLIPREGION_ACTION, false); + xmlDocPtr pDoc = dumper.dumpAndParse(aGDIMetaFile); + + CPPUNIT_ASSERT (pDoc); + + assertXPath(pDoc, "/metafile/clipregion[5]", "top", "0"); + assertXPath(pDoc, "/metafile/clipregion[5]", "left", "0"); + assertXPath(pDoc, "/metafile/clipregion[5]", "bottom", "-32767"); + assertXPath(pDoc, "/metafile/clipregion[5]", "right", "-32767"); +} + CPPUNIT_TEST_SUITE_REGISTRATION(PictFilterTest); CPPUNIT_PLUGIN_IMPLEMENT(); |