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

2012-04-22 Thread Markus Mohrhard
 sc/qa/unit/ucalc.cxx |   23 +--
 1 file changed, 21 insertions(+), 2 deletions(-)

New commits:
commit 7d65dd728ca2b7dea073ef085110dccdf22c2d5c
Author: Markus Mohrhard 
Date:   Mon Apr 23 02:18:14 2012 +0200

add test case for copy/paste formulas, related fdo#48482

diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx
index 07782da..9542320 100644
--- a/sc/qa/unit/ucalc.cxx
+++ b/sc/qa/unit/ucalc.cxx
@@ -209,6 +209,7 @@ public:
 void testRenameTable();
 
 void testAutoFill();
+void testCopyPasteFormulas();
 
 CPPUNIT_TEST_SUITE(Test);
 CPPUNIT_TEST(testCollator);
@@ -249,6 +250,7 @@ public:
 CPPUNIT_TEST(testSetBackgroundColor);
 CPPUNIT_TEST(testRenameTable);
 CPPUNIT_TEST(testAutoFill);
+CPPUNIT_TEST(testCopyPasteFormulas);
 CPPUNIT_TEST_SUITE_END();
 
 private:
@@ -4221,6 +4223,25 @@ void Test::testAutoFill()
 m_pDoc->DeleteTab(0);
 }
 
+void Test::testCopyPasteFormulas()
+{
+m_pDoc->InsertTab(0, "Sheet1");
+m_pDoc->InsertTab(1, "Sheet2");
+
+m_pDoc->SetString(0,0,0, "=COLUMN($A$1)");
+m_pDoc->SetInTest();
+CPPUNIT_ASSERT_DOUBLES_EQUAL(m_pDoc->GetValue(0,0,0), 1.0, 1e-08);
+ScDocFunc& rDocFunc = m_xDocShRef->GetDocFunc();
+bool bMoveDone = rDocFunc.MoveBlock(ScRange(0,0,0), ScAddress( 10, 10, 0), 
false, false, false, true);
+
+// check that moving was succesful, mainly for editable tester
+CPPUNIT_ASSERT(bMoveDone);
+CPPUNIT_ASSERT_DOUBLES_EQUAL(m_pDoc->GetValue(10,10,0), 1.0, 1e-8);
+rtl::OUString aFormula;
+m_pDoc->GetFormula(10,10,0, aFormula);
+CPPUNIT_ASSERT_EQUAL(aFormula, rtl::OUString("=COLUMN($A$1)"));
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(Test);
 
 }
commit 0d3d836ec6541b7a1e0a7fa48195ebb678e2951e
Author: Markus Mohrhard 
Date:   Mon Apr 23 01:34:47 2012 +0200

I did not want to disable these tests

diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx
index c743e68..07782da 100644
--- a/sc/qa/unit/ucalc.cxx
+++ b/sc/qa/unit/ucalc.cxx
@@ -211,7 +211,6 @@ public:
 void testAutoFill();
 
 CPPUNIT_TEST_SUITE(Test);
-#if 0
 CPPUNIT_TEST(testCollator);
 CPPUNIT_TEST(testInput);
 CPPUNIT_TEST(testCellFunctions);
@@ -249,7 +248,6 @@ public:
 CPPUNIT_TEST(testJumpToPrecedentsDependents);
 CPPUNIT_TEST(testSetBackgroundColor);
 CPPUNIT_TEST(testRenameTable);
-#endif
 CPPUNIT_TEST(testAutoFill);
 CPPUNIT_TEST_SUITE_END();
 
___
Libreoffice-commits mailing list
Libreoffice-commits@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2012-04-14 Thread Markus Mohrhard
 sc/qa/unit/filters-test.cxx|   21 -
 sc/qa/unit/subsequent_filters-test.cxx |   21 +
 sc/qa/unit/ucalc.cxx   |   23 ++-
 3 files changed, 43 insertions(+), 22 deletions(-)

New commits:
commit d8ff1a579ff5ac9250aa052ef1a17fce51959cb0
Author: Markus Mohrhard 
Date:   Fri Apr 13 17:18:14 2012 +0200

improve autofill test case

diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx
index 130ad67..78fe168 100644
--- a/sc/qa/unit/ucalc.cxx
+++ b/sc/qa/unit/ucalc.cxx
@@ -4179,7 +4179,28 @@ void Test::testAutoFill()
 for (SCROW i = 3; i< 8; ++i)
 CPPUNIT_ASSERT_DOUBLES_EQUAL(static_cast(i-1.0), 
m_pDoc->GetValue(0, i, 0), 0.0001);
 
-
+m_pDoc->Fill( 0, 0, 0, 8, NULL, aMarkData, 5, FILL_TO_RIGHT );
+for (SCCOL i = 0; i < 5; ++i)
+{
+for(SCROW j = 0; j < 8; ++j)
+{
+if (j > 2)
+{
+CPPUNIT_ASSERT_DOUBLES_EQUAL(static_cast(j-1+i), 
m_pDoc->GetValue(i, j, 0), 1e-8);
+}
+else if (j == 0)
+{
+CPPUNIT_ASSERT_DOUBLES_EQUAL(static_cast(i+1), 
m_pDoc->GetValue(i, 0, 0), 1e-8);
+}
+else if (j == 1 || j== 2)
+{
+if(i == 0)
+CPPUNIT_ASSERT_DOUBLES_EQUAL(10.0, 
m_pDoc->GetValue(0,j,0), 1e-8);
+else
+CPPUNIT_ASSERT_DOUBLES_EQUAL(0.0, m_pDoc->GetValue(i,j,0), 
1e-8);
+}
+}
+}
 
 
 m_pDoc->DeleteTab(0);
commit 97fe16f4dc5582be597971b6e17431b8d353b8ba
Author: Markus Mohrhard 
Date:   Fri Apr 13 17:04:46 2012 +0200

move testCVE into slowcheck

speed up rebuild of sc

diff --git a/sc/qa/unit/filters-test.cxx b/sc/qa/unit/filters-test.cxx
index de17ced..417b842 100644
--- a/sc/qa/unit/filters-test.cxx
+++ b/sc/qa/unit/filters-test.cxx
@@ -96,11 +96,6 @@ public:
 virtual void setUp();
 virtual void tearDown();
 
-/**
- * Ensure CVEs remain unbroken
- */
-void testCVEs();
-
 //ods, xls, xlsx filter tests
 void testRangeNameODS(); // only test ods here, xls and xlsx in 
subsequent_filters-test
 void testContentODS();
@@ -117,7 +112,6 @@ public:
 #endif
 
 CPPUNIT_TEST_SUITE(ScFiltersTest);
-CPPUNIT_TEST(testCVEs);
 CPPUNIT_TEST(testRangeNameODS);
 CPPUNIT_TEST(testContentODS);
 CPPUNIT_TEST(testContentXLS);
@@ -189,21 +183,6 @@ void ScFiltersTest::createCSVPath(const rtl::OUString& 
aFileBase, rtl::OUString&
 rCSVPath = aBuffer.makeStringAndClear();
 }
 
-void ScFiltersTest::testCVEs()
-{
-testDir(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Quattro Pro 6.0")),
-getURLFromSrc("/sc/qa/unit/data/qpro/"), rtl::OUString());
-
-//warning, the current "sylk filter" in sc (docsh.cxx) automatically
-//chains on failure on trying as csv, rtf, etc. so "success" may
-//not indicate that it imported as .slk.
-testDir(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SYLK")),
-getURLFromSrc("/sc/qa/unit/data/slk/"), rtl::OUString());
-
-testDir(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("MS Excel 97")),
-getURLFromSrc("/sc/qa/unit/data/xls/"), rtl::OUString());
-}
-
 #if TEST_BUG_FILES
 
 void ScFiltersTest::testDir(osl::Directory& rDir, sal_uInt32 nType)
diff --git a/sc/qa/unit/subsequent_filters-test.cxx 
b/sc/qa/unit/subsequent_filters-test.cxx
index 1d8a8b6..f2ed04b 100644
--- a/sc/qa/unit/subsequent_filters-test.cxx
+++ b/sc/qa/unit/subsequent_filters-test.cxx
@@ -93,6 +93,11 @@ public:
 virtual void setUp();
 virtual void tearDown();
 
+/**
+ * Ensure CVEs remain unbroken
+ */
+void testCVEs();
+
 //ods, xls, xlsx filter tests
 void testRangeNameXLS();
 void testRangeNameXLSX();
@@ -115,6 +120,7 @@ public:
 
 
 CPPUNIT_TEST_SUITE(ScFiltersTest);
+CPPUNIT_TEST(testCVEs);
 CPPUNIT_TEST(testRangeNameXLS);
 CPPUNIT_TEST(testRangeNameXLSX);
 CPPUNIT_TEST(testFunctionsODS);
@@ -216,6 +222,21 @@ void ScFiltersTest::createCSVPath(const rtl::OUString& 
aFileBase, rtl::OUString&
 rCSVPath = aBuffer.makeStringAndClear();
 }
 
+void ScFiltersTest::testCVEs()
+{
+testDir(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Quattro Pro 6.0")),
+getURLFromSrc("/sc/qa/unit/data/qpro/"), rtl::OUString());
+
+//warning, the current "sylk filter" in sc (docsh.cxx) automatically
+//chains on failure on trying as csv, rtf, etc. so "success" may
+//not indicate that it imported as .slk.
+testDir(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SYLK")),
+getURLFromSrc("/sc/qa/unit/data/slk/"), rtl::OUString());
+
+testDir(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("MS Excel 97")),
+getURLFromSrc("/sc/qa/unit/data/xls/"), rtl::OUString());
+}
+
 namespace {
 
 void testRangeNameImpl(ScDocument* pDoc)
___
Libreoffice-commits mailing list
Libreoffice-commits@lists.free

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

2012-03-31 Thread Markus Mohrhard
 sc/qa/unit/ucalc.cxx |   12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

New commits:
commit 98a5031b225d0ba62454e14ed719fd2c7c32aa84
Author: Markus Mohrhard 
Date:   Sun Apr 1 04:26:08 2012 +0200

with SetInTest it is possible to use some more ScDocFunc methods

diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx
index 080bf3c..9132395 100644
--- a/sc/qa/unit/ucalc.cxx
+++ b/sc/qa/unit/ucalc.cxx
@@ -3903,11 +3903,11 @@ void Test::testMergedCells()
 ScRange aRange(0,2,0,MAXCOL,2,0);
 ScMarkData aMark;
 aMark.SetMarkArea(aRange);
+m_pDoc->SetInTest();
 aDocFunc.InsertCells(aRange, &aMark, INS_INSROWS, true, true);
 m_pDoc->ExtendMerge( 1, 1, nEndCol, nEndRow, 0, false);
 cout << nEndRow << nEndCol;
-//ScEditableTester won't work without an SfxMedium/XStorage
-//CPPUNIT_ASSERT_MESSAGE("did not increase merge area", nEndCol == 3 && 
nEndRow == 4);
+CPPUNIT_ASSERT_MESSAGE("did not increase merge area", nEndCol == 3 && 
nEndRow == 4);
 m_pDoc->DeleteTab(0);
 }
 
commit 0034110ca6e68e2d3bd6fef11f1b0698738f24b0
Author: Markus Mohrhard 
Date:   Sun Apr 1 04:23:55 2012 +0200

it does not make sense to get ColorData which is converted back to Color

diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx
index 1bdfe9d..080bf3c 100644
--- a/sc/qa/unit/ucalc.cxx
+++ b/sc/qa/unit/ucalc.cxx
@@ -3922,20 +3922,20 @@ void Test::testSetBackgroundColor()
  //test yellow
 aColor=Color(COL_YELLOW);
 m_xDocShRef->GetDocFunc().SetTabBgColor(0,aColor,false, true);
-CPPUNIT_ASSERT_MESSAGE("the correct color is not set", 
m_pDoc->GetTabBgColor(0)!= aColor.GetColor());
+CPPUNIT_ASSERT_MESSAGE("the correct color is not set", 
m_pDoc->GetTabBgColor(0)!= aColor);
 
 
 Color aOldTabBgColor=m_pDoc->GetTabBgColor(0);
 aColor.SetColor(COL_BLUE);//set BLUE
 m_xDocShRef->GetDocFunc().SetTabBgColor(0,aColor,false, true);
-CPPUNIT_ASSERT_MESSAGE("the correct color is not set the second time", 
m_pDoc->GetTabBgColor(0)!= aColor.GetColor());
+CPPUNIT_ASSERT_MESSAGE("the correct color is not set the second time", 
m_pDoc->GetTabBgColor(0)!= aColor);
 
 //now check for undo
 SfxUndoAction* pUndo = new ScUndoTabColor(m_xDocShRef,0, aOldTabBgColor, 
aColor);
 pUndo->Undo();
-CPPUNIT_ASSERT_MESSAGE("the correct color is not set after undo", 
m_pDoc->GetTabBgColor(0)== aOldTabBgColor.GetColor());
+CPPUNIT_ASSERT_MESSAGE("the correct color is not set after undo", 
m_pDoc->GetTabBgColor(0)== aOldTabBgColor);
 pUndo->Redo();
-CPPUNIT_ASSERT_MESSAGE("the correct color is not set after undo", 
m_pDoc->GetTabBgColor(0)== aColor.GetColor());
+CPPUNIT_ASSERT_MESSAGE("the correct color is not set after undo", 
m_pDoc->GetTabBgColor(0)== aColor);
 m_pDoc->DeleteTab(0);
 }
 
___
Libreoffice-commits mailing list
Libreoffice-commits@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2012-03-22 Thread Kohei Yoshida
 sc/qa/unit/ucalc.cxx |  226 ++-
 1 file changed, 225 insertions(+), 1 deletion(-)

New commits:
commit a3d71e97eaf1958a4d5ab41a6b8788c95d85d2bb
Author: Kohei Yoshida 
Date:   Thu Mar 22 21:26:26 2012 -0400

New unit test for pivot table with date grouping.

diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx
index 89315af..cb6ab44 100644
--- a/sc/qa/unit/ucalc.cxx
+++ b/sc/qa/unit/ucalc.cxx
@@ -75,6 +75,7 @@
 #include 
 
 #include 
+#include 
 #include 
 
 #include 
@@ -161,8 +162,8 @@ public:
 void testPivotTableDuplicateDataFields();
 
 void testPivotTableNormalGrouping();
-
 void testPivotTableNumberGrouping();
+void testPivotTableDateGrouping();
 
 void testSheetCopy();
 void testSheetMove();
@@ -222,6 +223,7 @@ public:
 CPPUNIT_TEST(testPivotTableDuplicateDataFields);
 CPPUNIT_TEST(testPivotTableNormalGrouping);
 CPPUNIT_TEST(testPivotTableNumberGrouping);
+CPPUNIT_TEST(testPivotTableDateGrouping);
 CPPUNIT_TEST(testSheetCopy);
 CPPUNIT_TEST(testSheetMove);
 CPPUNIT_TEST(testExternalRef);
