diff options
-rw-r--r-- | emfio/qa/cppunit/wmf/data/stockobject.emf | bin | 0 -> 12708 bytes | |||
-rw-r--r-- | emfio/qa/cppunit/wmf/wmfimporttest.cxx | 25 | ||||
-rw-r--r-- | emfio/source/reader/mtftools.cxx | 2 |
3 files changed, 26 insertions, 1 deletions
diff --git a/emfio/qa/cppunit/wmf/data/stockobject.emf b/emfio/qa/cppunit/wmf/data/stockobject.emf Binary files differnew file mode 100644 index 000000000000..8de7c1ae591c --- /dev/null +++ b/emfio/qa/cppunit/wmf/data/stockobject.emf diff --git a/emfio/qa/cppunit/wmf/wmfimporttest.cxx b/emfio/qa/cppunit/wmf/wmfimporttest.cxx index b8c2218fdec2..d8a4ed82d0f0 100644 --- a/emfio/qa/cppunit/wmf/wmfimporttest.cxx +++ b/emfio/qa/cppunit/wmf/wmfimporttest.cxx @@ -56,6 +56,7 @@ public: void testTdf99402(); void testTdf39894(); void testETO_PDY(); + void testStockObject(); CPPUNIT_TEST_SUITE(WmfTest); CPPUNIT_TEST(testNonPlaceableWmf); @@ -69,6 +70,7 @@ public: CPPUNIT_TEST(testTdf99402); CPPUNIT_TEST(testTdf39894); CPPUNIT_TEST(testETO_PDY); + CPPUNIT_TEST(testStockObject); CPPUNIT_TEST_SUITE_END(); }; @@ -389,6 +391,29 @@ void WmfTest::testETO_PDY() } } +void WmfTest::testStockObject() +{ + SvFileStream aFileStream(getFullUrl(u"stockobject.emf"), StreamMode::READ); + GDIMetaFile aGDIMetaFile; + ReadWindowMetafile(aFileStream, aGDIMetaFile); + + MetafileXmlDump dumper; + xmlDocUniquePtr pDoc = dumpAndParse(dumper, aGDIMetaFile); + + CPPUNIT_ASSERT(pDoc); + + // Without the fix in place, this test would have failed with + // - Expected: 42 + // - Actual : 37 + assertXPathChildren(pDoc, "/metafile/push[2]", 42); + + // Without the fix in place, this test would have failed with + // - Expected: 1 + // - Actual : 0 + // - In <>, XPath '/metafile/push[2]/fillcolor[2]' number of nodes is incorrect + assertXPath(pDoc, "/metafile/push[2]/fillcolor[2]", "color", "#000000"); +} + CPPUNIT_TEST_SUITE_REGISTRATION(WmfTest); CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/emfio/source/reader/mtftools.cxx b/emfio/source/reader/mtftools.cxx index f829788dbd1b..5cb43ec68510 100644 --- a/emfio/source/reader/mtftools.cxx +++ b/emfio/source/reader/mtftools.cxx @@ -750,7 +750,7 @@ namespace emfio if ( nIndex & ENHMETA_STOCK_OBJECT ) { SAL_INFO ( "emfio", "\t\t ENHMETA_STOCK_OBJECT, StockObject Enumeration: 0x" << std::hex << nIndex ); - StockObject nStockId = static_cast<StockObject>(nIndex); + StockObject nStockId = static_cast<StockObject>(nIndex & 0xFF); switch( nStockId ) { case StockObject::WHITE_BRUSH : |