[Libreoffice-commits] .: sc/qa sc/source
Kohei Yoshida
kohei at kemper.freedesktop.org
Sat Jan 7 16:11:33 PST 2012
sc/qa/unit/ucalc.cxx | 17 +++++++++++++++++
sc/source/core/data/drwlayer.cxx | 3 ++-
2 files changed, 19 insertions(+), 1 deletion(-)
New commits:
commit d831f352ba4969f4e5ed0d1057a773d5a472d4aa
Author: Kohei Yoshida <kohei.yoshida at suse.com>
Date: Sat Jan 7 19:09:24 2012 -0500
More unit test code for drawing objects. Found another bug & fixed it.
Inserting a new sheet would not update the anchored sheet index. Fixed.
diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx
index 1adc2bf..c9c6b4b 100644
--- a/sc/qa/unit/ucalc.cxx
+++ b/sc/qa/unit/ucalc.cxx
@@ -48,6 +48,7 @@
#include "attrib.hxx"
#include "dbdata.hxx"
#include "reftokenhelper.hxx"
+#include "userdat.hxx"
#include "docsh.hxx"
#include "docfunc.hxx"
@@ -2526,6 +2527,10 @@ void Test::testGraphicsOnSheetMove()
CPPUNIT_ASSERT_MESSAGE("There should be one object on the 1st sheet.", pPage->GetObjCount() == 1);
+ const ScDrawObjData* pData = ScDrawLayer::GetObjData(pObj);
+ CPPUNIT_ASSERT_MESSAGE("Object meta-data doesn't exist.", pData);
+ CPPUNIT_ASSERT_MESSAGE("Wrong sheet ID in cell anchor data!", pData->maStart.Tab() == 0 && pData->maEnd.Tab() == 0);
+
pPage = pDrawLayer->GetPage(1);
CPPUNIT_ASSERT_MESSAGE("No page instance for the 2nd sheet.", pPage);
CPPUNIT_ASSERT_MESSAGE("2nd sheet shouldn't have any object.", pPage->GetObjCount() == 0);
@@ -2541,6 +2546,8 @@ void Test::testGraphicsOnSheetMove()
pPage = pDrawLayer->GetPage(2);
CPPUNIT_ASSERT_MESSAGE("3rd sheet should have no object.", pPage && pPage->GetObjCount() == 0);
+ CPPUNIT_ASSERT_MESSAGE("Wrong sheet ID in cell anchor data!", pData->maStart.Tab() == 1 && pData->maEnd.Tab() == 1);
+
// Now, delete the sheet that just got inserted. The object should be back
// on the 1st sheet.
m_pDoc->DeleteTab(0);
@@ -2549,6 +2556,16 @@ void Test::testGraphicsOnSheetMove()
CPPUNIT_ASSERT_MESSAGE("Size and position of the object shouldn't change.",
pObj->GetLogicRect() == aObjRect);
+ CPPUNIT_ASSERT_MESSAGE("Wrong sheet ID in cell anchor data!", pData->maStart.Tab() == 0 && pData->maEnd.Tab() == 0);
+
+ // Move the 1st sheet to the last position.
+ m_pDoc->MoveTab(0, 1);
+ pPage = pDrawLayer->GetPage(0);
+ CPPUNIT_ASSERT_MESSAGE("1st sheet should have no object.", pPage && pPage->GetObjCount() == 0);
+ pPage = pDrawLayer->GetPage(1);
+ CPPUNIT_ASSERT_MESSAGE("2nd sheet should have one object.", pPage && pPage->GetObjCount() == 1);
+ CPPUNIT_ASSERT_MESSAGE("Wrong sheet ID in cell anchor data!", pData->maStart.Tab() == 1 && pData->maEnd.Tab() == 1);
+
m_pDoc->DeleteTab(1);
m_pDoc->DeleteTab(0);
}
diff --git a/sc/source/core/data/drwlayer.cxx b/sc/source/core/data/drwlayer.cxx
index 69f289a..087d510 100644
--- a/sc/source/core/data/drwlayer.cxx
+++ b/sc/source/core/data/drwlayer.cxx
@@ -390,7 +390,8 @@ sal_Bool ScDrawLayer::ScAddPage( SCTAB nTab )
if (bRecording)
AddCalcUndo(new SdrUndoNewPage(*pPage));
- return sal_True; // inserted
+ ResetTab(nTab, pDoc->GetTableCount()-1);
+ return true; // inserted
}
void ScDrawLayer::ScRemovePage( SCTAB nTab )
More information about the Libreoffice-commits
mailing list