summaryrefslogtreecommitdiffstats
path: root/sd
diff options
context:
space:
mode:
authorTomaž Vajngerl <tomaz.vajngerl@collabora.co.uk>2018-05-23 18:24:19 +0900
committerTomaž Vajngerl <quikee@gmail.com>2018-05-23 13:39:29 +0200
commit82975bbc1a6acee97e3a90756909e424af03bc37 (patch)
tree0e1668f5d0839b85e2383f7e801bb0974cad15f6 /sd
parentsd: convert XGraphic to XBitmap for the "GraphicBitmap" property (diff)
downloadcore-82975bbc1a6acee97e3a90756909e424af03bc37.tar.gz
core-82975bbc1a6acee97e3a90756909e424af03bc37.zip
sd: extend bitmap bullet tests
Change-Id: I169f7306f3af2c283b1c928230eaf6566b1a6660 Reviewed-on: https://gerrit.libreoffice.org/54696 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
Diffstat (limited to 'sd')
-rw-r--r--sd/qa/unit/data/odp/BulletsAsImage.odpbin11475 -> 10754 bytes
-rw-r--r--sd/qa/unit/export-tests.cxx54
2 files changed, 52 insertions, 2 deletions
diff --git a/sd/qa/unit/data/odp/BulletsAsImage.odp b/sd/qa/unit/data/odp/BulletsAsImage.odp
index 21d10e494829..7094d34af949 100644
--- a/sd/qa/unit/data/odp/BulletsAsImage.odp
+++ b/sd/qa/unit/data/odp/BulletsAsImage.odp
Binary files differ
diff --git a/sd/qa/unit/export-tests.cxx b/sd/qa/unit/export-tests.cxx
index c6dd4a70741f..165d212fd956 100644
--- a/sd/qa/unit/export-tests.cxx
+++ b/sd/qa/unit/export-tests.cxx
@@ -944,14 +944,64 @@ void SdExportTest::testBulletsAsImage()
uno::Reference<container::XIndexAccess> xLevels(xPropSet->getPropertyValue("NumberingRules"), uno::UNO_QUERY_THROW);
uno::Sequence<beans::PropertyValue> aProperties;
xLevels->getByIndex(0) >>= aProperties; // 1st level
+
uno::Reference<awt::XBitmap> xBitmap;
- for (const beans::PropertyValue& rProperty : aProperties)
+ awt::Size aSize;
+ sal_Int16 nNumberingType = -1;
+
+ for (beans::PropertyValue const & rProperty : aProperties)
{
- if (rProperty.Name == "GraphicBitmap")
+ if (rProperty.Name == "NumberingType")
+ {
+ nNumberingType = rProperty.Value.get<sal_Int16>();
+ }
+ else if (rProperty.Name == "GraphicBitmap")
+ {
xBitmap = rProperty.Value.get<uno::Reference<awt::XBitmap>>();
+ }
+ else if (rProperty.Name == "GraphicSize")
+ {
+ aSize = rProperty.Value.get<awt::Size>();
+ }
}
+
+ CPPUNIT_ASSERT_EQUAL_MESSAGE(sFailedMessageBase.getStr(), style::NumberingType::BITMAP, nNumberingType);
+
+ // Graphic Bitmap
const OString sFailed = sFailedMessageBase + "No bitmap for the bullets";
CPPUNIT_ASSERT_MESSAGE(sFailed.getStr(), xBitmap.is());
+ Graphic aGraphic(uno::Reference<graphic::XGraphic>(xBitmap, uno::UNO_QUERY));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE(sFailedMessageBase.getStr(), GraphicType::Bitmap, aGraphic.GetType());
+ CPPUNIT_ASSERT_MESSAGE(sFailedMessageBase.getStr(), aGraphic.GetSizeBytes() > sal_uLong(0));
+
+ if (nExportFormat == ODP || nExportFormat == PPT)
+ {
+ CPPUNIT_ASSERT_EQUAL_MESSAGE(sFailedMessageBase.getStr(), 16L, aGraphic.GetSizePixel().Width());
+ CPPUNIT_ASSERT_EQUAL_MESSAGE(sFailedMessageBase.getStr(), 16L, aGraphic.GetSizePixel().Height());
+ }
+ else // FIXME: what happened here
+ {
+ CPPUNIT_ASSERT_EQUAL_MESSAGE(sFailedMessageBase.getStr(), 64L, aGraphic.GetSizePixel().Width());
+ CPPUNIT_ASSERT_EQUAL_MESSAGE(sFailedMessageBase.getStr(), 64L, aGraphic.GetSizePixel().Height());
+ }
+
+ // Graphic Size
+ if (nExportFormat == ODP)
+ {
+ CPPUNIT_ASSERT_EQUAL_MESSAGE(sFailedMessageBase.getStr(), sal_Int32(500), aSize.Width);
+ CPPUNIT_ASSERT_EQUAL_MESSAGE(sFailedMessageBase.getStr(), sal_Int32(500), aSize.Height);
+
+ }
+ else if (nExportFormat == PPT) // seems like a conversion error
+ {
+ CPPUNIT_ASSERT_EQUAL_MESSAGE(sFailedMessageBase.getStr(), sal_Int32(504), aSize.Width);
+ CPPUNIT_ASSERT_EQUAL_MESSAGE(sFailedMessageBase.getStr(), sal_Int32(504), aSize.Height);
+ }
+ else // FIXME: totally wrong
+ {
+ CPPUNIT_ASSERT_EQUAL_MESSAGE(sFailedMessageBase.getStr(), sal_Int32(790), aSize.Width);
+ CPPUNIT_ASSERT_EQUAL_MESSAGE(sFailedMessageBase.getStr(), sal_Int32(790), aSize.Height);
+ }
xDocShRef->DoClose();
}