[Libreoffice-commits] .: 2 commits - sc/qa sc/source

2012-03-18 Thread Markus Mohrhard
 sc/qa/unit/data/ods/bug-fixes.ods  |binary
 sc/qa/unit/subsequent_filters-test.cxx |   21 ++---
 sc/source/ui/app/transobj.cxx  |   26 +-
 3 files changed, 31 insertions(+), 16 deletions(-)

New commits:
commit d58421c2cc5199e9892627b894eaab64265c82e7
Author: Markus Mohrhard 
Date:   Sun Mar 18 19:20:06 2012 +0100

add test case for fdo#40426

diff --git a/sc/qa/unit/data/ods/bug-fixes.ods 
b/sc/qa/unit/data/ods/bug-fixes.ods
index 6864235..b7c0539 100644
Binary files a/sc/qa/unit/data/ods/bug-fixes.ods and 
b/sc/qa/unit/data/ods/bug-fixes.ods differ
diff --git a/sc/qa/unit/subsequent_filters-test.cxx 
b/sc/qa/unit/subsequent_filters-test.cxx
index f5f1eaf..4aac0fc 100644
--- a/sc/qa/unit/subsequent_filters-test.cxx
+++ b/sc/qa/unit/subsequent_filters-test.cxx
@@ -41,6 +41,7 @@
 
 #include 
 #include 
+#include 
 
 #define CALC_DEBUG_OUTPUT 0
 #define TEST_BUG_FILES 0
@@ -483,9 +484,23 @@ void ScFiltersTest::testBugFixesODS()
 CPPUNIT_ASSERT_MESSAGE("Failed to load bugFixes.ods", xDocSh.Is());
 ScDocument* pDoc = xDocSh->GetDocument();
 
-rtl::OUString aCSVFileName;
-
createCSVPath(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("bugFix_Sheet2.")), 
aCSVFileName);
-testFile(aCSVFileName, pDoc, 1);
+{
+// fdo
+rtl::OUString aCSVFileName;
+
createCSVPath(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("bugFix_Sheet2.")), 
aCSVFileName);
+testFile(aCSVFileName, pDoc, 1);
+}
+
+{
+// fdo#40426
+ScDBData* pDBData = 
pDoc->GetDBCollection()->getNamedDBs().findByName("DBRange1");
+CPPUNIT_ASSERT(pDBData);
+CPPUNIT_ASSERT(pDBData->HasHeader());
+// no header
+pDBData = 
pDoc->GetDBCollection()->getNamedDBs().findByName("DBRange2");
+CPPUNIT_ASSERT(pDBData);
+CPPUNIT_ASSERT(!pDBData->HasHeader());
+}
 
 xDocSh->DoClose();
 }
commit 521456068d8a848e4e5a358b1ff7e8659c94a353
Author: Markus Mohrhard 
Date:   Sun Mar 18 19:19:43 2012 +0100

some sal_Bool to bool in transobj.cxx

