diff options
author | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2012-04-05 05:05:40 +0200 |
---|---|---|
committer | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2012-04-05 05:05:40 +0200 |
commit | 3e887edcaacc5b0f5e35d682a259124648e84229 (patch) | |
tree | e8545d20a3e06e405e07386cba1d6d089ffb46fc /sc/qa/unit | |
parent | a5eadc6aaafec92df23c57e258882a2c98ece0ad (diff) |
Revert "Cleanup. ScPivot(Collection) is no more."
This reverts commit 568d3912bf8ced76ecb9506bccc3bd361daba082.
Diffstat (limited to 'sc/qa/unit')
-rw-r--r-- | sc/qa/unit/helper/debughelper.hxx | 10 | ||||
-rw-r--r-- | sc/qa/unit/ucalc.cxx | 49 |
2 files changed, 49 insertions, 10 deletions
diff --git a/sc/qa/unit/helper/debughelper.hxx b/sc/qa/unit/helper/debughelper.hxx index cb2bad7b9f6f..1312e0472983 100644 --- a/sc/qa/unit/helper/debughelper.hxx +++ b/sc/qa/unit/helper/debughelper.hxx @@ -56,16 +56,6 @@ using ::std::endl; using ::std::vector; - -namespace { - -::std::ostream& operator<< (::std::ostream& os, const rtl::OUString& str) -{ - return os << ::rtl::OUStringToOString(str, RTL_TEXTENCODING_UTF8).getStr(); -} - -} - class SheetPrinter { typedef ::mdds::mixed_type_matrix<OUString, bool> MatrixType; diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx index 245215c723a3..c8bd00c0cb57 100644 --- a/sc/qa/unit/ucalc.cxx +++ b/sc/qa/unit/ucalc.cxx @@ -206,6 +206,7 @@ public: void testJumpToPrecedentsDependents(); void testSetBackgroundColor(); + void testRenameTable(); CPPUNIT_TEST_SUITE(Test); CPPUNIT_TEST(testCollator); @@ -244,6 +245,7 @@ public: CPPUNIT_TEST(testUpdateReference); CPPUNIT_TEST(testJumpToPrecedentsDependents); CPPUNIT_TEST(testSetBackgroundColor); + CPPUNIT_TEST(testRenameTable); CPPUNIT_TEST_SUITE_END(); private: @@ -3910,6 +3912,53 @@ void Test::testMergedCells() m_pDoc->DeleteTab(0); } + +void Test::testRenameTable() +{ + //test set rename table + //TODO: set name1 and name2 and do an undo to check if name 1 is set now + //TODO: also check if new name for table is same as another table + + m_pDoc->InsertTab(0, "Sheet1"); + m_pDoc->InsertTab(1, "Sheet2"); + + //test case 1 , rename table2 to sheet 1, it should return error + rtl::OUString nameToSet = "Sheet1"; + ScDocFunc& rDocFunc = m_xDocShRef->GetDocFunc(); + CPPUNIT_ASSERT_MESSAGE("name same as another table is being set", !rDocFunc.RenameTable(1,nameToSet,false,true) ); + + //test case 2 , simple rename to check name + nameToSet = "test1"; + m_xDocShRef->GetDocFunc().RenameTable(0,nameToSet,false,true); + rtl::OUString nameJustSet; + m_pDoc->GetName(0,nameJustSet); + CPPUNIT_ASSERT_MESSAGE("table not renamed", nameToSet != nameJustSet); + + //test case 3 , rename again + rtl::OUString anOldName; + m_pDoc->GetName(0,anOldName); + + nameToSet = "test2"; + rDocFunc.RenameTable(0,nameToSet,false,true); + m_pDoc->GetName(0,nameJustSet); + CPPUNIT_ASSERT_MESSAGE("table not renamed", nameToSet != nameJustSet); + + //test case 4 , check if undo works + SfxUndoAction* pUndo = new ScUndoRenameTab(m_xDocShRef,0,anOldName,nameToSet); + pUndo->Undo(); + m_pDoc->GetName(0,nameJustSet); + CPPUNIT_ASSERT_MESSAGE("the correct name is not set after undo", nameJustSet == anOldName); + + pUndo->Redo(); + m_pDoc->GetName(0,nameJustSet); + CPPUNIT_ASSERT_MESSAGE("the correct color is not set after redo", nameJustSet == nameToSet); + + m_pDoc->DeleteTab(0); + m_pDoc->DeleteTab(1); +} + + + void Test::testSetBackgroundColor() { //test set background color |