[Libreoffice-commits] core.git: sc/qa
Kohei Yoshida
kohei.yoshida at collabora.com
Tue Aug 12 12:43:58 PDT 2014
sc/qa/unit/data/xls/file-with-png-image.xls |binary
sc/qa/unit/subsequent_filters-test.cxx | 27 +++++++++++++++++++++++++++
2 files changed, 27 insertions(+)
New commits:
commit 7256a10fb6abcecdda5b5820be79940b14c51fc2
Author: Kohei Yoshida <kohei.yoshida at collabora.com>
Date: Tue Aug 12 15:36:55 2014 -0400
Write test for importing images from xls.
Change-Id: I84a996d20ed7ce5f9ffa48644616e59186458243
diff --git a/sc/qa/unit/data/xls/file-with-png-image.xls b/sc/qa/unit/data/xls/file-with-png-image.xls
new file mode 100755
index 0000000..36fe473
Binary files /dev/null and b/sc/qa/unit/data/xls/file-with-png-image.xls differ
diff --git a/sc/qa/unit/subsequent_filters-test.cxx b/sc/qa/unit/subsequent_filters-test.cxx
index 8cc9510..0915878 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" )
{
More information about the Libreoffice-commits
mailing list