diff options
author | Tomaž Vajngerl <tomaz.vajngerl@collabora.com> | 2014-05-18 23:57:09 +0200 |
---|---|---|
committer | Tomaž Vajngerl <tomaz.vajngerl@collabora.com> | 2014-05-19 00:01:15 +0200 |
commit | 9a4a48d213457f93c797493011ac362eb528de6a (patch) | |
tree | 1692deef6218e88a2738a75b5b28be738cb769e0 /vcl | |
parent | fdo#72590 scale or map only when EMR_EXTSELECTCLIPRGN action (diff) | |
download | core-9a4a48d213457f93c797493011ac362eb528de6a.tar.gz core-9a4a48d213457f93c797493011ac362eb528de6a.zip |
vcl emf test: test clip region is correct for problematic files
Change-Id: I60caf9ebcff417e0f87bae9c6b5d308b5e2f0b37
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/qa/cppunit/wmf/data/computer_mail.emf | bin | 0 -> 45876 bytes | |||
-rw-r--r-- | vcl/qa/cppunit/wmf/data/sine_wave.emf | bin | 0 -> 15456 bytes | |||
-rw-r--r-- | vcl/qa/cppunit/wmf/wmfimporttest.cxx | 82 |
3 files changed, 73 insertions, 9 deletions
diff --git a/vcl/qa/cppunit/wmf/data/computer_mail.emf b/vcl/qa/cppunit/wmf/data/computer_mail.emf Binary files differnew file mode 100644 index 000000000000..0dbf23f7f330 --- /dev/null +++ b/vcl/qa/cppunit/wmf/data/computer_mail.emf diff --git a/vcl/qa/cppunit/wmf/data/sine_wave.emf b/vcl/qa/cppunit/wmf/data/sine_wave.emf Binary files differnew file mode 100644 index 000000000000..e5a4fa6759d1 --- /dev/null +++ b/vcl/qa/cppunit/wmf/data/sine_wave.emf diff --git a/vcl/qa/cppunit/wmf/wmfimporttest.cxx b/vcl/qa/cppunit/wmf/wmfimporttest.cxx index 12d1942bcbe8..7460447b87bd 100644 --- a/vcl/qa/cppunit/wmf/wmfimporttest.cxx +++ b/vcl/qa/cppunit/wmf/wmfimporttest.cxx @@ -27,37 +27,46 @@ using namespace css; class WmfTest : public test::BootstrapFixture, public XmlTestTools { + OUString maDataUrl; + + OUString getFullUrl(OUString sFileName) + { + return getURLFromSrc(maDataUrl) + sFileName; + } + public: WmfTest() : - BootstrapFixture(true, false) + BootstrapFixture(true, false), + maDataUrl("/vcl/qa/cppunit/wmf/data/") {} void testNonPlaceableWmf(); + void testSine(); + void testEmfProblem(); CPPUNIT_TEST_SUITE(WmfTest); CPPUNIT_TEST(testNonPlaceableWmf); + CPPUNIT_TEST(testSine); + CPPUNIT_TEST(testEmfProblem); CPPUNIT_TEST_SUITE_END(); }; void WmfTest::testNonPlaceableWmf() { - OUString aUrl = getURLFromSrc("/vcl/qa/cppunit/wmf/data/"); - - SvFileStream aFileStream(aUrl + "visio_import_source.wmf", STREAM_READ); + SvFileStream aFileStream(getFullUrl("visio_import_source.wmf"), STREAM_READ); GDIMetaFile aGDIMetaFile; ReadWindowMetafile(aFileStream, aGDIMetaFile); - boost::scoped_ptr<SvMemoryStream> aStream(new SvMemoryStream); + SvMemoryStream aStream; - MetafileXmlDump dumper(*aStream); + MetafileXmlDump dumper(aStream); dumper.filterAllActionTypes(); dumper.filterActionType(META_POLYLINE_ACTION, false); dumper.dump(aGDIMetaFile); - aStream->WriteChar(0); - aStream->Seek(STREAM_SEEK_TO_BEGIN); + aStream.Seek(STREAM_SEEK_TO_BEGIN); - xmlDocPtr pDoc = parseXmlStream(aStream.get()); + xmlDocPtr pDoc = parseXmlStream(&aStream); CPPUNIT_ASSERT (pDoc); @@ -77,6 +86,61 @@ void WmfTest::testNonPlaceableWmf() assertXPath(pDoc, "/metafile/polyline[1]/point[5]", "y", "1003"); } +void WmfTest::testSine() +{ + SvFileStream aFileStream(getFullUrl("sine_wave.emf"), STREAM_READ); + GDIMetaFile aGDIMetaFile; + ReadWindowMetafile(aFileStream, aGDIMetaFile); + + SvMemoryStream aStream; + + MetafileXmlDump dumper(aStream); + dumper.filterAllActionTypes(); + dumper.filterActionType(META_ISECTRECTCLIPREGION_ACTION, false); + dumper.dump(aGDIMetaFile); + + aStream.Seek(STREAM_SEEK_TO_BEGIN); + + xmlDocPtr pDoc = parseXmlStream(&aStream); + + CPPUNIT_ASSERT (pDoc); + + assertXPath(pDoc, "/metafile/sectrectclipregion[1]", "top", "0"); + assertXPath(pDoc, "/metafile/sectrectclipregion[1]", "left", "0"); + assertXPath(pDoc, "/metafile/sectrectclipregion[1]", "bottom", "1155947"); + assertXPath(pDoc, "/metafile/sectrectclipregion[1]", "right", "1155378"); + + assertXPath(pDoc, "/metafile/sectrectclipregion[2]", "top", "1411"); + assertXPath(pDoc, "/metafile/sectrectclipregion[2]", "left", "2962"); + assertXPath(pDoc, "/metafile/sectrectclipregion[2]", "bottom", "16651"); + assertXPath(pDoc, "/metafile/sectrectclipregion[2]", "right", "20698"); +} + +void WmfTest::testEmfProblem() +{ + SvFileStream aFileStream(getFullUrl("computer_mail.emf"), STREAM_READ); + GDIMetaFile aGDIMetaFile; + ReadWindowMetafile(aFileStream, aGDIMetaFile); + + SvMemoryStream aStream; + + MetafileXmlDump dumper(aStream); + dumper.filterAllActionTypes(); + dumper.filterActionType(META_ISECTRECTCLIPREGION_ACTION, false); + dumper.dump(aGDIMetaFile); + + aStream.Seek(STREAM_SEEK_TO_BEGIN); + + xmlDocPtr pDoc = parseXmlStream(&aStream); + + CPPUNIT_ASSERT (pDoc); + + assertXPath(pDoc, "/metafile/sectrectclipregion[1]", "top", "427"); + assertXPath(pDoc, "/metafile/sectrectclipregion[1]", "left", "740"); + assertXPath(pDoc, "/metafile/sectrectclipregion[1]", "bottom", "2823"); + assertXPath(pDoc, "/metafile/sectrectclipregion[1]", "right", "1876"); +} + CPPUNIT_TEST_SUITE_REGISTRATION(WmfTest); CPPUNIT_PLUGIN_IMPLEMENT(); |