sw/qa/extras/ooxmlimport/data/msobrightnesscontrast.docx |binary sw/qa/extras/ooxmlimport/ooxmlimport.cxx | 19 +++++++++++++ sw/qa/extras/ww8import/data/msobrightnesscontrast.doc |binary sw/qa/extras/ww8import/ww8import.cxx | 21 +++++++++++++++ 4 files changed, 40 insertions(+)
New commits: commit 2dda1cd4d1927790d546dbaf1893279d18515bae Author: LuboÅ¡ LuÅák <l.lu...@collabora.com> Date: Wed Apr 30 23:40:54 2014 +0200 tests for msoffice brightness+contrast For commits 1139d618b8bc6ab823a96184bd0f0257980aad24 and 893fe88469dec5b727d96f8ea1b4edb9e88288a7 . Change-Id: Ia59ec5c4226944280c4b585c87179d28303bda4b diff --git a/sw/qa/extras/ooxmlimport/data/msobrightnesscontrast.docx b/sw/qa/extras/ooxmlimport/data/msobrightnesscontrast.docx new file mode 100644 index 0000000..132f235 Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/msobrightnesscontrast.docx differ diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx index f85da0d..a533e16 100644 --- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx +++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx @@ -2089,6 +2089,25 @@ DECLARE_OOXMLIMPORT_TEST(testGridBefore, "gridbefore.docx") CPPUNIT_ASSERT( leftA3.toInt32() > leftB2.toInt32()); } +DECLARE_OOXMLIMPORT_TEST(testMsoBrightnessContrast, "msobrightnesscontrast.docx") +{ + uno::Reference<text::XTextDocument> textDocument(mxComponent, uno::UNO_QUERY); + uno::Reference<drawing::XShape> image(getShape(1), uno::UNO_QUERY); + uno::Reference<beans::XPropertySet> imageProperties(image, uno::UNO_QUERY); + uno::Reference<graphic::XGraphic> graphic; + imageProperties->getPropertyValue( "Graphic" ) >>= graphic; + uno::Reference<awt::XBitmap> bitmap(graphic, uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL( sal_Int32(58), bitmap->getSize().Width ); + CPPUNIT_ASSERT_EQUAL( sal_Int32(320), bitmap->getSize().Height ); + const uno::Sequence< sal_Int8 > data = bitmap->getDIB(); // as .bmp data + CPPUNIT_ASSERT_EQUAL( sal_Int32(56374), data.getLength()); + CPPUNIT_ASSERT_EQUAL( -50, int(data[0x6e0])); // -50 = 206 pixel value + CPPUNIT_ASSERT_EQUAL( -50, int(data[0x6e1])); + CPPUNIT_ASSERT_EQUAL( -50, int(data[0x6e2])); + CPPUNIT_ASSERT_EQUAL( -50, int(data[0x6e3])); + CPPUNIT_ASSERT_EQUAL( -50, int(data[0x6e4])); +} + #endif CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/sw/qa/extras/ww8import/data/msobrightnesscontrast.doc b/sw/qa/extras/ww8import/data/msobrightnesscontrast.doc new file mode 100644 index 0000000..675d6d3 Binary files /dev/null and b/sw/qa/extras/ww8import/data/msobrightnesscontrast.doc differ diff --git a/sw/qa/extras/ww8import/ww8import.cxx b/sw/qa/extras/ww8import/ww8import.cxx index 972b06b..04db612 100644 --- a/sw/qa/extras/ww8import/ww8import.cxx +++ b/sw/qa/extras/ww8import/ww8import.cxx @@ -10,6 +10,8 @@ #if !defined(MACOSX) && !defined(WNT) +#include <com/sun/star/awt/XBitmap.hpp> +#include <com/sun/star/graphic/XGraphic.hpp> #include <com/sun/star/table/BorderLine2.hpp> #include <com/sun/star/table/TableBorder.hpp> #include <com/sun/star/table/TableBorder2.hpp> @@ -375,6 +377,25 @@ DECLARE_WW8IMPORT_TEST(testBorderColours, "bordercolours.doc") #endif } +DECLARE_WW8IMPORT_TEST(testMsoBrightnessContrast, "msobrightnesscontrast.doc") +{ + uno::Reference<text::XTextDocument> textDocument(mxComponent, uno::UNO_QUERY); + uno::Reference<drawing::XShape> image(getShape(1), uno::UNO_QUERY); + uno::Reference<beans::XPropertySet> imageProperties(image, uno::UNO_QUERY); + uno::Reference<graphic::XGraphic> graphic; + imageProperties->getPropertyValue( "Graphic" ) >>= graphic; + uno::Reference<awt::XBitmap> bitmap(graphic, uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL( sal_Int32(58), bitmap->getSize().Width ); + CPPUNIT_ASSERT_EQUAL( sal_Int32(320), bitmap->getSize().Height ); + const uno::Sequence< sal_Int8 > data = bitmap->getDIB(); // as .bmp data + CPPUNIT_ASSERT_EQUAL( sal_Int32(20278), data.getLength()); + CPPUNIT_ASSERT_EQUAL( -50, int(data[0x6b0])); // -50 = 206 pixel value + CPPUNIT_ASSERT_EQUAL( -50, int(data[0x6b1])); + CPPUNIT_ASSERT_EQUAL( -50, int(data[0x6b2])); + CPPUNIT_ASSERT_EQUAL( -50, int(data[0x6b3])); + CPPUNIT_ASSERT_EQUAL( -50, int(data[0x6b4])); +} + #endif CPPUNIT_PLUGIN_IMPLEMENT();
_______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits