[Libreoffice-commits] core.git: sc/qa
Giuseppe Bilotta
giuseppe.bilotta at gmail.com
Sat May 7 22:34:09 UTC 2016
sc/qa/unit/data/xls/cell-anchored-group.xls |binary
sc/qa/unit/subsequent_export-test.cxx | 31 ++++++++++++++++++++++++++++
2 files changed, 31 insertions(+)
New commits:
commit ead37770442a0244094779d199303b7b7e6d634c
Author: Giuseppe Bilotta <giuseppe.bilotta at gmail.com>
Date: Fri Apr 22 12:22:30 2016 +0200
tdf#84394: add testcase and unit test
The testcase for tdf#84394 is quite interesting as it exposes a lot of
issues with import/export of nested objects in Calc. Add it to the
repository (I happen to be the author of the test case, so I give
myself permission for it) and add a unit test to validate that the
previous patch fixes at least one of the issues that plague its import
in LO Calc.
Change-Id: I996ea0f694d78faede77fce84838d2dd0831353e
Signed-off-by: Giuseppe Bilotta <giuseppe.bilotta at gmail.com>
Reviewed-on: https://gerrit.libreoffice.org/24296
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Markus Mohrhard <markus.mohrhard at googlemail.com>
diff --git a/sc/qa/unit/data/xls/cell-anchored-group.xls b/sc/qa/unit/data/xls/cell-anchored-group.xls
new file mode 100644
index 0000000..3b55d60
Binary files /dev/null and b/sc/qa/unit/data/xls/cell-anchored-group.xls differ
diff --git a/sc/qa/unit/subsequent_export-test.cxx b/sc/qa/unit/subsequent_export-test.cxx
index 037ed40..58d4681 100644
--- a/sc/qa/unit/subsequent_export-test.cxx
+++ b/sc/qa/unit/subsequent_export-test.cxx
@@ -111,6 +111,8 @@ public:
void testInlineArrayXLS();
void testEmbeddedChartXLS();
+ void testCellAnchoredGroupXLS();
+
void testFormulaReferenceXLS();
void testSheetProtectionXLSX();
@@ -187,6 +189,8 @@ public:
CPPUNIT_TEST(testFormatExportODS);
CPPUNIT_TEST(testInlineArrayXLS);
CPPUNIT_TEST(testEmbeddedChartXLS);
+ CPPUNIT_TEST(testCellAnchoredGroupXLS);
+
CPPUNIT_TEST(testFormulaReferenceXLS);
CPPUNIT_TEST(testSheetProtectionXLSX);
CPPUNIT_TEST(testCellBordersXLS);
@@ -1378,6 +1382,33 @@ void ScExportTest::testEmbeddedChartXLS()
xDocSh->DoClose();
}
+void ScExportTest::testCellAnchoredGroupXLS()
+{
+ ScDocShellRef xDocSh_in = loadDoc("cell-anchored-group.", FORMAT_XLS);
+ CPPUNIT_ASSERT_MESSAGE("Failed to load cell-anchored-group.xls", xDocSh_in.Is());
+
+ ScDocShellRef xDocSh = saveAndReload(&(*xDocSh_in), FORMAT_ODS);
+ CPPUNIT_ASSERT_MESSAGE("Failed to save and reload cell-anchored-group.ods", xDocSh.Is());
+
+ // the document contains a group anchored on the first cell, make sure it's there in the right place
+ ScDocument& rDoc = xDocSh->GetDocument();
+ CPPUNIT_ASSERT_MESSAGE("There should be at least one sheet.", rDoc.GetTableCount() > 0);
+ ScDrawLayer* pDrawLayer = rDoc.GetDrawLayer();
+ SdrPage* pPage = pDrawLayer->GetPage(0);
+ CPPUNIT_ASSERT_MESSAGE("draw page for sheet 1 should exist.", pPage);
+ const size_t nCount = pPage->GetObjCount();
+ CPPUNIT_ASSERT_EQUAL_MESSAGE(
+ "There should be 1 objects.", static_cast<size_t>(1), nCount);
+
+ SdrObject* pObj = pPage->GetObj(0);
+ CPPUNIT_ASSERT_MESSAGE("Failed to get drawing object.", pObj);
+ ScDrawObjData* pData = ScDrawLayer::GetObjData(pObj);
+ CPPUNIT_ASSERT_MESSAGE("Failed to retrieve user data for this object.", pData);
+ CPPUNIT_ASSERT_MESSAGE("Upper left of bounding rectangle should be nonnegative.",
+ pData->maLastRect.Left() >= 0 || pData->maLastRect.Top() >= 0);
+ xDocSh->DoClose();
+}
+
void ScExportTest::testFormulaReferenceXLS()
{
ScDocShellRef xShell = loadDoc("formula-reference.", FORMAT_XLS);
More information about the Libreoffice-commits
mailing list