diff options
author | Kohei Yoshida <kohei.yoshida@collabora.com> | 2014-08-12 15:36:55 -0400 |
---|---|---|
committer | Kohei Yoshida <kohei.yoshida@collabora.com> | 2014-08-12 15:43:36 -0400 |
commit | 7256a10fb6abcecdda5b5820be79940b14c51fc2 (patch) | |
tree | e3779b7196a81dc9e6910fd6e31c4bd3f489cbc8 /sc | |
parent | 78131b6bfc16d739e28024407de253c84cb68a8a (diff) |
Write test for importing images from xls.
Change-Id: I84a996d20ed7ce5f9ffa48644616e59186458243
Diffstat (limited to 'sc')
-rwxr-xr-x | sc/qa/unit/data/xls/file-with-png-image.xls | bin | 0 -> 49152 bytes | |||
-rw-r--r-- | sc/qa/unit/subsequent_filters-test.cxx | 27 |
2 files changed, 27 insertions, 0 deletions
diff --git a/sc/qa/unit/data/xls/file-with-png-image.xls b/sc/qa/unit/data/xls/file-with-png-image.xls Binary files differnew file mode 100755 index 000000000000..36fe4734df1a --- /dev/null +++ b/sc/qa/unit/data/xls/file-with-png-image.xls diff --git a/sc/qa/unit/subsequent_filters-test.cxx b/sc/qa/unit/subsequent_filters-test.cxx index 8cc9510a994e..0915878e604f 100644 --- a/sc/qa/unit/subsequent_filters-test.cxx +++ b/sc/qa/unit/subsequent_filters-test.cxx @@ -18,6 +18,7 @@ #include <sfx2/docfile.hxx> #include <sfx2/sfxmodelfactory.hxx> #include <svl/stritem.hxx> +#include <svx/svdograf.hxx> #include "drwlayer.hxx" #include <svx/svdpage.hxx> @@ -177,6 +178,7 @@ public: void testHybridSharedStringODS(); void testCopyMergedNumberFormats(); void testVBAUserFunctionXLSM(); + void testEmbeddedImageXLS(); CPPUNIT_TEST_SUITE(ScFiltersTest); CPPUNIT_TEST(testBasicCellContentODS); @@ -257,6 +259,7 @@ public: CPPUNIT_TEST(testHybridSharedStringODS); CPPUNIT_TEST(testCopyMergedNumberFormats); CPPUNIT_TEST(testVBAUserFunctionXLSM); + CPPUNIT_TEST(testEmbeddedImageXLS); CPPUNIT_TEST_SUITE_END(); private: @@ -2624,6 +2627,30 @@ void ScFiltersTest::testVBAUserFunctionXLSM() xDocSh->DoClose(); } +void ScFiltersTest::testEmbeddedImageXLS() +{ + // The document has one embedded image on the first sheet. Make sure it's + // imported properly. + + ScDocShellRef xDocSh = loadDoc("file-with-png-image.", XLS); + CPPUNIT_ASSERT(xDocSh.Is()); + ScDocument& rDoc = xDocSh->GetDocument(); + + ScDrawLayer* pDL = rDoc.GetDrawLayer(); + CPPUNIT_ASSERT(pDL); + const SdrPage* pPage = pDL->GetPage(0); + CPPUNIT_ASSERT(pPage); + const SdrObject* pObj = pPage->GetObj(0); + CPPUNIT_ASSERT(pObj); + const SdrGrafObj* pImageObj = dynamic_cast<const SdrGrafObj*>(pObj); + CPPUNIT_ASSERT(pImageObj); + const Graphic& rGrf = pImageObj->GetGraphic(); + BitmapEx aBMP = rGrf.GetBitmapEx(); + CPPUNIT_ASSERT_MESSAGE("Bitmap content should not be empty if the image has been properly imported.", !aBMP.IsEmpty()); + + xDocSh->DoClose(); +} + ScFiltersTest::ScFiltersTest() : ScBootstrapFixture( "/sc/qa/unit/data" ) { |