Kaydet (Commit) 7256a10f authored tarafından Kohei Yoshida's avatar Kohei Yoshida

Write test for importing images from xls.

Change-Id: I84a996d20ed7ce5f9ffa48644616e59186458243
üst 78131b6b
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
#include <sfx2/docfile.hxx> #include <sfx2/docfile.hxx>
#include <sfx2/sfxmodelfactory.hxx> #include <sfx2/sfxmodelfactory.hxx>
#include <svl/stritem.hxx> #include <svl/stritem.hxx>
#include <svx/svdograf.hxx>
#include "drwlayer.hxx" #include "drwlayer.hxx"
#include <svx/svdpage.hxx> #include <svx/svdpage.hxx>
...@@ -177,6 +178,7 @@ public: ...@@ -177,6 +178,7 @@ public:
void testHybridSharedStringODS(); void testHybridSharedStringODS();
void testCopyMergedNumberFormats(); void testCopyMergedNumberFormats();
void testVBAUserFunctionXLSM(); void testVBAUserFunctionXLSM();
void testEmbeddedImageXLS();
CPPUNIT_TEST_SUITE(ScFiltersTest); CPPUNIT_TEST_SUITE(ScFiltersTest);
CPPUNIT_TEST(testBasicCellContentODS); CPPUNIT_TEST(testBasicCellContentODS);
...@@ -257,6 +259,7 @@ public: ...@@ -257,6 +259,7 @@ public:
CPPUNIT_TEST(testHybridSharedStringODS); CPPUNIT_TEST(testHybridSharedStringODS);
CPPUNIT_TEST(testCopyMergedNumberFormats); CPPUNIT_TEST(testCopyMergedNumberFormats);
CPPUNIT_TEST(testVBAUserFunctionXLSM); CPPUNIT_TEST(testVBAUserFunctionXLSM);
CPPUNIT_TEST(testEmbeddedImageXLS);
CPPUNIT_TEST_SUITE_END(); CPPUNIT_TEST_SUITE_END();
private: private:
...@@ -2624,6 +2627,30 @@ void ScFiltersTest::testVBAUserFunctionXLSM() ...@@ -2624,6 +2627,30 @@ void ScFiltersTest::testVBAUserFunctionXLSM()
xDocSh->DoClose(); 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() ScFiltersTest::ScFiltersTest()
: ScBootstrapFixture( "/sc/qa/unit/data" ) : ScBootstrapFixture( "/sc/qa/unit/data" )
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment