[Libreoffice-commits] core.git: 2 commits - sc/qa sc/source
Kohei Yoshida
kohei.yoshida at collabora.com
Thu Jan 23 11:12:02 PST 2014
sc/qa/unit/ucalc.cxx | 21 +++++++++++++++++++++
sc/qa/unit/ucalc.hxx | 2 ++
sc/source/core/data/column3.cxx | 2 +-
3 files changed, 24 insertions(+), 1 deletion(-)
New commits:
commit 228cd29a48374833bbe305a434f7149a0ef3ddd1
Author: Kohei Yoshida <kohei.yoshida at collabora.com>
Date: Thu Jan 23 14:07:25 2014 -0500
fdo#73986: Write unit test for document statistics.
Change-Id: I8ff51fda91627b365cf71be8849d07b92b447ba9
diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx
index 357f596..111b940 100644
--- a/sc/qa/unit/ucalc.cxx
+++ b/sc/qa/unit/ucalc.cxx
@@ -634,6 +634,27 @@ void Test::testInput()
m_pDoc->DeleteTab(0);
}
+void Test::testDocStatistics()
+{
+ SCTAB nStartTabs = m_pDoc->GetTableCount();
+ m_pDoc->InsertTab(0, "Sheet1");
+ CPPUNIT_ASSERT_MESSAGE("Failed to increment sheet count.", m_pDoc->GetTableCount() == nStartTabs+1);
+ m_pDoc->InsertTab(1, "Sheet2");
+ CPPUNIT_ASSERT_MESSAGE("Failed to increment sheet count.", m_pDoc->GetTableCount() == nStartTabs+2);
+
+ CPPUNIT_ASSERT_EQUAL(static_cast<sal_uLong>(0), m_pDoc->GetCellCount());
+ m_pDoc->SetValue(ScAddress(0,0,0), 2.0);
+ CPPUNIT_ASSERT_EQUAL(static_cast<sal_uLong>(1), m_pDoc->GetCellCount());
+ m_pDoc->SetValue(ScAddress(2,2,0), 2.5);
+ CPPUNIT_ASSERT_EQUAL(static_cast<sal_uLong>(2), m_pDoc->GetCellCount());
+ m_pDoc->SetString(ScAddress(1,1,1), "Test");
+ CPPUNIT_ASSERT_EQUAL(static_cast<sal_uLong>(3), m_pDoc->GetCellCount());
+
+ m_pDoc->DeleteTab(1);
+ CPPUNIT_ASSERT_MESSAGE("Failed to decrement sheet count.", m_pDoc->GetTableCount() == nStartTabs+1);
+ m_pDoc->DeleteTab(0); // This may fail in case there is only one sheet in the document.
+}
+
void Test::testDataEntries()
{
m_pDoc->InsertTab(0, "Test");
diff --git a/sc/qa/unit/ucalc.hxx b/sc/qa/unit/ucalc.hxx
index 1dbfbbc..f6007ff 100644
--- a/sc/qa/unit/ucalc.hxx
+++ b/sc/qa/unit/ucalc.hxx
@@ -83,6 +83,7 @@ public:
void testSharedStringPool();
void testRangeList();
void testInput();
+ void testDocStatistics();
/**
* The 'data entries' data is a list of strings used for suggestions as
@@ -314,6 +315,7 @@ public:
CPPUNIT_TEST(testSharedStringPool);
CPPUNIT_TEST(testRangeList);
CPPUNIT_TEST(testInput);
+ CPPUNIT_TEST(testDocStatistics);
CPPUNIT_TEST(testDataEntries);
CPPUNIT_TEST(testSelectionFunction);
CPPUNIT_TEST(testFormulaCreateStringFromTokens);
commit 9ce7ba209d28cd284ab5ea584bc130d7a081b0f9
Author: Kohei Yoshida <kohei.yoshida at collabora.com>
Date: Thu Jan 23 14:06:34 2014 -0500
fdo#73986: Don't forget to receive returned object from for_each.
Change-Id: Ia4ccb83c45ea3ce72a8e5c62a560ab1802bb2441
diff --git a/sc/source/core/data/column3.cxx b/sc/source/core/data/column3.cxx
index 7675271..798d544 100644
--- a/sc/source/core/data/column3.cxx
+++ b/sc/source/core/data/column3.cxx
@@ -2433,7 +2433,7 @@ public:
SCSIZE ScColumn::GetCellCount() const
{
CellCounter aFunc;
- std::for_each(maCells.begin(), maCells.end(), aFunc);
+ aFunc = std::for_each(maCells.begin(), maCells.end(), aFunc);
return aFunc.getCount();
}
More information about the Libreoffice-commits
mailing list