diff --git a/sc/source/ui/app/transobj.cxx b/sc/source/ui/app/transobj.cxx
index cb1fa54..dbcfc54 100644
--- a/sc/source/ui/app/transobj.cxx
+++ b/sc/source/ui/app/transobj.cxx
@@ -150,7 +150,7 @@ ScTransferObj::ScTransferObj( ScDocument* pClipDoc, const 
TransferableObjectDesc
 SCCOL nCol2;
 SCROW nRow2;
 pDoc->GetClipStart( nCol1, nRow1 );
-pDoc->GetClipArea( nCol2, nRow2, sal_True );// real source area - 
include filtered rows
+pDoc->GetClipArea( nCol2, nRow2, true );// real source area - include 
filtered rows
 nCol2 = sal::static_int_cast( nCol2 + nCol1 );
 nRow2 = sal::static_int_cast( nRow2 + nRow1 );
 
@@ -161,7 +161,7 @@ ScTransferObj::ScTransferObj( ScDocument* pClipDoc, const 
TransferableObjectDesc
 
 SCTAB nTab1=0;
 SCTAB nTab2=0;
-sal_Bool bFirst = sal_True;
+bool bFirst = true;
 for (SCTAB i=0; i< pDoc->GetTableCount(); i++)
 if (pDoc->HasTable(i))
 {
@@ -260,7 +260,7 @@ void ScTransferObj::AddSupportedFormats()
 sal_Bool ScTransferObj::GetData( const datatransfer::DataFlavor& rFlavor )
 {
 sal_uInt32  nFormat = SotExchange::GetFormat( rFlavor );
-sal_BoolbOK = false;
+boolbOK = false;
 
 if( HasFormat( nFormat ) )
 {
@@ -308,7 +308,7 @@ sal_Bool ScTransferObj::GetData( const 
datatransfer::DataFlavor& rFlavor )
 if ( nFormat == SOT_FORMATSTR_ID_LINK )
 bUsedForLink = true;
 
-sal_Bool bIncludeFiltered = pDoc->IsCutMode() || bUsedForLink;
+bool bIncludeFiltered = pDoc->IsCutMode() || bUsedForLink;
 
 ScRange aReducedBlock = aBlock;
 if ( nFormat == SOT_FORMATSTR_ID_HTML && (aBlock.aEnd.Col() == 
MAXCOL || aBlock.aEnd.Row() == MAXROW) && aBlock.aStart.Tab() == 
aBlock.aEnd.Tab() )
@@ -481,7 +481,7 @@ sal_Bool ScTransferObj::WriteObject( SotStorageStreamRef& 
rxOStm, void* pUserObj
 delete pSrcStm;
 }
 
-bRet = sal_True;
+bRet = true;
 
 xWorkStore->dispose();
 xWorkStore = uno::Reference < embed::XStorage >();
@@ -558,7 +558,7 @@ void ScTransferObj::SetDragSourceFlags( sal_uInt16 nFlags )
 
 void ScTransferObj::SetDragWasInternal()
 {
-bDragWasInternal = sal_True;
+bDragWasInternal = true;
 }
 
 void ScTransferObj::SetUseInApi( bool bSet )
@@ -610,7 +610,7 @@ void ScTransferObj::InitDocShell()
 
 ScDocument* pDestDoc = pDocSh->GetDocument();
 ScMarkData aDestMark;
-aDestMark.SelectTable( 0, sal_True );
+aDestMark.SelectTable( 0, true );
 
 pDestDoc->SetDocOptions( pDoc->GetDocOptions() );   // #i42666#
 
@@ -663,16 +663,16 @@ void ScTransferObj::InitDocShell()
 //  pDoc is always a Clipboard-document
 
 ScRange aDestRange( nStartX,nStartY,0, nEndX,nEndY,0 );
-sal_Bool bWasCut = pDoc->IsCutMode();
+boo

[Libreoffice-commits] .: 2 commits - sc/qa sc/source

2011-10-20 Thread Markus Mohrhard
 sc/qa/unit/ucalc.cxx  |   57 +-
 sc/source/core/data/cell2.cxx |2 -
 2 files changed, 52 insertions(+), 7 deletions(-)

New commits:
commit 16cf673187679b3f45f2623bc6e3a52bf7dbba45
Author: Markus Mohrhard 
Date:   Thu Oct 20 19:16:06 2011 +0200

improve unit test for UpdateReference

check InsertTabs/InsertTab/DeleteTabs too

diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx
index 19741ed..232a62e 100644
--- a/sc/qa/unit/ucalc.cxx
+++ b/sc/qa/unit/ucalc.cxx
@@ -237,7 +237,7 @@ public:
 void testAutofilter();
 void testCopyPaste();
 void testMergedCells();
-void testSheetDelete();
+void testUpdateReference();
 
 /**
  * Make sure the sheet streams are invalidated properly.
@@ -282,7 +282,7 @@ public:
 CPPUNIT_TEST(testAutofilter);
 CPPUNIT_TEST(testCopyPaste);
 CPPUNIT_TEST(testMergedCells);
-CPPUNIT_TEST(testSheetDelete);
+CPPUNIT_TEST(testUpdateReference);
 CPPUNIT_TEST_SUITE_END();
 
 private:
@@ -2312,32 +2312,77 @@ void Test::testMergedCells()
 m_pDoc->DeleteTab(0);
 }
 
-void Test::testSheetDelete()
+void Test::testUpdateReference()
 {
 //test that formulas are correctly updated during sheet delete
 //TODO: add test cases for InsertTabs/InsertTab and DeleteTabs
 //TODO: add tests for references to other sheets, relative references, 
updating of named ranges, ...
 //TODO: maybe rename then to testUpdateReference
-m_pDoc->InsertTab(0, rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Sheet1")));
-m_pDoc->InsertTab(1, rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Sheet2")));
-m_pDoc->InsertTab(2, rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Sheet3")));
+rtl::OUString aSheet1(RTL_CONSTASCII_USTRINGPARAM("Sheet1"));
+rtl::OUString aSheet2(RTL_CONSTASCII_USTRINGPARAM("Sheet2"));
+rtl::OUString aSheet3(RTL_CONSTASCII_USTRINGPARAM("Sheet3"));
+rtl::OUString aSheet4(RTL_CONSTASCII_USTRINGPARAM("Sheet4"));
+m_pDoc->InsertTab(0, aSheet1);
+m_pDoc->InsertTab(1, aSheet2);
+m_pDoc->InsertTab(2, aSheet3);
+m_pDoc->InsertTab(3, aSheet4);
 
 m_pDoc->SetValue(0,0,2, 1);
 m_pDoc->SetValue(1,0,2, 2);
+m_pDoc->SetValue(1,1,3, 4);
 m_pDoc->SetString(2,0,2, 
rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("=A1+B1")));
+m_pDoc->SetString(2,1,2, 
rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("=Sheet4.B2+A1")));
 
 double aValue;
 m_pDoc->GetValue(2,0,2, aValue);
 CPPUNIT_ASSERT_MESSAGE("formula does not return correct result", aValue == 
3);
+m_pDoc->GetValue(2,1,2, aValue);
+CPPUNIT_ASSERT_MESSAGE("formula does not return correct result", aValue == 
5);
 
 //test deleting both sheets: one is not directly before the sheet, the 
other one is
 m_pDoc->DeleteTab(0);
 m_pDoc->GetValue(2,0,1, aValue);
 CPPUNIT_ASSERT_MESSAGE("after deleting first sheet formula does not return 
correct result", aValue == 3);
+m_pDoc->GetValue(2,1,1, aValue);
+CPPUNIT_ASSERT_MESSAGE("after deleting first sheet formula does not return 
correct result", aValue == 5);
 
 m_pDoc->DeleteTab(0);
 m_pDoc->GetValue(2,0,0, aValue);
 CPPUNIT_ASSERT_MESSAGE("after deleting second sheet formula does not 
return correct result", aValue == 3);
+m_pDoc->GetValue(2,1,0, aValue);
+CPPUNIT_ASSERT_MESSAGE("after deleting second sheet formula does not 
return correct result", aValue == 5);
+
+//test adding two sheets
+m_pDoc->InsertTab(0, aSheet2);
+m_pDoc->GetValue(2,0,1, aValue);
+CPPUNIT_ASSERT_MESSAGE("after inserting first sheet formula does not 
return correct result", aValue == 3);
+m_pDoc->GetValue(2,1,1, aValue);
+CPPUNIT_ASSERT_MESSAGE("after inserting first sheet formula does not 
return correct result", aValue == 5);
+
+m_pDoc->InsertTab(0, aSheet1);
+m_pDoc->GetValue(2,0,2, aValue);
+CPPUNIT_ASSERT_MESSAGE("after inserting second sheet formula does not 
return correct result", aValue == 3);
+m_pDoc->GetValue(2,1,2, aValue);
+CPPUNIT_ASSERT_MESSAGE("after inserting second sheet formula does not 
return correct result", aValue == 5);
+
+m_pDoc->DeleteTabs(0, 2);
+m_pDoc->GetValue(2, 0, 0, aValue);
+CPPUNIT_ASSERT_MESSAGE("after deleting sheets formula does not return 
correct result", aValue == 3);
+m_pDoc->GetValue(2, 1, 0, aValue);
+CPPUNIT_ASSERT_MESSAGE("after deleting sheets formula does not return 
correct result", aValue == 5);
+
+std::vector aSheets;
+aSheets.push_back(aSheet1);
+aSheets.push_back(aSheet2);
+m_pDoc->InsertTabs(0, aSheets, false, true);
+m_pDoc->GetValue(2, 0, 2, aValue);
+rtl::OUString aFormula;
+m_pDoc->GetFormula(2,0,2, aFormula);
+std::cout << "formel: " << rtl::OUStringToOString(aFormula, 
RTL_TEXTENCODING_UTF8).getStr() << std::endl;
+std::cout << std::endl << aValue << std::endl;
+CPPUNIT_ASSERT_MESSAGE("after inserting sheets formula does not return 
correct result", aValue == 3)