summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorKohei Yoshida <kohei.yoshida@collabora.com>2014-02-05 16:38:39 -0500
committerKohei Yoshida <kohei.yoshida@collabora.com>2014-02-05 23:06:26 -0500
commitf6f83f2ffdbea4fdbf744626c43e837cde44872f (patch)
treeb52dfef2992667619442adbee2b089e224688e6d /sc
parent352ff66347d3e71e7091522a73c24a4bc65b9975 (diff)
Move this test closer to the other tests for cell notes.
Change-Id: I101e7fd20016b925cfcc25f6785937bc2fb8a03a
Diffstat (limited to 'sc')
-rw-r--r--sc/qa/unit/ucalc.cxx130
-rw-r--r--sc/qa/unit/ucalc.hxx6
2 files changed, 68 insertions, 68 deletions
diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx
index d393aa4a4e77..b09399a6a469 100644
--- a/sc/qa/unit/ucalc.cxx
+++ b/sc/qa/unit/ucalc.cxx
@@ -3133,71 +3133,6 @@ void Test::testGraphicsOnSheetMove()
m_pDoc->DeleteTab(0);
}
-void Test::testPostIts()
-{
- OUString aHello("Hello world");
- OUString aJimBob("Jim Bob");
- OUString aTabName("PostIts");
- OUString aTabName2("Table2");
- m_pDoc->InsertTab(0, aTabName);
-
- ScAddress rAddr(2, 2, 0); // cell C3
- ScPostIt *pNote = m_pDoc->GetOrCreateNote(rAddr);
-
- pNote->SetText(rAddr, aHello);
- pNote->SetAuthor(aJimBob);
-
- ScPostIt *pGetNote = m_pDoc->GetNote(rAddr);
- CPPUNIT_ASSERT_MESSAGE("note should be itself", pGetNote == pNote );
-
- // Insert one row at row 1.
- bool bInsertRow = m_pDoc->InsertRow(0, 0, MAXCOL, 0, 1, 1);
- CPPUNIT_ASSERT_MESSAGE("failed to insert row", bInsertRow );
-
- CPPUNIT_ASSERT_MESSAGE("note hasn't moved", m_pDoc->GetNote(rAddr) == NULL);
- rAddr.IncRow(); // cell C4
- CPPUNIT_ASSERT_MESSAGE("note not there", m_pDoc->GetNote(rAddr) == pNote);
-
- // Insert column at column A.
- bool bInsertCol = m_pDoc->InsertCol(0, 0, MAXROW, 0, 1, 1);
- CPPUNIT_ASSERT_MESSAGE("failed to insert column", bInsertCol );
-
- CPPUNIT_ASSERT_MESSAGE("note hasn't moved", m_pDoc->GetNote(rAddr) == NULL);
- rAddr.IncCol(); // cell D4
- CPPUNIT_ASSERT_MESSAGE("note not there", m_pDoc->GetNote(rAddr) == pNote);
-
- // Insert a new sheet to shift the current sheet to the right.
- m_pDoc->InsertTab(0, aTabName2);
- CPPUNIT_ASSERT_MESSAGE("note hasn't moved", m_pDoc->GetNote(rAddr) == NULL);
- rAddr.IncTab(); // Move to the next sheet.
- CPPUNIT_ASSERT_MESSAGE("note not there", m_pDoc->GetNote(rAddr) == pNote);
-
- m_pDoc->DeleteTab(0);
- rAddr.IncTab(-1);
- CPPUNIT_ASSERT_MESSAGE("note not there", m_pDoc->GetNote(rAddr) == pNote);
-
- // Insert cell at C4. This should NOT shift the note position.
- bInsertRow = m_pDoc->InsertRow(2, 0, 2, 0, 3, 1);
- CPPUNIT_ASSERT_MESSAGE("Failed to insert cell at C4.", bInsertRow);
- CPPUNIT_ASSERT_MESSAGE("Note shouldn't have moved but it has.", m_pDoc->GetNote(rAddr) == pNote);
-
- // Delete cell at C4. Again, this should NOT shift the note position.
- m_pDoc->DeleteRow(2, 0, 2, 0, 3, 1);
- CPPUNIT_ASSERT_MESSAGE("Note shouldn't have moved but it has.", m_pDoc->GetNote(rAddr) == pNote);
-
- // Now, with the note at D4, delete cell D3. This should shift the note one cell up.
- m_pDoc->DeleteRow(3, 0, 3, 0, 2, 1);
- rAddr.IncRow(-1); // cell D3
- CPPUNIT_ASSERT_MESSAGE("Note at D4 should have shifted up to D3.", m_pDoc->GetNote(rAddr) == pNote);
-
- // Delete column C. This should shift the note one cell left.
- m_pDoc->DeleteCol(0, 0, MAXROW, 0, 2, 1);
- rAddr.IncCol(-1); // cell C3
- CPPUNIT_ASSERT_MESSAGE("Note at D3 should have shifted left to C3.", m_pDoc->GetNote(rAddr) == pNote);
-
- m_pDoc->DeleteTab(0);
-}
-
void Test::testToggleRefFlag()
{
// In this test, there is no need to insert formula string into a cell in
@@ -4706,6 +4641,71 @@ void Test::testShiftCells()
m_pDoc->DeleteTab(0);
}
+void Test::testNoteBasic()
+{
+ OUString aHello("Hello world");
+ OUString aJimBob("Jim Bob");
+ OUString aTabName("PostIts");
+ OUString aTabName2("Table2");
+ m_pDoc->InsertTab(0, aTabName);
+
+ ScAddress rAddr(2, 2, 0); // cell C3
+ ScPostIt *pNote = m_pDoc->GetOrCreateNote(rAddr);
+
+ pNote->SetText(rAddr, aHello);
+ pNote->SetAuthor(aJimBob);
+
+ ScPostIt *pGetNote = m_pDoc->GetNote(rAddr);
+ CPPUNIT_ASSERT_MESSAGE("note should be itself", pGetNote == pNote );
+
+ // Insert one row at row 1.
+ bool bInsertRow = m_pDoc->InsertRow(0, 0, MAXCOL, 0, 1, 1);
+ CPPUNIT_ASSERT_MESSAGE("failed to insert row", bInsertRow );
+
+ CPPUNIT_ASSERT_MESSAGE("note hasn't moved", m_pDoc->GetNote(rAddr) == NULL);
+ rAddr.IncRow(); // cell C4
+ CPPUNIT_ASSERT_MESSAGE("note not there", m_pDoc->GetNote(rAddr) == pNote);
+
+ // Insert column at column A.
+ bool bInsertCol = m_pDoc->InsertCol(0, 0, MAXROW, 0, 1, 1);
+ CPPUNIT_ASSERT_MESSAGE("failed to insert column", bInsertCol );
+
+ CPPUNIT_ASSERT_MESSAGE("note hasn't moved", m_pDoc->GetNote(rAddr) == NULL);
+ rAddr.IncCol(); // cell D4
+ CPPUNIT_ASSERT_MESSAGE("note not there", m_pDoc->GetNote(rAddr) == pNote);
+
+ // Insert a new sheet to shift the current sheet to the right.
+ m_pDoc->InsertTab(0, aTabName2);
+ CPPUNIT_ASSERT_MESSAGE("note hasn't moved", m_pDoc->GetNote(rAddr) == NULL);
+ rAddr.IncTab(); // Move to the next sheet.
+ CPPUNIT_ASSERT_MESSAGE("note not there", m_pDoc->GetNote(rAddr) == pNote);
+
+ m_pDoc->DeleteTab(0);
+ rAddr.IncTab(-1);
+ CPPUNIT_ASSERT_MESSAGE("note not there", m_pDoc->GetNote(rAddr) == pNote);
+
+ // Insert cell at C4. This should NOT shift the note position.
+ bInsertRow = m_pDoc->InsertRow(2, 0, 2, 0, 3, 1);
+ CPPUNIT_ASSERT_MESSAGE("Failed to insert cell at C4.", bInsertRow);
+ CPPUNIT_ASSERT_MESSAGE("Note shouldn't have moved but it has.", m_pDoc->GetNote(rAddr) == pNote);
+
+ // Delete cell at C4. Again, this should NOT shift the note position.
+ m_pDoc->DeleteRow(2, 0, 2, 0, 3, 1);
+ CPPUNIT_ASSERT_MESSAGE("Note shouldn't have moved but it has.", m_pDoc->GetNote(rAddr) == pNote);
+
+ // Now, with the note at D4, delete cell D3. This should shift the note one cell up.
+ m_pDoc->DeleteRow(3, 0, 3, 0, 2, 1);
+ rAddr.IncRow(-1); // cell D3
+ CPPUNIT_ASSERT_MESSAGE("Note at D4 should have shifted up to D3.", m_pDoc->GetNote(rAddr) == pNote);
+
+ // Delete column C. This should shift the note one cell left.
+ m_pDoc->DeleteCol(0, 0, MAXROW, 0, 2, 1);
+ rAddr.IncCol(-1); // cell C3
+ CPPUNIT_ASSERT_MESSAGE("Note at D3 should have shifted left to C3.", m_pDoc->GetNote(rAddr) == pNote);
+
+ m_pDoc->DeleteTab(0);
+}
+
void Test::testNoteDeleteRow()
{
ScDocument* pDoc = getDocShell().GetDocument();
diff --git a/sc/qa/unit/ucalc.hxx b/sc/qa/unit/ucalc.hxx
index 7c9b5f80ab3e..2dbb22909418 100644
--- a/sc/qa/unit/ucalc.hxx
+++ b/sc/qa/unit/ucalc.hxx
@@ -270,8 +270,6 @@ public:
void testGraphicsInGroup();
void testGraphicsOnSheetMove();
- void testPostIts();
-
/**
* Test toggling relative/absolute flag of cell and cell range references.
* This corresponds with hitting Shift-F4 while the cursor is on a formula
@@ -298,6 +296,8 @@ public:
void testSortWithFormulaRefs();
void testSortWithStrings();
void testShiftCells();
+
+ void testNoteBasic();
void testNoteDeleteRow();
void testNoteDeleteCol();
void testAreasWithNotes();
@@ -391,7 +391,7 @@ public:
CPPUNIT_TEST(testDataArea);
CPPUNIT_TEST(testGraphicsInGroup);
CPPUNIT_TEST(testGraphicsOnSheetMove);
- CPPUNIT_TEST(testPostIts);
+ CPPUNIT_TEST(testNoteBasic);
CPPUNIT_TEST(testStreamValid);
CPPUNIT_TEST(testFunctionLists);
CPPUNIT_TEST(testToggleRefFlag);