/* -*- 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/.
*/
class AutoRedactionTest : public UnoApiTest
{ public:
AutoRedactionTest()
: UnoApiTest(u"/sfx2/qa/cppunit/data/"_ustr)
{
}
};
CPPUNIT_TEST_FIXTURE(AutoRedactionTest, testImageRedaction)
{ // Get the images size and position from the writer
loadFromFile(u"autoredact_img.fodt");
CPPUNIT_ASSERT_MESSAGE("Failed to load autoredact_img.odt", mxComponent.is());
for (sal_Int32 i = 0; i < xGraphics->getCount(); i++)
{
uno::Reference<beans::XPropertySet> xProps;
xGraphics->getByIndex(i) >>= xProps; if (!xProps.is()) continue;
sal_Int32 nRedactRect = 0; for (sal_Int32 i = 0; i < xDrawPages->getCount(); i++)
{
uno::Reference<drawing::XDrawPage> xDrawPage;
xDrawPages->getByIndex(i) >>= xDrawPage;
CPPUNIT_ASSERT(xDrawPage.is());
// Iterate through all shapes on this page for (sal_Int32 j = 0; j < xDrawPage->getCount(); j++)
{
uno::Reference<drawing::XShape> xShape;
xDrawPage->getByIndex(j) >>= xShape;
CPPUNIT_ASSERT(xShape.is());
uno::Reference<beans::XPropertySet> xShapeProps(xShape, uno::UNO_QUERY); if (!xShapeProps.is()) continue;
bool bMatchesImage = false; for (constauto& aImageRect : aImageRectangles)
{ if (aRect.Overlaps(aImageRect))
{
bMatchesImage = true; break;
}
}
CPPUNIT_ASSERT_MESSAGE("No proper redaction rectangle for a image", bMatchesImage);
}
}
}
CPPUNIT_ASSERT_EQUAL_MESSAGE("Number of redaction rectangles should match number of images",
nImageCount, nRedactRect);
}
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.