class Test : public UnoApiTest
{ public:
Test()
: UnoApiTest(u"/cppcanvas/qa/extras/emfplus/data/"_ustr)
{
}
Bitmap load(constchar* pName)
{
loadFromFile(OUString::createFromAscii(pName));
SfxBaseModel* pModel = dynamic_cast<SfxBaseModel*>(mxComponent.get());
CPPUNIT_ASSERT(pModel);
SfxObjectShell* pShell = pModel->GetObjectShell();
std::shared_ptr<GDIMetaFile> xMetaFile = pShell->GetPreviewMetaFile();
BitmapEx aResultBitmap;
CPPUNIT_ASSERT(xMetaFile->CreateThumbnail(aResultBitmap)); // If this is set, the metafile will be dumped as a PNG one for debug purposes. char* pEnv = getenv("CPPCANVAS_DEBUG_EMFPLUS_DUMP_TO"); if (pEnv)
{
SvFileStream aStream(OUString::fromUtf8(pEnv), StreamMode::WRITE);
vcl::PngImageWriter aWriter(aStream);
CPPUNIT_ASSERT(aWriter.write(aResultBitmap));
}
return aResultBitmap.GetBitmap();
}
};
CPPUNIT_TEST_FIXTURE(Test, testFdo77229)
{
Bitmap aBitmap = load("fdo77229.emf");
BitmapScopedReadAccess pAccess(aBitmap); // The green star was missing.
Color aColor(pAccess->GetPixel(284, 280));
CPPUNIT_ASSERT_EQUAL(sal_uInt8(0), aColor.GetRed());
CPPUNIT_ASSERT_EQUAL(sal_uInt8(0), aColor.GetBlue());
CPPUNIT_ASSERT(aColor.GetGreen() == 0xfe || aColor.GetGreen() == 0xff);
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.