summaryrefslogtreecommitdiffstats
path: root/sc/qa
diff options
context:
space:
mode:
authorKohei Yoshida <kohei.yoshida@suse.com>2012-01-07 19:09:24 -0500
committerKohei Yoshida <kohei.yoshida@suse.com>2012-01-07 19:11:34 -0500
commitd831f352ba4969f4e5ed0d1057a773d5a472d4aa (patch)
treedae9c1bf0c2d68aeeb5e205814f11755f503d640 /sc/qa
parentReset sheet index of drawing objects when moving sheet too. (diff)
downloadcore-d831f352ba4969f4e5ed0d1057a773d5a472d4aa.tar.gz
core-d831f352ba4969f4e5ed0d1057a773d5a472d4aa.zip
More unit test code for drawing objects. Found another bug & fixed it.
Inserting a new sheet would not update the anchored sheet index. Fixed.
Diffstat (limited to 'sc/qa')
-rw-r--r--sc/qa/unit/ucalc.cxx17
1 files changed, 17 insertions, 0 deletions
diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx
index 1adc2bf0eb27..c9c6b4bd28f4 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);
}