[Libreoffice-commits] .: sc/qa
Michael Meeks
michael at kemper.freedesktop.org
Mon Nov 7 09:24:33 PST 2011
sc/qa/unit/ucalc.cxx | 36 ++++++++++++++++++++++++++++++++++++
1 file changed, 36 insertions(+)
New commits:
commit 0c3f7e161f2e282e3611be822982c096e1fa5752
Author: Michael Meeks <michael.meeks at suse.com>
Date: Mon Nov 7 16:42:44 2011 +0000
calc: initial cut at post-it unit test
diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx
index a7af452..a7770b5 100644
--- a/sc/qa/unit/ucalc.cxx
+++ b/sc/qa/unit/ucalc.cxx
@@ -44,6 +44,7 @@
#include "refundo.hxx"
#include "undoblk.hxx"
#include "queryentry.hxx"
+#include "postit.hxx"
#include "docsh.hxx"
#include "docfunc.hxx"
@@ -148,6 +149,8 @@ public:
void testGraphicsInGroup();
+ 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
@@ -174,6 +177,7 @@ public:
CPPUNIT_TEST(testExternalRefFunctions);
CPPUNIT_TEST(testDataArea);
CPPUNIT_TEST(testGraphicsInGroup);
+ CPPUNIT_TEST(testPostIts);
CPPUNIT_TEST(testStreamValid);
CPPUNIT_TEST(testFunctionLists);
CPPUNIT_TEST(testToggleRefFlag);
@@ -2078,6 +2082,38 @@ void Test::testGraphicsInGroup()
m_pDoc->DeleteTab(0);
}
+void Test::testPostIts()
+{
+ rtl::OUString aHello(RTL_CONSTASCII_USTRINGPARAM("Hello world"));
+ rtl::OUString aJimBob(RTL_CONSTASCII_USTRINGPARAM("Jim Bob"));
+ rtl::OUString aTabName(RTL_CONSTASCII_USTRINGPARAM("PostIts"));
+ m_pDoc->InsertTab(0, aTabName);
+
+ ScAddress rAddr(2, 2, 0);
+ 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 );
+
+ bool bInsertRow = m_pDoc->InsertRow( 0, 0, 100, 1, 1, 1 );
+ CPPUNIT_ASSERT_MESSAGE("failed to insert row", bInsertRow );
+
+ CPPUNIT_ASSERT_MESSAGE("note hasn't moved", m_pDoc->GetNote(rAddr) == NULL);
+ rAddr.IncRow();
+ CPPUNIT_ASSERT_MESSAGE("note not there", m_pDoc->GetNote(rAddr) == pNote);
+
+ bool bInsertCol = m_pDoc->InsertCol( 0, 0, 100, 1, 1, 1 );
+ CPPUNIT_ASSERT_MESSAGE("failed to insert column", bInsertCol );
+
+ CPPUNIT_ASSERT_MESSAGE("note hasn't moved", m_pDoc->GetNote(rAddr) == NULL);
+ rAddr.IncCol();
+ CPPUNIT_ASSERT_MESSAGE("note not there", 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
More information about the Libreoffice-commits
mailing list