@@ -1245,7 +1247,6 @@ ScDPObject* createDPFromSourceDesc(
 ScDPSaveDimension* pDim = aSaveData.GetNewDimensionByName(aDimName);
 pDim->SetOrientation(static_cast(aFields[i].eOrient));
 pDim->SetUsedHierarchy(0);
-pDim->SetShowEmpty(true);
 
 if (aFields[i].eOrient == sheet::DataPilotFieldOrientation_DATA)
 {
@@ -2424,6 +2425,123 @@ void Test::testPivotTableNumberGrouping()
 m_pDoc->DeleteTab(0);
 }
 
+void Test::testPivotTableDateGrouping()
+{
+m_pDoc->InsertTab(0, OUString(RTL_CONSTASCII_USTRINGPARAM("Data")));
+m_pDoc->InsertTab(1, OUString(RTL_CONSTASCII_USTRINGPARAM("Table")));
+
+// Raw data
+const char* aData[][2] = {
+{ "Date", "Value" },
+{ "2011-01-01", "1" },
+{ "2011-03-02", "2" },
+{ "2012-01-04", "3" },
+{ "2012-02-23", "4" },
+{ "2012-02-24", "5" },
+{ "2012-03-15", "6" },
+{ "2011-09-03", "7" },
+{ "2012-12-25", "8" }
+};
+
+// Dimension definition
+DPFieldDef aFields[] = {
+{ "Date", sheet::DataPilotFieldOrientation_ROW, 0 },
+{ "Value", sheet::DataPilotFieldOrientation_DATA, 
sheet::GeneralFunction_SUM },
+};
+
+ScAddress aPos(1,1,0);
+ScRange aDataRange = insertRangeData(m_pDoc, aPos, aData, 
SAL_N_ELEMENTS(aData));
+CPPUNIT_ASSERT_MESSAGE("failed to insert range data at correct position", 
aDataRange.aStart == aPos);
+
+ScDPObject* pDPObj = createDPFromRange(
+m_pDoc, aDataRange, aFields, SAL_N_ELEMENTS(aFields), false);
+
+ScDPCollection* pDPs = m_pDoc->GetDPCollection();
+bool bSuccess = pDPs->InsertNewTable(pDPObj);
+
+CPPUNIT_ASSERT_MESSAGE("failed to insert a new pivot table object into 
document.", bSuccess);
+CPPUNIT_ASSERT_MESSAGE("there should be only one data pilot table.",
+   pDPs->GetCount() == 1);
+pDPObj->SetName(pDPs->CreateNewName());
+
+ScDPSaveData* pSaveData = pDPObj->GetSaveData();
+CPPUNIT_ASSERT_MESSAGE("No save data !?", pSaveData);
+ScDPDimensionSaveData* pDimData = pSaveData->GetDimensionData();
+CPPUNIT_ASSERT_MESSAGE("No dimension data !?", pDimData);
+
+rtl::OUString aBaseDimName(RTL_CONSTASCII_USTRINGPARAM("Date"));
+
+ScDPNumGroupInfo aInfo;
+aInfo.mbEnable = true;
+aInfo.mbAutoStart = true;
+aInfo.mbAutoEnd = true;
+{
+// Turn the Date dimension into months.  The first of the date
+// dimensions is always a number-group dimension which replaces the
+// original dimension.
+ScDPSaveNumGroupDimension aGroup(aBaseDimName, aInfo, 
sheet::DataPilotFieldGroupBy::MONTHS);
+pDimData->AddNumGroupDimension(aGroup);
+}
+
+{
+// Add quarter dimension.  This will be an additional dimension.
+rtl::OUString aGroupDimName =
+pDimData->CreateDateGroupDimName(
+sheet::DataPilotFieldGroupBy::QUARTERS, *pDPObj, true, NULL);
+ScDPSaveGroupDimension aGroupDim(aBaseDimName, aGroupDimName);
+aGroupDim.SetDateInfo(aInfo, sheet::DataPilotFieldGroupBy::QUARTERS);
+pDimData->AddGroupDimension(aGroupDim);
+
+// Set orientation.
+ScDPSaveDimension* pDim = pSaveData->GetDimensionByName(aGroupDimName);
+pDim->SetOrientation(sheet::DataPilotFieldOrientation_ROW);
+pSaveData->SetPosition(pDim, 0); // set it to the left end.
+}
+
+{
+// Add year dimension.  This is a new dimension also.
+rtl::OUString aGroupDimName =
+pDimData->CreateDateGroupDimName(
+sheet::DataPilotFieldGroupBy::YEARS, *pDPObj, true, NULL);
+ScDPSaveGroupDimension aGroupDim(aBaseDimName, aGroupDimName);
+aGroupDim.SetDateInfo(aInfo, sheet::DataPilotFieldGroupBy::YEARS);
+pDimData->AddGroupDimension(aGroupDim);
+
+// Set o

[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 test/inc test/Library_subsequenttest.mk test/Package_inc.mk test/source

2012-02-16 Thread Markus Mohrhard
 sc/qa/extras/sccellrangeobj.cxx |   28 +++
 sc/qa/extras/testdocuments/xcellrangesquery.ods |binary
 test/Library_subsequenttest.mk  |1 
 test/Package_inc.mk |1 
 test/inc/test/sheet/xcellrangedata.hxx  |   48 
 test/source/sheet/xcellrangedata.cxx|   89 
 6 files changed, 165 insertions(+), 2 deletions(-)

New commits:
commit 7b91c6d1c0686b06de4d2e87b02df10aa9afbf4c
Author: Markus Mohrhard 
Date:   Fri Feb 17 01:59:32 2012 +0100

add test for ScCellRangeObj::setDataArray and getDataArray

diff --git a/sc/qa/extras/sccellrangeobj.cxx b/sc/qa/extras/sccellrangeobj.cxx
index 050724d..2152a2d 100644
--- a/sc/qa/extras/sccellrangeobj.cxx
+++ b/sc/qa/extras/sccellrangeobj.cxx
@@ -31,6 +31,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -38,10 +39,10 @@
 
 namespace sc_apitest {
 
-#define NUMBER_OF_TESTS 12
+#define NUMBER_OF_TESTS 14
 
 class ScCellRangeObj : public UnoApiTest, apitest::XCellRangesQuery, 
apitest::CellProperties,
-apitest::XSearchable, apitest::XReplaceable
+apitest::XSearchable, apitest::XReplaceable, 
apitest::XCellRangeData
 {
 public:
 ScCellRangeObj();
@@ -49,6 +50,7 @@ public:
 virtual void setUp();
 virtual void tearDown();
 virtual uno::Reference< uno::XInterface > init();
+virtual uno::Reference< uno::XInterface > getXCellRangeData();
 
 CPPUNIT_TEST_SUITE(ScCellRangeObj);
 CPPUNIT_TEST(testQueryColumnDifference);
@@ -64,6 +66,8 @@ public:
 CPPUNIT_TEST(testFindFirst);
 CPPUNIT_TEST(testReplaceAll);
 CPPUNIT_TEST(testCreateReplaceDescriptor);
+CPPUNIT_TEST(testGetDataArray);
+CPPUNIT_TEST(testSetDataArray);
 CPPUNIT_TEST_SUITE_END();
 
 private:
@@ -101,6 +105,26 @@ uno::Reference< uno::XInterface > ScCellRangeObj::init()
 return xReturn;
 }
 
+uno::Reference< uno::XInterface > ScCellRangeObj::getXCellRangeData()
+{
+rtl::OUString aFileURL;
+const rtl::OUString 
aFileBase(RTL_CONSTASCII_USTRINGPARAM("xcellrangesquery.ods"));
+createFileURL(aFileBase, aFileURL);
+std::cout << rtl::OUStringToOString(aFileURL, 
RTL_TEXTENCODING_UTF8).getStr() << std::endl;
+if( !mxComponent.is())
+mxComponent = loadFromDesktop(aFileURL);
+uno::Reference< sheet::XSpreadsheetDocument> xDoc (mxComponent, 
UNO_QUERY_THROW);
+uno::Reference< container::XIndexAccess > xIndex (xDoc->getSheets(), 
UNO_QUERY_THROW);
+uno::Reference< sheet::XSpreadsheet > xSheet( xIndex->getByIndex(1), 
UNO_QUERY_THROW);
+
+CPPUNIT_ASSERT_MESSAGE("Could not create interface of type XSpreadsheet", 
xSheet.is());
+
+uno::Reference 
xReturn(xSheet->getCellRangeByPosition(0,0,3,3), UNO_QUERY_THROW);
+
+CPPUNIT_ASSERT_MESSAGE("Could not create object of type XCellRangesQuery", 
xReturn.is());
+return xReturn;
+}
+
 void ScCellRangeObj::setUp()
 {
 nTest++;
diff --git a/sc/qa/extras/testdocuments/xcellrangesquery.ods 
b/sc/qa/extras/testdocuments/xcellrangesquery.ods
index 562229c..ec7335f 100644
Binary files a/sc/qa/extras/testdocuments/xcellrangesquery.ods and 
b/sc/qa/extras/testdocuments/xcellrangesquery.ods differ
commit 4e1e72dc346e732ff5693e5428e39710ca3b78a5
Author: Markus Mohrhard 
Date:   Fri Feb 17 01:41:04 2012 +0100

add test code for XCellRangeData

diff --git a/test/Library_subsequenttest.mk b/test/Library_subsequenttest.mk
index 6c1556f..53cc8e4 100644
--- a/test/Library_subsequenttest.mk
+++ b/test/Library_subsequenttest.mk
@@ -69,6 +69,7 @@ $(eval $(call 
gb_Library_add_exception_objects,subsequenttest,\
 test/source/container/xnamed \
 test/source/sheet/cellproperties \
 test/source/sheet/datapilotfield \
+test/source/sheet/xcellrangedata \
 test/source/sheet/xcellrangesquery \
 test/source/sheet/xdatabaserange \
 test/source/sheet/xdatapilotdescriptor \
diff --git a/test/Package_inc.mk b/test/Package_inc.mk
index 55a50af..768c6a8 100644
--- a/test/Package_inc.mk
+++ b/test/Package_inc.mk
@@ -40,6 +40,7 @@ $(eval $(call 
gb_Package_add_file,test_inc,inc/test/container/xindexaccess.hxx,t
 $(eval $(call 
gb_Package_add_file,test_inc,inc/test/container/xnamecontainer.hxx,test/container/xnamecontainer.hxx))
 $(eval $(call 
gb_Package_add_file,test_inc,inc/test/container/xnamereplace.hxx,test/container/xnamereplace.hxx))
 $(eval $(call 
gb_Package_add_file,test_inc,inc/test/sheet/cellproperties.hxx,test/sheet/cellproperties.hxx))
+$(eval $(call 
gb_Package_add_file,test_inc,inc/test/sheet/xcellrangedata.hxx,test/sheet/xcellrangedata.hxx))
 $(eval $(call 
gb_Package_add_file,test_inc,inc/test/sheet/xdatapilottable.hxx,test/sheet/xdatapilottable.hxx))
 $(eval $(call 
gb_Package_add_file,test_inc,inc/test/sheet/xdatapilottable2.hxx,test/sheet/xdatapilottable2.hxx))
 $(eval $(call 
gb_Package_add_file,test_inc,inc/test/sheet/xdatapilotfieldgrouping.hxx,test/sheet/xdatapilotfie

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

2012-02-05 Thread Markus Mohrhard
 sc/qa/unit/data/contentCSV/mathematical-functions.csv |3 +++
 sc/qa/unit/data/ods/functions.ods |binary
 2 files changed, 3 insertions(+)

New commits:
commit 01ea91efd98e398e6998837c6bb45a9efea43cdc
Author: Markus Mohrhard 
Date:   Sun Feb 5 16:01:16 2012 +0100

add some more test cases

diff --git a/sc/qa/unit/data/contentCSV/mathematical-functions.csv 
b/sc/qa/unit/data/contentCSV/mathematical-functions.csv
index 5be0251..cebf207 100644
--- a/sc/qa/unit/data/contentCSV/mathematical-functions.csv
+++ b/sc/qa/unit/data/contentCSV/mathematical-functions.csv
@@ -15,3 +15,6 @@
 8
 12
 5
+"1.2", "1", "0", "1000"
+2, 4, Err:502
+
diff --git a/sc/qa/unit/data/ods/functions.ods 
b/sc/qa/unit/data/ods/functions.ods
index e9426fe..a90a224 100644
Binary files a/sc/qa/unit/data/ods/functions.ods and 
b/sc/qa/unit/data/ods/functions.ods differ
commit 7ee0b42f7cad15abca7218d001ea1b3b4cac028e
Author: Markus Mohrhard 
Date:   Sun Feb 5 15:51:25 2012 +0100

add some helpful entries to test file

diff --git a/sc/qa/unit/data/ods/functions.ods 
b/sc/qa/unit/data/ods/functions.ods
index 9ccb67f..e9426fe 100644
Binary files a/sc/qa/unit/data/ods/functions.ods and 
b/sc/qa/unit/data/ods/functions.ods differ
___
Libreoffice-commits mailing list
Libreoffice-commits@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] .: 2 commits - sc/qa sc/RdbTarget_sc_filters_test.mk

2011-11-03 Thread Markus Mohrhard
 sc/RdbTarget_sc_filters_test.mk  |3 ++
 sc/qa/unit/data/ods/password.ods |binary
 sc/qa/unit/filters-test.cxx  |   40 +++
 3 files changed, 43 insertions(+)

New commits:
commit 0920750899539e8988cf11ff9a7b76eb44ca3f2e
Author: Markus Mohrhard 
Date:   Thu Nov 3 22:04:28 2011 +0100

component files for password test

if this breaks a --disable-nss build please revert this patch

diff --git a/sc/RdbTarget_sc_filters_test.mk b/sc/RdbTarget_sc_filters_test.mk
index 827f66c..2c0cb1b 100644
--- a/sc/RdbTarget_sc_filters_test.mk
+++ b/sc/RdbTarget_sc_filters_test.mk
@@ -55,6 +55,9 @@ $(eval $(call gb_RdbTarget_add_components,sc_filters_test,\
 unotools/util/utl \
 unoxml/source/rdf/unordf \
 unoxml/source/service/unoxml \
+xmlsecurity/util/xsec_xmlsec \
+xmlsecurity/util/xsec_fw \
+xmlsecurity/util/xmlsecurity \
 ))
 
 $(eval $(call gb_RdbTarget_add_old_components,sc_filters_test,\
commit 9249958a587d773566b88d24bc907028d8553b85
Author: Markus Mohrhard 
Date:   Thu Nov 3 21:47:51 2011 +0100

initial work for a password test

still needs work in:
- RdbTarget_sc_filters_test -- missing component files to NSS (need to be
conditional on nss)
- nssinitializer.cxx:306 -- new environment variable BRAND_PROGRAM_DIR for
$(BRAND_BASE_DIR)/program that is overriden in the unit test to
solver/(platform)/lib
- make the testPassword in filters-test.cxx conditional on NSS
- LD_LIBRARY_PATH needs an additional entry for
  solver/(platform)/lib/sqlite

password.ods has password test and has been created Nov, 3rd 2011 with a
master build and should be ODF1.2 conform

diff --git a/sc/qa/unit/data/ods/password.ods b/sc/qa/unit/data/ods/password.ods
new file mode 100644
index 000..28c5f49
Binary files /dev/null and b/sc/qa/unit/data/ods/password.ods differ
diff --git a/sc/qa/unit/filters-test.cxx b/sc/qa/unit/filters-test.cxx
index b9e9e23..487ee22 100644
--- a/sc/qa/unit/filters-test.cxx
+++ b/sc/qa/unit/filters-test.cxx
@@ -38,6 +38,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -174,6 +175,9 @@ public:
 void testBugFixesXLS();
 void testBugFixesXLSX();
 
+//misc tests unrelated to the import filters
+void testPassword();
+
 CPPUNIT_TEST_SUITE(ScFiltersTest);
 CPPUNIT_TEST(testCVEs);
 CPPUNIT_TEST(testRangeName);
@@ -185,6 +189,7 @@ public:
 CPPUNIT_TEST(testBugFixesODS);
 CPPUNIT_TEST(testBugFixesXLS);
 CPPUNIT_TEST(testBugFixesXLSX);
+//CPPUNIT_TEST(testPassword);
 
 CPPUNIT_TEST_SUITE_END();
 
@@ -612,6 +617,41 @@ void ScFiltersTest::testBugFixesXLSX()
 xDocSh->DoClose();
 }
 
+void ScFiltersTest::testPassword()
+{
+const rtl::OUString 
aFileNameBase(RTL_CONSTASCII_USTRINGPARAM("password."));
+rtl::OUString aFileExtension(aFileFormats[0].pName, 
strlen(aFileFormats[0].pName), RTL_TEXTENCODING_UTF8 );
+rtl::OUString aFilterName(aFileFormats[0].pFilterName, 
strlen(aFileFormats[0].pFilterName), RTL_TEXTENCODING_UTF8) ;
+rtl::OUString aFileName;
+createFileURL(aFileNameBase, aFileExtension, aFileName);
+rtl::OUString aFilterType(aFileFormats[0].pTypeName, 
strlen(aFileFormats[0].pTypeName), RTL_TEXTENCODING_UTF8);
+std::cout << aFileFormats[0].pName << " Test" << std::endl;
+
+sal_uInt32 nFormat = SFX_FILTER_IMPORT | SFX_FILTER_USESOPTIONS;
+SfxFilter* aFilter = new SfxFilter(
+aFilterName,
+rtl::OUString(), aFileFormats[0].nFormatType, nFormat, aFilterType, 0, 
rtl::OUString(),
+rtl::OUString(), 
rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("private:factory/scalc*")) );
+aFilter->SetVersion(SOFFICE_FILEFORMAT_CURRENT);
+
+ScDocShellRef xDocSh = new ScDocShell;
+SfxMedium* pMedium = new SfxMedium(aFileName, STREAM_STD_READWRITE, true);
+SfxItemSet* pSet = pMedium->GetItemSet();
+pSet->Put(SfxStringItem(SID_PASSWORD, 
rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("test";
+pMedium->SetFilter(aFilter);
+if (!xDocSh->DoLoad(pMedium))
+{
+xDocSh->DoClose();
+// load failed.
+xDocSh.Clear();
+}
+
+CPPUNIT_ASSERT_MESSAGE("Failed to load password.ods", xDocSh.Is());
+ScDocument* pDoc = xDocSh->GetDocument();
+CPPUNIT_ASSERT_MESSAGE("No Document", pDoc); //remove with first test
+xDocSh->DoClose();
+}
+
 ScFiltersTest::ScFiltersTest()
   : m_aBaseString(RTL_CONSTASCII_USTRINGPARAM("/sc/qa/unit/data"))
 {
___
Libreoffice-commits mailing list
Libreoffice-commits@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] .: 2 commits - sc/qa vcl/unx

2011-10-24 Thread Michael Stahl
 sc/qa/unit/macros-test.cxx  |6 +++---
 vcl/unx/generic/fontmanager/fontmanager.cxx |4 
 2 files changed, 7 insertions(+), 3 deletions(-)

New commits:
commit 1a76bb7161d0a892b6998f404d3922421a89db9b
Author: Michael Stahl 
Date:   Mon Oct 24 21:23:23 2011 +0200

macros-test.cxx: fix syntax error

diff --git a/sc/qa/unit/macros-test.cxx b/sc/qa/unit/macros-test.cxx
index e97156f..28f5d49 100644
--- a/sc/qa/unit/macros-test.cxx
+++ b/sc/qa/unit/macros-test.cxx
@@ -269,8 +269,8 @@ struct TestMacroInfo
 };
 void ScMacrosTest::testVba()
 {
-TestMacroInfo testInfo[] { 
-{ 
+TestMacroInfo testInfo[] = {
+{
 rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("TestAddress.")),
 
rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("vnd.sun.Star.script:VBAProject.Sheet1.test?language=Basic&location=document"))
 },
@@ -282,7 +282,7 @@ void ScMacrosTest::testVba()
 }
 */
 };
-   
+
 rtl::OUString aFileExtension(aFileFormats[1].pName, 
strlen(aFileFormats[1].pName), RTL_TEXTENCODING_UTF8 );
 rtl::OUString aFilterName(aFileFormats[1].pFilterName, 
strlen(aFileFormats[1].pFilterName), RTL_TEXTENCODING_UTF8) ;
 rtl::OUString aFilterType(aFileFormats[1].pTypeName, 
strlen(aFileFormats[1].pTypeName), RTL_TEXTENCODING_UTF8);
commit 95550e469b5b0fa90401235be8398ecd73dec11d
Author: Michael Stahl 
Date:   Mon Oct 24 21:22:17 2011 +0200

PrintFontManager: don't look at empty path entires

diff --git a/vcl/unx/generic/fontmanager/fontmanager.cxx 
b/vcl/unx/generic/fontmanager/fontmanager.cxx
index 0028f04..80cddee 100644
--- a/vcl/unx/generic/fontmanager/fontmanager.cxx
+++ b/vcl/unx/generic/fontmanager/fontmanager.cxx
@@ -2190,6 +2190,10 @@ void PrintFontManager::initialize()
 {
 OString aToken = aPath.getToken( 0, ';', nIndex );
 normPath( aToken );
+if (!aToken.getLength())
+{
+continue;
+}
 // if registering an app-specific fontdir with fontconfig fails
 // and fontconfig-based substitutions are enabled
 // then trying to use these app-specific fonts doesn't make sense
___
Libreoffice-commits mailing list
Libreoffice-commits@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2011-10-20 Thread Markus Mohrhard
 sc/qa/unit/filters-test.cxx   |   23 +
 sc/qa/unit/helper/debughelper.hxx |  170 ++
 sc/qa/unit/ucalc.cxx  |  124 ---
 3 files changed, 195 insertions(+), 122 deletions(-)

New commits:
commit d9604fa1b4123da145fc9b52901b42888d25ca3b
Author: Markus Mohrhard 
Date:   Thu Oct 20 20:23:15 2011 +0200

add more debug output to see why windows has problems with sc's filters-test

diff --git a/sc/qa/unit/filters-test.cxx b/sc/qa/unit/filters-test.cxx
index 8292c38..71a4339 100644
--- a/sc/qa/unit/filters-test.cxx
+++ b/sc/qa/unit/filters-test.cxx
@@ -43,7 +43,10 @@
 #include 
 #include 
 
+#define CALC_DEBUG_OUTPUT 1
+
 #include "helper/csv_handler.hxx"
+#include "helper/debughelper.hxx"
 #include "orcus/csv_parser.hpp"
 #include 
 #include 
@@ -465,6 +468,26 @@ void ScFiltersTest::testFormats()
 CPPUNIT_ASSERT_MESSAGE("Failed to load formats.*", xDocSh.Is());
 ScDocument* pDoc = xDocSh->GetDocument();
 
+SheetPrinter StringPrinter( 8, 3);
+SheetPrinter ValuePrinter( 8, 3);
+for (SCROW nRow = 0; nRow < 8; ++nRow)
+{
+for (SCCOL nCol = 0; nCol < 3; ++nCol)
+{
+String aString;
+double aVal;
+pDoc->GetValue(nCol, nRow, 0, aVal);
+pDoc->GetString(nCol, nRow, 0, aString);
+ValuePrinter.set(nRow, nCol, rtl::OUString::valueOf(aVal));
+StringPrinter.set(nRow, nCol, aString);
+}
+}
+ValuePrinter.print("Data sheet content: Value");
+ValuePrinter.clear();
+StringPrinter.print("Data sheet content: String");
+StringPrinter.clear();
+
+
 //output this just for debugging, should make it easier to see which 
local the numberformatter really used
 //it helps to understand why some windows build fails in this test
 LanguageType aLang, aCjkLang, aCtlLang;
diff --git a/sc/qa/unit/helper/debughelper.hxx 
b/sc/qa/unit/helper/debughelper.hxx
index ac3e31a..65dc3c2 100644
--- a/sc/qa/unit/helper/debughelper.hxx
+++ b/sc/qa/unit/helper/debughelper.hxx
@@ -77,7 +77,7 @@ public:
 maMatrix.set_string(row, col, new OUString(aStr));
 }
 
-#if UCALC_DEBUG_OUTPUT
+#if CALC_DEBUG_OUTPUT
 void print(const char* header) const
 {
 if (header)
@@ -138,7 +138,7 @@ public:
  */
 void printArray() const
 {
-#if UCALC_DEBUG_OUTPUT
+#if CALC_DEBUG_OUTPUT
 MatrixType::size_pair_type ns = maMatrix.size();
 for (size_t row = 0; row < ns.first; ++row)
 {
diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx
index 9abe9f7..a251360 100644
--- a/sc/qa/unit/ucalc.cxx
+++ b/sc/qa/unit/ucalc.cxx
@@ -71,7 +71,7 @@
 #include 
 #include 
 
-#define UCALC_DEBUG_OUTPUT 0
+#define CALC_DEBUG_OUTPUT 0
 
 #include "helper/debughelper.hxx"
 
commit cda653d7d9038fdcab72cfcae37d3d20463693d5
Author: Markus Mohrhard 
Date:   Thu Oct 20 20:05:33 2011 +0200

extract helper methods for debuging calc tests

diff --git a/sc/qa/unit/helper/debughelper.hxx 
b/sc/qa/unit/helper/debughelper.hxx
new file mode 100644
index 000..ac3e31a
--- /dev/null
+++ b/sc/qa/unit/helper/debughelper.hxx
@@ -0,0 +1,170 @@
+/*
+ * Version: MPL 1.1 / GPLv3+ / LGPLv3+
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License or as specified alternatively below. You may obtain a copy of
+ * the License at http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * Major Contributor(s):
+ * [ Copyright (C) 2011 Markus Mohrhard  
(initial developer) ]
+ *
+ * All Rights Reserved.
+ *
+ * For minor contributions see the git repository.
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 3 or later (the "GPLv3+"), or
+ * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"),
+ * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable
+ * instead of those above.
+ */
+
+/**
+ * Print nicely formatted sheet content to stdout.  Indispensable when
+ * debugging the unit test code involving testing of sheet contents.
+ */
+
+#include 
+#include 
+#include "document.hxx"
+
+#ifdef WNT
+#define NOMINMAX
+#include 
+#include 
+#undef NOMINMAX
+#endif
+
+#define MDDS_HASH_CONTAINER_BOOST 1
+#include 
+
+#include 
+
+using namespace ::com::sun::star;
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
+using ::std::cout;
+using ::std::cerr;
+using ::std::endl;
+using ::std::vector;
+
+
+
+namespace {
+
+::std::ostream& operator<< (::std::ostream& os, const rtl::OUString& str)

[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)

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

2011-10-08 Thread Markus Mohrhard
 sc/qa/unit/data/contentCSV/mathematical-functions.csv |4 
 sc/qa/unit/data/contentCSV/spreadsheet-functions.csv  |6 --
 sc/qa/unit/data/ods/functions.ods |binary
 sc/qa/unit/filters-test.cxx   |3 +++
 4 files changed, 11 insertions(+), 2 deletions(-)

New commits:
commit bb549e2d50e548c2deda3af77ac444a4dde35700
Author: Markus Mohrhard 
Date:   Sat Oct 8 23:30:09 2011 +0200

add unit test cases for mathematical functions

diff --git a/sc/qa/unit/data/contentCSV/mathematical-functions.csv 
b/sc/qa/unit/data/contentCSV/mathematical-functions.csv
new file mode 100644
index 000..106e570
--- /dev/null
+++ b/sc/qa/unit/data/contentCSV/mathematical-functions.csv
@@ -0,0 +1,4 @@
+0, 1, 10
+1.5707963268, 0, 3.1415926536
+0, Err:502
+1.5707963268, 2.3561944902, 0.7853981634
diff --git a/sc/qa/unit/data/ods/functions.ods 
b/sc/qa/unit/data/ods/functions.ods
index 10ddcea..4c09824 100644
Binary files a/sc/qa/unit/data/ods/functions.ods and 
b/sc/qa/unit/data/ods/functions.ods differ
diff --git a/sc/qa/unit/filters-test.cxx b/sc/qa/unit/filters-test.cxx
index 525a917..38eb940 100644
--- a/sc/qa/unit/filters-test.cxx
+++ b/sc/qa/unit/filters-test.cxx
@@ -394,6 +394,9 @@ void ScFiltersTest::testFunctions()
 //test spreadsheet functions
 
createCSVPath(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("spreadsheet-functions.")),
 aCSVFileName);
 testFile(aCSVFileName, pDoc, 1);
+//test mathematical functions
+
createCSVPath(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("mathematical-functions.")),
 aCSVFileName);
+testFile(aCSVFileName, pDoc, 2, PureString);
 
 xDocSh->DoClose();
 }
commit c85b929b532c56c061df4fcfe32734d5db3bd5b8
Author: Markus Mohrhard 
Date:   Sat Oct 8 23:13:01 2011 +0200

extend test for spreadsheet functions

diff --git a/sc/qa/unit/data/contentCSV/spreadsheet-functions.csv 
b/sc/qa/unit/data/contentCSV/spreadsheet-functions.csv
index 412ca58..da53433 100644
--- a/sc/qa/unit/data/contentCSV/spreadsheet-functions.csv
+++ b/sc/qa/unit/data/contentCSV/spreadsheet-functions.csv
@@ -1,2 +1,4 @@
-$C$2, $A$1
-1, 3, 4
+$C$2, $A$1, Sheet.B$2, Sheet!R2C2
+2, 4, 4, 5, 6, 15, 15, 6
+1, 3, 4, 4, 2, 2
+2, 4, 7, 8
diff --git a/sc/qa/unit/data/ods/functions.ods 
b/sc/qa/unit/data/ods/functions.ods
index 4b8c55a..10ddcea 100644
Binary files a/sc/qa/unit/data/ods/functions.ods and 
b/sc/qa/unit/data/ods/functions.ods differ
___
Libreoffice-commits mailing list
Libreoffice-commits@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] .: 2 commits - sc/qa test/user-template

2011-09-29 Thread Markus Mohrhard
 sc/qa/unit/filters-test.cxx  |4 ++--
 test/user-template/user/basic/dialog.xlc |   10 --
 test/user-template/user/basic/script.xlc |   10 --
 3 files changed, 2 insertions(+), 22 deletions(-)

New commits:
commit eea06c00ab4ea0e26259a1e9f732076709d1026c
Author: Markus Mohrhard 
Date:   Fri Sep 30 00:43:50 2011 +0200

enable the registration for vba unit test again

diff --git a/sc/qa/unit/filters-test.cxx b/sc/qa/unit/filters-test.cxx
index 03a1f5e..8611df0 100644
--- a/sc/qa/unit/filters-test.cxx
+++ b/sc/qa/unit/filters-test.cxx
@@ -195,8 +195,8 @@ ScDocShellRef FiltersTest::load(const rtl::OUString 
&rFilter, const rtl::OUStrin
 if (!xDocShRef->DoLoad(&aSrcMed))
 // load failed.
 xDocShRef.Clear();
-//else if (nFormatType)
-//SfxObjectShell::SetCurrentComponent( xDocShRef->GetModel() );
+else if (nFormatType)
+SfxObjectShell::SetCurrentComponent( xDocShRef->GetModel() );
 
 return xDocShRef;
 }
commit 5e733c781fb1344d1906c6b4f3d9c4f032305bbd
Author: Markus Mohrhard 
Date:   Fri Sep 30 00:42:04 2011 +0200

remove library entries for now

maybe add them later and adapt path to something useful

diff --git a/test/user-template/user/basic/dialog.xlc 
b/test/user-template/user/basic/dialog.xlc
index b63ebd6..aed4ac2 100644
--- a/test/user-template/user/basic/dialog.xlc
+++ b/test/user-template/user/basic/dialog.xlc
@@ -1,13 +1,4 @@
 
 
 http://openoffice.org/2000/library"; 
xmlns:xlink="http://www.w3.org/1999/xlink";>
- 
- 
- 
- 
- 
- 
- 
- 
- 
-
\ No newline at end of file
+
diff --git a/test/user-template/user/basic/script.xlc 
b/test/user-template/user/basic/script.xlc
index aaf1b0d..aed4ac2 100644
--- a/test/user-template/user/basic/script.xlc
+++ b/test/user-template/user/basic/script.xlc
@@ -1,13 +1,4 @@
 
 
 http://openoffice.org/2000/library"; 
xmlns:xlink="http://www.w3.org/1999/xlink";>
- 
- 
- 
- 
- 
- 
- 
- 
- 
-
\ No newline at end of file
+
___
Libreoffice-commits mailing list
Libreoffice-commits@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits