diff options
author | Luboš Luňák <l.lunak@collabora.com> | 2014-04-30 23:40:54 +0200 |
---|---|---|
committer | Luboš Luňák <l.lunak@collabora.com> | 2014-04-30 23:41:34 +0200 |
commit | 2dda1cd4d1927790d546dbaf1893279d18515bae (patch) | |
tree | 05cbfeb088f95d21d0cb5c7eac6f2b427b573765 /sw | |
parent | 893fe88469dec5b727d96f8ea1b4edb9e88288a7 (diff) |
tests for msoffice brightness+contrast
For commits 1139d618b8bc6ab823a96184bd0f0257980aad24 and
893fe88469dec5b727d96f8ea1b4edb9e88288a7 .
Change-Id: Ia59ec5c4226944280c4b585c87179d28303bda4b
Diffstat (limited to 'sw')
-rw-r--r-- | sw/qa/extras/ooxmlimport/data/msobrightnesscontrast.docx | bin | 0 -> 18972 bytes | |||
-rw-r--r-- | sw/qa/extras/ooxmlimport/ooxmlimport.cxx | 19 | ||||
-rw-r--r-- | sw/qa/extras/ww8import/data/msobrightnesscontrast.doc | bin | 0 -> 27648 bytes | |||
-rw-r--r-- | sw/qa/extras/ww8import/ww8import.cxx | 21 |
4 files changed, 40 insertions, 0 deletions
diff --git a/sw/qa/extras/ooxmlimport/data/msobrightnesscontrast.docx b/sw/qa/extras/ooxmlimport/data/msobrightnesscontrast.docx Binary files differnew file mode 100644 index 000000000000..132f23575b57 --- /dev/null +++ b/sw/qa/extras/ooxmlimport/data/msobrightnesscontrast.docx diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx index f85da0de7180..a533e1670c5f 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 Binary files differnew file mode 100644 index 000000000000..675d6d3702e4 --- /dev/null +++ b/sw/qa/extras/ww8import/data/msobrightnesscontrast.doc diff --git a/sw/qa/extras/ww8import/ww8import.cxx b/sw/qa/extras/ww8import/ww8import.cxx index 972b06b63d91..04db6129f813 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(); |