summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorZolnai Tamás <tamas.zolnai@collabora.com>2014-02-11 18:35:38 +0100
committerZolnai Tamás <tamas.zolnai@collabora.com>2014-02-12 13:20:31 +0100
commit2efd433478cf4820b308b20cf42595345e023af2 (patch)
tree9ff1854fa52a4b3ef178877e5af2aadeb1f41a5b /sw
parent682ab832522b1349f1714bcb16f6e83468ea2920 (diff)
drawingML import: picture with scheme color
Theme fragment must be loaded for pictures too. Change-Id: If4c412926319df2beaecfc120065bd011fc3eb57
Diffstat (limited to 'sw')
-rw-r--r--sw/qa/extras/ooxmlimport/data/picture-with-schemecolor.docxbin0 -> 35489 bytes
-rw-r--r--sw/qa/extras/ooxmlimport/ooxmlimport.cxx23
2 files changed, 23 insertions, 0 deletions
diff --git a/sw/qa/extras/ooxmlimport/data/picture-with-schemecolor.docx b/sw/qa/extras/ooxmlimport/data/picture-with-schemecolor.docx
new file mode 100644
index 000000000000..bfee0e1415e8
--- /dev/null
+++ b/sw/qa/extras/ooxmlimport/data/picture-with-schemecolor.docx
Binary files differ
diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
index 8195558a545f..15c3fdf4f18d 100644
--- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
+++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
@@ -1813,6 +1813,29 @@ DECLARE_OOXMLIMPORT_TEST(testDMLShapeFillBitmapCrop, "dml-shape-fillbitmapcrop.d
CPPUNIT_ASSERT_EQUAL( sal_Int32( 0 ), aGraphicCropStruct.Bottom );
}
+
+DECLARE_OOXMLIMPORT_TEST(testPictureWithSchemeColor, "picture-with-schemecolor.docx")
+{
+ // At the start of the document, a picture which has a color specified with a color scheme, lost
+ // it's color during import.
+ uno::Reference<beans::XPropertySet> xImage(getShape(1), uno::UNO_QUERY);
+ uno::Reference<graphic::XGraphic> xGraphic = getProperty<uno::Reference<graphic::XGraphic> >(xImage, "Graphic");
+ uno::Reference<awt::XBitmap> xBitmap(xGraphic, uno::UNO_QUERY);
+ CPPUNIT_ASSERT_EQUAL( static_cast<sal_Int32>(341), xBitmap->getSize().Width );
+ CPPUNIT_ASSERT_EQUAL( static_cast<sal_Int32>(181), xBitmap->getSize().Height );
+
+ // Check some bits of the bitmap which change when color is imported.
+ const uno::Sequence< sal_Int8 > aDIB = xBitmap->getDIB();
+ CPPUNIT_ASSERT_EQUAL( static_cast<sal_Int8>(-91), aDIB[54] );
+ CPPUNIT_ASSERT_EQUAL( static_cast<sal_Int8>(110), aDIB[55] );
+ CPPUNIT_ASSERT_EQUAL( static_cast<sal_Int8>(49), aDIB[56] );
+ CPPUNIT_ASSERT_EQUAL( static_cast<sal_Int8>(-36), aDIB[96] );
+ CPPUNIT_ASSERT_EQUAL( static_cast<sal_Int8>(-57), aDIB[97] );
+ CPPUNIT_ASSERT_EQUAL( static_cast<sal_Int8>(-80), aDIB[98] );
+ CPPUNIT_ASSERT_EQUAL( static_cast<sal_Int8>(-91), aDIB[135] );
+ CPPUNIT_ASSERT_EQUAL( static_cast<sal_Int8>(110), aDIB[136] );
+ CPPUNIT_ASSERT_EQUAL( static_cast<sal_Int8>(49), aDIB[137] );
+}
#endif
CPPUNIT_PLUGIN_IMPLEMENT();