Kaydet (Commit) cb729adc authored tarafından Kohei Yoshida's avatar Kohei Yoshida

Removed patch accidentally committed.

üst 336ed340
From e8c376c207e89f0b6155e4bbcd0f46421db116ea Mon Sep 17 00:00:00 2001
From: Markus Mohrhard <markus.mohrhard@googlemail.com>
Date: Thu, 26 May 2011 19:12:43 +0200
Subject: [PATCH] add unit test for ScDocument::MoveTab
this unit test is disabled for now because there is a problem with ScProgress in ScDocument::MoveTab during unit tests
---
sc/qa/unit/ucalc.cxx | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 52 insertions(+), 0 deletions(-)
diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx
index a55fbbf..c43eb01 100644
--- a/sc/qa/unit/ucalc.cxx
+++ b/sc/qa/unit/ucalc.cxx
@@ -236,6 +236,7 @@ public:
void testDataPilot();
void testDataPilotFilters();
void testSheetCopy();
+ void testSheetMove();
void testExternalRef();
void testDataArea();
@@ -276,6 +277,9 @@ public:
CPPUNIT_TEST(testDataPilot);
CPPUNIT_TEST(testDataPilotFilters);
CPPUNIT_TEST(testSheetCopy);
+#if 0 // Disabled, first problem with ScProgress in ScDocument::MoveTab must be solved
+ CPPUNIT_TEST(testSheetMove);
+#endif
CPPUNIT_TEST(testExternalRef);
CPPUNIT_TEST(testDataArea);
CPPUNIT_TEST(testGraphicsInGroup);
@@ -1238,6 +1242,54 @@ void Test::testSheetCopy()
CPPUNIT_ASSERT_MESSAGE("rows 5 - 10 should be hidden", bHidden && nRow1 == 5 && nRow2 == 10);
bHidden = m_pDoc->RowHidden(11, 1, &nRow1, &nRow2);
CPPUNIT_ASSERT_MESSAGE("rows 11 - maxrow should be visible", !bHidden && nRow1 == 11 && nRow2 == MAXROW);
+ m_pDoc->DeleteTab(1);
+ m_pDoc->DeleteTab(0);
+}
+
+void Test::testSheetMove()
+{
+ OUString aTabName(RTL_CONSTASCII_USTRINGPARAM("TestTab1"));
+ m_pDoc->InsertTab(0, aTabName);
+ CPPUNIT_ASSERT_MESSAGE("document should have one sheet to begin with.", m_pDoc->GetTableCount() == 1);
+ SCROW nRow1, nRow2;
+ bool bHidden = m_pDoc->RowHidden(0, 0, &nRow1, &nRow2);
+ CPPUNIT_ASSERT_MESSAGE("new sheet should have all rows visible", !bHidden && nRow1 == 0 && nRow2 == MAXROW);
+
+ //test if inserting before another sheet works
+ m_pDoc->InsertTab(0, OUString(RTL_CONSTASCII_USTRINGPARAM("TestTab2")));
+ CPPUNIT_ASSERT_MESSAGE("document should have two sheets", m_pDoc->GetTableCount() == 2);
+ bHidden = m_pDoc->RowHidden(0, 0, &nRow1, &nRow2);
+ CPPUNIT_ASSERT_MESSAGE("new sheet should have all rows visible", !bHidden && nRow1 == 0 && nRow2 == MAXROW);
+
+ // Move and test the result.
+ m_pDoc->MoveTab(0, 1);
+ CPPUNIT_ASSERT_MESSAGE("document now should have two sheets.", m_pDoc->GetTableCount() == 2);
+ bHidden = m_pDoc->RowHidden(0, 1, &nRow1, &nRow2);
+ CPPUNIT_ASSERT_MESSAGE("copied sheet should also have all rows visible as the original.", !bHidden && nRow1 == 0 && nRow2 == MAXROW);
+ String aName;
+ m_pDoc->GetName(0, aName);
+ CPPUNIT_ASSERT_MESSAGE("sheets should have changed places", aName.EqualsAscii("TestTab1"));
+
+ m_pDoc->SetRowHidden(5, 10, 0, true);
+ bHidden = m_pDoc->RowHidden(0, 0, &nRow1, &nRow2);
+ CPPUNIT_ASSERT_MESSAGE("rows 0 - 4 should be visible", !bHidden && nRow1 == 0 && nRow2 == 4);
+ bHidden = m_pDoc->RowHidden(5, 0, &nRow1, &nRow2);
+ CPPUNIT_ASSERT_MESSAGE("rows 5 - 10 should be hidden", bHidden && nRow1 == 5 && nRow2 == 10);
+ bHidden = m_pDoc->RowHidden(11, 0, &nRow1, &nRow2);
+ CPPUNIT_ASSERT_MESSAGE("rows 11 - maxrow should be visible", !bHidden && nRow1 == 11 && nRow2 == MAXROW);
+
+ // Move the sheet once again.
+ m_pDoc->MoveTab(1, 0);
+ CPPUNIT_ASSERT_MESSAGE("document now should have two sheets.", m_pDoc->GetTableCount() == 2);
+ bHidden = m_pDoc->RowHidden(0, 1, &nRow1, &nRow2);
+ CPPUNIT_ASSERT_MESSAGE("rows 0 - 4 should be visible", !bHidden && nRow1 == 0 && nRow2 == 4);
+ bHidden = m_pDoc->RowHidden(5, 1, &nRow1, &nRow2);
+ CPPUNIT_ASSERT_MESSAGE("rows 5 - 10 should be hidden", bHidden && nRow1 == 5 && nRow2 == 10);
+ bHidden = m_pDoc->RowHidden(11, 1, &nRow1, &nRow2);
+ CPPUNIT_ASSERT_MESSAGE("rows 11 - maxrow should be visible", !bHidden && nRow1 == 11 && nRow2 == MAXROW);
+ m_pDoc->GetName(0, aName);
+ CPPUNIT_ASSERT_MESSAGE("sheets should have changed places", aName.EqualsAscii("TestTab2"));
+ m_pDoc->DeleteTab(1);
m_pDoc->DeleteTab(0);
}
--
1.7.2.5
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment