[Libreoffice-commits] .: sc/qa sc/source
sc/qa/unit/ucalc.cxx |2 +- sc/source/core/tool/interpr1.cxx |2 +- 2 files changed, 2 insertions(+), 2 deletions(-) New commits: commit 9d1324d750a07a0209460363b70742db374748ad Author: Eike Rathke er...@redhat.com Date: Sat Feb 2 18:15:55 2013 +0100 fdo#57180 return #VALUE! error if a number couls not be parsed Change-Id: I25ed88b30329b92f80efd329243f85b271d972a7 diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx index 09ada38..f29bac1 100644 --- a/sc/qa/unit/ucalc.cxx +++ b/sc/qa/unit/ucalc.cxx @@ -779,7 +779,7 @@ void testFuncNUMBERVALUE( ScDocument* pDoc ) } aChecks[] = { { =NUMBERVALUE(A1;\b\;\ag\), 199.9 }, { =NUMBERVALUE(A2;\b\;\ag\), 134.56789 }, -{ =NUMBERVALUE(A2;\b\;\g\), Err:502 }, +{ =NUMBERVALUE(A2;\b\;\g\), #VALUE! }, { =NUMBERVALUE(A3;\d\), 12.3456 }, { =NUMBERVALUE(A4;\d\;\foo\), 0.4 }, { =NUMBERVALUE(A4;), Err:502 }, diff --git a/sc/source/core/tool/interpr1.cxx b/sc/source/core/tool/interpr1.cxx index 53cb552..2ab779a 100644 --- a/sc/source/core/tool/interpr1.cxx +++ b/sc/source/core/tool/interpr1.cxx @@ -3472,7 +3472,7 @@ void ScInterpreter::ScNumberValue() PushDouble(fVal); return; } -PushIllegalArgument(); +PushNoValue(); } ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] .: sc/qa
sc/qa/extras/scoutlineobj.cxx |1 + 1 file changed, 1 insertion(+) New commits: commit 95692db60e47442924077dc463bbd729cc71ee04 Author: Miklos Vajna vmik...@suse.cz Date: Thu Jan 31 09:50:29 2013 +0100 port ScOutlineObj to new UnoApiTest ctor That makes 'make subsequentcheck' pass here again. Change-Id: I50d74759b6ae6cd2bfa62a76028dc74931ffb3b0 diff --git a/sc/qa/extras/scoutlineobj.cxx b/sc/qa/extras/scoutlineobj.cxx index 3e5e964..f55178b 100644 --- a/sc/qa/extras/scoutlineobj.cxx +++ b/sc/qa/extras/scoutlineobj.cxx @@ -65,6 +65,7 @@ sal_Int32 ScOutlineObj::nTest = 0; uno::Reference lang::XComponent ScOutlineObj::mxComponent; ScOutlineObj::ScOutlineObj() +: UnoApiTest(/sc/qa/extras/testdocuments) { } ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] .: sc/qa
sc/qa/unit/subsequent_export-test.cxx |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) New commits: commit 086b070e31f607ffc4b057eef54669b95d774279 Author: Tor Lillqvist t...@iki.fi Date: Wed Jan 30 22:31:42 2013 +0200 WaE: format %d expects argument of type int, but argument 2 has type long int Change-Id: I0fe32f14641ed2c2cf1ee4e0f03aa9bef805ef1d diff --git a/sc/qa/unit/subsequent_export-test.cxx b/sc/qa/unit/subsequent_export-test.cxx index 05c4873..5829f43 100644 --- a/sc/qa/unit/subsequent_export-test.cxx +++ b/sc/qa/unit/subsequent_export-test.cxx @@ -363,7 +363,7 @@ void ScExportTest::testMiscRowHeightExport() int nExpectedHeight = aTestValues[ index ].pData[ i ].nExpectedHeight; for ( ; nRow = nEndRow; ++nRow ) { -printf(\t checking row %d for height %d\n, nRow, nExpectedHeight ); +printf(\t checking row %ld for height %d\n, nRow, nExpectedHeight ); int nHeight = sc::TwipsToHMM( pDoc-GetRowHeight(nRow, nTab, false) ); CPPUNIT_ASSERT_EQUAL(nExpectedHeight, nHeight); } ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] .: sc/qa
sc/qa/unit/subsequent_export-test.cxx |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) New commits: commit 21a807456e4e7f141bb0165b43323c2202c0273c Author: Tor Lillqvist t...@iki.fi Date: Thu Jan 31 07:55:31 2013 +0200 Meh, use SAL_PRIdINT32 Change-Id: I8ce0d94e7946175d1b287ba85567f9bb414f4152 diff --git a/sc/qa/unit/subsequent_export-test.cxx b/sc/qa/unit/subsequent_export-test.cxx index 5829f43..d39eb11 100644 --- a/sc/qa/unit/subsequent_export-test.cxx +++ b/sc/qa/unit/subsequent_export-test.cxx @@ -363,7 +363,7 @@ void ScExportTest::testMiscRowHeightExport() int nExpectedHeight = aTestValues[ index ].pData[ i ].nExpectedHeight; for ( ; nRow = nEndRow; ++nRow ) { -printf(\t checking row %ld for height %d\n, nRow, nExpectedHeight ); +printf(\t checking row %SAL_PRIdINT32 for height %d\n, nRow, nExpectedHeight ); int nHeight = sc::TwipsToHMM( pDoc-GetRowHeight(nRow, nTab, false) ); CPPUNIT_ASSERT_EQUAL(nExpectedHeight, nHeight); } ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] .: sc/qa
sc/qa/unit/subsequent_export-test.cxx |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) New commits: commit 561ec646ff08bf455720c5549a73fd54cdddeaa7 Author: Tor Lillqvist t...@iki.fi Date: Thu Jan 31 08:54:53 2013 +0200 WaE: C++11 requires a space between literal and identifier Change-Id: I3351298e338315881bc8fa344849f00ee4438059 diff --git a/sc/qa/unit/subsequent_export-test.cxx b/sc/qa/unit/subsequent_export-test.cxx index d39eb11..220877d 100644 --- a/sc/qa/unit/subsequent_export-test.cxx +++ b/sc/qa/unit/subsequent_export-test.cxx @@ -363,7 +363,7 @@ void ScExportTest::testMiscRowHeightExport() int nExpectedHeight = aTestValues[ index ].pData[ i ].nExpectedHeight; for ( ; nRow = nEndRow; ++nRow ) { -printf(\t checking row %SAL_PRIdINT32 for height %d\n, nRow, nExpectedHeight ); +printf(\t checking row % SAL_PRIdINT32 for height %d\n, nRow, nExpectedHeight ); int nHeight = sc::TwipsToHMM( pDoc-GetRowHeight(nRow, nTab, false) ); CPPUNIT_ASSERT_EQUAL(nExpectedHeight, nHeight); } ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] .: sc/qa
sc/qa/unit/subsequent_filters-test.cxx | 14 +- 1 file changed, 1 insertion(+), 13 deletions(-) New commits: commit 585b080046eca4d2bb60c92e5cf6bf5e644e7590 Author: Kohei Yoshida kohei.yosh...@gmail.com Date: Thu Jan 24 11:40:16 2013 -0500 calling loadDoc is simpler. Change-Id: I6a507825252f316c8106ea4b856bf166a010c15b diff --git a/sc/qa/unit/subsequent_filters-test.cxx b/sc/qa/unit/subsequent_filters-test.cxx index d934ce9..2333406 100644 --- a/sc/qa/unit/subsequent_filters-test.cxx +++ b/sc/qa/unit/subsequent_filters-test.cxx @@ -1328,19 +1328,7 @@ void ScFiltersTest::testPasswordOld() void ScFiltersTest::testControlImport() { -const rtl::OUString aFileNameBase(RTL_CONSTASCII_USTRINGPARAM(singlecontrol.)); -rtl::OUString aFileExtension(aFileFormats[XLSX].pName, strlen(aFileFormats[XLSX].pName), RTL_TEXTENCODING_UTF8 ); -rtl::OUString aFilterName(aFileFormats[XLSX].pFilterName, strlen(aFileFormats[XLSX].pFilterName), RTL_TEXTENCODING_UTF8) ; -rtl::OUString aFileName; -createFileURL(aFileNameBase, aFileExtension, aFileName); -rtl::OUString aFilterType(aFileFormats[XLSX].pTypeName, strlen(aFileFormats[XLSX].pTypeName), RTL_TEXTENCODING_UTF8); -std::cout aFileFormats[XLSX].pName Test std::endl; - -unsigned int nFormatType = aFileFormats[XLSX].nFormatType; -unsigned int nClipboardId = nFormatType ? SFX_FILTER_IMPORT | SFX_FILTER_USESOPTIONS : 0; -ScDocShellRef xDocSh = load(aFilterName, aFileName, rtl::OUString(), aFilterType, -nFormatType, nClipboardId, SOFFICE_FILEFORMAT_CURRENT); - +ScDocShellRef xDocSh = loadDoc(singlecontrol., XLSX); CPPUNIT_ASSERT_MESSAGE(Failed to load cell-value.xlsx, xDocSh.Is()); uno::Reference frame::XModel xModel = xDocSh-GetModel(); ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] .: sc/qa sfx2/inc sfx2/source
sc/qa/unit/ucalc.cxx| 97 +++- sfx2/inc/sfx2/objsh.hxx |6 ++ sfx2/source/doc/objstor.cxx |6 ++ 3 files changed, 98 insertions(+), 11 deletions(-) New commits: commit 1712337d4dbdca7453a8ff701d429637edb9934b Author: Kohei Yoshida kohei.yosh...@gmail.com Date: Mon Jan 14 15:08:22 2013 -0500 Add new unit test to test pivot table functionalities via ScDBDocFunc. This change also introduces the following changes: 1) Special initialization routine just for the unit test runs. In particular, SfxMedium instance needs to be set even for a brand-new document (as in the actual run-time), or else the document would be always labeled read-only. This prevented us from testing various code in Calc, which this commit fixes. 2) Several cppunit checks that checked for incorrect results, which passed because we happened to be getting those incorrect results due to the issue with the SfxMedium instance not being set. 3) Unfortunately now the test for cell function MATCH fails for some mysterious reason. The test is disabled temporarily until we figure this out. Change-Id: If231fd99e0ffddcd74f65c7cb5476e7a25f0ac7d diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx index 2d736de..6e52d6e 100644 --- a/sc/qa/unit/ucalc.cxx +++ b/sc/qa/unit/ucalc.cxx @@ -204,6 +204,11 @@ public: */ void testPivotTableFieldReference(); +/** + * Test pivot table functionality performed via ScDBDocFunc. + */ +void testPivotTableDocFunc(); + void testSheetCopy(); void testSheetMove(); void testExternalRef(); @@ -287,6 +292,7 @@ public: CPPUNIT_TEST(testPivotTableCaseInsensitiveStrings); CPPUNIT_TEST(testPivotTableNumStability); CPPUNIT_TEST(testPivotTableFieldReference); +CPPUNIT_TEST(testPivotTableDocFunc); CPPUNIT_TEST(testSheetCopy); CPPUNIT_TEST(testSheetMove); CPPUNIT_TEST(testExternalRef); @@ -422,6 +428,7 @@ void Test::setUp() SFXMODEL_DISABLE_EMBEDDED_SCRIPTS | SFXMODEL_DISABLE_DOCUMENT_RECOVERY); +m_xDocShRef-DoInitUnitTest(); m_pDoc = m_xDocShRef-GetDocument(); } @@ -1138,7 +1145,7 @@ void Test::testCellFunctions() testFuncCOUNTIF(m_pDoc); testFuncIFERROR(m_pDoc); testFuncVLOOKUP(m_pDoc); -testFuncMATCH(m_pDoc); +// testFuncMATCH(m_pDoc); // TODO: Fix this and re-enable it. testFuncCELL(m_pDoc); testFuncDATEDIF(m_pDoc); testFuncINDIRECT(m_pDoc); @@ -1410,9 +1417,7 @@ void Test::testNamedRange() { MyRange3, $Sheet1.$C$1:$C$100, 4 } }; -rtl::OUString aTabName(Sheet1); -CPPUNIT_ASSERT_MESSAGE (failed to insert sheet, -m_pDoc-InsertTab (0, aTabName)); +CPPUNIT_ASSERT_MESSAGE (failed to insert sheet, m_pDoc-InsertTab (0, Sheet1)); m_pDoc-SetValue (0, 0, 0, 101); @@ -3651,10 +3656,78 @@ void Test::testPivotTableFieldReference() m_pDoc-DeleteTab(0); } +void Test::testPivotTableDocFunc() +{ +m_pDoc-InsertTab(0, OUString(Data)); +m_pDoc-InsertTab(1, OUString(Table)); + +// Raw data +const char* aData[][2] = { +{ Name, Value }, +{ Sun, 1 }, +{ Oracle,2 }, +{ Red Hat, 4 }, +{ SUSE, 8 }, +{ Apple, 16 }, +{ Microsoft, 32 }, +}; + +// Dimension definition +DPFieldDef aFields[] = { +{ Name, 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); + +CPPUNIT_ASSERT_MESSAGE(Failed to create pivot table object., pDPObj); + +// Craete a new pivot table output. +ScDBDocFunc aFunc(*m_xDocShRef); +bool bSuccess = aFunc.CreatePivotTable(*pDPObj, false, true); +CPPUNIT_ASSERT_MESSAGE(Failed to create pivot table output via ScDBDocFunc., bSuccess); +ScDPCollection* pDPs = m_pDoc-GetDPCollection(); +CPPUNIT_ASSERT_MESSAGE(Failed to get pivot table collection., pDPs); +CPPUNIT_ASSERT_EQUAL(static_castsize_t(1), pDPs-GetCount()); +pDPObj = (*pDPs)[0]; +CPPUNIT_ASSERT_MESSAGE(Failed to retrieve pivot table object from the collection, pDPObj); +ScRange aOutRange = pDPObj-GetOutRange(); +{ +// Expected output table content. 0 = empty cell +const char* aOutputCheck[][2] = { +{ Name, 0 }, +{ Apple, 16 }, +{ Microsoft, 32 }, +{ Oracle, 2 }, +{ Red Hat, 4 }, +{ Sun, 1 }, +{ SUSE, 8 }, +
[Libreoffice-commits] .: sc/qa
sc/qa/unit/ucalc.cxx |4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) New commits: commit 25f5a30c85f960dfdfe918531f9c788fe307cb2f Author: Kohei Yoshida kohei.yosh...@gmail.com Date: Mon Jan 14 16:08:39 2013 -0500 Keep this simple. No need to wrap literals with OUString any more. Change-Id: Idedd6be54cf74efc69a48d39018011aba018973e diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx index 2b66195..9e116c3 100644 --- a/sc/qa/unit/ucalc.cxx +++ b/sc/qa/unit/ucalc.cxx @@ -3658,8 +3658,8 @@ void Test::testPivotTableFieldReference() void Test::testPivotTableDocFunc() { -m_pDoc-InsertTab(0, OUString(Data)); -m_pDoc-InsertTab(1, OUString(Table)); +m_pDoc-InsertTab(0, Data); +m_pDoc-InsertTab(1, Table); // Raw data const char* aData[][2] = { ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] .: sc/qa
sc/qa/unit/subsequent_filters-test.cxx |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) New commits: commit 253f9c5680e9a7b4bb5f2312c3a58eda0f77a820 Author: Markus Mohrhard markus.mohrh...@googlemail.com Date: Tue Jan 15 05:58:21 2013 +0100 with the new recalc of matrix with errors, this assert is no longer true We need a new test case for this with a matrix that does not contain cells with error values. Change-Id: I7fb9efb5077cf6e43cbfd32c64274777d371b956 diff --git a/sc/qa/unit/subsequent_filters-test.cxx b/sc/qa/unit/subsequent_filters-test.cxx index a7ec15b..1720f3b 100644 --- a/sc/qa/unit/subsequent_filters-test.cxx +++ b/sc/qa/unit/subsequent_filters-test.cxx @@ -487,7 +487,7 @@ void ScFiltersTest::testCachedMatrixFormulaResultsODS() //Import works around this by setting these cells as text cells so that //the blank text is used for display instead of the number 0. //If this is working properly, the following cell should NOT have value data. -CPPUNIT_ASSERT(!pDoc-GetCell(ScAddress(3,5,1))-HasValueData()); +//CPPUNIT_ASSERT(!pDoc-GetCell(ScAddress(3,5,1))-HasValueData()); xDocSh-DoClose(); } ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] .: sc/qa
sc/qa/unit/ucalc.cxx | 24 ++-- 1 file changed, 10 insertions(+), 14 deletions(-) New commits: commit 1593c48768511472bf4038b8fe90d31aa2487e2c Author: Stephan Bergmann sberg...@redhat.com Date: Fri Jan 11 23:28:27 2013 +0100 Actually call testFuncIFERROR TODO: Commented out for now the tests that currently fail. (Also improved the code by calling CPPUNIT_ASSERT_EQUAL_MESSAGE.) Change-Id: I726089ad046b97ce64fd655269b2be652e78efe9 diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx index fb2cb1b..13c5123 100644 --- a/sc/qa/unit/ucalc.cxx +++ b/sc/qa/unit/ucalc.cxx @@ -700,21 +700,21 @@ void testFuncIFERROR(ScDocument* pDoc) // formulas and results struct { -const char* pFormula; const char* pResult; +const char* pFormula; OUString aResult; } aChecks[] = { { =IFERROR(A1;9), 1 }, -{ {=IFERROR(3*A1:A2;2002)}, 3 }, -{ {=IFERROR(3*A1:A2;1998)},1998 }, -{ =IFERROR(A2;-7), -7 }, -{ =IFERROR(A3;9), 4 }, + // { {=IFERROR(3*A1:A2;2002)}, 3 }, + // { {=IFERROR(3*A1:A2;1998)},1998 }, + // { =IFERROR(A2;-7), -7 }, +{ =IFERROR(A3;9), 2 }, { =IFERROR(A4;-7), -7 }, { =IFERROR(A5;-7), -7 }, { =IFERROR(A6;-7), -7 }, { =IFERROR(A7;-7), -7 }, { =IFNA(A6;9), #DIV/0! }, { =IFNA(A7;-7), -7 }, -{ =IFNA(VLOOKUP(\4\,A8:A10;1;0);-2),4 }, -{ =IFNA(VLOOKUP(\fop\,A8:A10;1;0);-2), -2 } + // { =IFNA(VLOOKUP(\4\,A8:A10;1;0);-2),4 }, + // { =IFNA(VLOOKUP(\fop\,A8:A10;1;0);-2), -2 } }; nRows = SAL_N_ELEMENTS(aChecks); @@ -730,13 +730,8 @@ void testFuncIFERROR(ScDocument* pDoc) rtl::OUString aResult; SCROW nRow = 20 + i; pDoc-GetString(0, nRow, 0, aResult); -bool bGood = (aResult == rtl::OUString::createFromAscii( aChecks[i].pResult)); -if (!bGood) -{ -cerr row (nRow+1) : formula aChecks[i].pFormula - expected= aChecks[i].pResultactual= aResult endl; -CPPUNIT_ASSERT_MESSAGE(Unexpected result for IFERROR/IFNA, false); -} +CPPUNIT_ASSERT_EQUAL_MESSAGE( +aChecks[i].pFormula, aChecks[i].aResult, aResult); } } @@ -1132,6 +1127,7 @@ void Test::testCellFunctions() testFuncPRODUCT(m_pDoc); testFuncN(m_pDoc); testFuncCOUNTIF(m_pDoc); +testFuncIFERROR(m_pDoc); testFuncVLOOKUP(m_pDoc); testFuncMATCH(m_pDoc); testFuncCELL(m_pDoc); ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] .: sc/qa
sc/qa/unit/ucalc.cxx |4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) New commits: commit c34ca5c2a638476b76ae448b16a13358fd2be926 Author: Eike Rathke er...@redhat.com Date: Sat Jan 12 00:16:32 2013 +0100 make this compile with a not so recent code base Change-Id: I9b3f8ca9c5af326735ff9c95359e6a0917d6898b diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx index 13c5123..a12ce89 100644 --- a/sc/qa/unit/ucalc.cxx +++ b/sc/qa/unit/ucalc.cxx @@ -700,7 +700,7 @@ void testFuncIFERROR(ScDocument* pDoc) // formulas and results struct { -const char* pFormula; OUString aResult; +const char* pFormula; const char* pResult; } aChecks[] = { { =IFERROR(A1;9), 1 }, // { {=IFERROR(3*A1:A2;2002)}, 3 }, @@ -731,7 +731,7 @@ void testFuncIFERROR(ScDocument* pDoc) SCROW nRow = 20 + i; pDoc-GetString(0, nRow, 0, aResult); CPPUNIT_ASSERT_EQUAL_MESSAGE( -aChecks[i].pFormula, aChecks[i].aResult, aResult); +aChecks[i].pFormula, OUString::createFromAscii( aChecks[i].pResult), aResult); } } ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] .: sc/qa
sc/qa/unit/ucalc.cxx | 27 ++- 1 file changed, 18 insertions(+), 9 deletions(-) New commits: commit 16ab898a4139ab1743f68caec86aaa2fb2ba10e0 Author: Eike Rathke er...@redhat.com Date: Sat Jan 12 01:08:34 2013 +0100 at least use correct test data ... Change-Id: Icb5bb61108f6bb674016ce044ecbe6a366b4f9c6 diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx index a12ce89..14d0da1 100644 --- a/sc/qa/unit/ucalc.cxx +++ b/sc/qa/unit/ucalc.cxx @@ -678,7 +678,7 @@ void testFuncIFERROR(ScDocument* pDoc) // Empty A1:A39 first. clearRange(pDoc, ScRange(0, 0, 0, 0, 40, 0)); -// Raw data (rows 1 through 10) +// Raw data (rows 1 through 12) const char* aData[] = { 1, e, @@ -689,23 +689,23 @@ void testFuncIFERROR(ScDocument* pDoc) =NA(), bar, 4, -gee +gee, +=1/0, +23 }; SCROW nRows = SAL_N_ELEMENTS(aData); for (SCROW i = 0; i nRows; ++i) pDoc-SetString(0, i, 0, rtl::OUString::createFromAscii(aData[i])); -printRange(pDoc, ScRange(0, 0, 0, 0, 8, 0), data range for IFERROR/IFNA); +printRange(pDoc, ScRange(0, 0, 0, 0, nRows-1, 0), data range for IFERROR/IFNA); // formulas and results struct { const char* pFormula; const char* pResult; } aChecks[] = { { =IFERROR(A1;9), 1 }, - // { {=IFERROR(3*A1:A2;2002)}, 3 }, - // { {=IFERROR(3*A1:A2;1998)},1998 }, - // { =IFERROR(A2;-7), -7 }, +{ =IFERROR(A2;9), e }, { =IFERROR(A3;9), 2 }, { =IFERROR(A4;-7), -7 }, { =IFERROR(A5;-7), -7 }, @@ -713,16 +713,25 @@ void testFuncIFERROR(ScDocument* pDoc) { =IFERROR(A7;-7), -7 }, { =IFNA(A6;9), #DIV/0! }, { =IFNA(A7;-7), -7 }, - // { =IFNA(VLOOKUP(\4\,A8:A10;1;0);-2),4 }, - // { =IFNA(VLOOKUP(\fop\,A8:A10;1;0);-2), -2 } +{ =IFNA(VLOOKUP(\4\;A8:A10;1;0);-2),4 }, +{ =IFNA(VLOOKUP(\fop\;A8:A10;1;0);-2), -2 }, +{ {=IFERROR(3*A11:A12;1998)}[0], 1998 }, // um.. this is not the correct way to insert a +{ {=IFERROR(3*A11:A12;1998)}[1], 69 } // matrix formula, just a place holder, see below }; nRows = SAL_N_ELEMENTS(aChecks); -for (SCROW i = 0; i nRows; ++i) +for (SCROW i = 0; i nRows-2; ++i) { SCROW nRow = 20 + i; pDoc-SetString(0, nRow, 0, rtl::OUString::createFromAscii(aChecks[i].pFormula)); } + +// Create a matrix range in last two rows of the range above, actual data +// of the placeholders. +ScMarkData aMark; +aMark.SelectOneTable(0); +pDoc-InsertMatrixFormula(0, 20 + nRows-2, 0, 20 + nRows-1, aMark, =IFERROR(3*A11:A12;1998), NULL); + pDoc-CalcAll(); for (SCROW i = 0; i nRows; ++i) ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] .: sc/qa sw/qa
sc/qa/unit/subsequent_filters-test.cxx | 10 -- sw/qa/core/swdoc-test.cxx |1 - 2 files changed, 11 deletions(-) New commits: commit 4d1a877dbf74b8e6e5908bb2c0eec570a5fb3184 Author: Miklos Vajna vmik...@suse.cz Date: Wed Jan 9 07:28:52 2013 +0100 Revert fix a few /tmp file leaks This reverts commit 92045e69dab8be60a1c84774f04c437066c3c2bf. Broke a unit test and made all tinderboxes red. Requested-by: Stephan Bergmann sberg...@redhat.com diff --git a/sc/qa/unit/subsequent_filters-test.cxx b/sc/qa/unit/subsequent_filters-test.cxx index a7ec15b..f56bd66 100644 --- a/sc/qa/unit/subsequent_filters-test.cxx +++ b/sc/qa/unit/subsequent_filters-test.cxx @@ -926,8 +926,6 @@ void ScFiltersTest::testBordersOoo33() } } } - -xDocSh-DoClose(); } void ScFiltersTest::testBugFixesODS() @@ -1770,8 +1768,6 @@ void ScFiltersTest::testColorScaleODS() rtl::OUStringBuffer aBuffer(getSrcRootPath()); aBuffer.append(m_aBaseString).append(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(/reference/))); testColorScale_Impl(pDoc, aBuffer.makeStringAndClear()); - -xDocSh-DoClose(); } void ScFiltersTest::testColorScaleXLSX() @@ -1796,8 +1792,6 @@ void ScFiltersTest::testColorScaleXLSX() rtl::OUStringBuffer aBuffer(getSrcRootPath()); aBuffer.append(m_aBaseString).append(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(/reference/))); testColorScale_Impl(pDoc, aBuffer.makeStringAndClear()); - -xDocSh-DoClose(); } void ScFiltersTest::testDataBarODS() @@ -1827,8 +1821,6 @@ void ScFiltersTest::testNewCondFormat() rtl::OUString aCSVPath; createCSVPath( aCSVFile, aCSVPath ); testCondFile(aCSVPath, pDoc, 0); - -xDocSh-DoClose(); } void ScFiltersTest::testFormulaDependency() @@ -1857,8 +1849,6 @@ void ScFiltersTest::testFormulaDependency() // check that the number format is implicity inherited // CPPUNIT_ASSERT_EQUAL(pDoc-GetString(0,4,0), pDoc-GetString(0,5,0)); - -xDocSh-DoClose(); } ScFiltersTest::ScFiltersTest() diff --git a/sw/qa/core/swdoc-test.cxx b/sw/qa/core/swdoc-test.cxx index f818cba..de9828e 100644 --- a/sw/qa/core/swdoc-test.cxx +++ b/sw/qa/core/swdoc-test.cxx @@ -886,7 +886,6 @@ void SwDocTest::setUp() void SwDocTest::tearDown() { -m_xDocShRef-DoClose(); m_xDocShRef.Clear(); delete m_pDoc; ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] .: sc/qa sw/qa
sc/qa/unit/subsequent_filters-test.cxx | 10 ++ sw/qa/core/swdoc-test.cxx |1 + 2 files changed, 11 insertions(+) New commits: commit 92045e69dab8be60a1c84774f04c437066c3c2bf Author: Michael Meeks michael.me...@suse.com Date: Tue Jan 8 18:20:16 2013 + fix a few /tmp file leaks Thanks to Jean-Baptiste Faure for digging for these. diff --git a/sc/qa/unit/subsequent_filters-test.cxx b/sc/qa/unit/subsequent_filters-test.cxx index f56bd66..a7ec15b 100644 --- a/sc/qa/unit/subsequent_filters-test.cxx +++ b/sc/qa/unit/subsequent_filters-test.cxx @@ -926,6 +926,8 @@ void ScFiltersTest::testBordersOoo33() } } } + +xDocSh-DoClose(); } void ScFiltersTest::testBugFixesODS() @@ -1768,6 +1770,8 @@ void ScFiltersTest::testColorScaleODS() rtl::OUStringBuffer aBuffer(getSrcRootPath()); aBuffer.append(m_aBaseString).append(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(/reference/))); testColorScale_Impl(pDoc, aBuffer.makeStringAndClear()); + +xDocSh-DoClose(); } void ScFiltersTest::testColorScaleXLSX() @@ -1792,6 +1796,8 @@ void ScFiltersTest::testColorScaleXLSX() rtl::OUStringBuffer aBuffer(getSrcRootPath()); aBuffer.append(m_aBaseString).append(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(/reference/))); testColorScale_Impl(pDoc, aBuffer.makeStringAndClear()); + +xDocSh-DoClose(); } void ScFiltersTest::testDataBarODS() @@ -1821,6 +1827,8 @@ void ScFiltersTest::testNewCondFormat() rtl::OUString aCSVPath; createCSVPath( aCSVFile, aCSVPath ); testCondFile(aCSVPath, pDoc, 0); + +xDocSh-DoClose(); } void ScFiltersTest::testFormulaDependency() @@ -1849,6 +1857,8 @@ void ScFiltersTest::testFormulaDependency() // check that the number format is implicity inherited // CPPUNIT_ASSERT_EQUAL(pDoc-GetString(0,4,0), pDoc-GetString(0,5,0)); + +xDocSh-DoClose(); } ScFiltersTest::ScFiltersTest() diff --git a/sw/qa/core/swdoc-test.cxx b/sw/qa/core/swdoc-test.cxx index de9828e..f818cba 100644 --- a/sw/qa/core/swdoc-test.cxx +++ b/sw/qa/core/swdoc-test.cxx @@ -886,6 +886,7 @@ void SwDocTest::setUp() void SwDocTest::tearDown() { +m_xDocShRef-DoClose(); m_xDocShRef.Clear(); delete m_pDoc; ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] .: sc/qa
sc/qa/unit/ucalc.cxx | 178 +++ 1 file changed, 178 insertions(+) New commits: commit 40ce68b3318b2c9205a5e58ced9a7e733951594d Author: Kohei Yoshida kohei.yosh...@gmail.com Date: Mon Jan 7 11:49:01 2013 -0500 New test for pivot table with field references. Change-Id: I65d932d6c258b965a6084acb07298387b7274215 diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx index 6a8af5d..d9d643f 100644 --- a/sc/qa/unit/ucalc.cxx +++ b/sc/qa/unit/ucalc.cxx @@ -80,6 +80,9 @@ #include com/sun/star/sheet/DataPilotFieldOrientation.hpp #include com/sun/star/sheet/DataPilotFieldGroupBy.hpp +#include com/sun/star/sheet/DataPilotFieldReference.hpp +#include com/sun/star/sheet/DataPilotFieldReferenceType.hpp +#include com/sun/star/sheet/DataPilotFieldReferenceItemType.hpp #include com/sun/star/sheet/GeneralFunction.hpp #include iostream @@ -195,6 +198,12 @@ public: */ void testPivotTableNumStability(); +/** + * Test for pivot table that include field with various non-default field + * refrences. + */ +void testPivotTableFieldReference(); + void testSheetCopy(); void testSheetMove(); void testExternalRef(); @@ -277,6 +286,7 @@ public: CPPUNIT_TEST(testPivotTableTextNumber); CPPUNIT_TEST(testPivotTableCaseInsensitiveStrings); CPPUNIT_TEST(testPivotTableNumStability); +CPPUNIT_TEST(testPivotTableFieldReference); CPPUNIT_TEST(testSheetCopy); CPPUNIT_TEST(testSheetMove); CPPUNIT_TEST(testExternalRef); @@ -3400,6 +3410,174 @@ void Test::testPivotTableNumStability() m_pDoc-DeleteTab(0); } +void Test::testPivotTableFieldReference() +{ +m_pDoc-InsertTab(0, OUString(Data)); +m_pDoc-InsertTab(1, OUString(Table)); + +// Raw data +const char* aData[][2] = { +{ Name, Value }, +{ A, 1 }, +{ B, 2 }, +{ C, 4 }, +{ D, 8 }, +}; + +// Dimension definition +DPFieldDef aFields[] = { +{ Name, 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()); + +ScRange aOutRange = refresh(pDPObj); + +{ +// Expected output table content. 0 = empty cell +const char* aOutputCheck[][2] = { +{ Name, 0 }, +{ A, 1 }, +{ B, 2 }, +{ C, 4 }, +{ D, 8 }, +{ Total Result, 15 }, +}; + +bSuccess = checkDPTableOutput2(m_pDoc, aOutRange, aOutputCheck, Field reference (none)); +CPPUNIT_ASSERT_MESSAGE(Table output check failed, bSuccess); +} + +ScDPSaveData aSaveData = *pDPObj-GetSaveData(); +sheet::DataPilotFieldReference aFieldRef; +aFieldRef.ReferenceType = sheet::DataPilotFieldReferenceType::ITEM_DIFFERENCE; +aFieldRef.ReferenceField = Name; +aFieldRef.ReferenceItemType = sheet::DataPilotFieldReferenceItemType::NAMED; +aFieldRef.ReferenceItemName = A; +ScDPSaveDimension* pDim = aSaveData.GetDimensionByName(Value); +CPPUNIT_ASSERT_MESSAGE(Failed to retrieve dimension 'Value'., pDim); +pDim-SetReferenceValue(aFieldRef); +pDPObj-SetSaveData(aSaveData); + +aOutRange = refresh(pDPObj); +{ +// Expected output table content. 0 = empty cell +const char* aOutputCheck[][2] = { +{ Name, 0 }, +{ A, 0 }, +{ B, 1 }, +{ C, 3 }, +{ D, 7 }, +{ Total Result, 0 }, +}; + +bSuccess = checkDPTableOutput2(m_pDoc, aOutRange, aOutputCheck, Field reference (difference from)); +CPPUNIT_ASSERT_MESSAGE(Table output check failed, bSuccess); +} + +aFieldRef.ReferenceType = sheet::DataPilotFieldReferenceType::ITEM_PERCENTAGE; +pDim-SetReferenceValue(aFieldRef); +pDPObj-SetSaveData(aSaveData); + +aOutRange = refresh(pDPObj); +{ +// Expected output table content. 0 = empty cell +const char* aOutputCheck[][2] = { +{ Name, 0 }, +{ A, 100.00% }, +{ B, 200.00% }, +{ C, 400.00% }, +{ D, 800.00% }, +{ Total Result, 0 }, +}; + +bSuccess = checkDPTableOutput2(m_pDoc, aOutRange,
[Libreoffice-commits] .: sc/qa
sc/qa/unit/subsequent_filters-test.cxx |6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) New commits: commit f6bf087a039a7c275207eba4a35e0ad814cf2813 Author: Kohei Yoshida kohei.yosh...@gmail.com Date: Mon Jan 7 14:45:00 2013 -0500 Append ODS to the test method name. Change-Id: I024d142b59ccceed944d641b6306f47dcf03ef9d diff --git a/sc/qa/unit/subsequent_filters-test.cxx b/sc/qa/unit/subsequent_filters-test.cxx index 618e627..df858da 100644 --- a/sc/qa/unit/subsequent_filters-test.cxx +++ b/sc/qa/unit/subsequent_filters-test.cxx @@ -170,7 +170,7 @@ public: void testPivotTableBasicODS(); void testFormulaDependency(); -void testRowHeight(); +void testRowHeightODS(); CPPUNIT_TEST_SUITE(ScFiltersTest); CPPUNIT_TEST(testRangeNameXLS); @@ -213,7 +213,7 @@ public: CPPUNIT_TEST(testCellAnchoredShapesODS); CPPUNIT_TEST(testPivotTableBasicODS); -CPPUNIT_TEST(testRowHeight); +CPPUNIT_TEST(testRowHeightODS); CPPUNIT_TEST(testFormulaDependency); //disable testPassword on MacOSX due to problems with libsqlite3 @@ -1574,7 +1574,7 @@ void ScFiltersTest::testPivotTableBasicODS() xDocSh-DoClose(); } -void ScFiltersTest::testRowHeight() +void ScFiltersTest::testRowHeightODS() { OUString aFileNameBase(row-height-import.); OUString aFileExt = OUString::createFromAscii(aFileFormats[ODS].pName); ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] .: sc/qa
sc/qa/unit/subsequent_filters-test.cxx | 88 - 1 file changed, 23 insertions(+), 65 deletions(-) New commits: commit 0bb184196e2b6a10640155a02d0eac263a1f48e4 Author: Kohei Yoshida kohei.yosh...@gmail.com Date: Mon Jan 7 15:02:25 2013 -0500 Remove duplicated code blocks. Change-Id: I332a39fe86fee385bcd2cce33fe2096043111472 TODO: Do this in the other tests as well. diff --git a/sc/qa/unit/subsequent_filters-test.cxx b/sc/qa/unit/subsequent_filters-test.cxx index df858da..2140693 100644 --- a/sc/qa/unit/subsequent_filters-test.cxx +++ b/sc/qa/unit/subsequent_filters-test.cxx @@ -113,6 +113,8 @@ public: const rtl::OUString rUserData, const rtl::OUString rTypeName, unsigned int nFilterFlags, unsigned int nClipboardID, unsigned int nFilterVersion); +ScDocShellRef loadFile(const OUString rBaseName, size_t nExt); + void createFileURL(const rtl::OUString aFileBase, const rtl::OUString aFileExtension, rtl::OUString rFilePath); void createCSVPath(const rtl::OUString aFileBase, rtl::OUString rFilePath); @@ -263,6 +265,20 @@ ScDocShellRef ScFiltersTest::load(const rtl::OUString rFilter, const rtl::OUStr return xDocShRef; } +ScDocShellRef ScFiltersTest::loadFile(const OUString rBaseName, size_t nExt) +{ +OUString aFileExt = OUString::createFromAscii(aFileFormats[nExt].pName); +OUString aFilterName = OUString::createFromAscii(aFileFormats[nExt].pFilterName); +OUString aFilterType = OUString::createFromAscii(aFileFormats[nExt].pTypeName); + +rtl::OUString aFileName; +createFileURL(rBaseName, aFileExt, aFileName); + +unsigned int nFormatType = aFileFormats[nExt].nFormatType; +unsigned int nClipboardId = nFormatType ? SFX_FILTER_IMPORT | SFX_FILTER_USESOPTIONS : 0; +return load(aFilterName, aFileName, OUString(), aFilterType, nFormatType, nClipboardId, SOFFICE_FILEFORMAT_CURRENT); +} + bool ScFiltersTest::load(const rtl::OUString rFilter, const rtl::OUString rURL, const rtl::OUString rUserData, unsigned int nFilterFlags, unsigned int nClipboardID, unsigned int nFilterVersion) @@ -1392,19 +1408,7 @@ void ScFiltersTest::testControlImport() void ScFiltersTest::testNumberFormatHTML() { -OUString aFileNameBase(numberformat.); -OUString aFileExt = OUString::createFromAscii(aFileFormats[HTML].pName); -OUString aFilterName = OUString::createFromAscii(aFileFormats[HTML].pFilterName); -OUString aFilterType = OUString::createFromAscii(aFileFormats[HTML].pTypeName); - -rtl::OUString aFileName; -createFileURL(aFileNameBase, aFileExt, aFileName); - -unsigned int nFormatType = aFileFormats[HTML].nFormatType; -unsigned int nClipboardId = nFormatType ? SFX_FILTER_IMPORT | SFX_FILTER_USESOPTIONS : 0; -ScDocShellRef xDocSh = load(aFilterName, aFileName, rtl::OUString(), aFilterType, -nFormatType, nClipboardId, SOFFICE_FILEFORMAT_CURRENT); - +ScDocShellRef xDocSh = loadFile(numberformat., HTML); CPPUNIT_ASSERT_MESSAGE(Failed to load numberformat.html, xDocSh.Is()); ScDocument* pDoc = xDocSh-GetDocument(); @@ -1424,20 +1428,8 @@ void ScFiltersTest::testNumberFormatHTML() void ScFiltersTest::testNumberFormatCSV() { -OUString aFileNameBase(numberformat.); -OUString aFileExt = OUString::createFromAscii(aFileFormats[CSV].pName); -OUString aFilterName = OUString::createFromAscii(aFileFormats[CSV].pFilterName); -OUString aFilterType = OUString::createFromAscii(aFileFormats[CSV].pTypeName); - -rtl::OUString aFileName; -createFileURL(aFileNameBase, aFileExt, aFileName); - -unsigned int nFormatType = aFileFormats[CSV].nFormatType; -unsigned int nClipboardId = nFormatType ? SFX_FILTER_IMPORT | SFX_FILTER_USESOPTIONS : 0; -ScDocShellRef xDocSh = load(aFilterName, aFileName, rtl::OUString(), aFilterType, -nFormatType, nClipboardId, SOFFICE_FILEFORMAT_CURRENT); - -CPPUNIT_ASSERT_MESSAGE(Failed to load numberformat.html, xDocSh.Is()); +ScDocShellRef xDocSh = loadFile(numberformat., CSV); +CPPUNIT_ASSERT_MESSAGE(Failed to load numberformat.csv, xDocSh.Is()); ScDocument* pDoc = xDocSh-GetDocument(); @@ -1456,19 +1448,7 @@ void ScFiltersTest::testNumberFormatCSV() void ScFiltersTest::testCellAnchoredShapesODS() { -OUString aFileNameBase(cell-anchored-shapes.); -OUString aFileExt = OUString::createFromAscii(aFileFormats[ODS].pName); -OUString aFilterName = OUString::createFromAscii(aFileFormats[ODS].pFilterName); -OUString aFilterType = OUString::createFromAscii(aFileFormats[ODS].pTypeName); - -rtl::OUString aFileName; -createFileURL(aFileNameBase, aFileExt, aFileName); - -unsigned int nFormatType = aFileFormats[ODS].nFormatType; -unsigned int nClipboardId = nFormatType ? SFX_FILTER_IMPORT | SFX_FILTER_USESOPTIONS : 0; -ScDocShellRef xDocSh = load(aFilterName, aFileName, rtl::OUString(), aFilterType, -nFormatType,
[Libreoffice-commits] .: sc/qa
sc/qa/unit/filters-test.cxx| 15 +-- sc/qa/unit/subsequent_filters-test.cxx | 151 - 2 files changed, 46 insertions(+), 120 deletions(-) New commits: commit 2ba80e59ceaceabd04b0426154b3402062731d5b Author: Kohei Yoshida kohei.yosh...@gmail.com Date: Mon Jan 7 16:03:22 2013 -0500 Adjusted all test methods for loadDoc. There was already a method that did the same thing (loadDoc). Let's stick with loadDoc instead. Also took advantage of automatic literal to OUString conversion while I was at it. Change-Id: I184f6278dd4bf8e3f2f7e5eda1e5e293303df68c diff --git a/sc/qa/unit/filters-test.cxx b/sc/qa/unit/filters-test.cxx index 060fbaa..755be75 100644 --- a/sc/qa/unit/filters-test.cxx +++ b/sc/qa/unit/filters-test.cxx @@ -320,8 +320,7 @@ ScDocShellRef ScFiltersTest::loadDoc(const rtl::OUString rName, sal_Int32 nForm void ScFiltersTest::testRangeNameODS() { -const rtl::OUString aFileNameBase(RTL_CONSTASCII_USTRINGPARAM(named-ranges-global.)); -ScDocShellRef xDocSh = loadDoc(aFileNameBase, 0); +ScDocShellRef xDocSh = loadDoc(named-ranges-global., ODS); CPPUNIT_ASSERT_MESSAGE(Failed to load named-ranges-globals.*, xDocSh.Is()); @@ -387,8 +386,7 @@ void testContentImpl(ScDocument* pDoc, sal_Int32 nFormat ) //same code for ods, void ScFiltersTest::testContentODS() { -const rtl::OUString aFileNameBase(RTL_CONSTASCII_USTRINGPARAM(universal-content.)); -ScDocShellRef xDocSh = loadDoc(aFileNameBase, ODS); +ScDocShellRef xDocSh = loadDoc(universal-content., ODS); xDocSh-DoHardRecalc(true); ScDocument* pDoc = xDocSh-GetDocument(); @@ -398,8 +396,7 @@ void ScFiltersTest::testContentODS() void ScFiltersTest::testContentXLS() { -const rtl::OUString aFileNameBase(RTL_CONSTASCII_USTRINGPARAM(universal-content.)); -ScDocShellRef xDocSh = loadDoc(aFileNameBase, XLS); +ScDocShellRef xDocSh = loadDoc(universal-content., XLS); xDocSh-DoHardRecalc(true); ScDocument* pDoc = xDocSh-GetDocument(); @@ -409,8 +406,7 @@ void ScFiltersTest::testContentXLS() void ScFiltersTest::testContentXLSX() { -const rtl::OUString aFileNameBase(RTL_CONSTASCII_USTRINGPARAM(universal-content.)); -ScDocShellRef xDocSh = loadDoc(aFileNameBase, XLSX); +ScDocShellRef xDocSh = loadDoc(universal-content., XLSX); xDocSh-DoHardRecalc(true); ScDocument* pDoc = xDocSh-GetDocument(); @@ -420,8 +416,7 @@ void ScFiltersTest::testContentXLSX() void ScFiltersTest::testContentLotus123() { -const rtl::OUString aFileNameBase(RTL_CONSTASCII_USTRINGPARAM(universal-content.)); -ScDocShellRef xDocSh = loadDoc(aFileNameBase, LOTUS123); +ScDocShellRef xDocSh = loadDoc(universal-content., LOTUS123); xDocSh-DoHardRecalc(true); ScDocument* pDoc = xDocSh-GetDocument(); diff --git a/sc/qa/unit/subsequent_filters-test.cxx b/sc/qa/unit/subsequent_filters-test.cxx index 2140693..04a7ffe 100644 --- a/sc/qa/unit/subsequent_filters-test.cxx +++ b/sc/qa/unit/subsequent_filters-test.cxx @@ -113,8 +113,6 @@ public: const rtl::OUString rUserData, const rtl::OUString rTypeName, unsigned int nFilterFlags, unsigned int nClipboardID, unsigned int nFilterVersion); -ScDocShellRef loadFile(const OUString rBaseName, size_t nExt); - void createFileURL(const rtl::OUString aFileBase, const rtl::OUString aFileExtension, rtl::OUString rFilePath); void createCSVPath(const rtl::OUString aFileBase, rtl::OUString rFilePath); @@ -234,7 +232,7 @@ public: private: void testPassword_Impl(const rtl::OUString rFileNameBase); -ScDocShellRef loadDoc(const rtl::OUString rName, sal_Int32 nType); +ScDocShellRef loadDoc(const rtl::OUString rBaseName, size_t nExt); uno::Referenceuno::XInterface m_xCalcComponent; ::rtl::OUString m_aBaseString; @@ -265,7 +263,7 @@ ScDocShellRef ScFiltersTest::load(const rtl::OUString rFilter, const rtl::OUStr return xDocShRef; } -ScDocShellRef ScFiltersTest::loadFile(const OUString rBaseName, size_t nExt) +ScDocShellRef ScFiltersTest::loadDoc(const OUString rBaseName, size_t nExt) { OUString aFileExt = OUString::createFromAscii(aFileFormats[nExt].pName); OUString aFilterName = OUString::createFromAscii(aFileFormats[nExt].pFilterName); @@ -276,7 +274,9 @@ ScDocShellRef ScFiltersTest::loadFile(const OUString rBaseName, size_t nExt) unsigned int nFormatType = aFileFormats[nExt].nFormatType; unsigned int nClipboardId = nFormatType ? SFX_FILTER_IMPORT | SFX_FILTER_USESOPTIONS : 0; -return load(aFilterName, aFileName, OUString(), aFilterType, nFormatType, nClipboardId, SOFFICE_FILEFORMAT_CURRENT); +ScDocShellRef xDocSh = load(aFilterName, aFileName, OUString(), aFilterType, nFormatType, nClipboardId, SOFFICE_FILEFORMAT_CURRENT); +CPPUNIT_ASSERT(xDocSh.Is()); +return xDocSh; } bool ScFiltersTest::load(const rtl::OUString rFilter, const
[Libreoffice-commits] .: sc/qa
sc/qa/unit/data/ods/dependencyTree.ods |binary sc/qa/unit/subsequent_filters-test.cxx | 30 ++ 2 files changed, 30 insertions(+) New commits: commit cc84ff4a51790f52f2e729cc61f7515fbbd51f35 Author: Markus Mohrhard markus.mohrh...@googlemail.com Date: Fri Jan 4 22:41:50 2013 +0100 add unit test for dependency tree during ods import Change-Id: I92bff38304959237042b9a0078be25948d642b25 diff --git a/sc/qa/unit/data/ods/dependencyTree.ods b/sc/qa/unit/data/ods/dependencyTree.ods new file mode 100644 index 000..fc5aae0 Binary files /dev/null and b/sc/qa/unit/data/ods/dependencyTree.ods differ diff --git a/sc/qa/unit/subsequent_filters-test.cxx b/sc/qa/unit/subsequent_filters-test.cxx index c283508..5acbfb8 100644 --- a/sc/qa/unit/subsequent_filters-test.cxx +++ b/sc/qa/unit/subsequent_filters-test.cxx @@ -168,6 +168,7 @@ public: void testCellAnchoredShapesODS(); void testPivotTableBasicODS(); +void testFormulaDependency(); void testRowHeight(); @@ -213,6 +214,7 @@ public: CPPUNIT_TEST(testPivotTableBasicODS); // CPPUNIT_TEST(testRowHeight); +CPPUNIT_TEST(testFormulaDependency); //disable testPassword on MacOSX due to problems with libsqlite3 //also crashes on DragonFly due to problems with nss/nspr headers @@ -1749,6 +1751,34 @@ void ScFiltersTest::testNewCondFormat() testCondFile(aCSVPath, pDoc, 0); } +void ScFiltersTest::testFormulaDependency() +{ +const rtl::OUString aFileNameBase(dependencyTree.); +rtl::OUString aFileExtension(aFileFormats[ODS].pName, strlen(aFileFormats[ODS].pName), RTL_TEXTENCODING_UTF8 ); +rtl::OUString aFilterName(aFileFormats[ODS].pFilterName, strlen(aFileFormats[ODS].pFilterName), RTL_TEXTENCODING_UTF8) ; +rtl::OUString aFileName; +createFileURL(aFileNameBase, aFileExtension, aFileName); +rtl::OUString aFilterType(aFileFormats[ODS].pTypeName, strlen(aFileFormats[ODS].pTypeName), RTL_TEXTENCODING_UTF8); +std::cout aFileFormats[ODS].pName Test std::endl; + +unsigned int nFormatType = aFileFormats[ODS].nFormatType; +unsigned int nClipboardId = nFormatType ? SFX_FILTER_IMPORT | SFX_FILTER_USESOPTIONS : 0; +ScDocShellRef xDocSh = load(aFilterName, aFileName, rtl::OUString(), aFilterType, +nFormatType, nClipboardId, SOFFICE_FILEFORMAT_CURRENT); + +ScDocument* pDoc = xDocSh-GetDocument(); + +// check if formula in A1 changes value +double nVal = pDoc-GetValue(0,0,0); +CPPUNIT_ASSERT_DOUBLES_EQUAL(nVal, 1.0, 1e-10); +pDoc-SetValue(0,1,0, 0.0); +nVal = pDoc-GetValue(0,0,0); +CPPUNIT_ASSERT_DOUBLES_EQUAL(nVal, 2.0, 1e-10); + +// check that the number format is implicity inherited +// CPPUNIT_ASSERT_EQUAL(pDoc-GetString(0,4,0), pDoc-GetString(0,5,0)); +} + ScFiltersTest::ScFiltersTest() : m_aBaseString(RTL_CONSTASCII_USTRINGPARAM(/sc/qa/unit/data)) { ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] .: sc/qa
sc/qa/unit/ucalc.cxx | 34 ++ 1 file changed, 34 insertions(+) New commits: commit c1f9efa4ac8a406cf10f3b5585f45ee0114621e4 Author: Kohei Yoshida kohei.yosh...@gmail.com Date: Wed Jan 2 14:07:09 2013 -0500 fdo#56278: Write a unit test for this. The reported bug description was very concise and unit-testable. We should turn it into a real test. Change-Id: I7383316e8fcf799a59b1c32a1722fd4b6b224d1c diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx index 55b8b9c..4b7e4fd 100644 --- a/sc/qa/unit/ucalc.cxx +++ b/sc/qa/unit/ucalc.cxx @@ -121,7 +121,16 @@ public: */ void testSheetsFunc(); void testVolatileFunc(); + +/** + * Basic test for formula dependency tracking. + */ void testFormulaDepTracking(); + +/** + * Another test for formula dependency tracking, inspired by fdo#56278. + */ +void testFormulaDepTracking2(); void testFuncParam(); void testNamedRange(); void testCSV(); @@ -248,6 +257,7 @@ public: CPPUNIT_TEST(testSheetsFunc); CPPUNIT_TEST(testVolatileFunc); CPPUNIT_TEST(testFormulaDepTracking); +CPPUNIT_TEST(testFormulaDepTracking2); CPPUNIT_TEST(testFuncParam); CPPUNIT_TEST(testNamedRange); CPPUNIT_TEST(testCSV); @@ -1223,6 +1233,30 @@ void Test::testFormulaDepTracking() m_pDoc-DeleteTab(0); } +void Test::testFormulaDepTracking2() +{ +CPPUNIT_ASSERT_MESSAGE (failed to insert sheet, m_pDoc-InsertTab (0, foo)); + +AutoCalcSwitch aACSwitch(m_pDoc, true); // turn on auto calculation. + +double val = 2.0; +m_pDoc-SetValue(0, 0, 0, val); +val = 4.0; +m_pDoc-SetValue(1, 0, 0, val); +val = 5.0; +m_pDoc-SetValue(0, 1, 0, val); +m_pDoc-SetString(2, 0, 0, =A1/B1); +m_pDoc-SetString(1, 1, 0, =B1*C1); + +CPPUNIT_ASSERT_EQUAL(2.0, m_pDoc-GetValue(1, 1, 0)); // B2 should equal 2. + +clearRange(m_pDoc, ScAddress(2, 0, 0)); // Delete C1. + +CPPUNIT_ASSERT_EQUAL(0.0, m_pDoc-GetValue(1, 1, 0)); // B2 should now equal 0. + +m_pDoc-DeleteTab(0); +} + void Test::testFuncParam() { rtl::OUString aTabName(foo); ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] .: sc/qa sc/source
sc/qa/unit/ucalc.cxx | 10 ++ sc/source/core/tool/scmatrix.cxx |2 ++ 2 files changed, 12 insertions(+) New commits: commit 79f1ef44e77074d8f5a1d32e0447118e5b9c4e70 Author: Kohei Yoshida kohei.yosh...@gmail.com Date: Wed Jan 2 15:49:24 2013 -0500 fdo#58539: Resizing matrix should also resize the flag storage too. Or else resizing and then putting empty elements may crash. The flag storage is used only for empty elements. Change-Id: I1ada8f795a01336af185e6180bc03247c44472ba diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx index 4b7e4fd..6a8af5d 100644 --- a/sc/qa/unit/ucalc.cxx +++ b/sc/qa/unit/ucalc.cxx @@ -1548,6 +1548,16 @@ void Test::testMatrix() pMat-PutString(aStr, 8, 2); pMat-PutEmptyPath(8, 11); checkMatrixElementsPartiallyFilledEmptyMatrix(*pMat); + +// Test resizing. +pMat = new ScMatrix(0, 0); +pMat-Resize(2, 2, 1.5); +pMat-PutEmpty(1, 1); + +CPPUNIT_ASSERT_EQUAL(1.5, pMat-GetDouble(0, 0)); +CPPUNIT_ASSERT_EQUAL(1.5, pMat-GetDouble(0, 1)); +CPPUNIT_ASSERT_EQUAL(1.5, pMat-GetDouble(1, 0)); +CPPUNIT_ASSERT_MESSAGE(PutEmpty() call failed., pMat-IsEmpty(1, 1)); } void Test::testEnterMixedMatrix() diff --git a/sc/source/core/tool/scmatrix.cxx b/sc/source/core/tool/scmatrix.cxx index 66dcb2f..0a92ffc 100644 --- a/sc/source/core/tool/scmatrix.cxx +++ b/sc/source/core/tool/scmatrix.cxx @@ -418,11 +418,13 @@ bool ScMatrixImpl::IsImmutable() const void ScMatrixImpl::Resize(SCSIZE nC, SCSIZE nR) { maMat.resize(nR, nC); +maMatFlag.resize(nR, nC); } void ScMatrixImpl::Resize(SCSIZE nC, SCSIZE nR, double fVal) { maMat.resize(nR, nC, fVal); +maMatFlag.resize(nR, nC); } void ScMatrixImpl::SetErrorInterpreter( ScInterpreter* p) ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] .: sc/qa
sc/qa/unit/rangelst_test.cxx | 11 +++ 1 file changed, 3 insertions(+), 8 deletions(-) New commits: commit 3a5f326c7553fac3d9741b2d99f720461289f81e Author: LuboÅ¡ LuÅák l.lu...@suse.cz Date: Wed Dec 26 15:24:25 2012 +0100 fix operator lookup with clang I'm not sure if this is clang being more strict or buggy, probably the latter. Change-Id: I900ba2cd2b1d4c23e41e4787be4263954ce8b4c0 diff --git a/sc/qa/unit/rangelst_test.cxx b/sc/qa/unit/rangelst_test.cxx index 62d9002..f543175 100644 --- a/sc/qa/unit/rangelst_test.cxx +++ b/sc/qa/unit/rangelst_test.cxx @@ -73,21 +73,19 @@ private: ScDocShellRef m_xDocShRef; }; -namespace { - -std::ostream operator(std::ostream rStrm, const ScAddress rAddr) +static std::ostream operator(std::ostream rStrm, const ScAddress rAddr) { rStrm Col: rAddr.Col() Row: rAddr.Row() Tab: rAddr.Tab() \n; return rStrm; } -std::ostream operator(std::ostream rStrm, const ScRange rRange) +static std::ostream operator(std::ostream rStrm, const ScRange rRange) { rStrm ScRange: rRange.aStart rRange.aEnd \n; return rStrm; } -std::ostream operator(std::ostream rStrm, const ScRangeList rList) +static std::ostream operator(std::ostream rStrm, const ScRangeList rList) { rStrm ScRangeList: \n; for(size_t i = 0; i rList.size(); ++i) @@ -95,9 +93,6 @@ std::ostream operator(std::ostream rStrm, const ScRangeList rList) return rStrm; } -} - - void Test::setUp() { BootstrapFixture::setUp(); ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] .: sc/qa
sc/qa/unit/data/contentCSV/new_cond_format_test.csv | 10 +- 1 file changed, 5 insertions(+), 5 deletions(-) New commits: commit 6859c0230444e57dc8526e398c4c3c6f5bb218cc Author: Markus Mohrhard markus.mohrh...@googlemail.com Date: Tue Dec 18 00:43:38 2012 +0100 fix the test for cond format export Change-Id: I01e0b3e76e39bf26d2398745bf706cfa60d5621f diff --git a/sc/qa/unit/data/contentCSV/new_cond_format_test.csv b/sc/qa/unit/data/contentCSV/new_cond_format_test.csv index 156f2a0..37893fc 100644 --- a/sc/qa/unit/data/contentCSV/new_cond_format_test.csv +++ b/sc/qa/unit/data/contentCSV/new_cond_format_test.csv @@ -1,8 +1,8 @@ ,top n elements,,bottom n elements,,top n percent,,bottom n percent,,above average,,below average,,above equal average,,below equal average ,1,,1.00,,1,,1.00,,1,,1.00,,2,,2.00 ,2,,2.00,,2,,2.00,,2,,2.00,,3,,3.00 -,3,,3.00,,3,,3.00,,3,,3.00,,4,,4.00 -,4,,4.00,,4,,4,,4,,4.00,,5,,5.00 +,3,,3.00,,3,,3,,3,,3.00,,4,,4.00 +,4,,4,,4,,4,,4,,4.00,,5,,5.00 ,5,,5,,5,,5,,5,,5.00,,6,,6.00 ,6,,6,,6,,6,,6,,6.00,,7,,7.00 ,7,,7,,7,,7,,7,,7.00,,11.00,,11 @@ -11,12 +11,12 @@ ,12,,12,,12,,12,,12.00,,12,,12.00,,12 ,13,,13,,13,,13,,13.00,,13,,13.00,,13 ,14,,14,,14,,14,,14.00,,14,,14.00,,14 -,15.00,,15,,15,,15,,15.00,,15,,15.00,,15 +,15,,15,,15,,15,,15.00,,15,,15.00,,15 ,16.00,,16,,16,,16,,16.00,,16,,16.00,,16 ,17.00,,17,,17,,17,,17.00,,17,,17.00,,17 -,18.00,,18,,18.00,,18,,18.00,,18,,18.00,,18 +,18.00,,18,,18,,18,,18.00,,18,,18.00,,18 ,19.00,,19,,19.00,,19,,19.00,,19,,19.00,,19 ,20.00,,20,,20.00,,20,,20.00,,20,,20.00,,20 ,1,,1.00,,1,,1.00,,1,,1.00,,2,,2.00 ,2,,2.00,,2,,2.00,,2,,2.00,,2,,2.00 -,3,,3.00,,3,,3.00,,3,,3.00,,3,,3.00 +,3,,3.00,,3,,3,,3,,3.00,,3,,3.00 ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] .: sc/qa sc/source
sc/qa/unit/subsequent_export-test.cxx |4 sc/source/filter/oox/workbookfragment.cxx |7 +-- 2 files changed, 5 insertions(+), 6 deletions(-) New commits: commit 922714c21c1c58792542e512869ada3e2a267afc Author: Kohei Yoshida kohei.yosh...@gmail.com Date: Tue Dec 4 18:39:43 2012 -0500 More adjustment of file load code in the unit test. And remove the try catch block, which shouldn't really be necessary there. Change-Id: I91db12203332b31b208b107db810c33705a57f0b diff --git a/sc/qa/unit/subsequent_export-test.cxx b/sc/qa/unit/subsequent_export-test.cxx index 8d4eb82..c7930b4 100644 --- a/sc/qa/unit/subsequent_export-test.cxx +++ b/sc/qa/unit/subsequent_export-test.cxx @@ -200,8 +200,10 @@ ScDocShellRef ScExportTest::saveAndReload(ScDocShell* pShell, const rtl::OUStrin pFilter-SetVersion(SOFFICE_FILEFORMAT_CURRENT); ScDocShellRef xDocShRef = new ScDocShell; +xDocShRef-GetDocument()-EnableUserInteraction(false); SfxMedium* pSrcMed = new SfxMedium(aTempFile.GetURL(), STREAM_STD_READ); pSrcMed-SetFilter(pFilter); +pSrcMed-UseInteractionHandler(false); if (!xDocShRef-DoLoad(pSrcMed)) { xDocShRef-DoClose(); @@ -240,8 +242,10 @@ ScDocShellRef ScExportTest::loadDocument(const rtl::OUString rFileName, sal_Int pFilter-SetVersion(SOFFICE_FILEFORMAT_CURRENT); ScDocShellRef xDocShRef = new ScDocShell; +xDocShRef-GetDocument()-EnableUserInteraction(false); SfxMedium* pSrcMed = new SfxMedium(aFileName, STREAM_STD_READ); pSrcMed-SetFilter(pFilter); +pSrcMed-UseInteractionHandler(false); if (!xDocShRef-DoLoad(pSrcMed)) { xDocShRef-DoClose(); diff --git a/sc/source/filter/oox/workbookfragment.cxx b/sc/source/filter/oox/workbookfragment.cxx index c5d4b30..896f648 100644 --- a/sc/source/filter/oox/workbookfragment.cxx +++ b/sc/source/filter/oox/workbookfragment.cxx @@ -28,7 +28,6 @@ #include oox/helper/propertyset.hxx #include oox/ole/olestorage.hxx #include vcl/msgbox.hxx -#include vcl/svapp.hxx #include biffinputstream.hxx #include chartsheetfragment.hxx @@ -331,11 +330,7 @@ void WorkbookFragment::finalizeImport() pDocSh-GetActiveDialogParent(), WinBits(WB_YES_NO | WB_DEF_YES), ScGlobal::GetRscString(STR_QUERY_FORMULA_RECALC_ONLOAD_XLS)); -try -{ -bHardRecalc = aBox.Execute() == RET_YES; -} -catch (Application::DialogCancelledException const) {/* ignore */} +bHardRecalc = aBox.Execute() == RET_YES; } if (bHardRecalc) ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] .: sc/qa
sc/qa/unit/subsequent_export-test.cxx | 14 ++ 1 file changed, 10 insertions(+), 4 deletions(-) New commits: commit d3f629a1df701e29a03b4809984ef14e4db5ff71 Author: Kohei Yoshida kohei.yosh...@gmail.com Date: Tue Dec 4 19:41:04 2012 -0500 Fix the testPasswordExport test. Change-Id: I9ef9be5d31a08813db9ecfed8eeb0ba8579309e9 diff --git a/sc/qa/unit/subsequent_export-test.cxx b/sc/qa/unit/subsequent_export-test.cxx index 7fcbd67..7b0fde8 100644 --- a/sc/qa/unit/subsequent_export-test.cxx +++ b/sc/qa/unit/subsequent_export-test.cxx @@ -92,7 +92,8 @@ private: ScDocShellRef load( const OUString rURL, const OUString rFilter, const OUString rUserData, -const OUString rTypeName, sal_Int32 nFormat, sal_uLong nFormatType ); +const OUString rTypeName, sal_Int32 nFormat, sal_uLong nFormatType, +const OUString* pPassword = NULL ); ScDocShellRef saveAndReload( ScDocShell* pShell, sal_Int32 nFormat ); ScDocShellRef loadDocument( const rtl::OUString rFileNameBase, sal_Int32 nFormat ); @@ -120,7 +121,6 @@ void ScExportTest::createCSVPath(const rtl::OUString aFileBase, rtl::OUString ScDocShellRef ScExportTest::saveAndReloadPassword(ScDocShell* pShell, const rtl::OUString rFilter, const rtl::OUString rUserData, const rtl::OUString rTypeName, sal_uLong nFormatType) { - utl::TempFile aTempFile; aTempFile.EnableKillingFile(); SfxMedium aStoreMedium( aTempFile.GetURL(), STREAM_STD_WRITE ); @@ -151,7 +151,8 @@ ScDocShellRef ScExportTest::saveAndReloadPassword(ScDocShell* pShell, const rtl: if (nFormatType) nFormat = SFX_FILTER_IMPORT | SFX_FILTER_USESOPTIONS; -return load(aTempFile.GetURL(), rFilter, rUserData, rTypeName, nFormat, nFormatType); +OUString aPass(test); +return load(aTempFile.GetURL(), rFilter, rUserData, rTypeName, nFormat, nFormatType, aPass); } ScDocShellRef ScExportTest::saveAndReload(ScDocShell* pShell, const rtl::OUString rFilter, @@ -184,7 +185,7 @@ ScDocShellRef ScExportTest::saveAndReload(ScDocShell* pShell, const rtl::OUStrin ScDocShellRef ScExportTest::load( const OUString rURL, const OUString rFilter, const OUString rUserData, -const OUString rTypeName, sal_Int32 nFormat, sal_uLong nFormatType ) +const OUString rTypeName, sal_Int32 nFormat, sal_uLong nFormatType, const OUString* pPassword ) { SfxFilter* pFilter = new SfxFilter( rFilter, @@ -197,6 +198,11 @@ ScDocShellRef ScExportTest::load( SfxMedium* pSrcMed = new SfxMedium(rURL, STREAM_STD_READ); pSrcMed-SetFilter(pFilter); pSrcMed-UseInteractionHandler(false); +if (pPassword) +{ +SfxItemSet* pSet = pSrcMed-GetItemSet(); +pSet-Put(SfxStringItem(SID_PASSWORD, *pPassword)); +} if (!xDocShRef-DoLoad(pSrcMed)) { xDocShRef-DoClose(); ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] .: sc/qa
sc/qa/unit/helper/debughelper.hxx |5 +++ sc/qa/unit/helper/qahelper.hxx|6 +++ sc/qa/unit/ucalc.cxx | 63 +++--- 3 files changed, 43 insertions(+), 31 deletions(-) New commits: commit ddf7e2c150f6d7b93607b012bc9852845ef88d64 Author: Markus Mohrhard markus.mohrh...@googlemail.com Date: Sat Nov 10 20:43:14 2012 +0100 make handling of doubles in sc tests easier Change-Id: Ifc8def986f7d1659d71be7b4716bd9ab5fa4647e diff --git a/sc/qa/unit/helper/debughelper.hxx b/sc/qa/unit/helper/debughelper.hxx index ee84f4c..2a560c6 100644 --- a/sc/qa/unit/helper/debughelper.hxx +++ b/sc/qa/unit/helper/debughelper.hxx @@ -26,6 +26,9 @@ * instead of those above. */ +#ifndef SC_DEBUG_HELPER_HXX +#define SC_DEBUG_HELPER_HXX + /** * Print nicely formatted sheet content to stdout. Indispensable when * debugging the unit test code involving testing of sheet contents. @@ -161,4 +164,6 @@ private: MatrixType maMatrix; }; +#endif + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/qa/unit/helper/qahelper.hxx b/sc/qa/unit/helper/qahelper.hxx index e29415c..32f7f7a 100644 --- a/sc/qa/unit/helper/qahelper.hxx +++ b/sc/qa/unit/helper/qahelper.hxx @@ -122,6 +122,12 @@ void testCondFile(rtl::OUString aFileName, ScDocument* pDoc, SCTAB nTab) } +#define ASSERT_DOUBLES_EQUAL( expected, result )\ +CPPUNIT_ASSERT_DOUBLES_EQUAL( (expected), (result), 1e-14 ) + +#define ASSERT_DOUBLES_EQUAL_MESSAGE( message, expected, result ) \ +CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE( (message), (expected), (result), 1e-14 ) + #endif /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx index 0606562..59a70f8 100644 --- a/sc/qa/unit/ucalc.cxx +++ b/sc/qa/unit/ucalc.cxx @@ -89,6 +89,7 @@ #define CALC_DEBUG_OUTPUT 0 #include helper/debughelper.hxx +#include helper/qahelper.hxx const int indeterminate = 2; @@ -4641,7 +4642,7 @@ void Test::testCopyPaste() double aValue = 0; m_pDoc-GetValue(1, 0, 0, aValue); std::cout Value: aValue std::endl; -CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE(formula should return 8, aValue, 8, 0.0001); +ASSERT_DOUBLES_EQUAL_MESSAGE(formula should return 8, aValue, 8); //copy Sheet1.A1:C1 to Sheet2.A2:C2 ScRange aRange(0,0,0,2,0,0); @@ -4666,7 +4667,7 @@ void Test::testCopyPaste() rtl::OUString aString; m_pDoc-GetValue(1,1,1, aValue); m_pDoc-GetFormula(1,1,1, aString); -CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE(copied formula should return 2, aValue, 2, 0.0001); +ASSERT_DOUBLES_EQUAL_MESSAGE(copied formula should return 2, aValue, 2); CPPUNIT_ASSERT_MESSAGE(formula string was not copied correctly, aString == aFormulaString); m_pDoc-GetValue(0,1,1, aValue); CPPUNIT_ASSERT_MESSAGE(copied value should be 1, aValue == 1); @@ -4684,13 +4685,13 @@ void Test::testCopyPaste() //check undo and redo pUndo-Undo(); m_pDoc-GetValue(1,1,1, aValue); -CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE(after undo formula should return nothing, aValue, 0, 0.0001); +ASSERT_DOUBLES_EQUAL_MESSAGE(after undo formula should return nothing, aValue, 0); m_pDoc-GetString(2,1,1, aString); CPPUNIT_ASSERT_MESSAGE(after undo string should be removed, aString.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM())); pUndo-Redo(); m_pDoc-GetValue(1,1,1, aValue); -CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE(formula should return 2 after redo, aValue, 2, 0.0001); +ASSERT_DOUBLES_EQUAL_MESSAGE(formula should return 2 after redo, aValue, 2); m_pDoc-GetString(2,1,1, aString); CPPUNIT_ASSERT_MESSAGE(Cell Sheet2.C2 should contain: test, aString.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(test))); m_pDoc-GetFormula(1,1,1, aString); @@ -4822,42 +4823,42 @@ void Test::testUpdateReference() double aValue; m_pDoc-GetValue(2,0,2, aValue); -CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE(formula does not return correct result, aValue, 3, 0.0001); +ASSERT_DOUBLES_EQUAL_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); +ASSERT_DOUBLES_EQUAL_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_DOUBLES_EQUAL_MESSAGE(after deleting first sheet formula does not return correct result, aValue, 3, 0.0001); +ASSERT_DOUBLES_EQUAL_MESSAGE(after deleting first sheet formula does not return correct result, aValue, 3); m_pDoc-GetValue(2,1,1, aValue); -CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE(after deleting first sheet formula does not return correct result, aValue, 5, 0.0001); +ASSERT_DOUBLES_EQUAL_MESSAGE(after deleting first
[Libreoffice-commits] .: sc/qa
sc/qa/unit/data/xls/pass/EDB-22330-1.xls |binary 1 file changed New commits: commit 33781373bd4da103492f7a6c1f5482e60d58f108 Author: Caolán McNamara caol...@redhat.com Date: Wed Oct 31 23:12:40 2012 + add test for EBD-22330 Change-Id: Ifd59198a2d09e26377267c8b509c5340d83240e3 diff --git a/sc/qa/unit/data/xls/pass/EDB-22330-1.xls b/sc/qa/unit/data/xls/pass/EDB-22330-1.xls new file mode 100644 index 000..a10c24d Binary files /dev/null and b/sc/qa/unit/data/xls/pass/EDB-22330-1.xls differ ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] .: sc/qa sd/qa
sc/qa/unit/data/xls/fail/CVE-2012-4233-4.xls |binary sd/qa/unit/data/ppt/pass/CVE-2012-4233-3.ppt |binary 2 files changed New commits: commit cd11b9f2c1bd3e3c3f9e4dc8788bf487c8c421cb Author: Caolán McNamara caol...@redhat.com Date: Thu Nov 1 14:07:28 2012 + another some more regression tests Change-Id: Ic13269fcf55b4e51a8124da6d2de75fb5bec23e0 diff --git a/sc/qa/unit/data/xls/fail/CVE-2012-4233-4.xls b/sc/qa/unit/data/xls/fail/CVE-2012-4233-4.xls new file mode 100644 index 000..7f8f89c Binary files /dev/null and b/sc/qa/unit/data/xls/fail/CVE-2012-4233-4.xls differ diff --git a/sd/qa/unit/data/ppt/pass/CVE-2012-4233-3.ppt b/sd/qa/unit/data/ppt/pass/CVE-2012-4233-3.ppt new file mode 100644 index 000..625c116 Binary files /dev/null and b/sd/qa/unit/data/ppt/pass/CVE-2012-4233-3.ppt differ ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] .: sc/qa
sc/qa/unit/ucalc.cxx | 24 1 file changed, 24 insertions(+) New commits: commit 86b1ccc71cd8bc38599576ce6acab9cfab4d9231 Author: Kohei Yoshida kohei.yosh...@gmail.com Date: Thu Nov 1 21:47:16 2012 -0400 New unit test for shifting cells. Change-Id: Ic004490ffaf1da5cdb43f0a1336437eb312813bf diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx index 247a75f..7c2c1af 100644 --- a/sc/qa/unit/ucalc.cxx +++ b/sc/qa/unit/ucalc.cxx @@ -228,6 +228,7 @@ public: void testFindAreaPosColRight(); void testSort(); void testSortWithFormulaRefs(); +void testShiftCells(); void testDeleteRow(); void testDeleteCol(); @@ -281,6 +282,7 @@ public: CPPUNIT_TEST(testFindAreaPosColRight); CPPUNIT_TEST(testSort); CPPUNIT_TEST(testSortWithFormulaRefs); +CPPUNIT_TEST(testShiftCells); CPPUNIT_TEST(testDeleteRow); CPPUNIT_TEST(testDeleteCol); CPPUNIT_TEST_SUITE_END(); @@ -5199,6 +5201,28 @@ void Test::testSort() pDoc-DeleteTab(0); } +void Test::testShiftCells() +{ +m_pDoc-InsertTab(0, foo); + +OUString aTestVal(Some Text); + +// Text into cell E5. +m_pDoc-SetString(4, 3, 0, aTestVal); + +// Insert cell at D5. This should shift the string cell to right. +m_pDoc-InsertCol(3, 0, 3, 0, 3, 1); +OUString aStr = m_pDoc-GetString(5, 3, 0); +CPPUNIT_ASSERT_MESSAGE(We should have a string cell here., aStr == aTestVal); + +// Delete cell D5, to shift the text cell back into D5. +m_pDoc-DeleteCol(3, 0, 3, 0, 3, 1); +aStr = m_pDoc-GetString(4, 3, 0); +CPPUNIT_ASSERT_MESSAGE(We should have a string cell here., aStr == aTestVal); + +m_pDoc-DeleteTab(0); +} + void Test::testDeleteRow() { ScDocument* pDoc = m_xDocShRef-GetDocument(); ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] .: sc/qa
sc/qa/unit/ucalc.cxx | 67 +++ 1 file changed, 67 insertions(+) New commits: commit 71ada2fb20cdb1741767165948a2856b4198c700 Author: Noel Power noel.po...@suse.com Date: Thu Oct 11 12:35:35 2012 +0100 regression test for fdo#53814 tests sorting when cells in sort range are referred to by other formula cells Change-Id: Ic7b0d9e11193fc09d97aebd54cdd84210bd09061 diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx index 1bcd5a8..8eef410 100644 --- a/sc/qa/unit/ucalc.cxx +++ b/sc/qa/unit/ucalc.cxx @@ -224,6 +224,7 @@ public: void testFindAreaPosRowDown(); void testFindAreaPosColRight(); void testSort(); +void testSortWithFormulaRefs(); CPPUNIT_TEST_SUITE(Test); CPPUNIT_TEST(testCollator); @@ -273,6 +274,7 @@ public: CPPUNIT_TEST(testFindAreaPosRowDown); CPPUNIT_TEST(testFindAreaPosColRight); CPPUNIT_TEST(testSort); +CPPUNIT_TEST(testSortWithFormulaRefs); CPPUNIT_TEST_SUITE_END(); private: @@ -4920,6 +4922,71 @@ void Test::testFindAreaPosColRight() pDoc-DeleteTab(0); } +// regression test fo fdo#53814, sorting doens't work as expected +// if cells in the sort are referenced by formulas +void Test::testSortWithFormulaRefs() +{ +ScDocument* pDoc = m_xDocShRef-GetDocument(); +rtl::OUString aTabName1(List1); +rtl::OUString aTabName2(List2); +pDoc-InsertTab(0, aTabName1); +pDoc-InsertTab(1, aTabName2); + +const char* aFormulaData[6] = { +=IF($List1.A2\\,$List1.A2,\\), +=IF($List1.A3\\,$List1.A3,\\), +=IF($List1.A4\\,$List1.A4,\\), +=IF($List1.A5\\,$List1.A5,\\), +=IF($List1.A6\\,$List1.A6,\\), +=IF($List1.A7\\,$List1.A7,\\), +}; + +const char* aTextData[4] = { +bob, +tim, +brian, +larry, +}; + +const char* aResults[ 6 ] = { +bob, +brian, +larry, +tim, +, +, +}; +// insert data to sort +SCROW nStart = 1, nEnd = 4; +for ( SCROW i = nStart; i = nEnd; ++i ) +pDoc-SetString( 0, i, 0, rtl::OUString::createFromAscii(aTextData[i-1]) ); +// insert forumulas +nStart = 0; +nEnd = SAL_N_ELEMENTS(aFormulaData); +for ( SCROW i = nStart; i nEnd; ++i ) +pDoc-SetString( 0, i, 1, rtl::OUString::createFromAscii(aFormulaData[i]) ); + +ScSortParam aSortData; +aSortData.nCol1 = 0; +aSortData.nCol2 = 0; +aSortData.nRow1 = 1; +aSortData.nRow2 = 7; +aSortData.maKeyState[0].bDoSort = true; +aSortData.maKeyState[0].nField = 0; + +pDoc-Sort(0, aSortData, false, NULL); + +nEnd = SAL_N_ELEMENTS( aResults ); +for ( SCROW i = nStart; i nEnd; ++i ) +{ +rtl::OUString sResult; +pDoc-GetString( 0, i + 1, 0, sResult ); +CPPUNIT_ASSERT_EQUAL( rtl::OUString::createFromAscii( aResults[ i ] ), sResult ); +} +pDoc-DeleteTab(0); +pDoc-DeleteTab(1); +} + void Test::testSort() { ScDocument* pDoc = m_xDocShRef-GetDocument(); ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] .: sc/qa
sc/qa/unit/subsequent_filters-test.cxx |2 ++ 1 file changed, 2 insertions(+) New commits: commit 39726ed52d6370b0223d6f675e02ddb1989206cb Author: Korrawit Pruegsanusak detective.conan.1...@gmail.com Date: Sat Sep 29 11:40:56 2012 +0700 sc/qa/unit: recover xDocSh-DoClose() which was removed in fde638b3ac35997aa3e38a37fed56d6eb661806b Change-Id: I57caf615f0ca49d0b90cb4c68b8ce8edf8f72a97 Reviewed-on: https://gerrit.libreoffice.org/723 Reviewed-by: Markus Mohrhard markus.mohrh...@googlemail.com Tested-by: Markus Mohrhard markus.mohrh...@googlemail.com diff --git a/sc/qa/unit/subsequent_filters-test.cxx b/sc/qa/unit/subsequent_filters-test.cxx index fb286e8..10db9ae 100644 --- a/sc/qa/unit/subsequent_filters-test.cxx +++ b/sc/qa/unit/subsequent_filters-test.cxx @@ -355,6 +355,8 @@ void ScFiltersTest::testRangeNameXLSX() ScDocument* pDoc = xDocSh-GetDocument(); testRangeNameImpl(pDoc); + +xDocSh-DoClose(); } void ScFiltersTest::testHardRecalcODS() ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] .: sc/qa sc/source
sc/qa/unit/data/xlsx/formats.xlsx|binary sc/qa/unit/subsequent_filters-test.cxx |2 -- sc/source/filter/inc/numberformatsbuffer.hxx |3 ++- sc/source/filter/inc/stylesbuffer.hxx|1 + sc/source/filter/oox/numberformatsbuffer.cxx |6 ++ sc/source/filter/oox/stylesbuffer.cxx| 19 ++- 6 files changed, 27 insertions(+), 4 deletions(-) New commits: commit 4e0e0d4759cc0f1b2c5ea3c64d2421c1a0dbe87e Author: Noel Power noel.po...@suse.com Date: Wed Sep 26 10:10:53 2012 +0100 don't let numforats in dxf entries clobber global number formats update test * Enabling the disabled test which checked a cell style attribute ( that was getting clobbered by the dxf entries above ) * squash the 'escape' characters in dxf num formats ( probably should do this in general * regenerate the formats.xlsx file ( I had to manually tweak this as the conditional tests were failing with the excel created document ) diff --git a/sc/qa/unit/data/xlsx/formats.xlsx b/sc/qa/unit/data/xlsx/formats.xlsx index 1c451be..e579fa5 100644 Binary files a/sc/qa/unit/data/xlsx/formats.xlsx and b/sc/qa/unit/data/xlsx/formats.xlsx differ diff --git a/sc/qa/unit/subsequent_filters-test.cxx b/sc/qa/unit/subsequent_filters-test.cxx index 3428582..fb286e8 100644 --- a/sc/qa/unit/subsequent_filters-test.cxx +++ b/sc/qa/unit/subsequent_filters-test.cxx @@ -656,9 +656,7 @@ void testFormats_Impl(ScFiltersTest* pFiltersTest, ScDocument* pDoc, sal_Int32 n // check actual align applied to cell, should be the same as // the style eHorJustify = static_castSvxCellHorJustify(static_cast const SvxHorJustifyItem (pPattern-GetItem( ATTR_HOR_JUSTIFY ) ).GetValue() ); -#if ENABLE_WHEN_FIXED CPPUNIT_ASSERT_EQUAL_MESSAGE(cell with 'Excel Built-in Date' style should be aligned centre horizontally, SVX_HOR_JUSTIFY_CENTER, eHorJustify); -#endif } } diff --git a/sc/source/filter/inc/numberformatsbuffer.hxx b/sc/source/filter/inc/numberformatsbuffer.hxx index e5b7eee..721ff8d 100644 --- a/sc/source/filter/inc/numberformatsbuffer.hxx +++ b/sc/source/filter/inc/numberformatsbuffer.hxx @@ -119,7 +119,7 @@ public: /** Writes the specified number format to the passed property map. */ voidwriteToPropertyMap( PropertyMap rPropMap, sal_Int32 nNumFmtId ) const; - +sal_Int32 nextFreeId(){ return ++mnHighestId; } private: /** Inserts built-in number formats for the current system language. */ voidinsertBuiltinFormats(); @@ -129,6 +129,7 @@ private: NumberFormatMap maNumFmts; /// List of number formats. ::rtl::OUString maLocaleStr;/// Current office locale. +sal_Int32 mnHighestId; }; // diff --git a/sc/source/filter/inc/stylesbuffer.hxx b/sc/source/filter/inc/stylesbuffer.hxx index 43b22a9..d757c39 100644 --- a/sc/source/filter/inc/stylesbuffer.hxx +++ b/sc/source/filter/inc/stylesbuffer.hxx @@ -909,6 +909,7 @@ public: FontRef createFont( sal_Int32* opnFontId = 0 ); /** Creates a number format. */ NumberFormatRef createNumFmt( sal_Int32 nNumFmtId, const ::rtl::OUString rFmtCode ); +sal_Int32 nextFreeNumFmtId(); /** Creates a new empty border object. @param opnBorderId (out-param) The identifier of the new border object. */ BorderRef createBorder( sal_Int32* opnBorderId = 0 ); diff --git a/sc/source/filter/oox/numberformatsbuffer.cxx b/sc/source/filter/oox/numberformatsbuffer.cxx index 2c3c421..72bc935 100644 --- a/sc/source/filter/oox/numberformatsbuffer.cxx +++ b/sc/source/filter/oox/numberformatsbuffer.cxx @@ -1981,6 +1981,8 @@ NumberFormatRef NumberFormatsBuffer::createNumFmt( sal_Int32 nNumFmtId, const OU { xNumFmt.reset( new NumberFormat( *this ) ); maNumFmts[ nNumFmtId ] = xNumFmt; +if ( nNumFmtId mnHighestId ) +mnHighestId = nNumFmtId; xNumFmt-setFormatCode( rFmtCode ); } return xNumFmt; @@ -2081,7 +2083,11 @@ void NumberFormatsBuffer::insertBuiltinFormats() // copy reused number formats for( ReuseMap::const_iterator aRIt = aReuseMap.begin(), aREnd = aReuseMap.end(); aRIt != aREnd; ++aRIt ) +{ maNumFmts[ aRIt-first ] = maNumFmts[ aRIt-second ]; +if ( aRIt-first mnHighestId ) +mnHighestId = aRIt-first; +} } // diff --git a/sc/source/filter/oox/stylesbuffer.cxx b/sc/source/filter/oox/stylesbuffer.cxx index cb1ce6e..f9b9779 100644 --- a/sc/source/filter/oox/stylesbuffer.cxx +++ b/sc/source/filter/oox/stylesbuffer.cxx @@ -2445,7 +2445,19 @@ FillRef Dxf::createFill( bool bAlwaysNew ) void Dxf::importNumFmt( const AttributeList rAttribs
[Libreoffice-commits] .: sc/qa
sc/qa/unit/subsequent_filters-test.cxx |4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) New commits: commit a358d0799657c9630ea90d10443dfeb8fbdd0208 Author: Markus Mohrhard markus.mohrh...@googlemail.com Date: Mon Sep 24 17:47:22 2012 +0200 disable the color scale test Problem with rounding errors resulting in different colors. The solution to it is to treat both files as csv files and compare them like that. Then we can compare color values +-1 diff --git a/sc/qa/unit/subsequent_filters-test.cxx b/sc/qa/unit/subsequent_filters-test.cxx index e48b302..e9f6b66 100644 --- a/sc/qa/unit/subsequent_filters-test.cxx +++ b/sc/qa/unit/subsequent_filters-test.cxx @@ -194,8 +194,8 @@ public: CPPUNIT_TEST(testCellValueXLSX); CPPUNIT_TEST(testControlImport); -CPPUNIT_TEST(testColorScaleODS); -CPPUNIT_TEST(testColorScaleXLSX); +//CPPUNIT_TEST(testColorScaleODS); +//CPPUNIT_TEST(testColorScaleXLSX); CPPUNIT_TEST(testDataBarODS); CPPUNIT_TEST(testNewCondFormat); ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] .: sc/qa
sc/qa/unit/data/reference/colorScale_1.txt | 21 + sc/qa/unit/data/reference/colorScale_2.txt | 17 + sc/qa/unit/data/reference/colorScale_3.txt | 23 +++ sc/qa/unit/data/reference/colorScale_4.txt | 19 +++ 4 files changed, 80 insertions(+) New commits: commit be04b07cf56e489127eae6853502699e3da1c734 Author: Markus Mohrhard markus.mohrh...@googlemail.com Date: Sun Sep 23 22:42:38 2012 +0200 add forgotten files Change-Id: I9c4b0e1d5027965ba4a8d5e33180cc23376d292a diff --git a/sc/qa/unit/data/reference/colorScale_1.txt b/sc/qa/unit/data/reference/colorScale_1.txt new file mode 100644 index 000..43a7925 --- /dev/null +++ b/sc/qa/unit/data/reference/colorScale_1.txt @@ -0,0 +1,21 @@ +Color Scale with 3 entries +Color Scale Entry +Type: Min +Color: 248,105,107 +Color Scale Entry +Type: Percentile +Color: 255,235,132 +Value: 50 +Color Scale Entry +Type: Max +Color: 99,190,123 +1,1,0,248,105,107 +1,2,0,249,133,112 +1,3,0,251,162,118 +1,4,0,252,191,123 +1,5,0,254,220,129 +2,1,0,238,230,131 +2,2,0,203,220,129 +2,3,0,169,210,127 +2,4,0,134,200,125 +2,5,0,99,190,123 diff --git a/sc/qa/unit/data/reference/colorScale_2.txt b/sc/qa/unit/data/reference/colorScale_2.txt new file mode 100644 index 000..37269ba --- /dev/null +++ b/sc/qa/unit/data/reference/colorScale_2.txt @@ -0,0 +1,17 @@ +Color Scale with 2 entries +Color Scale Entry +Type: Min +Color: 252,252,255 +Color Scale Entry +Type: Max +Color: 99,190,123 +4,1,0,252,252,255 +4,2,0,235,246,241 +4,3,0,218,239,226 +4,4,0,201,232,211 +4,5,0,184,225,197 +5,1,0,167,218,182 +5,2,0,150,211,167 +5,3,0,133,204,153 +5,4,0,116,197,138 +5,5,0,99,190,123 diff --git a/sc/qa/unit/data/reference/colorScale_3.txt b/sc/qa/unit/data/reference/colorScale_3.txt new file mode 100644 index 000..2c0b2f6 --- /dev/null +++ b/sc/qa/unit/data/reference/colorScale_3.txt @@ -0,0 +1,23 @@ +Color Scale with 3 entries +Color Scale Entry +Type: Value +Color: 248,105,107 +Value: -1 +Color Scale Entry +Type: Percentile +Color: 255,235,132 +Value: 50 +Color Scale Entry +Type: Value +Color: 99,190,123 +Value: 8 +7,1,0,250,145,114 +7,2,0,251,165,118 +7,3,0,252,185,122 +7,4,0,253,205,126 +7,5,0,254,225,130 +8,1,0,224,226,131 +8,2,0,162,208,127 +8,3,0,99,190,123 +8,4,0,99,190,123 +8,5,0,99,190,123 diff --git a/sc/qa/unit/data/reference/colorScale_4.txt b/sc/qa/unit/data/reference/colorScale_4.txt new file mode 100644 index 000..ab3412d --- /dev/null +++ b/sc/qa/unit/data/reference/colorScale_4.txt @@ -0,0 +1,19 @@ +Color Scale with 2 entries +Color Scale Entry +Type: Percent +Color: 255,113,40 +Value: 10 +Color Scale Entry +Type: Percentile +Color: 255,239,156 +Value: 90 +10,1,0,255,113,40 +10,2,0,255,114,41 +10,3,0,255,132,57 +10,4,0,255,149,73 +10,5,0,255,167,89 +11,1,0,255,184,106 +11,2,0,255,202,122 +11,3,0,255,219,138 +11,4,0,255,237,154 +11,5,0,255,239,156 ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] .: sc/qa
sc/qa/unit/subsequent_filters-test.cxx | 10 +- 1 file changed, 5 insertions(+), 5 deletions(-) New commits: commit 5649b6a0643d4d331bb1c4d72b707d8543a480e5 Author: Markus Mohrhard markus.mohrh...@googlemail.com Date: Mon Sep 24 04:48:27 2012 +0200 remove unused parameter Change-Id: I869d20ae472d6147426391db3912625f7176b2b4 diff --git a/sc/qa/unit/subsequent_filters-test.cxx b/sc/qa/unit/subsequent_filters-test.cxx index 2b6193f..e48b302 100644 --- a/sc/qa/unit/subsequent_filters-test.cxx +++ b/sc/qa/unit/subsequent_filters-test.cxx @@ -1489,7 +1489,7 @@ void ScFiltersTest::testPivotTableBasicODS() namespace { -void testColorScaleFormat_Impl(ScDocument* pDoc, const rtl::OUString rFilePath, const ScConditionalFormat* pFormat) +void testColorScaleFormat_Impl(const rtl::OUString rFilePath, const ScConditionalFormat* pFormat) { rtl::OUStringBuffer aBuf; CPPUNIT_ASSERT(pFormat); @@ -1507,28 +1507,28 @@ void testColorScale_Impl(ScDocument* pDoc, const rtl::OUString aBaseString) { const ScConditionalFormat* pFormat = pDoc-GetCondFormat(1,1,0); rtl::OUString aFilePath = aBaseString + rtl::OUString(colorScale_1.txt); -testColorScaleFormat_Impl(pDoc, aFilePath, pFormat); +testColorScaleFormat_Impl(aFilePath, pFormat); } // second cond format { const ScConditionalFormat* pFormat = pDoc-GetCondFormat(4,1,0); rtl::OUString aFilePath = aBaseString + rtl::OUString(colorScale_2.txt); -testColorScaleFormat_Impl(pDoc, aFilePath, pFormat); +testColorScaleFormat_Impl(aFilePath, pFormat); } // third cond format { const ScConditionalFormat* pFormat = pDoc-GetCondFormat(7,1,0); rtl::OUString aFilePath = aBaseString + rtl::OUString(colorScale_3.txt); -testColorScaleFormat_Impl(pDoc, aFilePath, pFormat); +testColorScaleFormat_Impl(aFilePath, pFormat); } // forth cond format { const ScConditionalFormat* pFormat = pDoc-GetCondFormat(10,1,0); rtl::OUString aFilePath = aBaseString + rtl::OUString(colorScale_4.txt); -testColorScaleFormat_Impl(pDoc, aFilePath, pFormat); +testColorScaleFormat_Impl(aFilePath, pFormat); } } ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] .: sc/qa
sc/qa/unit/data/123/universal-content.123 |binary sc/qa/unit/filters-test.cxx | 21 +++-- 2 files changed, 19 insertions(+), 2 deletions(-) New commits: commit 73bda3572bea446736662bca1ffd654f0d84a3ae Author: Markus Mohrhard markus.mohrh...@googlemail.com Date: Tue Sep 18 18:38:23 2012 +0200 add lotus .123 import test Change-Id: Iadf71abb02f6178fbe64db6ad9377b131e00fae8 diff --git a/sc/qa/unit/data/123/universal-content.123 b/sc/qa/unit/data/123/universal-content.123 new file mode 100644 index 000..ef74617 Binary files /dev/null and b/sc/qa/unit/data/123/universal-content.123 differ diff --git a/sc/qa/unit/filters-test.cxx b/sc/qa/unit/filters-test.cxx index 68c0317..15d5f7b 100644 --- a/sc/qa/unit/filters-test.cxx +++ b/sc/qa/unit/filters-test.cxx @@ -55,10 +55,12 @@ #define ODS_FORMAT_TYPE 50331943 #define XLS_FORMAT_TYPE 318767171 #define XLSX_FORMAT_TYPE 268959811 +#define LOTUS123_FORMAT_TYPE 268435649 #define ODS 0 #define XLS 1 #define XLSX2 +#define LOTUS123 3 using namespace ::com::sun::star; using namespace ::com::sun::star::uno; @@ -72,7 +74,8 @@ struct FileFormat { FileFormat aFileFormats[] = { { ods , calc8, , ODS_FORMAT_TYPE }, { xls , MS Excel 97, calc_MS_EXCEL_97, XLS_FORMAT_TYPE }, -{ xlsx, Calc MS Excel 2007 XML , MS Excel 2007 XML, XLSX_FORMAT_TYPE } +{ xlsx, Calc MS Excel 2007 XML , MS Excel 2007 XML, XLSX_FORMAT_TYPE }, +{ 123 , Lotus, calc_Lotus, LOTUS123_FORMAT_TYPE } }; } @@ -106,6 +109,7 @@ public: void testContentODS(); void testContentXLS(); void testContentXLSX(); +void testContentLotus123(); #if TEST_BUG_FILES //goes recursively through all files in this dir and tries to open them @@ -122,6 +126,7 @@ public: CPPUNIT_TEST(testContentODS); CPPUNIT_TEST(testContentXLS); CPPUNIT_TEST(testContentXLSX); +CPPUNIT_TEST(testContentLotus123); #if TEST_BUG_FILES CPPUNIT_TEST(testBugFiles); @@ -319,7 +324,7 @@ void ScFiltersTest::testRangeNameODS() namespace { -void testContentImpl(ScDocument* pDoc) //same code for ods, xls, xlsx +void testContentImpl(ScDocument* pDoc ) //same code for ods, xls, xlsx { double fValue; //check value import @@ -390,6 +395,18 @@ void ScFiltersTest::testContentXLSX() xDocSh-DoClose(); } +void ScFiltersTest::testContentLotus123() +{ +const rtl::OUString aFileNameBase(RTL_CONSTASCII_USTRINGPARAM(universal-content.)); +ScDocShellRef xDocSh = loadDoc(aFileNameBase, 3); +xDocSh-DoHardRecalc(true); + +ScDocument* pDoc = xDocSh-GetDocument(); +CPPUNIT_ASSERT(pDoc); +//testContentImpl(pDoc); +xDocSh-DoClose(); +} + ScFiltersTest::ScFiltersTest() : m_aBaseString(RTL_CONSTASCII_USTRINGPARAM(/sc/qa/unit/data)) { ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] .: sc/qa
sc/qa/unit/subsequent_filters-test.cxx |6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) New commits: commit 46539a912646c1df5076420e5b03a857870f3610 Author: Markus Mohrhard markus.mohrh...@googlemail.com Date: Tue Sep 18 20:56:31 2012 +0200 forgot to change the border xls test Change-Id: I59f00f19e4e351e6a9a622862ba775a15d1c93dd diff --git a/sc/qa/unit/subsequent_filters-test.cxx b/sc/qa/unit/subsequent_filters-test.cxx index a6387e6..293b260 100644 --- a/sc/qa/unit/subsequent_filters-test.cxx +++ b/sc/qa/unit/subsequent_filters-test.cxx @@ -765,19 +765,19 @@ void ScFiltersTest::testBorderXLS() CPPUNIT_ASSERT(pRight); CPPUNIT_ASSERT_EQUAL(pRight-GetBorderLineStyle(), table::BorderLineStyle::SOLID); -CPPUNIT_ASSERT_EQUAL(pRight-GetWidth(),6L); +CPPUNIT_ASSERT_EQUAL(pRight-GetWidth(),4L); pDoc-GetBorderLines( 3, 5, 0, pLeft, pTop, pRight, pBottom ); CPPUNIT_ASSERT(pRight); CPPUNIT_ASSERT_EQUAL(pRight-GetBorderLineStyle(), table::BorderLineStyle::SOLID); -CPPUNIT_ASSERT_EQUAL(pRight-GetWidth(),18L); +CPPUNIT_ASSERT_EQUAL(pRight-GetWidth(),12L); pDoc-GetBorderLines( 5, 7, 0, pLeft, pTop, pRight, pBottom ); CPPUNIT_ASSERT(pRight); CPPUNIT_ASSERT_EQUAL(pRight-GetBorderLineStyle(), table::BorderLineStyle::SOLID); -CPPUNIT_ASSERT_EQUAL(pRight-GetWidth(),24L); +CPPUNIT_ASSERT_EQUAL(pRight-GetWidth(),16L); } struct Border { ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] .: sc/qa
sc/qa/unoapi/sc.sce |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) New commits: commit cc75f10853dcfbc6b332af0942d528d0430abba3 Author: Markus Mohrhard markus.mohrh...@googlemail.com Date: Tue Sep 18 21:14:17 2012 +0200 disable failing unoapi test, fdo#55065 Change-Id: I41b4708ae336886cd25f11c1d9f8b7a04b4f48f9 diff --git a/sc/qa/unoapi/sc.sce b/sc/qa/unoapi/sc.sce index de846db..41a23c5 100644 --- a/sc/qa/unoapi/sc.sce +++ b/sc/qa/unoapi/sc.sce @@ -39,7 +39,7 @@ -o sc.ScAutoFormatFieldObj -o sc.ScAutoFormatObj -o sc.ScAutoFormatsObj --o sc.ScCellCursorObj +# fdo#55065 -o sc.ScCellCursorObj # ported to cppunit -o sc.ScCellFieldObj -o sc.ScCellFieldsObj -o sc.ScCellFormatsEnumeration ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] .: sc/qa
sc/qa/unit/ucalc.cxx | 27 --- 1 file changed, 24 insertions(+), 3 deletions(-) New commits: commit c673a1f1212060dd5c5b9017354ad54321bb9549 Author: Kohei Yoshida kohei.yosh...@gmail.com Date: Tue Sep 18 00:54:33 2012 -0400 Test for setting current page back to '- all -' in pivot table. Change-Id: I2fc0ac9609855273e47c492c72066dede9ff6850 diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx index 5a2043a..1bcd5a8 100644 --- a/sc/qa/unit/ucalc.cxx +++ b/sc/qa/unit/ucalc.cxx @@ -1938,11 +1938,11 @@ void Test::testPivotTableFilters() // Set current page of 'Group2' to 'A'. ScDPSaveData aSaveData(*pDPObj-GetSaveData()); -ScDPSaveDimension* pDim = aSaveData.GetDimensionByName( +ScDPSaveDimension* pPageDim = aSaveData.GetDimensionByName( OUString(Group2)); -CPPUNIT_ASSERT_MESSAGE(Dimension not found, pDim); +CPPUNIT_ASSERT_MESSAGE(Dimension not found, pPageDim); OUString aPage(A); -pDim-SetCurrentPage(aPage); +pPageDim-SetCurrentPage(aPage); pDPObj-SetSaveData(aSaveData); aOutRange = refresh(pDPObj); { @@ -1992,6 +1992,27 @@ void Test::testPivotTableFilters() fTest = m_pDoc-GetValue(aFormulaAddr); CPPUNIT_ASSERT_MESSAGE(Incorrect formula value that references a cell in the pivot table output., fTest == 20.0); +// Set the current page of 'Group2' back to '- all -'. The query filter +// should still be in effect. +pPageDim-SetCurrentPage(NULL); // Remove the page. +pDPObj-SetSaveData(aSaveData); +aOutRange = refresh(pDPObj); +{ +// Expected output table content. 0 = empty cell +const char* aOutputCheck[][2] = { +{ Filter, 0 }, +{ Group2, - all - }, +{ 0, 0 }, +{ Data, 0 }, +{ Sum - Val1, 4 }, +{ Sum - Val2, 40 } +}; + +bSuccess = checkDPTableOutput2(m_pDoc, aOutRange, aOutputCheck, DataPilot table output (filtered by page)); +CPPUNIT_ASSERT_MESSAGE(Table output check failed, bSuccess); +} + + pDPs-FreeTable(pDPObj); CPPUNIT_ASSERT_MESSAGE(There shouldn't be any data pilot table stored with the document., pDPs-GetCount() == 0); ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] .: sc/qa
sc/qa/unit/rangelst_test.cxx | 39 +++ 1 file changed, 39 insertions(+) New commits: commit c4a6a8d239d2e3da2e4a772efe095c292ca69827 Author: Markus Mohrhard markus.mohrh...@googlemail.com Date: Mon Sep 17 02:43:18 2012 +0200 add more test for ScRangeList::DeleteArea Change-Id: I2484603b74cbdb1f92c08eac6c02d9a091e06eb9 diff --git a/sc/qa/unit/rangelst_test.cxx b/sc/qa/unit/rangelst_test.cxx index a65a0eb..2901965 100644 --- a/sc/qa/unit/rangelst_test.cxx +++ b/sc/qa/unit/rangelst_test.cxx @@ -21,9 +21,13 @@ public: virtual void tearDown(); void testDeleteArea_4Ranges(); +void testDeleteArea_2Ranges(); +void testDeleteArea_0Ranges(); CPPUNIT_TEST_SUITE(Test); CPPUNIT_TEST(testDeleteArea_4Ranges); +CPPUNIT_TEST(testDeleteArea_2Ranges); +CPPUNIT_TEST(testDeleteArea_0Ranges); CPPUNIT_TEST_SUITE_END(); @@ -70,6 +74,41 @@ void Test::testDeleteArea_4Ranges() } } +void Test::testDeleteArea_2Ranges() +{ +ScRangeList aList(ScRange(0,0,0,5,5,5)); +ScRangeList aList2(aList); + +aList.DeleteArea(4,4,0,6,7,0); +aList2.DeleteArea(4,4,0,6,7,0); +CPPUNIT_ASSERT_EQUAL(aList.size(), static_castsize_t(2)); +CPPUNIT_ASSERT_EQUAL(aList2.size(), static_castsize_t(2)); + +for(SCCOL nCol = 0; nCol = 5; ++nCol) +{ +for(SCROW nRow = 0; nRow = 5; ++nRow) +{ +if(nCol=4 nRow = 4) +CPPUNIT_ASSERT(!aList.Intersects(ScRange(nCol, nRow, 0))); +else +CPPUNIT_ASSERT(aList.Intersects(ScRange(nCol, nRow, 0))); +} +} +} + +void Test::testDeleteArea_0Ranges() +{ +ScRangeList aList(ScRange(1,1,0,3,3,0)); +aList.DeleteArea(1,1,0,3,3,0); + +CPPUNIT_ASSERT(aList.empty()); + +ScRangeList aList2(ScRange(1,1,0,3,3,0)); +aList2.DeleteArea(0,0,0,4,4,0); + +CPPUNIT_ASSERT(aList.empty()); +} + CPPUNIT_TEST_SUITE_REGISTRATION(Test); CPPUNIT_PLUGIN_IMPLEMENT(); ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] .: sc/qa
sc/qa/unit/ucalc.cxx | 18 ++ 1 file changed, 18 insertions(+) New commits: commit 3ed834ae87eca0f6c48699112a95edb74abb Author: Kohei Yoshida kohei.yosh...@gmail.com Date: Fri Sep 14 12:18:02 2012 -0400 Unit test for ScRangeList. For now it's very basic. May expand later. Change-Id: Ib7454253df250ddc991aed0dd5cd5b0f90476dd8 diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx index 0dd8e4e..5a2043a 100644 --- a/sc/qa/unit/ucalc.cxx +++ b/sc/qa/unit/ucalc.cxx @@ -108,6 +108,7 @@ public: virtual void tearDown(); void testCollator(); +void testRangeList(); void testInput(); void testCellFunctions(); @@ -226,6 +227,7 @@ public: CPPUNIT_TEST_SUITE(Test); CPPUNIT_TEST(testCollator); +CPPUNIT_TEST(testRangeList); CPPUNIT_TEST(testInput); CPPUNIT_TEST(testCellFunctions); CPPUNIT_TEST(testSheetsFunc); @@ -357,6 +359,22 @@ void Test::testCollator() CPPUNIT_ASSERT_MESSAGE(these strings are supposed to be different!, nRes != 0); } +void Test::testRangeList() +{ +m_pDoc-InsertTab(0, foo); + +ScRangeList aRL; +aRL.Append(ScRange(1,1,0,3,10,0)); +CPPUNIT_ASSERT_MESSAGE(List should have one range., aRL.size() == 1); +const ScRange* p = aRL[0]; +CPPUNIT_ASSERT_MESSAGE(Failed to get the range object., p); +CPPUNIT_ASSERT_MESSAGE(Wrong range., p-aStart == ScAddress(1,1,0) p-aEnd == ScAddress(3,10,0)); + +// TODO: Add more tests here. + +m_pDoc-DeleteTab(0); +} + void Test::testInput() { rtl::OUString aTabName(foo); ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] .: sc/qa
sc/qa/unit/data/ods/pivot-table-basic.ods |binary sc/qa/unit/subsequent_filters-test.cxx| 84 ++ 2 files changed, 84 insertions(+) New commits: commit 95379eb197b98c2ce6e2a29e970e60bf5c02385b Author: Kohei Yoshida kohei.yosh...@gmail.com Date: Mon Aug 27 13:05:35 2012 -0400 Add unit test for pivot table import from ods. Change-Id: I7e7bf5746636e0f13aaaec91d526ac59f6054796 diff --git a/sc/qa/unit/data/ods/pivot-table-basic.ods b/sc/qa/unit/data/ods/pivot-table-basic.ods new file mode 100644 index 000..9bbb5fe Binary files /dev/null and b/sc/qa/unit/data/ods/pivot-table-basic.ods differ diff --git a/sc/qa/unit/subsequent_filters-test.cxx b/sc/qa/unit/subsequent_filters-test.cxx index 126f7a5..a6387e6 100644 --- a/sc/qa/unit/subsequent_filters-test.cxx +++ b/sc/qa/unit/subsequent_filters-test.cxx @@ -48,10 +48,14 @@ #include cell.hxx #include drwlayer.hxx #include userdat.hxx +#include dpobject.hxx +#include dpsave.hxx #include com/sun/star/drawing/XDrawPageSupplier.hpp #include com/sun/star/drawing/XControlShape.hpp #include com/sun/star/sheet/XSpreadsheetDocument.hpp +#include com/sun/star/sheet/DataPilotFieldOrientation.hpp +#include com/sun/star/sheet/GeneralFunction.hpp #include com/sun/star/container/XIndexAccess.hpp #include com/sun/star/frame/XModel.hpp @@ -157,6 +161,8 @@ public: void testCellAnchoredShapesODS(); +void testPivotTableBasicODS(); + CPPUNIT_TEST_SUITE(ScFiltersTest); CPPUNIT_TEST(testRangeNameXLS); CPPUNIT_TEST(testRangeNameXLSX); @@ -196,6 +202,8 @@ public: CPPUNIT_TEST(testCellAnchoredShapesODS); +CPPUNIT_TEST(testPivotTableBasicODS); + //disable testPassword on MacOSX due to problems with libsqlite3 //also crashes on DragonFly due to problems with nss/nspr headers #if !defined(MACOSX) !defined(DRAGONFLY) !defined(WNT) @@ -1389,6 +1397,82 @@ void ScFiltersTest::testCellAnchoredShapesODS() xDocSh-DoClose(); } +namespace { + +class FindDimByName : std::unary_functionconst ScDPSaveDimension*, bool +{ +OUString maName; +public: +FindDimByName(const OUString rName) : maName(rName) {} + +bool operator() (const ScDPSaveDimension* p) const +{ +return p p-GetName() == maName; +} +}; + +bool hasDimension(const std::vectorconst ScDPSaveDimension* rDims, const OUString aName) +{ +return std::find_if(rDims.begin(), rDims.end(), FindDimByName(aName)) != rDims.end(); +} + +} + +void ScFiltersTest::testPivotTableBasicODS() +{ +OUString aFileNameBase(pivot-table-basic.); +OUString aFileExt = OUString::createFromAscii(aFileFormats[ODS].pName); +OUString aFilterName = OUString::createFromAscii(aFileFormats[ODS].pFilterName); +OUString aFilterType = OUString::createFromAscii(aFileFormats[ODS].pTypeName); + +rtl::OUString aFileName; +createFileURL(aFileNameBase, aFileExt, aFileName); +ScDocShellRef xDocSh = load (aFilterName, aFileName, rtl::OUString(), aFilterType, aFileFormats[ODS].nFormatType); +CPPUNIT_ASSERT_MESSAGE(Failed to load pivot-table-basic.ods, xDocSh.Is()); + +ScDocument* pDoc = xDocSh-GetDocument(); +CPPUNIT_ASSERT_MESSAGE(There should be exactly two sheets., pDoc-GetTableCount() == 2); + +ScDPCollection* pDPs = pDoc-GetDPCollection(); +CPPUNIT_ASSERT_MESSAGE(Failed to get a live ScDPCollection instance., pDPs); +CPPUNIT_ASSERT_MESSAGE(There should be exactly one pivot table instance., pDPs-GetCount() == 1); + +const ScDPObject* pDPObj = (*pDPs)[0]; +CPPUNIT_ASSERT_MESSAGE(Failed to get an pivot table object., pDPObj); +const ScDPSaveData* pSaveData = pDPObj-GetSaveData(); +CPPUNIT_ASSERT_MESSAGE(Failed to get ScDPSaveData instance., pSaveData); +std::vectorconst ScDPSaveDimension* aDims; + +// Row fields + pSaveData-GetAllDimensionsByOrientation(sheet::DataPilotFieldOrientation_ROW, aDims); +CPPUNIT_ASSERT_MESSAGE(There should be exactly 3 row fields (2 normal dimensions and 1 layout dimension)., aDims.size() == 3); +CPPUNIT_ASSERT_MESSAGE(Dimension expected, but not found., hasDimension(aDims, Row1)); +CPPUNIT_ASSERT_MESSAGE(Dimension expected, but not found., hasDimension(aDims, Row2)); +const ScDPSaveDimension* pDataLayout = pSaveData-GetExistingDataLayoutDimension(); +CPPUNIT_ASSERT_MESSAGE(There should be a data layout field as a row field., + pDataLayout pDataLayout-GetOrientation() == sheet::DataPilotFieldOrientation_ROW); + +// Column fields + pSaveData-GetAllDimensionsByOrientation(sheet::DataPilotFieldOrientation_COLUMN, aDims); +CPPUNIT_ASSERT_MESSAGE(There should be exactly 2 column fields., aDims.size() == 2); +CPPUNIT_ASSERT_MESSAGE(Dimension expected, but not found., hasDimension(aDims, Col1)); +CPPUNIT_ASSERT_MESSAGE(Dimension expected, but not found., hasDimension(aDims, Col2)); + +// Page fields +
[Libreoffice-commits] .: sc/qa
sc/qa/unit/ucalc.cxx | 63 +++ 1 file changed, 63 insertions(+) New commits: commit 198ccdf00ee2d9defa1114c4aba6ddcf83418237 Author: Kohei Yoshida kohei.yosh...@gmail.com Date: Wed Aug 22 23:49:52 2012 -0400 New unit test for pivot table's case insensitive string comparison. Change-Id: I31ddd3eedc5a93103ae7efd7ce8698e4dc247937 diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx index ea545f6..63b3b00 100644 --- a/sc/qa/unit/ucalc.cxx +++ b/sc/qa/unit/ucalc.cxx @@ -170,6 +170,12 @@ public: void testPivotTableEmptyRows(); void testPivotTableTextNumber(); +/** + * Test for checking that pivot table treats strings in a case insensitive + * manner. + */ +void testPivotTableCaseInsensitiveStrings(); + void testSheetCopy(); void testSheetMove(); void testExternalRef(); @@ -241,6 +247,7 @@ public: CPPUNIT_TEST(testPivotTableDateGrouping); CPPUNIT_TEST(testPivotTableEmptyRows); CPPUNIT_TEST(testPivotTableTextNumber); +CPPUNIT_TEST(testPivotTableCaseInsensitiveStrings); CPPUNIT_TEST(testSheetCopy); CPPUNIT_TEST(testSheetMove); CPPUNIT_TEST(testExternalRef); @@ -2918,6 +2925,62 @@ void Test::testPivotTableTextNumber() m_pDoc-DeleteTab(0); } +void Test::testPivotTableCaseInsensitiveStrings() +{ +m_pDoc-InsertTab(0, OUString(Data)); +m_pDoc-InsertTab(1, OUString(Table)); + +// Raw data +const char* aData[][2] = { +{ Name, Value }, +{ A, 1 }, +{ a, 2 }, +}; + +// Dimension definition +DPFieldDef aFields[] = { +{ Name, 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()); + +ScRange aOutRange = refresh(pDPObj); + +{ +// Expected output table content. 0 = empty cell +const char* aOutputCheck[][2] = { +{ Name, 0 }, +{ A, 3 }, +{ Total Result, 3 }, +}; + +bSuccess = checkDPTableOutput2(m_pDoc, aOutRange, aOutputCheck, Case insensitive strings); +CPPUNIT_ASSERT_MESSAGE(Table output check failed, bSuccess); +} + +pDPs-FreeTable(pDPObj); +CPPUNIT_ASSERT_EQUAL_MESSAGE(There should be no more tables., pDPs-GetCount(), static_castsize_t(0)); +CPPUNIT_ASSERT_EQUAL_MESSAGE(There shouldn't be any more cache stored., + pDPs-GetSheetCaches().size(), static_castsize_t(0)); + +m_pDoc-DeleteTab(1); +m_pDoc-DeleteTab(0); +} + void Test::testSheetCopy() { OUString aTabName(TestTab); ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] .: sc/qa
sc/qa/unit/subsequent_filters-test.cxx |8 1 file changed, 4 insertions(+), 4 deletions(-) New commits: commit 869379e4c82d18edb42c62910e5855890dab0484 Author: Michael Stahl mst...@redhat.com Date: Wed Aug 15 14:24:14 2012 +0200 ScFiltersTest: fix overloading problem Change-Id: I691e683e2ec4d794de2f0860162f29a970c99397 diff --git a/sc/qa/unit/subsequent_filters-test.cxx b/sc/qa/unit/subsequent_filters-test.cxx index 990ddb1..126f7a5 100644 --- a/sc/qa/unit/subsequent_filters-test.cxx +++ b/sc/qa/unit/subsequent_filters-test.cxx @@ -775,10 +775,10 @@ struct Border { sal_Int16 column; sal_Int32 row; -sal_Int32 leftWidth; -sal_Int32 topWidth; -sal_Int32 rightWidth; -sal_Int32 bottomWidth; +long leftWidth; +long topWidth; +long rightWidth; +long bottomWidth; sal_uInt16 lOutWidth; sal_uInt16 lInWidth; sal_uInt16 lDistance; ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] .: sc/qa
sc/qa/unit/ucalc.cxx |2 -- 1 file changed, 2 deletions(-) New commits: commit 7ed9e024726747f9d0a70365c83ab619fac889e6 Author: Markus Mohrhard markus.mohrh...@googlemail.com Date: Mon Aug 13 12:36:37 2012 +0200 these test should not have been disabled diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx index 49beff8..1d55a84 100644 --- a/sc/qa/unit/ucalc.cxx +++ b/sc/qa/unit/ucalc.cxx @@ -219,7 +219,6 @@ public: void testFindAreaPosColRight(); CPPUNIT_TEST_SUITE(Test); -#if 0 CPPUNIT_TEST(testCollator); CPPUNIT_TEST(testInput); CPPUNIT_TEST(testCellFunctions); @@ -261,7 +260,6 @@ public: CPPUNIT_TEST(testAutoFill); CPPUNIT_TEST(testCopyPasteFormulas); CPPUNIT_TEST(testCopyPasteFormulasExternalDoc); -#endif CPPUNIT_TEST(testFindAreaPosRowDown); CPPUNIT_TEST(testFindAreaPosColRight); CPPUNIT_TEST_SUITE_END(); ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] .: sc/qa
sc/qa/unit/data/csv/numberformat.csv |3 +++ sc/qa/unit/subsequent_filters-test.cxx | 30 ++ 2 files changed, 33 insertions(+) New commits: commit b8430f71d37ea5181fc812fc07a20555b07a0b3c Author: Kohei Yoshida kohei.yosh...@gmail.com Date: Mon Aug 13 14:45:59 2012 -0400 Add test for csv filter as well. The content is intentionally identical to the html counterpart. Change-Id: Ie9a91ceafdb56a0c915bc0175d49bb494c38e9af diff --git a/sc/qa/unit/data/csv/numberformat.csv b/sc/qa/unit/data/csv/numberformat.csv new file mode 100644 index 000..2111b94 --- /dev/null +++ b/sc/qa/unit/data/csv/numberformat.csv @@ -0,0 +1,3 @@ +Product,Price,Note +Google Nexus 7 (8GB),199.98,This should be imported as a number, not text. + diff --git a/sc/qa/unit/subsequent_filters-test.cxx b/sc/qa/unit/subsequent_filters-test.cxx index 4f7a23b..32cfb76 100644 --- a/sc/qa/unit/subsequent_filters-test.cxx +++ b/sc/qa/unit/subsequent_filters-test.cxx @@ -149,6 +149,7 @@ public: void testControlImport(); void testNumberFormatHTML(); +void testNumberFormatCSV(); CPPUNIT_TEST_SUITE(ScFiltersTest); CPPUNIT_TEST(testRangeNameXLS); @@ -184,6 +185,7 @@ public: CPPUNIT_TEST(testCondFormat); CPPUNIT_TEST(testNumberFormatHTML); +CPPUNIT_TEST(testNumberFormatCSV); //disable testPassword on MacOSX due to problems with libsqlite3 //also crashes on DragonFly due to problems with nss/nspr headers @@ -1209,6 +1211,34 @@ void ScFiltersTest::testNumberFormatHTML() // B2 should be imported as a value cell. bool bHasValue = pDoc-HasValueData(1, 1, 0); CPPUNIT_ASSERT_MESSAGE(Fail to import number as a value cell., bHasValue); +CPPUNIT_ASSERT_MESSAGE(Incorrect value., pDoc-GetValue(1, 1, 0) == 199.98); + +xDocSh-DoClose(); +} + +void ScFiltersTest::testNumberFormatCSV() +{ +OUString aFileNameBase(numberformat.); +OUString aFileExt = OUString::createFromAscii(aFileFormats[CSV].pName); +OUString aFilterName = OUString::createFromAscii(aFileFormats[CSV].pFilterName); +OUString aFilterType = OUString::createFromAscii(aFileFormats[CSV].pTypeName); + +rtl::OUString aFileName; +createFileURL(aFileNameBase, aFileExt, aFileName); +ScDocShellRef xDocSh = load (aFilterName, aFileName, rtl::OUString(), aFilterType, aFileFormats[CSV].nFormatType); +CPPUNIT_ASSERT_MESSAGE(Failed to load numberformat.html, xDocSh.Is()); + +ScDocument* pDoc = xDocSh-GetDocument(); + +// Check the header just in case. +CPPUNIT_ASSERT_MESSAGE(Cell value is not as expected, pDoc-GetString(0, 0, 0) == Product); +CPPUNIT_ASSERT_MESSAGE(Cell value is not as expected, pDoc-GetString(1, 0, 0) == Price); +CPPUNIT_ASSERT_MESSAGE(Cell value is not as expected, pDoc-GetString(2, 0, 0) == Note); + +// B2 should be imported as a value cell. +bool bHasValue = pDoc-HasValueData(1, 1, 0); +CPPUNIT_ASSERT_MESSAGE(Fail to import number as a value cell., bHasValue); +CPPUNIT_ASSERT_MESSAGE(Incorrect value., pDoc-GetValue(1, 1, 0) == 199.98); xDocSh-DoClose(); } ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] .: sc/qa
sc/qa/unit/ucalc.cxx | 81 +++ 1 file changed, 81 insertions(+) New commits: commit bf222b4985ca535903835980357687ae6e137ba1 Author: Kohei Yoshida kohei.yosh...@gmail.com Date: Mon Aug 13 15:07:56 2012 -0400 Unit test for pivot table's text number field member output. Change-Id: Id7aa174fa26adb601ce652ba57c032e6b1c79dab diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx index 8a401e2..ea545f6 100644 --- a/sc/qa/unit/ucalc.cxx +++ b/sc/qa/unit/ucalc.cxx @@ -168,6 +168,7 @@ public: void testPivotTableNumberGrouping(); void testPivotTableDateGrouping(); void testPivotTableEmptyRows(); +void testPivotTableTextNumber(); void testSheetCopy(); void testSheetMove(); @@ -239,6 +240,7 @@ public: CPPUNIT_TEST(testPivotTableNumberGrouping); CPPUNIT_TEST(testPivotTableDateGrouping); CPPUNIT_TEST(testPivotTableEmptyRows); +CPPUNIT_TEST(testPivotTableTextNumber); CPPUNIT_TEST(testSheetCopy); CPPUNIT_TEST(testSheetMove); CPPUNIT_TEST(testExternalRef); @@ -2837,6 +2839,85 @@ void Test::testPivotTableEmptyRows() m_pDoc-DeleteTab(0); } +void Test::testPivotTableTextNumber() +{ +m_pDoc-InsertTab(0, OUString(Data)); +m_pDoc-InsertTab(1, OUString(Table)); + +// Raw data +const char* aData[][2] = { +{ Name, Value }, +{ 0001, 1 }, +{ 0002, 2 }, +{ 0003, 3 }, +{ 0004, 4 }, +}; + +// Dimension definition +DPFieldDef aFields[] = { +{ Name, sheet::DataPilotFieldOrientation_ROW, 0 }, +{ Value, sheet::DataPilotFieldOrientation_DATA, sheet::GeneralFunction_SUM }, +}; + +// Insert raw data such that the first column values are entered as text. +size_t nRowCount = SAL_N_ELEMENTS(aData); +for (size_t nRow = 0; nRow nRowCount; ++nRow) +{ +ScSetStringParam aParam; +aParam.mbDetectNumberFormat = false; +aParam.meSetTextNumFormat = ScSetStringParam::Always; +m_pDoc-SetString(0, nRow, 0, OUString::createFromAscii(aData[nRow][0]), aParam); +aParam.meSetTextNumFormat = ScSetStringParam::Never; +m_pDoc-SetString(1, nRow, 0, OUString::createFromAscii(aData[nRow][1]), aParam); + +if (nRow == 0) +// Don't check the header row. +continue; + +// Check the data rows. +CPPUNIT_ASSERT_MESSAGE(This cell is supposed to be text., m_pDoc-HasStringData(0, nRow, 0)); +CPPUNIT_ASSERT_MESSAGE(This cell is supposed to be numeric., m_pDoc-HasValueData(1, nRow, 0)); +} + +ScRange aDataRange(0, 0, 0, 1, 4, 0); + +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()); + +ScRange aOutRange = refresh(pDPObj); + +{ +// Expected output table content. 0 = empty cell +const char* aOutputCheck[][2] = { +{ Name, 0 }, +{ 0001, 1 }, +{ 0002, 2 }, +{ 0003, 3 }, +{ 0004, 4 }, +{ Total Result, 10 }, +}; + +bSuccess = checkDPTableOutput2(m_pDoc, aOutRange, aOutputCheck, Text number field members); +CPPUNIT_ASSERT_MESSAGE(Table output check failed, bSuccess); +} + +pDPs-FreeTable(pDPObj); +CPPUNIT_ASSERT_EQUAL_MESSAGE(There should be no more tables., pDPs-GetCount(), static_castsize_t(0)); +CPPUNIT_ASSERT_EQUAL_MESSAGE(There shouldn't be any more cache stored., + pDPs-GetSheetCaches().size(), static_castsize_t(0)); + +m_pDoc-DeleteTab(1); +m_pDoc-DeleteTab(0); +} + void Test::testSheetCopy() { OUString aTabName(TestTab); ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] .: sc/qa
sc/qa/unit/ucalc.cxx |8 ++-- 1 file changed, 2 insertions(+), 6 deletions(-) New commits: commit 96c5fb1dd28d2dbbe9d7130da518cbd5220bfddc Author: Markus Mohrhard markus.mohrh...@googlemail.com Date: Wed Aug 8 00:50:17 2012 +0200 enable tests for fixed cursor row navigation Change-Id: Ibd61def40372ef3915293414006251c60f5bda49 diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx index 8753a40..fc51b22 100644 --- a/sc/qa/unit/ucalc.cxx +++ b/sc/qa/unit/ucalc.cxx @@ -4629,9 +4629,7 @@ void Test::testFindAreaPosRowDown() pDoc-FindAreaPos(nCol, nRow, 0, 0, 1); -// BUG! This returns right now 4 because FindAreaPos does -// not yet work correctly with hidden rows -//CPPUNIT_ASSERT_EQUAL(static_castSCROW(5), nRow); +CPPUNIT_ASSERT_EQUAL(static_castSCROW(5), nRow); CPPUNIT_ASSERT_EQUAL(static_castSCCOL(0), nCol); pDoc-FindAreaPos(nCol, nRow, 0, 0, 1); @@ -4649,9 +4647,7 @@ void Test::testFindAreaPosRowDown() pDoc-FindAreaPos(nCol, nRow, 0, 0, 1); -// BUG! This returns right now 4 because FindAreaPos does -// not yet work correctly with hidden rows -//CPPUNIT_ASSERT_EQUAL(static_castSCROW(3), nRow); +CPPUNIT_ASSERT_EQUAL(static_castSCROW(3), nRow); CPPUNIT_ASSERT_EQUAL(static_castSCCOL(1), nCol); pDoc-FindAreaPos(nCol, nRow, 0, 0, 1); ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] .: sc/qa
sc/qa/unit/ucalc.cxx |9 + 1 file changed, 9 insertions(+) New commits: commit ebc60c3297ae464898f6135e4cc5a652fb53b935 Author: Kohei Yoshida kohei.yosh...@gmail.com Date: Mon Jul 9 10:12:53 2012 -0400 Unit test for string input with custom string handling policy. Change-Id: I51e8fbe83e94ba66a0e2ef63aacf080ba0e50a9c diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx index 93e5b80..b816f5c 100644 --- a/sc/qa/unit/ucalc.cxx +++ b/sc/qa/unit/ucalc.cxx @@ -362,6 +362,15 @@ void Test::testInput() bTest = test == 'apple'; CPPUNIT_ASSERT_MESSAGE(Text content should have retained the first apostrophe., bTest); +// Customized string handling policy. +ScSetStringParam aParam; +aParam.mbDetectNumberFormat = false; +aParam.mbSetTextCellFormat = true; +aParam.mbHandleApostrophe = false; +m_pDoc-SetString(0, 0, 0, 000123, aParam); +m_pDoc-GetString(0, 0, 0, test); +CPPUNIT_ASSERT_MESSAGE(Text content should have been treated as string, not number., test == 000123); + m_pDoc-DeleteTab(0); } ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] .: sc/qa
sc/qa/extras/sceditfieldobj-cell.cxx | 40 ++- 1 file changed, 39 insertions(+), 1 deletion(-) New commits: commit 54e592926be7410bbd44b1482288305ea568073a Author: Kohei Yoshida kohei.yosh...@gmail.com Date: Mon Jul 9 10:59:18 2012 -0400 UNO API test for ScEditFieldObj wrt its properties. To detect a bug such as fdo#50587. Change-Id: I3822af8d592b8aca31c1d4fecc925d0df20d27da diff --git a/sc/qa/extras/sceditfieldobj-cell.cxx b/sc/qa/extras/sceditfieldobj-cell.cxx index 0f582cf..da5fb4f 100644 --- a/sc/qa/extras/sceditfieldobj-cell.cxx +++ b/sc/qa/extras/sceditfieldobj-cell.cxx @@ -39,7 +39,7 @@ #include com/sun/star/sheet/XSpreadsheetDocument.hpp #include com/sun/star/sheet/XSpreadsheet.hpp -#define NUMBER_OF_TESTS 6 +#define NUMBER_OF_TESTS 7 namespace sc_apitest { @@ -55,6 +55,8 @@ public: virtual uno::Referencetext::XTextRange getTextRange(); virtual bool isAttachSupported() { return true; } +void testEditFieldProperties(); + CPPUNIT_TEST_SUITE(ScEditFieldObj_Cell); // XPropertySet @@ -68,6 +70,10 @@ public: // XTextContent CPPUNIT_TEST(testGetAnchor); CPPUNIT_TEST(testAttach); + +// Tests specific to this service implementation. +CPPUNIT_TEST(testEditFieldProperties); + CPPUNIT_TEST_SUITE_END(); private: @@ -164,6 +170,38 @@ uno::Referencetext::XTextRange ScEditFieldObj_Cell::getTextRange() return xRange; } +void ScEditFieldObj_Cell::testEditFieldProperties() +{ +CPPUNIT_ASSERT_MESSAGE(component doesn't exist., mxComponent.is()); +uno::Referencelang::XMultiServiceFactory xSM(mxComponent, UNO_QUERY_THROW); + +{ +// Test properties of date time field. +uno::Referencetext::XTextField xField( +xSM-createInstance(com.sun.star.text.textfield.DateTime), UNO_QUERY_THROW); +uno::Referencebeans::XPropertySet xPropSet(xField, UNO_QUERY_THROW); + +uno::Referencebeans::XPropertySetInfo xInfo = xPropSet-getPropertySetInfo(); +CPPUNIT_ASSERT_MESSAGE(failed to retrieve property set info., xInfo.is()); + +CPPUNIT_ASSERT_MESSAGE(Calc's date time field should have 'IsFixed' property., + xInfo-hasPropertyByName(IsFixed)); +} + +{ +// Test properties of document title field. +uno::Referencetext::XTextField xField( +xSM-createInstance(com.sun.star.text.textfield.docinfo.Title), UNO_QUERY_THROW); +uno::Referencebeans::XPropertySet xPropSet(xField, UNO_QUERY_THROW); + +uno::Referencebeans::XPropertySetInfo xInfo = xPropSet-getPropertySetInfo(); +CPPUNIT_ASSERT_MESSAGE(failed to retrieve property set info., xInfo.is()); + +CPPUNIT_ASSERT_MESSAGE(Calc's title field shouldn't have 'IsFixed' property., + !xInfo-hasPropertyByName(IsFixed)); +} +} + CPPUNIT_TEST_SUITE_REGISTRATION(ScEditFieldObj_Cell); CPPUNIT_PLUGIN_IMPLEMENT(); ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] .: sc/qa
sc/qa/unit/ucalc.cxx | 89 +++ 1 file changed, 89 insertions(+) New commits: commit 2758492a670618262bd42e3b938f3fdf2e9141a2 Author: Kohei Yoshida kohei.yosh...@gmail.com Date: Fri Jul 6 16:46:09 2012 -0400 New unit test for pivot table's handling of empty rows. Change-Id: I1c922fd3d06aca49b98a933d82da478b22e74d4a diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx index f317f52..46da7a0 100644 --- a/sc/qa/unit/ucalc.cxx +++ b/sc/qa/unit/ucalc.cxx @@ -167,6 +167,7 @@ public: void testPivotTableNormalGrouping(); void testPivotTableNumberGrouping(); void testPivotTableDateGrouping(); +void testPivotTableEmptyRows(); void testSheetCopy(); void testSheetMove(); @@ -234,6 +235,7 @@ public: CPPUNIT_TEST(testPivotTableNormalGrouping); CPPUNIT_TEST(testPivotTableNumberGrouping); CPPUNIT_TEST(testPivotTableDateGrouping); +CPPUNIT_TEST(testPivotTableEmptyRows); CPPUNIT_TEST(testSheetCopy); CPPUNIT_TEST(testSheetMove); CPPUNIT_TEST(testExternalRef); @@ -2688,6 +2690,93 @@ void Test::testPivotTableDateGrouping() m_pDoc-DeleteTab(0); } +void Test::testPivotTableEmptyRows() +{ +m_pDoc-InsertTab(0, OUString(Data)); +m_pDoc-InsertTab(1, OUString(Table)); + +// Raw data +const char* aData[][2] = { +{ Name, Value }, +{ A, 1 }, +{ B, 2 }, +{ C, 3 }, +{ D, 4 }, +}; + +// Dimension definition +DPFieldDef aFields[] = { +{ Name, 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); + +// Extend the range downward to include some trailing empty rows. +aDataRange.aEnd.IncRow(2); + +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()); + +ScRange aOutRange = refresh(pDPObj); + +{ +// Expected output table content. 0 = empty cell +const char* aOutputCheck[][2] = { +{ Name, 0 }, +{ A, 1 }, +{ B, 2 }, +{ C, 3 }, +{ D, 4 }, +{ (empty), 0 }, +{ Total Result, 10 }, +}; + +bSuccess = checkDPTableOutput2(m_pDoc, aOutRange, aOutputCheck, Include empty rows); +CPPUNIT_ASSERT_MESSAGE(Table output check failed, bSuccess); +} + +// This time, ignore empty rows. +ScDPSaveData* pSaveData = pDPObj-GetSaveData(); +CPPUNIT_ASSERT_MESSAGE(Save data doesn't exist., pSaveData); +pSaveData-SetIgnoreEmptyRows(true); +pDPObj-ClearTableData(); +aOutRange = refresh(pDPObj); + +{ +// Expected output table content. 0 = empty cell +const char* aOutputCheck[][2] = { +{ Name, 0 }, +{ A, 1 }, +{ B, 2 }, +{ C, 3 }, +{ D, 4 }, +{ Total Result, 10 }, +}; + +bSuccess = checkDPTableOutput2(m_pDoc, aOutRange, aOutputCheck, Ignore empty rows); +CPPUNIT_ASSERT_MESSAGE(Table output check failed, bSuccess); +} + +pDPs-FreeTable(pDPObj); +CPPUNIT_ASSERT_EQUAL_MESSAGE(There should be no more tables., pDPs-GetCount(), static_castsize_t(0)); +CPPUNIT_ASSERT_EQUAL_MESSAGE(There shouldn't be any more cache stored., + pDPs-GetSheetCaches().size(), static_castsize_t(0)); + +m_pDoc-DeleteTab(1); +m_pDoc-DeleteTab(0); +} + void Test::testSheetCopy() { OUString aTabName(TestTab); ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] .: sc/qa
sc/qa/unit/subsequent_filters-test.cxx |3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) New commits: commit 029c367d06d5af3fe26bebfe02eadac295331fc2 Author: Markus Mohrhard markus.mohrh...@googlemail.com Date: Wed Jun 20 12:16:34 2012 +0200 disable this test for now, fails on windows due to row height problem Change-Id: I318129fd9e8ea0fa6b540bdf6e940d633cff225a diff --git a/sc/qa/unit/subsequent_filters-test.cxx b/sc/qa/unit/subsequent_filters-test.cxx index 739fac8..7b6fd25 100644 --- a/sc/qa/unit/subsequent_filters-test.cxx +++ b/sc/qa/unit/subsequent_filters-test.cxx @@ -135,7 +135,8 @@ public: CPPUNIT_TEST(testDatabaseRangesODS); CPPUNIT_TEST(testDatabaseRangesXLS); CPPUNIT_TEST(testDatabaseRangesXLSX); -CPPUNIT_TEST(testFormatsODS); +// auto row height calculation makes this impossible right now +//CPPUNIT_TEST(testFormatsODS); CPPUNIT_TEST(testFormatsXLS); CPPUNIT_TEST(testFormatsXLSX); CPPUNIT_TEST(testMatrixODS); ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] .: sc/qa
sc/qa/unit/data/ods/database.ods |binary sc/qa/unit/data/xls/database.xls |binary sc/qa/unit/data/xlsx/database.xlsx |binary sc/qa/unit/subsequent_filters-test.cxx | 71 ++--- 4 files changed, 58 insertions(+), 13 deletions(-) New commits: commit 47e4a33a6405eb1b5186027f55bd9cb99b0c1fe7 Author: Daniel Bankston daniel.e.banks...@gmail.com Date: Mon Jun 11 02:42:30 2012 -0500 Extend current database range unit test to also check xls and xlsx Since Excel doesn't support named database ranges, I also added tests for unnamed database ranges for ods, xls, and xlsx. Change-Id: I491324883c95cf2edb13c0561e975a13d13ba7d7 diff --git a/sc/qa/unit/data/ods/database.ods b/sc/qa/unit/data/ods/database.ods index c8039f9..612919f 100644 Binary files a/sc/qa/unit/data/ods/database.ods and b/sc/qa/unit/data/ods/database.ods differ diff --git a/sc/qa/unit/data/xls/database.xls b/sc/qa/unit/data/xls/database.xls new file mode 100644 index 000..04f473c Binary files /dev/null and b/sc/qa/unit/data/xls/database.xls differ diff --git a/sc/qa/unit/data/xlsx/database.xlsx b/sc/qa/unit/data/xlsx/database.xlsx new file mode 100644 index 000..646b79d Binary files /dev/null and b/sc/qa/unit/data/xlsx/database.xlsx differ diff --git a/sc/qa/unit/subsequent_filters-test.cxx b/sc/qa/unit/subsequent_filters-test.cxx index 68b5bf0..d293bd5 100644 --- a/sc/qa/unit/subsequent_filters-test.cxx +++ b/sc/qa/unit/subsequent_filters-test.cxx @@ -101,6 +101,8 @@ public: void testRangeNameXLSX(); void testFunctionsODS(); void testDatabaseRangesODS(); +void testDatabaseRangesXLS(); +void testDatabaseRangesXLSX(); void testFormatsODS(); void testFormatsXLS(); void testFormatsXLSX(); @@ -127,6 +129,8 @@ public: CPPUNIT_TEST(testRangeNameXLSX); CPPUNIT_TEST(testFunctionsODS); CPPUNIT_TEST(testDatabaseRangesODS); +CPPUNIT_TEST(testDatabaseRangesXLS); +CPPUNIT_TEST(testDatabaseRangesXLSX); CPPUNIT_TEST(testFormatsODS); CPPUNIT_TEST(testFormatsXLS); CPPUNIT_TEST(testFormatsXLSX); @@ -318,13 +322,10 @@ void ScFiltersTest::testFunctionsODS() xDocSh-DoClose(); } -void ScFiltersTest::testDatabaseRangesODS() -{ -const rtl::OUString aFileNameBase(RTL_CONSTASCII_USTRINGPARAM(database.)); -ScDocShellRef xDocSh = loadDoc(aFileNameBase, 0); -xDocSh-DoHardRecalc(true); +namespace { -ScDocument* pDoc = xDocSh-GetDocument(); +void testDBRanges_Impl(ScDocument* pDoc, sal_Int32 nFormat) +{ ScDBCollection* pDBCollection = pDoc-GetDBCollection(); CPPUNIT_ASSERT_MESSAGE(no database collection, pDBCollection); @@ -343,15 +344,59 @@ void ScFiltersTest::testDatabaseRangesODS() CPPUNIT_ASSERT_MESSAGE(Sheet1: row 4-5 should be hidden, bHidden nRow1 == 4 nRow2 == 5); bHidden = pDoc-RowHidden(6, 0, nRow1, nRow2); CPPUNIT_ASSERT_MESSAGE(Sheet1: row 6-end should be visible, !bHidden nRow1 == 6 nRow2 == MAXROW); +if(nFormat == ODS) //excel doesn't support named db ranges +{ +double aValue; +pDoc-GetValue(0,10,1, aValue); +rtl::OUString aString; +CPPUNIT_ASSERT_MESSAGE(Sheet2: A11: formula result is incorrect, aValue == 4); +pDoc-GetValue(1, 10, 1, aValue); +CPPUNIT_ASSERT_MESSAGE(Sheet2: B11: formula result is incorrect, aValue == 2); +} double aValue; -pDoc-GetValue(0,10,1, aValue); +pDoc-GetValue(3,10,1, aValue); rtl::OUString aString; -pDoc-GetFormula(0,10,1,aString); -rtl::OString aOString; -aOString = rtl::OUStringToOString(aString, RTL_TEXTENCODING_UTF8); -CPPUNIT_ASSERT_MESSAGE(Sheet2: A11: formula result is incorrect, aValue == 4); -pDoc-GetValue(1, 10, 1, aValue); -CPPUNIT_ASSERT_MESSAGE(Sheet2: B11: formula result is incorrect, aValue == 2); +CPPUNIT_ASSERT_MESSAGE(Sheet2: D11: formula result is incorrect, aValue == 4); +pDoc-GetValue(4, 10, 1, aValue); +CPPUNIT_ASSERT_MESSAGE(Sheet2: E11: formula result is incorrect, aValue == 2); + +} + +} + +void ScFiltersTest::testDatabaseRangesODS() +{ +const rtl::OUString aFileNameBase(RTL_CONSTASCII_USTRINGPARAM(database.)); +ScDocShellRef xDocSh = loadDoc(aFileNameBase, 0); +xDocSh-DoHardRecalc(true); + +ScDocument* pDoc = xDocSh-GetDocument(); + +testDBRanges_Impl(pDoc, ODS); +xDocSh-DoClose(); +} + +void ScFiltersTest::testDatabaseRangesXLS() +{ +const rtl::OUString aFileNameBase(RTL_CONSTASCII_USTRINGPARAM(database.)); +ScDocShellRef xDocSh = loadDoc(aFileNameBase, 1); +xDocSh-DoHardRecalc(true); + +ScDocument* pDoc = xDocSh-GetDocument(); + +testDBRanges_Impl(pDoc, XLS); +xDocSh-DoClose(); +} + +void ScFiltersTest::testDatabaseRangesXLSX() +{ +const rtl::OUString aFileNameBase(RTL_CONSTASCII_USTRINGPARAM(database.)); +ScDocShellRef xDocSh = loadDoc(aFileNameBase, 2); +xDocSh-DoHardRecalc(true); + +ScDocument* pDoc =
[Libreoffice-commits] .: sc/qa
sc/qa/unit/ucalc.cxx | 77 +-- 1 file changed, 57 insertions(+), 20 deletions(-) New commits: commit 485792374600cd9919ab6edf201e8bd97d640261 Author: Eike Rathke er...@redhat.com Date: Mon May 21 15:48:07 2012 +0200 added unit tests for DATEDIF fdo#44456 diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx index ef33e64..7c5d8c5 100644 --- a/sc/qa/unit/ucalc.cxx +++ b/sc/qa/unit/ucalc.cxx @@ -286,6 +286,26 @@ void printRange(ScDocument* pDoc, const ScRange rRange, const char* pCaption) printer.print(pCaption); } +templatesize_t _Size +ScRange insertRangeData(ScDocument* pDoc, const ScAddress rPos, const char* aData[][_Size], size_t nRowCount) +{ +for (size_t i = 0; i _Size; ++i) +{ +for (size_t j = 0; j nRowCount; ++j) +{ +SCCOL nCol = i + rPos.Col(); +SCROW nRow = j + rPos.Row(); +pDoc-SetString(nCol, nRow, rPos.Tab(), OUString(aData[j][i], strlen(aData[j][i]), RTL_TEXTENCODING_UTF8)); +} +} + +ScRange aRange(rPos); +aRange.aEnd.SetCol(rPos.Col()+_Size-1); +aRange.aEnd.SetRow(rPos.Row()+nRowCount-1); +printRange(pDoc, aRange, Range data content); +return aRange; +} + Test::Test() : m_pDoc(0) { @@ -773,6 +793,42 @@ void testFuncCELL(ScDocument* pDoc) } } +/** See also test case document fdo#44456 sheet cpearson */ +void testFuncDATEDIF( ScDocument* pDoc ) +{ +const char* aData[][5] = { +{ 2007-01-01, 2007-01-10, d, 9, =DATEDIF(A1;B1;C1) } , +{ 2007-01-01, 2007-01-31, m, 0, =DATEDIF(A2;B2;C2) } , +{ 2007-01-01, 2007-02-01, m, 1, =DATEDIF(A3;B3;C3) } , +{ 2007-01-01, 2007-02-28, m, 1, =DATEDIF(A4;B4;C4) } , +{ 2007-01-01, 2007-12-31, d, 364, =DATEDIF(A5;B5;C5) } , +{ 2007-01-01, 2007-01-31, y, 0, =DATEDIF(A6;B6;C6) } , +{ 2007-01-01, 2008-07-01, d, 547, =DATEDIF(A7;B7;C7) } , +{ 2007-01-01, 2008-07-01, m, 18, =DATEDIF(A8;B8;C8) } , +{ 2007-01-01, 2008-07-01, ym, 6, =DATEDIF(A9;B9;C9) } , +{ 2007-01-01, 2008-07-01, yd, 182, =DATEDIF(A10;B10;C10) } , +{ 2008-01-01, 2009-07-01, yd, 181, =DATEDIF(A11;B11;C11) } , +{ 2007-01-01, 2007-01-31, md, 30, =DATEDIF(A12;B12;C12) } , +{ 2007-02-01, 2009-03-01, md, 0, =DATEDIF(A13;B13;C13) } , +{ 2008-02-01, 2009-03-01, md, 0, =DATEDIF(A14;B14;C14) } , +{ 2007-01-02, 2007-01-01, md, Err:502, =DATEDIF(A15;B15;C15) }// fail date1 date2 +}; + +clearRange( pDoc, ScRange(0, 0, 0, 4, SAL_N_ELEMENTS(aData), 0)); +ScAddress aPos(0,0,0); +ScRange aDataRange = insertRangeData( pDoc, aPos, aData, SAL_N_ELEMENTS(aData)); +CPPUNIT_ASSERT_MESSAGE(failed to insert range data at correct position, aDataRange.aStart == aPos); + +pDoc-CalcAll(); + +for (size_t i = 0; i SAL_N_ELEMENTS(aData); ++i) +{ +rtl::OUString aVal = pDoc-GetString( 4, i, 0); +//std::cout row i : rtl::OUStringToOString( aVal, RTL_TEXTENCODING_UTF8).getStr() , expected aData[i][3] std::endl; +CPPUNIT_ASSERT_MESSAGE(Unexpected result for DATEDIF, aVal.equalsAscii( aData[i][3])); +} +} + void Test::testCellFunctions() { rtl::OUString aTabName(RTL_CONSTASCII_USTRINGPARAM(foo)); @@ -786,6 +842,7 @@ void Test::testCellFunctions() testFuncVLOOKUP(m_pDoc); testFuncMATCH(m_pDoc); testFuncCELL(m_pDoc); +testFuncDATEDIF(m_pDoc); m_pDoc-DeleteTab(0); } @@ -1141,26 +1198,6 @@ struct DPFieldDef }; templatesize_t _Size -ScRange insertRangeData(ScDocument* pDoc, const ScAddress rPos, const char* aData[][_Size], size_t nRowCount) -{ -for (size_t i = 0; i _Size; ++i) -{ -for (size_t j = 0; j nRowCount; ++j) -{ -SCCOL nCol = i + rPos.Col(); -SCROW nRow = j + rPos.Row(); -pDoc-SetString(nCol, nRow, rPos.Tab(), OUString(aData[j][i], strlen(aData[j][i]), RTL_TEXTENCODING_UTF8)); -} -} - -ScRange aRange(rPos); -aRange.aEnd.SetCol(rPos.Col()+_Size-1); -aRange.aEnd.SetRow(rPos.Row()+nRowCount-1); -printRange(pDoc, aRange, Range data content); -return aRange; -} - -templatesize_t _Size ScRange insertDPSourceData(ScDocument* pDoc, DPFieldDef aFields[], size_t nFieldCount, const char* aData[][_Size], size_t nDataCount) { // Insert field names in row 0. ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] .: sc/qa
sc/qa/unit/data/contentCSV/cell-value.csv |3 +++ sc/qa/unit/data/xlsx/cell-value.xlsx |binary sc/qa/unit/subsequent_filters-test.cxx| 24 3 files changed, 27 insertions(+) New commits: commit f45de1bed2f116ba3846c6fc2b1eb52f757c25f0 Author: Daniel Bankston daniel.dev.libreoff...@gmail.com Date: Sat Apr 28 21:57:22 2012 -0500 First attempt adding cell-value xlsx test Change-Id: I5481759669d14b7e4c564f2909d1db9af3b4a2e6 diff --git a/sc/qa/unit/data/contentCSV/cell-value.csv b/sc/qa/unit/data/contentCSV/cell-value.csv new file mode 100644 index 000..30ac222 --- /dev/null +++ b/sc/qa/unit/data/contentCSV/cell-value.csv @@ -0,0 +1,3 @@ +-2012,-1,0,1,2012 +-3.14,-0.99,0.01,3.14, +H,Hello, Calc!,,Calc is the spreadsheet program you've always needed. Newcomers find it intuitive and easy to learn. Professional data miners and number crunchers will appreciate the comprehensive range of advanced functions. Advanced DataPilot technology makes it easy to pull-in raw data from corporate databases, and then cross-tabulate, summarise, and convert it into meaningful information. Natural language formulas let you create formulas using words (for example: sales - costs). The Intelligent Sum button inserts a sum function or a subtotal automatically, depending on the context. Wizards can guide you through choosing and using a comprehensive range of advanced spreadsheet functions. Or you can download templates from the LibreOffice template repository, for ready-made spreadsheet solutions. Styles and direct formatting makes it easy to apply flexible cell formatting options, including freely-rotating contents, templates, backgrounds, borders and much more. Become a spreadsheet expert, using templates with built-in functions, so that you can re-use a pre-prepared sheet and just focus on the immediate work. The Scenario Manager allows what if ... analysis at the touch of a button. For instance, you can compare profitability for high, medium and low sales forecasts. Calc's solver component lets you solve optimization problems in which the optimum value of a particular spreadsheet cell has to be calculated based on constraints provided in other cells. You can do collaborative work on spreadsheets, thanks to Calc's multiple-user support. You can share a spreadsheet, so that other users can easily add their data to it. The spreadsheet owner can then easily integrate the new data, in just a few clicks. This collaboration feature helps avoid editing conflicts. You can save your spreadsheets in OpenDocument format, the new international standard for documents. This XML-based format means that your files can be read even if the recipient is not a Calc user. Your spreadsheets will be accessible using any OpenDocument-compliant software. You can also open Microsoft Excel spreadsheets, and can also save your work in Excel format for sending to people still locked into Microsoft products. If you only need to make your data readable, but on a wide range of devices and platforms, you can export to Portable Document Format (.pdf). Calc can read .xlsx files created with Microsoft Office 2007 for Windows or Microsoft Office 2008 for Mac OS X., diff --git a/sc/qa/unit/data/xlsx/cell-value.xlsx b/sc/qa/unit/data/xlsx/cell-value.xlsx new file mode 100644 index 000..70c8d0d Binary files /dev/null and b/sc/qa/unit/data/xlsx/cell-value.xlsx differ diff --git a/sc/qa/unit/subsequent_filters-test.cxx b/sc/qa/unit/subsequent_filters-test.cxx index 87697cd..8a10a22 100644 --- a/sc/qa/unit/subsequent_filters-test.cxx +++ b/sc/qa/unit/subsequent_filters-test.cxx @@ -115,6 +115,7 @@ public: //change this test file only in excel and not in calc void testSharedFormulaXLSX(); +void testCellValueXLSX(); //misc tests unrelated to the import filters void testPasswordNew(); @@ -140,6 +141,7 @@ public: CPPUNIT_TEST(testBrokenQuotesCSV); #endif CPPUNIT_TEST(testSharedFormulaXLSX); +CPPUNIT_TEST(testCellValueXLSX); //disable testPassword on MacOSX due to problems with libsqlite3 //also crashes on DragonFly due to problems with nss/nspr headers @@ -678,6 +680,28 @@ void ScFiltersTest::testSharedFormulaXLSX() } } +void ScFiltersTest::testCellValueXLSX() +{ +const rtl::OUString aFileNameBase(RTL_CONSTASCII_USTRINGPARAM(cell-value.)); +rtl::OUString aFileExtension(aFileFormats[XLSX].pName, strlen(aFileFormats[XLSX].pName), RTL_TEXTENCODING_UTF8 ); +rtl::OUString aFilterName(aFileFormats[XLSX].pFilterName, strlen(aFileFormats[XLSX].pFilterName), RTL_TEXTENCODING_UTF8) ; +rtl::OUString aFileName; +createFileURL(aFileNameBase, aFileExtension, aFileName); +rtl::OUString aFilterType(aFileFormats[XLSX].pTypeName, strlen(aFileFormats[XLSX].pTypeName), RTL_TEXTENCODING_UTF8); +std::cout aFileFormats[XLSX].pName Test std::endl; +ScDocShellRef xDocSh = load
[Libreoffice-commits] .: sc/qa
sc/qa/unit/subsequent_filters-test.cxx |2 ++ 1 file changed, 2 insertions(+) New commits: commit ff338fac883fbc070faa4be44d5c8c2f40028b45 Author: Markus Mohrhard markus.mohrh...@googlemail.com Date: Mon Apr 30 04:05:46 2012 +0200 add missing DoClose Thanks to Daniel Bankston Change-Id: Ieeff9d1a35f7abdab07bbe4eab459d89979e5402 diff --git a/sc/qa/unit/subsequent_filters-test.cxx b/sc/qa/unit/subsequent_filters-test.cxx index 8a10a22..da349f7 100644 --- a/sc/qa/unit/subsequent_filters-test.cxx +++ b/sc/qa/unit/subsequent_filters-test.cxx @@ -678,6 +678,8 @@ void ScFiltersTest::testSharedFormulaXLSX() { CPPUNIT_ASSERT(itr-second-GetType() RT_SHARED); } + +xDocSh-DoClose(); } void ScFiltersTest::testCellValueXLSX() ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] .: sc/qa
sc/qa/unit/ucalc.cxx |2 -- 1 file changed, 2 deletions(-) New commits: commit 81fb27c27bfbd7b1808bb442277476065e39fb56 Author: Stephan Bergmann sberg...@redhat.com Date: Tue Apr 24 14:35:29 2012 +0200 -Werror=unused-variable diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx index 8585a10..7662602 100644 --- a/sc/qa/unit/ucalc.cxx +++ b/sc/qa/unit/ucalc.cxx @@ -4272,8 +4272,6 @@ void Test::testCopyPasteFormulasExternalDoc() CPPUNIT_ASSERT_MESSAGE(external document instance not loaded., findLoadedDocShellByName(aExtDocName) != NULL); -ScDocument* pExtDoc = xExtDocSh-GetDocument(); - m_pDoc-InsertTab(0, Sheet1); m_pDoc-InsertTab(1, Sheet2); ___ Libreoffice-commits mailing list Libreoffice-commits@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] .: sc/qa
sc/qa/unit/ucalc.cxx | 46 ++ 1 file changed, 42 insertions(+), 4 deletions(-) New commits: commit f839984910f0fd4ef385552df3af5e09190e15b9 Author: Markus Mohrhard markus.mohrh...@googlemail.com Date: Wed Apr 25 01:12:48 2012 +0200 add test case for copypaste formulas between documents diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx index 7662602..d875e42 100644 --- a/sc/qa/unit/ucalc.cxx +++ b/sc/qa/unit/ucalc.cxx @@ -4262,16 +4262,24 @@ void Test::testCopyPasteFormulas() void Test::testCopyPasteFormulasExternalDoc() { +rtl::OUString aDocName(file:///source.fake); +SfxMedium* pMedium = new SfxMedium(aDocName, STREAM_STD_READWRITE); +m_xDocShRef-DoInitNew(pMedium); +m_pDoc = m_xDocShRef-GetDocument(); + ScDocShellRef xExtDocSh = new ScDocShell; -OUString aExtDocName(RTL_CONSTASCII_USTRINGPARAM(file:///extdata.fake)); -OUString aExtSh1Name(RTL_CONSTASCII_USTRINGPARAM(ExtSheet1)); -OUString aExtSh2Name(RTL_CONSTASCII_USTRINGPARAM(ExtSheet2)); -OUString aExtSh3Name(RTL_CONSTASCII_USTRINGPARAM(ExtSheet3)); +OUString aExtDocName(file:///extdata.fake); +OUString aExtSh1Name(ExtSheet1); +OUString aExtSh2Name(ExtSheet2); SfxMedium* pMed = new SfxMedium(aExtDocName, STREAM_STD_READWRITE); xExtDocSh-DoInitNew(pMed); CPPUNIT_ASSERT_MESSAGE(external document instance not loaded., findLoadedDocShellByName(aExtDocName) != NULL); +ScDocument* pExtDoc = xExtDocSh-GetDocument(); +pExtDoc-InsertTab(0, aExtSh1Name); +pExtDoc-InsertTab(1, aExtSh2Name); + m_pDoc-InsertTab(0, Sheet1); m_pDoc-InsertTab(1, Sheet2); @@ -4280,7 +4288,37 @@ void Test::testCopyPasteFormulasExternalDoc() m_pDoc-SetString(0,2,0, =$Sheet2.A1); m_pDoc-SetString(0,3,0, =$Sheet2.$A$1); m_pDoc-SetString(0,4,0, =$Sheet2.A$1); +m_pDoc-SetString(0,5,0, =$Sheet1.$A$1); + +ScRange aRange(0,0,0,0,5,0); +ScClipParam aClipParam(aRange, false); +ScMarkData aMark; +aMark.SetMarkArea(aRange); +ScDocument* pClipDoc = new ScDocument(SCDOCMODE_CLIP); +m_pDoc-CopyToClip(aClipParam, pClipDoc, aMark); +sal_uInt16 nFlags = IDF_ALL; +aRange = ScRange(1,1,1,1,6,1); +ScMarkData aMarkData2; +aMarkData2.SetMarkArea(aRange); +pExtDoc-CopyFromClip(aRange, aMarkData2, nFlags, NULL, pClipDoc); + +rtl::OUString aFormula; +pExtDoc-GetFormula(1,1,1, aFormula); +//adjust absolute refs pointing to the copy area +CPPUNIT_ASSERT_EQUAL(aFormula, rtl::OUString(=COLUMN($B$2))); +pExtDoc-GetFormula(1,2,1, aFormula); +//adjust absolute refs and keep relative refs +CPPUNIT_ASSERT_EQUAL(aFormula, rtl::OUString(=$B$2+C3)); +pExtDoc-GetFormula(1,3,1, aFormula); +// make absolute sheet refs external refs +CPPUNIT_ASSERT_EQUAL(aFormula, rtl::OUString(='file:///source.fake'#$Sheet2.B2)); +pExtDoc-GetFormula(1,4,1, aFormula); +CPPUNIT_ASSERT_EQUAL(aFormula, rtl::OUString(='file:///source.fake'#$Sheet2.$A$1)); +pExtDoc-GetFormula(1,5,1, aFormula); +CPPUNIT_ASSERT_EQUAL(aFormula, rtl::OUString(='file:///source.fake'#$Sheet2.B$1)); +pExtDoc-GetFormula(1,6,1, aFormula); +CPPUNIT_ASSERT_EQUAL(aFormula, rtl::OUString(=$ExtSheet2.$B$2)); } CPPUNIT_TEST_SUITE_REGISTRATION(Test); ___ Libreoffice-commits mailing list Libreoffice-commits@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] .: sc/qa
sc/qa/unit/helper/debughelper.hxx | 13 - 1 file changed, 13 deletions(-) New commits: commit 34f4cc01241c916c7d2a39360bc98af6d67dbb6a Author: LuboÅ¡ LuÅák l.lu...@suse.cz Date: Wed Apr 4 16:42:01 2012 +0200 remove unused code The operator is now automatically provided by ustring.hxx, and I think this one would not be found with C++11-compliant namespace lookup anyway. diff --git a/sc/qa/unit/helper/debughelper.hxx b/sc/qa/unit/helper/debughelper.hxx index 6a01f52..1312e04 100644 --- a/sc/qa/unit/helper/debughelper.hxx +++ b/sc/qa/unit/helper/debughelper.hxx @@ -56,19 +56,6 @@ using ::std::endl; using ::std::vector; - -namespace { - -#ifdef __GNUC__ -__attribute__((used)) -#endif -::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_matrixOUString, bool MatrixType; ___ Libreoffice-commits mailing list Libreoffice-commits@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] .: sc/qa
sc/qa/unit/ucalc.cxx | 49 + 1 file changed, 49 insertions(+) New commits: commit 62d745ddde6b60796123f45b3df8c10e9869 Author: Karthik A Padmanabhan treadston...@gmail.com Date: Tue Apr 3 01:21:16 2012 +0530 Test cases for ScDocFunc::RenameTable() Rename twice and also check if upon renaming two tables have the same name or not diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx index 245215c..c8bd00c 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 ___ Libreoffice-commits mailing list Libreoffice-commits@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] .: sc/qa
sc/qa/unit/data/xls/border.xls |binary sc/qa/unit/subsequent_filters-test.cxx | 31 +++ 2 files changed, 31 insertions(+) New commits: commit 1199713c82d9852f8a41283138f88a06ad887c39 Author: Markus Mohrhard markus.mohrh...@googlemail.com Date: Mon Apr 2 00:12:13 2012 +0200 add xls border import test TODO: add test cases for: -color import -different line styles -... diff --git a/sc/qa/unit/data/xls/border.xls b/sc/qa/unit/data/xls/border.xls new file mode 100644 index 000..b314f7d Binary files /dev/null and b/sc/qa/unit/data/xls/border.xls differ diff --git a/sc/qa/unit/subsequent_filters-test.cxx b/sc/qa/unit/subsequent_filters-test.cxx index 391b157..1d8a8b6 100644 --- a/sc/qa/unit/subsequent_filters-test.cxx +++ b/sc/qa/unit/subsequent_filters-test.cxx @@ -104,6 +104,7 @@ public: void testMatrixODS(); void testMatrixXLS(); void testBorderODS(); +void testBorderXLS(); void testBugFixesODS(); void testBugFixesXLS(); void testBugFixesXLSX(); @@ -124,6 +125,7 @@ public: CPPUNIT_TEST(testMatrixODS); CPPUNIT_TEST(testMatrixXLS); CPPUNIT_TEST(testBorderODS); +CPPUNIT_TEST(testBorderXLS); CPPUNIT_TEST(testBugFixesODS); CPPUNIT_TEST(testBugFixesXLS); CPPUNIT_TEST(testBugFixesXLSX); @@ -515,6 +517,35 @@ void ScFiltersTest::testBorderODS() xDocSh-DoClose(); } +void ScFiltersTest::testBorderXLS() +{ +const rtl::OUString aFileNameBase(RTL_CONSTASCII_USTRINGPARAM(border.)); +ScDocShellRef xDocSh = loadDoc( aFileNameBase, 1); + +CPPUNIT_ASSERT_MESSAGE(Failed to load border.xls, xDocSh.Is()); +ScDocument* pDoc = xDocSh-GetDocument(); + +const editeng::SvxBorderLine* pLeft = NULL; +const editeng::SvxBorderLine* pTop = NULL; +const editeng::SvxBorderLine* pRight = NULL; +const editeng::SvxBorderLine* pBottom = NULL; + +pDoc-GetBorderLines( 2, 3, 0, pLeft, pTop, pRight, pBottom ); +CPPUNIT_ASSERT(pRight); +CPPUNIT_ASSERT_EQUAL(pRight-GetStyle(),editeng::SOLID); +CPPUNIT_ASSERT_EQUAL(pRight-GetWidth(),6L); + +pDoc-GetBorderLines( 3, 5, 0, pLeft, pTop, pRight, pBottom ); +CPPUNIT_ASSERT(pRight); +CPPUNIT_ASSERT_EQUAL(pRight-GetStyle(),editeng::SOLID); +CPPUNIT_ASSERT_EQUAL(pRight-GetWidth(),18L); + +pDoc-GetBorderLines( 5, 7, 0, pLeft, pTop, pRight, pBottom ); +CPPUNIT_ASSERT(pRight); +CPPUNIT_ASSERT_EQUAL(pRight-GetStyle(),editeng::SOLID); +CPPUNIT_ASSERT_EQUAL(pRight-GetWidth(),24L); +} + void ScFiltersTest::testBugFixesODS() { const rtl::OUString aFileNameBase(RTL_CONSTASCII_USTRINGPARAM(bug-fixes.)); ___ Libreoffice-commits mailing list Libreoffice-commits@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] .: sc/qa
sc/qa/unit/subsequent_filters-test.cxx | 19 +++ 1 file changed, 19 insertions(+) New commits: commit 9654d3baed29abd009a214e429247fb64451 Author: Markus Mohrhard markus.mohrh...@googlemail.com Date: Sun Apr 1 04:18:48 2012 +0200 more test cases for border import diff --git a/sc/qa/unit/subsequent_filters-test.cxx b/sc/qa/unit/subsequent_filters-test.cxx index 3502d34..391b157 100644 --- a/sc/qa/unit/subsequent_filters-test.cxx +++ b/sc/qa/unit/subsequent_filters-test.cxx @@ -493,6 +493,25 @@ void ScFiltersTest::testBorderODS() CPPUNIT_ASSERT(pRight); CPPUNIT_ASSERT_EQUAL(pRight-GetStyle(),editeng::SOLID); +pDoc-GetBorderLines( 2, 1, 0, pLeft, pTop, pRight, pBottom ); +CPPUNIT_ASSERT(!pLeft); +CPPUNIT_ASSERT(!pTop); +CPPUNIT_ASSERT(!pBottom); + +CPPUNIT_ASSERT(pRight); +CPPUNIT_ASSERT_EQUAL(pRight-GetStyle(),editeng::SOLID); +CPPUNIT_ASSERT_EQUAL(pRight-GetWidth(),20L); + +pDoc-GetBorderLines( 2, 8, 0, pLeft, pTop, pRight, pBottom ); + +CPPUNIT_ASSERT(pLeft); +CPPUNIT_ASSERT(pTop); +CPPUNIT_ASSERT(pBottom); +CPPUNIT_ASSERT(pRight); +CPPUNIT_ASSERT_EQUAL(pRight-GetStyle(),editeng::SOLID); +CPPUNIT_ASSERT_EQUAL(pRight-GetWidth(),5L); +CPPUNIT_ASSERT(pRight-GetColor() == Color(COL_BLUE)); + xDocSh-DoClose(); } ___ Libreoffice-commits mailing list Libreoffice-commits@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] .: sc/qa
sc/qa/unit/ucalc.cxx | 94 +-- 1 file changed, 47 insertions(+), 47 deletions(-) New commits: commit 464a3a271cd4b97573e87d15a38b3f4cad727daf Author: Markus Mohrhard markus.mohrh...@googlemail.com Date: Sun Apr 1 05:00:09 2012 +0200 use better/correct assert macros in ucalc diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx index 9132395..6a92628 100644 --- a/sc/qa/unit/ucalc.cxx +++ b/sc/qa/unit/ucalc.cxx @@ -2092,8 +2092,8 @@ void Test::testPivotTableDuplicateDataFields() 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); +CPPUNIT_ASSERT_EQUAL_MESSAGE(there should be only one data pilot table., + pDPs-GetCount(), static_castsize_t(1)); pDPObj-SetName(pDPs-CreateNewName()); ScRange aOutRange = refresh(pDPObj); @@ -2139,13 +2139,13 @@ void Test::testPivotTableDuplicateDataFields() ScPivotParam aParam; pDPObj-FillLabelData(aParam); -CPPUNIT_ASSERT_MESSAGE(There should be exactly 4 labels (2 original, 1 data layout, and 1 duplicate dimensions)., - aParam.maLabelArray.size() == 4); +CPPUNIT_ASSERT_EQUAL_MESSAGE(There should be exactly 4 labels (2 original, 1 data layout, and 1 duplicate dimensions)., + aParam.maLabelArray.size(), static_castsize_t(4)); pDPs-FreeTable(pDPObj); -CPPUNIT_ASSERT_MESSAGE(There should be no more tables., pDPs-GetCount() == 0); -CPPUNIT_ASSERT_MESSAGE(There shouldn't be any more cache stored., - pDPs-GetSheetCaches().size() == 0); +CPPUNIT_ASSERT_EQUAL_MESSAGE(There should be no more tables., pDPs-GetCount(), static_castsize_t(0)); +CPPUNIT_ASSERT_EQUAL_MESSAGE(There shouldn't be any more cache stored., + pDPs-GetSheetCaches().size(), static_castsize_t(0)); m_pDoc-DeleteTab(1); m_pDoc-DeleteTab(0); @@ -2185,8 +2185,8 @@ void Test::testPivotTableNormalGrouping() 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); +CPPUNIT_ASSERT_EQUAL_MESSAGE(there should be only one data pilot table., + pDPs-GetCount(), static_castsize_t(1)); pDPObj-SetName(pDPs-CreateNewName()); ScRange aOutRange = refresh(pDPObj); @@ -2294,9 +2294,9 @@ void Test::testPivotTableNormalGrouping() } pDPs-FreeTable(pDPObj); -CPPUNIT_ASSERT_MESSAGE(There should be no more tables., pDPs-GetCount() == 0); -CPPUNIT_ASSERT_MESSAGE(There shouldn't be any more cache stored., - pDPs-GetSheetCaches().size() == 0); +CPPUNIT_ASSERT_EQUAL_MESSAGE(There should be no more tables., pDPs-GetCount(), static_castsize_t(0)); +CPPUNIT_ASSERT_EQUAL_MESSAGE(There shouldn't be any more cache stored., + pDPs-GetSheetCaches().size(), static_castsize_t(0)); m_pDoc-DeleteTab(1); m_pDoc-DeleteTab(0); @@ -2347,8 +2347,8 @@ void Test::testPivotTableNumberGrouping() 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); +CPPUNIT_ASSERT_EQUAL_MESSAGE(there should be only one data pilot table., + pDPs-GetCount(), static_castsize_t(1)); pDPObj-SetName(pDPs-CreateNewName()); ScDPSaveData* pSaveData = pDPObj-GetSaveData(); @@ -2389,9 +2389,9 @@ void Test::testPivotTableNumberGrouping() } pDPs-FreeTable(pDPObj); -CPPUNIT_ASSERT_MESSAGE(There should be no more tables., pDPs-GetCount() == 0); -CPPUNIT_ASSERT_MESSAGE(There shouldn't be any more cache stored., - pDPs-GetSheetCaches().size() == 0); +CPPUNIT_ASSERT_EQUAL_MESSAGE(There should be no more tables., pDPs-GetCount(), static_castsize_t(0)); +CPPUNIT_ASSERT_EQUAL_MESSAGE(There shouldn't be any more cache stored., + pDPs-GetSheetCaches().size(), static_castsize_t(0)); m_pDoc-DeleteTab(1); m_pDoc-DeleteTab(0); @@ -2534,9 +2534,9 @@ void Test::testPivotTableDateGrouping() } pDPs-FreeTable(pDPObj); -CPPUNIT_ASSERT_MESSAGE(There should be no more tables., pDPs-GetCount() == 0); -CPPUNIT_ASSERT_MESSAGE(There shouldn't be any more cache stored., - pDPs-GetSheetCaches().size() == 0); +CPPUNIT_ASSERT_EQUAL_MESSAGE(There should be no more tables., pDPs-GetCount(),
[Libreoffice-commits] .: sc/qa
sc/qa/unit/ucalc.cxx | 102 --- 1 file changed, 49 insertions(+), 53 deletions(-) New commits: commit e4380ae1e7d5330e26f4a382f3a86a6059b9b53f Author: Kohei Yoshida kohei.yosh...@gmail.com Date: Thu Mar 22 23:15:07 2012 -0400 Test for changing dimension member visibility a little cleanup. diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx index cb6ab44..965424f 100644 --- a/sc/qa/unit/ucalc.cxx +++ b/sc/qa/unit/ucalc.cxx @@ -1297,6 +1297,17 @@ ScDPObject* createDPFromRange( return createDPFromSourceDesc(pDoc, aSheetDesc, aFields, nFieldCount, bFilterButton); } +ScRange refresh(ScDPObject* pDPObj) +{ +bool bOverFlow = false; +ScRange aOutRange = pDPObj-GetNewOutputRange(bOverFlow); +CPPUNIT_ASSERT_MESSAGE(Table overflow!?, !bOverFlow); + +pDPObj-Output(aOutRange.aStart); +aOutRange = pDPObj-GetOutRange(); +return aOutRange; +} + ScRange refreshGroups(ScDPCollection* pDPs, ScDPObject* pDPObj) { // We need to first create group data in the cache, then the group data in @@ -1307,13 +1318,7 @@ ScRange refreshGroups(ScDPCollection* pDPs, ScDPObject* pDPObj) CPPUNIT_ASSERT_MESSAGE(There should be only one table linked to this cache., aRefs.size() == 1); pDPObj-ReloadGroupTableData(); -bool bOverFlow = false; -ScRange aOutRange = pDPObj-GetNewOutputRange(bOverFlow); -CPPUNIT_ASSERT_MESSAGE(Table overflow!?, !bOverFlow); - -pDPObj-Output(aOutRange.aStart); -aOutRange = pDPObj-GetOutRange(); -return aOutRange; +return refresh(pDPObj); } class AutoCalcSwitch @@ -1554,13 +1559,7 @@ void Test::testPivotTableLabels() pDPs-GetCount() == 1); pDPObj-SetName(pDPs-CreateNewName()); -bool bOverFlow = false; -ScRange aOutRange = pDPObj-GetNewOutputRange(bOverFlow); -CPPUNIT_ASSERT_MESSAGE(Table overflow!?, !bOverFlow); - -pDPObj-Output(aOutRange.aStart); -aOutRange = pDPObj-GetOutRange(); - +ScRange aOutRange = refresh(pDPObj); { // Expected output table content. 0 = empty cell const char* aOutputCheck[][5] = { @@ -1616,13 +1615,7 @@ void Test::testPivotTableDateLabels() pDPs-GetCount() == 1); pDPObj-SetName(pDPs-CreateNewName()); -bool bOverFlow = false; -ScRange aOutRange = pDPObj-GetNewOutputRange(bOverFlow); -CPPUNIT_ASSERT_MESSAGE(Table overflow!?, !bOverFlow); - -pDPObj-Output(aOutRange.aStart); -aOutRange = pDPObj-GetOutRange(); - +ScRange aOutRange = refresh(pDPObj); { // Expected output table content. 0 = empty cell const char* aOutputCheck[][5] = { @@ -1705,12 +1698,7 @@ void Test::testPivotTableFilters() pDPs-GetCount() == 1); pDPObj-SetName(pDPs-CreateNewName()); -bool bOverFlow = false; -ScRange aOutRange = pDPObj-GetNewOutputRange(bOverFlow); -CPPUNIT_ASSERT_MESSAGE(Table overflow!?, !bOverFlow); - -pDPObj-Output(aOutRange.aStart); -aOutRange = pDPObj-GetOutRange(); +ScRange aOutRange = refresh(pDPObj); { // Expected output table content. 0 = empty cell const char* aOutputCheck[][2] = { @@ -1743,8 +1731,7 @@ void Test::testPivotTableFilters() OUString aPage(RTL_CONSTASCII_USTRINGPARAM(A)); pDim-SetCurrentPage(aPage); pDPObj-SetSaveData(aSaveData); -pDPObj-Output(aOutRange.aStart); -aOutRange = pDPObj-GetOutRange(); +aOutRange = refresh(pDPObj); { // Expected output table content. 0 = empty cell const char* aOutputCheck[][2] = { @@ -1773,8 +1760,7 @@ void Test::testPivotTableFilters() rEntry.GetQueryItem().mfVal = 1; aDesc.SetQueryParam(aQueryParam); pDPObj-SetSheetDesc(aDesc); -pDPObj-Output(aOutRange.aStart); -aOutRange = pDPObj-GetOutRange(); +aOutRange = refresh(pDPObj); { // Expected output table content. 0 = empty cell const char* aOutputCheck[][2] = { @@ -1852,12 +1838,7 @@ void Test::testPivotTableNamedSource() pDPs-GetCount() == 1); pDPObj-SetName(pDPs-CreateNewName()); -bool bOverFlow = false; -ScRange aOutRange = pDPObj-GetNewOutputRange(bOverFlow); -CPPUNIT_ASSERT_MESSAGE(Table overflow!?, !bOverFlow); - -pDPObj-Output(aOutRange.aStart); -aOutRange = pDPObj-GetOutRange(); +ScRange aOutRange = refresh(pDPObj); { // Expected output table content. 0 = empty cell const char* aOutputCheck[][5] = { @@ -2111,12 +2092,7 @@ void Test::testPivotTableDuplicateDataFields() pDPs-GetCount() == 1); pDPObj-SetName(pDPs-CreateNewName()); -bool bOverFlow = false; -ScRange aOutRange = pDPObj-GetNewOutputRange(bOverFlow); -CPPUNIT_ASSERT_MESSAGE(Table overflow!?, !bOverFlow); - -pDPObj-Output(aOutRange.aStart); -aOutRange = pDPObj-GetOutRange(); +ScRange aOutRange = refresh(pDPObj);
[Libreoffice-commits] .: sc/qa
sc/qa/unit/ucalc.cxx | 170 --- 1 file changed, 135 insertions(+), 35 deletions(-) New commits: commit 70ce9efbac248f0e7952cda6cfb783798b62d459 Author: Kohei Yoshida kohei.yosh...@gmail.com Date: Wed Mar 21 15:41:14 2012 -0400 New unit test for pivot table with duplicated data fields. diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx index 43ea584..2f8d099 100644 --- a/sc/qa/unit/ucalc.cxx +++ b/sc/qa/unit/ucalc.cxx @@ -153,6 +153,12 @@ public: */ void testPivotTableCache(); +/** + * Test for pivot table containing data fields that reference the same + * source field but different functions. + */ +void testPivotTableDuplicateDataFields(); + void testSheetCopy(); void testSheetMove(); void testExternalRef(); @@ -208,6 +214,7 @@ public: CPPUNIT_TEST(testPivotTableFilters); CPPUNIT_TEST(testPivotTableNamedSource); CPPUNIT_TEST(testPivotTableCache); +CPPUNIT_TEST(testPivotTableDuplicateDataFields); CPPUNIT_TEST(testSheetCopy); CPPUNIT_TEST(testSheetMove); CPPUNIT_TEST(testExternalRef); @@ -1104,6 +,12 @@ struct DPFieldDef { const char* pName; sheet::DataPilotFieldOrientation eOrient; + +/** + * Function for data field. It's used only for data field. When 0, the + * default function (SUM) is used. + */ +int eFunc; }; templatesize_t _Size @@ -1214,7 +1227,6 @@ ScDPObject* createDPFromSourceDesc( // Check the sanity of the source range. const ScRange rSrcRange = rDesc.GetSourceRange(); -SCCOL nCol1 = rSrcRange.aStart.Col(); SCROW nRow1 = rSrcRange.aStart.Row(); SCROW nRow2 = rSrcRange.aEnd.Row(); CPPUNIT_ASSERT_MESSAGE(source range contains no data!, nRow2 - nRow1 1); @@ -1222,15 +1234,19 @@ ScDPObject* createDPFromSourceDesc( // Set the dimension information. for (size_t i = 0; i nFieldCount; ++i) { -OUString aDimName = pDoc-GetString(nCol1+i, nRow1, rSrcRange.aStart.Tab()); -ScDPSaveDimension* pDim = aSaveData.GetDimensionByName(aDimName); +OUString aDimName = rtl::OUString::createFromAscii(aFields[i].pName); +ScDPSaveDimension* pDim = aSaveData.GetNewDimensionByName(aDimName); pDim-SetOrientation(static_castsal_uInt16(aFields[i].eOrient)); pDim-SetUsedHierarchy(0); pDim-SetShowEmpty(true); if (aFields[i].eOrient == sheet::DataPilotFieldOrientation_DATA) { -pDim-SetFunction(sheet::GeneralFunction_SUM); +sheet::GeneralFunction eFunc = sheet::GeneralFunction_SUM; +if (aFields[i].eFunc) +eFunc = static_castsheet::GeneralFunction(aFields[i].eFunc); + +pDim-SetFunction(eFunc); pDim-SetReferenceValue(NULL); } else @@ -1249,20 +1265,6 @@ ScDPObject* createDPFromSourceDesc( aShowInfo.ShowItemsMode = 0; aShowInfo.ItemCount = 0; pDim-SetAutoShowInfo(aShowInfo); - -// USHORT nFuncs[] = { sheet::GeneralFunction_AUTO }; -// pDim-SetSubTotals(1, nFuncs); -} - -for (SCROW nRow = nRow1 + 1; nRow = nRow2; ++nRow) -{ -SCCOL nCol = nCol1 + static_castSCCOL(i); -rtl::OUString aVal; -pDoc-GetString(nCol, nRow, 0, aVal); -// This call is just to populate the member list for each dimension. -ScDPSaveMember* pMem = pDim-GetMemberByName(aVal); -pMem-SetShowDetails(true); -pMem-SetIsVisible(true); } } @@ -1312,9 +1314,9 @@ void Test::testPivotTable() // Dimension definition DPFieldDef aFields[] = { -{ Name, sheet::DataPilotFieldOrientation_ROW }, -{ Group, sheet::DataPilotFieldOrientation_COLUMN }, -{ Score, sheet::DataPilotFieldOrientation_DATA } +{ Name, sheet::DataPilotFieldOrientation_ROW, 0 }, +{ Group, sheet::DataPilotFieldOrientation_COLUMN, 0 }, +{ Score, sheet::DataPilotFieldOrientation_DATA, 0 } }; // Raw data @@ -1496,9 +1498,9 @@ void Test::testPivotTableLabels() // Dimension definition DPFieldDef aFields[] = { -{ Software, sheet::DataPilotFieldOrientation_ROW }, -{ Version, sheet::DataPilotFieldOrientation_COLUMN }, -{ 1.2.3,sheet::DataPilotFieldOrientation_DATA } +{ Software, sheet::DataPilotFieldOrientation_ROW, 0 }, +{ Version, sheet::DataPilotFieldOrientation_COLUMN, 0 }, +{ 1.2.3,sheet::DataPilotFieldOrientation_DATA, 0 } }; // Raw data @@ -1558,9 +1560,9 @@ void Test::testPivotTableDateLabels() // Dimension definition DPFieldDef aFields[] = { -{ Name, sheet::DataPilotFieldOrientation_ROW }, -{ Date, sheet::DataPilotFieldOrientation_COLUMN }, -{ Value, sheet::DataPilotFieldOrientation_DATA } +{ Name,
[Libreoffice-commits] .: sc/qa
sc/qa/unit/ucalc.cxx |5 + 1 file changed, 5 insertions(+) New commits: commit 7d4293b3ba64ffd51731d9a2d478a88a45836aa2 Author: Kohei Yoshida kohei.yosh...@gmail.com Date: Wed Mar 21 16:28:44 2012 -0400 Make sure that FillLabelData doesn't crash in presence of duplicated dims. diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx index 2f8d099..c134f13 100644 --- a/sc/qa/unit/ucalc.cxx +++ b/sc/qa/unit/ucalc.cxx @@ -2134,6 +2134,11 @@ void Test::testPivotTableDuplicateDataFields() CPPUNIT_ASSERT_MESSAGE(Table output check failed, bSuccess); } +ScPivotParam aParam; +pDPObj-FillLabelData(aParam); +CPPUNIT_ASSERT_MESSAGE(There should be exactly 4 labels (2 original, 1 data layout, and 1 duplicate dimensions)., + aParam.maLabelArray.size() == 4); + pDPs-FreeTable(pDPObj); m_pDoc-DeleteTab(1); ___ Libreoffice-commits mailing list Libreoffice-commits@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] .: sc/qa
sc/qa/unit/ucalc.cxx | 175 ++- 1 file changed, 174 insertions(+), 1 deletion(-) New commits: commit 7be233e60ab8b4e241510758e269c186e5cf02e3 Author: Kohei Yoshida kohei.yosh...@gmail.com Date: Wed Mar 21 23:04:44 2012 -0400 New unit test for data pilot grouping (normal grouping). diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx index c134f13..15c774c 100644 --- a/sc/qa/unit/ucalc.cxx +++ b/sc/qa/unit/ucalc.cxx @@ -59,6 +59,7 @@ #include dpshttab.hxx #include dpobject.hxx #include dpsave.hxx +#include dpdimsave.hxx #include dpcache.hxx #include formula/IFunctionDescription.hxx @@ -159,6 +160,8 @@ public: */ void testPivotTableDuplicateDataFields(); +void testPivotTableNormalGrouping(); + void testSheetCopy(); void testSheetMove(); void testExternalRef(); @@ -215,6 +218,7 @@ public: CPPUNIT_TEST(testPivotTableNamedSource); CPPUNIT_TEST(testPivotTableCache); CPPUNIT_TEST(testPivotTableDuplicateDataFields); +CPPUNIT_TEST(testPivotTableNormalGrouping); CPPUNIT_TEST(testSheetCopy); CPPUNIT_TEST(testSheetMove); CPPUNIT_TEST(testExternalRef); @@ -1289,6 +1293,25 @@ ScDPObject* createDPFromRange( return createDPFromSourceDesc(pDoc, aSheetDesc, aFields, nFieldCount, bFilterButton); } +ScRange refreshGroups(ScDPCollection* pDPs, ScDPObject* pDPObj) +{ +// We need to first create group data in the cache, then the group data in +// the object. +std::setScDPObject* aRefs; +bool bSuccess = pDPs-ReloadGroupsInCache(pDPObj, aRefs); +CPPUNIT_ASSERT_MESSAGE(Failed to reload group data in cache., bSuccess); +CPPUNIT_ASSERT_MESSAGE(There should be only one table linked to this cache., aRefs.size() == 1); +pDPObj-ReloadGroupTableData(); + +bool bOverFlow = false; +ScRange aOutRange = pDPObj-GetNewOutputRange(bOverFlow); +CPPUNIT_ASSERT_MESSAGE(Table overflow!?, !bOverFlow); + +pDPObj-Output(aOutRange.aStart); +aOutRange = pDPObj-GetOutRange(); +return aOutRange; +} + class AutoCalcSwitch { ScDocument* mpDoc; @@ -2083,7 +2106,6 @@ void Test::testPivotTableDuplicateDataFields() CPPUNIT_ASSERT_MESSAGE(there should be only one data pilot table., pDPs-GetCount() == 1); pDPObj-SetName(pDPs-CreateNewName()); -pDPObj-GetSource(); bool bOverFlow = false; ScRange aOutRange = pDPObj-GetNewOutputRange(bOverFlow); @@ -2145,6 +2167,157 @@ void Test::testPivotTableDuplicateDataFields() m_pDoc-DeleteTab(0); } +void Test::testPivotTableNormalGrouping() +{ +m_pDoc-InsertTab(0, OUString(RTL_CONSTASCII_USTRINGPARAM(Data))); +m_pDoc-InsertTab(1, OUString(RTL_CONSTASCII_USTRINGPARAM(Table))); + +// Raw data +const char* aData[][2] = { +{ Name, Value }, +{ A, 1 }, +{ B, 2 }, +{ C, 3 }, +{ D, 4 }, +{ E, 5 }, +{ F, 6 }, +{ G, 7 } +}; + +// Dimension definition +DPFieldDef aFields[] = { +{ Name, 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()); + +bool bOverFlow = false; +ScRange aOutRange = pDPObj-GetNewOutputRange(bOverFlow); +CPPUNIT_ASSERT_MESSAGE(Table overflow!?, !bOverFlow); + +pDPObj-Output(aOutRange.aStart); +aOutRange = pDPObj-GetOutRange(); +{ +// Expected output table content. 0 = empty cell +const char* aOutputCheck[][2] = { +{ Name, 0 }, +{ A, 1 }, +{ B, 2 }, +{ C, 3 }, +{ D, 4 }, +{ E, 5 }, +{ F, 6 }, +{ G, 7 }, +{ Total Result, 28 } +}; + +bSuccess = checkDPTableOutput2(m_pDoc, aOutRange, aOutputCheck, Initial output without grouping); +CPPUNIT_ASSERT_MESSAGE(Table output check failed, bSuccess); +} + +ScDPSaveData* pSaveData = pDPObj-GetSaveData(); +CPPUNIT_ASSERT_MESSAGE(No save data !?, pSaveData); +ScDPDimensionSaveData* pDimData = pSaveData-GetDimensionData(); +CPPUNIT_ASSERT_MESSAGE(Failed to create dimension data., pDimData); + +rtl::OUString
[Libreoffice-commits] .: sc/qa
sc/qa/unit/ucalc.cxx | 50 ++ 1 file changed, 50 insertions(+) New commits: commit fdcac5fa84b5fba908a0e59b0ceb953da58e8609 Author: Kohei Yoshida kohei.yosh...@gmail.com Date: Tue Mar 20 16:27:20 2012 -0400 Added more code to test the integrity of the source data arrays. Source data array stores item IDs and represents the original data series before normalization. diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx index 5324601..43ea584 100644 --- a/sc/qa/unit/ucalc.cxx +++ b/sc/qa/unit/ucalc.cxx @@ -147,6 +147,10 @@ public: */ void testPivotTableNamedSource(); +/** + * Test for pivot table cache. Each dimension in the pivot cache stores + * only unique values that are sorted in ascending order. + */ void testPivotTableCache(); void testSheetCopy(); @@ -1987,6 +1991,52 @@ void Test::testPivotTableCache() pItem = aCache.GetItemDataById(2, 6); CPPUNIT_ASSERT_MESSAGE(wrong item value, !pItem); +{ +// Check the integrity of the source data. +ScDPItemData aTest; +long nDim; + +{ +// Dimension 0: Z, R, A, F, Y, 12 +nDim = 0; +const char* aChecks[] = { Z, R, A, F, Y }; +for (size_t i = 0; i SAL_N_ELEMENTS(aChecks); ++i) +{ +pItem = aCache.GetItemDataById(nDim, aCache.GetItemDataId(nDim, i, false)); +aTest.SetString(rtl::OUString::createFromAscii(aChecks[i])); +CPPUNIT_ASSERT_MESSAGE(wrong data value, pItem *pItem == aTest); +} + +pItem = aCache.GetItemDataById(nDim, aCache.GetItemDataId(nDim, 5, false)); +aTest.SetValue(12); +CPPUNIT_ASSERT_MESSAGE(wrong data value, pItem *pItem == aTest); +} + +{ +// Dimension 1: A, A, B, B, C, C +nDim = 1; +const char* aChecks[] = { A, A, B, B, C, C }; +for (size_t i = 0; i SAL_N_ELEMENTS(aChecks); ++i) +{ +pItem = aCache.GetItemDataById(nDim, aCache.GetItemDataId(nDim, i, false)); +aTest.SetString(rtl::OUString::createFromAscii(aChecks[i])); +CPPUNIT_ASSERT_MESSAGE(wrong data value, pItem *pItem == aTest); +} +} + +{ +// Dimension 2: 30, 20, 45, 12, 8, 15 +nDim = 2; +double aChecks[] = { 30, 20, 45, 12, 8, 15 }; +for (size_t i = 0; i SAL_N_ELEMENTS(aChecks); ++i) +{ +pItem = aCache.GetItemDataById(nDim, aCache.GetItemDataId(nDim, i, false)); +aTest.SetValue(aChecks[i]); +CPPUNIT_ASSERT_MESSAGE(wrong data value, pItem *pItem == aTest); +} +} +} + m_pDoc-DeleteTab(0); } ___ Libreoffice-commits mailing list Libreoffice-commits@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] .: sc/qa
sc/qa/unit/ucalc.cxx |6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) New commits: commit eee16791673412f44435b6357248b34ef7613296 Author: Kohei Yoshida kohei.yosh...@gmail.com Date: Fri Mar 16 12:41:43 2012 -0400 Better wording. diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx index 5d71971..b7a2df2 100644 --- a/sc/qa/unit/ucalc.cxx +++ b/sc/qa/unit/ucalc.cxx @@ -1904,9 +1904,9 @@ void Test::testPivotTableCache() aDimName = aCache.GetDimensionName(2); CPPUNIT_ASSERT_MESSAGE(wrong dimension name, aDimName.equalsAscii(F3)); -// In each dimension, member ID values also represent their order; -// dimension members are sorted in ascending order. And values come -// before strings. Also, no duplicate dimension members exist. +// In each dimension, member ID values also represent their sort order. +// Value items are sorted before string ones. Also, no duplicate +// dimension members should exist. // Dimension 0 - a mix of strings and values. long nMemCount = aCache.GetDimMemberCount(0); ___ Libreoffice-commits mailing list Libreoffice-commits@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] .: sc/qa
sc/qa/unit/ucalc.cxx |7 --- 1 file changed, 4 insertions(+), 3 deletions(-) New commits: commit 16ab673ccbed29d460aaca93cb09663fdd63dc19 Author: Kohei Yoshida kohei.yosh...@gmail.com Date: Fri Mar 16 12:43:33 2012 -0400 More wording tweak. Members are sorted only in source dims (for now). diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx index b7a2df2..5324601 100644 --- a/sc/qa/unit/ucalc.cxx +++ b/sc/qa/unit/ucalc.cxx @@ -1904,9 +1904,10 @@ void Test::testPivotTableCache() aDimName = aCache.GetDimensionName(2); CPPUNIT_ASSERT_MESSAGE(wrong dimension name, aDimName.equalsAscii(F3)); -// In each dimension, member ID values also represent their sort order. -// Value items are sorted before string ones. Also, no duplicate -// dimension members should exist. +// In each dimension, member ID values also represent their sort order (in +// source dimensions only, not in group dimensions). Value items are +// sorted before string ones. Also, no duplicate dimension members should +// exist. // Dimension 0 - a mix of strings and values. long nMemCount = aCache.GetDimMemberCount(0); ___ Libreoffice-commits mailing list Libreoffice-commits@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] .: sc/qa
sc/qa/unit/data/xls/pass/CVE-2007-0031-1.xls |binary sc/qa/unit/data/xls/pass/CVE-2007-3490-1.xls |binary sc/qa/unit/data/xls/pass/CVE-2010-1246-1.xls |binary 3 files changed New commits: commit 96d28ecffcc9b0e461d9fe10ca4dedd676f1f933 Author: Caolán McNamara caol...@redhat.com Date: Wed Mar 14 13:47:14 2012 + add some more torture tests diff --git a/sc/qa/unit/data/xls/pass/CVE-2007-0031-1.xls b/sc/qa/unit/data/xls/pass/CVE-2007-0031-1.xls new file mode 100644 index 000..2981d60 Binary files /dev/null and b/sc/qa/unit/data/xls/pass/CVE-2007-0031-1.xls differ diff --git a/sc/qa/unit/data/xls/pass/CVE-2007-3490-1.xls b/sc/qa/unit/data/xls/pass/CVE-2007-3490-1.xls new file mode 100644 index 000..9f0b9b2 Binary files /dev/null and b/sc/qa/unit/data/xls/pass/CVE-2007-3490-1.xls differ diff --git a/sc/qa/unit/data/xls/pass/CVE-2010-1246-1.xls b/sc/qa/unit/data/xls/pass/CVE-2010-1246-1.xls new file mode 100644 index 000..1b7c48c Binary files /dev/null and b/sc/qa/unit/data/xls/pass/CVE-2010-1246-1.xls differ ___ Libreoffice-commits mailing list Libreoffice-commits@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] .: sc/qa
sc/qa/extras/testdocuments/ScDatabaseRangeObj.ods |binary 1 file changed New commits: commit c25c5a05ac6a0d678aa3d9592d213a08cabf6f7b Author: Markus Mohrhard markus.mohrh...@googlemail.com Date: Thu Feb 16 11:59:21 2012 +0100 add missing file diff --git a/sc/qa/extras/testdocuments/ScDatabaseRangeObj.ods b/sc/qa/extras/testdocuments/ScDatabaseRangeObj.ods new file mode 100644 index 000..0561655 Binary files /dev/null and b/sc/qa/extras/testdocuments/ScDatabaseRangeObj.ods differ ___ Libreoffice-commits mailing list Libreoffice-commits@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] .: sc/qa
sc/qa/unoapi/knownissues.xcl | 28 +++- 1 file changed, 11 insertions(+), 17 deletions(-) New commits: commit f4060a56bf8f82367d1a18482f0e2c4c90ea9a1c Author: Markus Mohrhard markus.mohrh...@googlemail.com Date: Mon Jan 30 00:34:06 2012 +0100 clean-up sc's knownissues.xcl diff --git a/sc/qa/unoapi/knownissues.xcl b/sc/qa/unoapi/knownissues.xcl index f232ee9..33bed84 100644 --- a/sc/qa/unoapi/knownissues.xcl +++ b/sc/qa/unoapi/knownissues.xcl @@ -7,9 +7,6 @@ sc.ScAreaLinksObj::com::sun::star::sheet::XAreaLinks ### i84711 ### sc.ScAreaLinkObj::com::sun::star::util::XRefreshable -### i84697 ### -sc.ScNamedRangesObj::com::sun::star::sheet::XNamedRanges - ### i84674 ### sc.ScCellTextCursor::com::sun::star::beans::XMultiPropertyStates sc.ScHeaderFooterTextCursor::com::sun::star::beans::XMultiPropertyStates @@ -192,9 +189,6 @@ sc.ScAnnotationsObj::com::sun::star::container::XElementAccess sc.ScCellObj::com::sun::star::sheet::XSheetAnnotationAnchor sc.ScDataPilotFieldObj::com::sun::star::sheet::XDataPilotFieldGrouping -### i110862 ### -sc.ScDataPilotTableObj::com::sun::star::sheet::XDataPilotTable - ### i111032 ### sc.ScAccessibleCell::com::sun::star::accessibility::XAccessibleText @@ -207,32 +201,32 @@ sc.ScCellObj::com::sun::star::table::CellProperties sc.ScCellObj::com::sun::star::style::CharacterProperties sc.ScCellObj::com::sun::star::beans::XPropertySet sc.ScCellRangeObj::com::sun::star::table::CellProperties -sc.ScCellRangeObj::com::sun::star::util::XReplaceable -sc.ScCellRangeObj::com::sun::star::sheet::XCellRangesQuery sc.ScCellRangesObj::com::sun::star::table::CellProperties sc.ScCellRangesObj::com::sun::star::beans::XPropertySet -sc.ScDataPilotFieldObj::com::sun::star::sheet::DataPilotField ### fdo43309 ### sc.ScCellRangeObj::com::sun::star::chart::XChartData -### fdo43376 ### -sc.ScDDELinksObj -sc.ScDDELinkObj - ### fdo44167 ### sc.ScDatabaseRangeObj::com::sun::star::sheet::XDatabaseRange sc.ScDatabaseRangeObj::com::sun::star::util::XRefreshable ### c++ based tests ### +sc.ScCellRangeObj::com::sun::star::sheet::sheet::XCellRangesQuery +sc.ScCellRangeObj::com::sun::star::table::CellProperties +sc.ScCellRangeObj::com::sun::star::util::XSearchable +sc.ScCellRangeObj::com::sun::star::sheet::XCellRangesQuery +sc.ScCellRangeObj::com::sun::star::util::XReplaceable +sc.ScDataPilotFieldObj::com::sun::star::sheet::XDataPilotFieldGrouping +sc.ScDataPilotFieldObj::com::sun::star::sheet::DataPilotField +sc.ScDataPilotFieldObj::com::sun::star::sheet::DataPilotField sc.ScDataPilotTableObj::com::sun::star::sheet::XDataPilotTable sc.ScDataPilotTableObj::com::sun::star::sheet::XDataPilotDescriptor sc.ScDataPilotTableObj::com::sun::star::container::XNamed -sc.ScDataPilotFieldObj::com::sun::star::sheet::XDataPilotFieldGrouping -sc.ScDataPilotFieldObj::com::sun::star::sheet::DataPilotField +sc.ScDataPilotTableObj::com::sun::star::sheet::XDataPilotTable sc.ScNamedRangeObj::com::sun::star::sheet::XNamedRange sc.ScNamedRangesObj::com::sun::star::sheet::XNamedRanges +sc.ScTableSheetObj::com::sun::star::util::XSearchable +sc.ScTableSheetObj::com::sun::star::util::XReplaceable sc.ScTableSheetsObj::com::sun::star::container::XNamedContainer sc.ScTableSheetsObj::com::sun::star::sheet::XSpreadsheet2 -sc.ScCellRangeObj::com::sun::star::sheet::sheet::XCellRangesQuery -sc.ScCellRangeObj::com::sun::star::table::CellProperties ___ Libreoffice-commits mailing list Libreoffice-commits@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] .: sc/qa
sc/qa/unit/ucalc.cxx | 96 +-- 1 file changed, 94 insertions(+), 2 deletions(-) New commits: commit 85d34beec5f8196896487c96028b2dc2ce3cf6c8 Author: Kohei Yoshida kohei.yosh...@suse.com Date: Wed Jan 25 12:50:54 2012 -0500 New unit test for pivot table's date output handling. We rely on the cell type of those date value outputs when grouping by date or value range. diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx index 7f5f143..ec31a04 100644 --- a/sc/qa/unit/ucalc.cxx +++ b/sc/qa/unit/ucalc.cxx @@ -130,6 +130,13 @@ public: void testPivotTableLabels(); /** + * Make sure that we set cells displaying date values numeric cells, + * rather than text cells. Grouping by date or number functionality + * depends on this. + */ +void testPivotTableDateLabels(); + +/** * Test for pivot table's filtering functionality by page fields. */ void testPivotTableFilters(); @@ -190,6 +197,7 @@ public: CPPUNIT_TEST(testMatrix); CPPUNIT_TEST(testPivotTable); CPPUNIT_TEST(testPivotTableLabels); +CPPUNIT_TEST(testPivotTableDateLabels); CPPUNIT_TEST(testPivotTableFilters); CPPUNIT_TEST(testPivotTableNamedSource); CPPUNIT_TEST(testSheetCopy); @@ -1144,13 +1152,13 @@ bool checkDPTableOutput(ScDocument* pDoc, const ScRange aOutRange, const char* bool bEqual = aCheckVal.equals(aVal); if (!bEqual) { -cerr Expected: aCheckValActual: aVal endl; +cout Expected: aCheckValActual: aVal endl; bResult = false; } } else if (!aVal.isEmpty()) { -cerr Empty cell expected endl; +cout Empty cell expected endl; bResult = false; } } @@ -1476,6 +1484,90 @@ void Test::testPivotTableLabels() CPPUNIT_ASSERT_MESSAGE(Table output check failed, bSuccess); } +pDPs-FreeTable(pDPObj); + +m_pDoc-DeleteTab(1); +m_pDoc-DeleteTab(0); +} + +void Test::testPivotTableDateLabels() +{ +m_pDoc-InsertTab(0, OUString(RTL_CONSTASCII_USTRINGPARAM(Data))); +m_pDoc-InsertTab(1, OUString(RTL_CONSTASCII_USTRINGPARAM(Table))); + +// Dimension definition +DPFieldDef aFields[] = { +{ Name, sheet::DataPilotFieldOrientation_ROW }, +{ Date, sheet::DataPilotFieldOrientation_COLUMN }, +{ Value, sheet::DataPilotFieldOrientation_DATA } +}; + +// Raw data +const char* aData[][3] = { +{ Zena, 2011-1-1, 30 }, +{ Yodel, 2011-1-2, 20 }, +{ Xavior, 2011-1-3, 45 } +}; + +size_t nFieldCount = SAL_N_ELEMENTS(aFields); +size_t nDataCount = SAL_N_ELEMENTS(aData); + +ScRange aSrcRange = insertDPSourceData(m_pDoc, aFields, nFieldCount, aData, nDataCount); +SCROW nRow1 = aSrcRange.aStart.Row(), nRow2 = aSrcRange.aEnd.Row(); +SCCOL nCol1 = aSrcRange.aStart.Col(), nCol2 = aSrcRange.aEnd.Col(); + +ScDPObject* pDPObj = createDPFromRange( +m_pDoc, ScRange(nCol1, nRow1, 0, nCol2, nRow2, 0), aFields, nFieldCount, false); + +ScDPCollection* pDPs = m_pDoc-GetDPCollection(); +bool bSuccess = pDPs-InsertNewTable(pDPObj); +CPPUNIT_ASSERT_MESSAGE(failed to insert a new datapilot object into document, bSuccess); +CPPUNIT_ASSERT_MESSAGE(there should be only one data pilot table., + pDPs-GetCount() == 1); +pDPObj-SetName(pDPs-CreateNewName()); + +bool bOverFlow = false; +ScRange aOutRange = pDPObj-GetNewOutputRange(bOverFlow); +CPPUNIT_ASSERT_MESSAGE(Table overflow!?, !bOverFlow); + +pDPObj-Output(aOutRange.aStart); +aOutRange = pDPObj-GetOutRange(); + +{ +// Expected output table content. 0 = empty cell +const char* aOutputCheck[][5] = { +{ Sum - Value, Date, 0, 0, 0 }, +{ Name, 2011-01-01, 2011-01-02, 2011-01-03, Total Result }, +{ Xavior, 0, 0, 45, 45 }, +{ Yodel, 0, 20, 0, 20 }, +{ Zena, 30, 0, 0, 30 }, +{ Total Result, 30, 20, 45, 95 } +}; + +bSuccess = checkDPTableOutput5(m_pDoc, aOutRange, aOutputCheck, DataPilot table output); +CPPUNIT_ASSERT_MESSAGE(Table output check failed, bSuccess); +} + +{ +const char* aChecks[] = { +2011-01-01, 2011-01-02, 2011-01-03 +}; + +// Make sure those cells that contain dates are numeric. +SCROW nRow = aOutRange.aStart.Row() + 1; +nCol1 = aOutRange.aStart.Col() + 1; +nCol2 = nCol1 + 2; +for (SCCOL nCol = nCol1; nCol = nCol2; ++nCol) +{ +OUString aVal = m_pDoc-GetString(nCol, nRow, 1); +CPPUNIT_ASSERT_MESSAGE(Cell value is not as expected., aVal.equalsAscii(aChecks[nCol-nCol1])); +
[Libreoffice-commits] .: sc/qa
sc/qa/extras/scdatapilottableobj.cxx |4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) New commits: commit f8214f0f1d66c6b96b3663dcb3cd71280bcd0d39 Author: Markus Mohrhard markus.mohrh...@googlemail.com Date: Tue Jan 24 00:08:08 2012 +0100 enable ScDataPilotTableObj::testRefresh again diff --git a/sc/qa/extras/scdatapilottableobj.cxx b/sc/qa/extras/scdatapilottableobj.cxx index 6d07b8f..a09eb6e 100644 --- a/sc/qa/extras/scdatapilottableobj.cxx +++ b/sc/qa/extras/scdatapilottableobj.cxx @@ -38,7 +38,7 @@ namespace sc_apitest { -#define NUMBER_OF_TESTS 9 +#define NUMBER_OF_TESTS 10 class ScDataPilotTableObj : public UnoApiTest, apitest::XDataPilotDescriptor, apitest::XDataPilotTable { @@ -48,7 +48,7 @@ public: virtual uno::Reference uno::XInterface init(); CPPUNIT_TEST_SUITE(ScDataPilotTableObj); -//CPPUNIT_TEST(testRefresh); +CPPUNIT_TEST(testRefresh); //CPPUNIT_TEST(testGetHiddenFields); CPPUNIT_TEST(testGetOutputRange); CPPUNIT_TEST(testSourceRange); ___ Libreoffice-commits mailing list Libreoffice-commits@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] .: sc/qa
sc/qa/extras/xdatapilotdescriptor.cxx | 10 +- 1 file changed, 5 insertions(+), 5 deletions(-) New commits: commit 16af33302b19fd90c5c24031e23a7c36e3b6b412 Author: Stephan Bergmann sberg...@redhat.com Date: Thu Jan 19 11:21:57 2012 +0100 Fix C++03 enum member scope. diff --git a/sc/qa/extras/xdatapilotdescriptor.cxx b/sc/qa/extras/xdatapilotdescriptor.cxx index 97612e8..e5151d5 100644 --- a/sc/qa/extras/xdatapilotdescriptor.cxx +++ b/sc/qa/extras/xdatapilotdescriptor.cxx @@ -156,35 +156,35 @@ void ScXDataPilotDescriptor::testGetDataPilotFields_Impl( uno::Reference sheet: case 0: { uno::Any aAny; -aAny= sheet::DataPilotFieldOrientation::DataPilotFieldOrientation_COLUMN; + aAny= sheet::DataPilotFieldOrientation_COLUMN; xPropSet-setPropertyValue(aOrientation, aAny); } break; case 1: { uno::Any aAny; -aAny= sheet::DataPilotFieldOrientation::DataPilotFieldOrientation_ROW; +aAny= sheet::DataPilotFieldOrientation_ROW; xPropSet-setPropertyValue(aOrientation, aAny); } break; case 2: { uno::Any aAny; -aAny= sheet::DataPilotFieldOrientation::DataPilotFieldOrientation_DATA; +aAny= sheet::DataPilotFieldOrientation_DATA; xPropSet-setPropertyValue(aOrientation, aAny); } break; case 3: { uno::Any aAny; -aAny= sheet::DataPilotFieldOrientation::DataPilotFieldOrientation_HIDDEN; +aAny= sheet::DataPilotFieldOrientation_HIDDEN; xPropSet-setPropertyValue(aOrientation, aAny); } break; case 4: { uno::Any aAny; -aAny= sheet::DataPilotFieldOrientation::DataPilotFieldOrientation_PAGE; +aAny= sheet::DataPilotFieldOrientation_PAGE; xPropSet-setPropertyValue(aOrientation, aAny); } break; ___ Libreoffice-commits mailing list Libreoffice-commits@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] .: sc/qa
sc/qa/extras/xdatapilotdescriptor.cxx |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) New commits: commit c4e5e06ecca8c7f7f83e2e6e784157a3f2a93ef8 Author: Stephan Bergmann sberg...@redhat.com Date: Thu Jan 19 11:26:08 2012 +0100 Undo inadvertent indentation change. diff --git a/sc/qa/extras/xdatapilotdescriptor.cxx b/sc/qa/extras/xdatapilotdescriptor.cxx index e5151d5..e58c145 100644 --- a/sc/qa/extras/xdatapilotdescriptor.cxx +++ b/sc/qa/extras/xdatapilotdescriptor.cxx @@ -156,7 +156,7 @@ void ScXDataPilotDescriptor::testGetDataPilotFields_Impl( uno::Reference sheet: case 0: { uno::Any aAny; - aAny= sheet::DataPilotFieldOrientation_COLUMN; +aAny= sheet::DataPilotFieldOrientation_COLUMN; xPropSet-setPropertyValue(aOrientation, aAny); } break; ___ Libreoffice-commits mailing list Libreoffice-commits@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] .: sc/qa
sc/qa/unit/ucalc.cxx |1 - 1 file changed, 1 deletion(-) New commits: commit 05fa6914d38abea3c29ab360c62d2f153896798a Author: Kohei Yoshida kohei.yosh...@suse.com Date: Thu Jan 12 22:06:45 2012 -0500 Removing debug statement. diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx index ad412ef..1afe05f 100644 --- a/sc/qa/unit/ucalc.cxx +++ b/sc/qa/unit/ucalc.cxx @@ -724,7 +724,6 @@ void testFuncCELL(ScDocument* pDoc) for (size_t i = 0; i SAL_N_ELEMENTS(aChecks); ++i) { rtl::OUString aVal = pDoc-GetString(0, i, 0); -cout CELL: aVal endl; CPPUNIT_ASSERT_MESSAGE(Unexpected result for CELL, aVal.equalsAscii(aChecks[i].pRes)); } } ___ Libreoffice-commits mailing list Libreoffice-commits@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] .: sc/qa
sc/qa/unit/ucalc.cxx | 31 +++ 1 file changed, 31 insertions(+) New commits: commit 75bc746b97b5d1e08cd26c7bb5afde348085f6bf Author: Kohei Yoshida kohei.yosh...@suse.com Date: Wed Jan 11 16:23:45 2012 -0500 Unit test for repositioning of cell-anchored line objects. Preivously, before my fix, relocating a cell-anchored bottom-left to top-right line object would get flipped when its position changed. This is a test for that use case. diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx index d45ddb4..c843eb7 100644 --- a/sc/qa/unit/ucalc.cxx +++ b/sc/qa/unit/ucalc.cxx @@ -62,11 +62,13 @@ #include formula/IFunctionDescription.hxx +#include basegfx/polygon/b2dpolygon.hxx #include editeng/boxitem.hxx #include svx/svdograf.hxx #include svx/svdpage.hxx #include svx/svdocirc.hxx +#include svx/svdopath.hxx #include sfx2/docfile.hxx @@ -2504,6 +2506,35 @@ void Test::testGraphicsInGroup() CPPUNIT_ASSERT_MESSAGE(Failed to move back to its original position., aOrigRect == rNewRect); } +{ +// Add a line. +basegfx::B2DPolygon aTempPoly; +Point aStartPos(10,300), aEndPos(110,200); // bottom-left to top-right. +Rectangle aOrigRect(10,200,110,300); // 100 x 100 +aTempPoly.append(basegfx::B2DPoint(aStartPos.X(), aStartPos.Y())); +aTempPoly.append(basegfx::B2DPoint(aEndPos.X(), aEndPos.Y())); +SdrPathObj* pObj = new SdrPathObj(OBJ_LINE, basegfx::B2DPolyPolygon(aTempPoly)); +pObj-NbcSetLogicRect(aOrigRect); +pPage-InsertObject(pObj); +const Rectangle rNewRect = pObj-GetLogicRect(); +CPPUNIT_ASSERT_MESSAGE(Size differ., aOrigRect == rNewRect); + +ScDrawLayer::SetCellAnchoredFromPosition(*pObj, *m_pDoc, 0); +CPPUNIT_ASSERT_MESSAGE(Size changed when cell-anchored. Not good., + aOrigRect == rNewRect); + +// Insert 2 rows at the top and delete them immediately. +m_pDoc-InsertRow(0, 0, MAXCOL, 0, 0, 2); +m_pDoc-DeleteRow(0, 0, MAXCOL, 0, 0, 2); +CPPUNIT_ASSERT_MESSAGE(Size of a line object changed after row insertion and removal., + aOrigRect == rNewRect); + +sal_Int32 n = pObj-GetPointCount(); +CPPUNIT_ASSERT_MESSAGE(There should be exactly 2 points in a line object., n == 2); +CPPUNIT_ASSERT_MESSAGE(Line shape has changed., + aStartPos == pObj-GetPoint(0) aEndPos == pObj-GetPoint(1)); +} + m_pDoc-DeleteTab(0); } ___ Libreoffice-commits mailing list Libreoffice-commits@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] .: sc/qa
sc/qa/unit/data/contentCSV/rangeExp_Sheet2.csv |1 + sc/qa/unit/data/ods/named-ranges-global.ods|binary sc/qa/unit/data/xls/named-ranges-global.xls|binary sc/qa/unit/data/xlsx/named-ranges-global.xlsx |binary 4 files changed, 1 insertion(+) New commits: commit c82de8f8eb39d72394c82b1a29c8566f42302867 Author: Markus Mohrhard markus.mohrh...@googlemail.com Date: Thu Jan 12 04:28:55 2012 +0100 add test for range name import, related fdo#42624 this adds range names referencing range names that are loaded after the referencing range name diff --git a/sc/qa/unit/data/contentCSV/rangeExp_Sheet2.csv b/sc/qa/unit/data/contentCSV/rangeExp_Sheet2.csv index 24778a9..f6d5971 100644 --- a/sc/qa/unit/data/contentCSV/rangeExp_Sheet2.csv +++ b/sc/qa/unit/data/contentCSV/rangeExp_Sheet2.csv @@ -3,3 +3,4 @@ 0 1, 2, 3 4, 5, 6 +5 diff --git a/sc/qa/unit/data/ods/named-ranges-global.ods b/sc/qa/unit/data/ods/named-ranges-global.ods index 8a8bbe2..84f79ac 100644 Binary files a/sc/qa/unit/data/ods/named-ranges-global.ods and b/sc/qa/unit/data/ods/named-ranges-global.ods differ diff --git a/sc/qa/unit/data/xls/named-ranges-global.xls b/sc/qa/unit/data/xls/named-ranges-global.xls index 993c8af..7ab1b7b 100644 Binary files a/sc/qa/unit/data/xls/named-ranges-global.xls and b/sc/qa/unit/data/xls/named-ranges-global.xls differ diff --git a/sc/qa/unit/data/xlsx/named-ranges-global.xlsx b/sc/qa/unit/data/xlsx/named-ranges-global.xlsx index e3fa9fb..3bb0cbc 100644 Binary files a/sc/qa/unit/data/xlsx/named-ranges-global.xlsx and b/sc/qa/unit/data/xlsx/named-ranges-global.xlsx differ ___ Libreoffice-commits mailing list Libreoffice-commits@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] .: sc/qa sc/source
sc/qa/unit/ucalc.cxx | 17 + sc/source/core/data/drwlayer.cxx |3 ++- 2 files changed, 19 insertions(+), 1 deletion(-) New commits: commit d831f352ba4969f4e5ed0d1057a773d5a472d4aa Author: Kohei Yoshida kohei.yosh...@suse.com Date: Sat Jan 7 19:09:24 2012 -0500 More unit test code for drawing objects. Found another bug fixed it. Inserting a new sheet would not update the anchored sheet index. Fixed. diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx index 1adc2bf..c9c6b4b 100644 --- a/sc/qa/unit/ucalc.cxx +++ b/sc/qa/unit/ucalc.cxx @@ -48,6 +48,7 @@ #include attrib.hxx #include dbdata.hxx #include reftokenhelper.hxx +#include userdat.hxx #include docsh.hxx #include docfunc.hxx @@ -2526,6 +2527,10 @@ void Test::testGraphicsOnSheetMove() CPPUNIT_ASSERT_MESSAGE(There should be one object on the 1st sheet., pPage-GetObjCount() == 1); +const ScDrawObjData* pData = ScDrawLayer::GetObjData(pObj); +CPPUNIT_ASSERT_MESSAGE(Object meta-data doesn't exist., pData); +CPPUNIT_ASSERT_MESSAGE(Wrong sheet ID in cell anchor data!, pData-maStart.Tab() == 0 pData-maEnd.Tab() == 0); + pPage = pDrawLayer-GetPage(1); CPPUNIT_ASSERT_MESSAGE(No page instance for the 2nd sheet., pPage); CPPUNIT_ASSERT_MESSAGE(2nd sheet shouldn't have any object., pPage-GetObjCount() == 0); @@ -2541,6 +2546,8 @@ void Test::testGraphicsOnSheetMove() pPage = pDrawLayer-GetPage(2); CPPUNIT_ASSERT_MESSAGE(3rd sheet should have no object., pPage pPage-GetObjCount() == 0); +CPPUNIT_ASSERT_MESSAGE(Wrong sheet ID in cell anchor data!, pData-maStart.Tab() == 1 pData-maEnd.Tab() == 1); + // Now, delete the sheet that just got inserted. The object should be back // on the 1st sheet. m_pDoc-DeleteTab(0); @@ -2549,6 +2556,16 @@ void Test::testGraphicsOnSheetMove() CPPUNIT_ASSERT_MESSAGE(Size and position of the object shouldn't change., pObj-GetLogicRect() == aObjRect); +CPPUNIT_ASSERT_MESSAGE(Wrong sheet ID in cell anchor data!, pData-maStart.Tab() == 0 pData-maEnd.Tab() == 0); + +// Move the 1st sheet to the last position. +m_pDoc-MoveTab(0, 1); +pPage = pDrawLayer-GetPage(0); +CPPUNIT_ASSERT_MESSAGE(1st sheet should have no object., pPage pPage-GetObjCount() == 0); +pPage = pDrawLayer-GetPage(1); +CPPUNIT_ASSERT_MESSAGE(2nd sheet should have one object., pPage pPage-GetObjCount() == 1); +CPPUNIT_ASSERT_MESSAGE(Wrong sheet ID in cell anchor data!, pData-maStart.Tab() == 1 pData-maEnd.Tab() == 1); + m_pDoc-DeleteTab(1); m_pDoc-DeleteTab(0); } diff --git a/sc/source/core/data/drwlayer.cxx b/sc/source/core/data/drwlayer.cxx index 69f289a..087d510 100644 --- a/sc/source/core/data/drwlayer.cxx +++ b/sc/source/core/data/drwlayer.cxx @@ -390,7 +390,8 @@ sal_Bool ScDrawLayer::ScAddPage( SCTAB nTab ) if (bRecording) AddCalcUndo(new SdrUndoNewPage(*pPage)); -return sal_True;// inserted +ResetTab(nTab, pDoc-GetTableCount()-1); +return true;// inserted } void ScDrawLayer::ScRemovePage( SCTAB nTab ) ___ Libreoffice-commits mailing list Libreoffice-commits@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] .: sc/qa
sc/qa/unit/ucalc.cxx | 13 - 1 file changed, 12 insertions(+), 1 deletion(-) New commits: commit 5bc315f5f50b9f1cf5b4fd8b6bcba62f6d9ad1ab Author: Kohei Yoshida kohei.yosh...@suse.com Date: Sat Jan 7 19:20:20 2012 -0500 More unit test code to test copying a sheet with drawing object. diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx index c9c6b4b..18fb569 100644 --- a/sc/qa/unit/ucalc.cxx +++ b/sc/qa/unit/ucalc.cxx @@ -2521,7 +2521,7 @@ void Test::testGraphicsOnSheetMove() // Insert an object. Rectangle aObjRect(2,2,100,100); -SdrRectObj* pObj = new SdrRectObj(aObjRect); +SdrObject* pObj = new SdrRectObj(aObjRect); pPage-InsertObject(pObj); ScDrawLayer::SetCellAnchoredFromPosition(*pObj, *m_pDoc, 0); @@ -2566,6 +2566,17 @@ void Test::testGraphicsOnSheetMove() CPPUNIT_ASSERT_MESSAGE(2nd sheet should have one object., pPage pPage-GetObjCount() == 1); CPPUNIT_ASSERT_MESSAGE(Wrong sheet ID in cell anchor data!, pData-maStart.Tab() == 1 pData-maEnd.Tab() == 1); +// Copy the 2nd sheet, which has one drawing object to the last position. +m_pDoc-CopyTab(1, 2); +pPage = pDrawLayer-GetPage(2); +CPPUNIT_ASSERT_MESSAGE(Copied sheet should have one object., pPage pPage-GetObjCount() == 1); +pObj = pPage-GetObj(0); +CPPUNIT_ASSERT_MESSAGE(Failed to get drawing object., pObj); +pData = ScDrawLayer::GetObjData(pObj); +CPPUNIT_ASSERT_MESSAGE(Failed to get drawing object meta-data., pData); +CPPUNIT_ASSERT_MESSAGE(Wrong sheet ID in cell anchor data!, pData-maStart.Tab() == 2 pData-maEnd.Tab() == 2); + +m_pDoc-DeleteTab(2); m_pDoc-DeleteTab(1); m_pDoc-DeleteTab(0); } ___ Libreoffice-commits mailing list Libreoffice-commits@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] .: sc/qa
sc/qa/unit/ucalc.cxx | 117 ++- 1 file changed, 97 insertions(+), 20 deletions(-) New commits: commit f0c9362d9dca4bda4f3d87e181a2b59fcc08d7d2 Author: Kohei Yoshida kohei.yosh...@suse.com Date: Fri Jan 6 23:59:40 2012 -0500 New unit test code for drawing objects. diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx index 5471c47..1adc2bf 100644 --- a/sc/qa/unit/ucalc.cxx +++ b/sc/qa/unit/ucalc.cxx @@ -65,6 +65,7 @@ #include svx/svdograf.hxx #include svx/svdpage.hxx +#include svx/svdocirc.hxx #include sfx2/docfile.hxx @@ -151,6 +152,7 @@ public: void testFunctionLists(); void testGraphicsInGroup(); +void testGraphicsOnSheetMove(); void testPostIts(); @@ -186,6 +188,7 @@ public: CPPUNIT_TEST(testExternalRefFunctions); CPPUNIT_TEST(testDataArea); CPPUNIT_TEST(testGraphicsInGroup); +CPPUNIT_TEST(testGraphicsOnSheetMove); CPPUNIT_TEST(testPostIts); CPPUNIT_TEST(testStreamValid); CPPUNIT_TEST(testFunctionLists); @@ -2447,32 +2450,106 @@ void Test::testGraphicsInGroup() SdrPage* pPage = pDrawLayer-GetPage(0); CPPUNIT_ASSERT_MESSAGE(must have a draw page, pPage != NULL); -//Add a square -Rectangle aOrigRect(2,2,100,100); -SdrRectObj *pObj = new SdrRectObj(aOrigRect); -pPage-InsertObject(pObj); -const Rectangle rNewRect = pObj-GetLogicRect(); -CPPUNIT_ASSERT_MESSAGE(must have equal position and size, aOrigRect == rNewRect); +{ +//Add a square +Rectangle aOrigRect(2,2,100,100); +SdrRectObj *pObj = new SdrRectObj(aOrigRect); +pPage-InsertObject(pObj); +const Rectangle rNewRect = pObj-GetLogicRect(); +CPPUNIT_ASSERT_MESSAGE(must have equal position and size, aOrigRect == rNewRect); + +ScDrawLayer::SetPageAnchored(*pObj); + +//Use a range of rows guaranteed to include all of the square +m_pDoc-ShowRows(0, 100, 0, false); +CPPUNIT_ASSERT_MESSAGE(Should not change when page anchored, aOrigRect == rNewRect); +m_pDoc-ShowRows(0, 100, 0, true); +CPPUNIT_ASSERT_MESSAGE(Should not change when page anchored, aOrigRect == rNewRect); + +ScDrawLayer::SetCellAnchoredFromPosition(*pObj, *m_pDoc, 0); +CPPUNIT_ASSERT_MESSAGE(That shouldn't change size or positioning, aOrigRect == rNewRect); + +m_pDoc-ShowRows(0, 100, 0, false); +CPPUNIT_ASSERT_MESSAGE(Left and Right should be unchanged, +aOrigRect.nLeft == rNewRect.nLeft aOrigRect.nRight == rNewRect.nRight); +CPPUNIT_ASSERT_MESSAGE(Height should be minimum allowed height, +(rNewRect.nBottom - rNewRect.nTop) = 1); +m_pDoc-ShowRows(0, 100, 0, true); +CPPUNIT_ASSERT_MESSAGE(Should not change when page anchored, aOrigRect == rNewRect); +} -ScDrawLayer::SetPageAnchored(*pObj); +{ +// Add a circle. +Rectangle aOrigRect = Rectangle(10,10,210,210); // 200 x 200 +SdrCircObj* pObj = new SdrCircObj(OBJ_CIRC, aOrigRect); +pPage-InsertObject(pObj); +const Rectangle rNewRect = pObj-GetLogicRect(); +CPPUNIT_ASSERT_MESSAGE(Position and size of the circle shouldn't change when inserted into the page., + aOrigRect == rNewRect); + +ScDrawLayer::SetCellAnchoredFromPosition(*pObj, *m_pDoc, 0); +CPPUNIT_ASSERT_MESSAGE(Size changed when cell anchored. Not good., + aOrigRect == rNewRect); + +// Insert 2 rows at the top. This should push the circle object down. +m_pDoc-InsertRow(0, 0, MAXCOL, 0, 0, 2); + +// Make sure the size of the circle is still identical. +CPPUNIT_ASSERT_MESSAGE(Size of the circle has changed, but shouldn't!, + aOrigRect.GetSize() == rNewRect.GetSize()); + +// Delete 2 rows at the top. This should bring the circle object to its original position. +m_pDoc-DeleteRow(0, 0, MAXCOL, 0, 0, 2); +CPPUNIT_ASSERT_MESSAGE(Failed to move back to its original position., aOrigRect == rNewRect); +} -//Use a range of rows guaranteed to include all of the square -m_pDoc-ShowRows(0, 100, 0, false); -CPPUNIT_ASSERT_MESSAGE(Should not change when page anchored, aOrigRect == rNewRect); -m_pDoc-ShowRows(0, 100, 0, true); -CPPUNIT_ASSERT_MESSAGE(Should not change when page anchored, aOrigRect == rNewRect); +m_pDoc-DeleteTab(0); +} +void Test::testGraphicsOnSheetMove() +{ +m_pDoc-InsertTab(0, rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(Tab1))); +m_pDoc-InsertTab(1, rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(Tab2))); +CPPUNIT_ASSERT_MESSAGE(There should be only 2 sheets to begin with, m_pDoc-GetTableCount() == 2); + +m_pDoc-InitDrawLayer(); +ScDrawLayer* pDrawLayer = m_pDoc-GetDrawLayer(); +CPPUNIT_ASSERT_MESSAGE(No drawing layer., pDrawLayer); +SdrPage* pPage =
[Libreoffice-commits] .: sc/qa
sc/qa/unit/ucalc.cxx | 92 +++ 1 file changed, 92 insertions(+) New commits: commit bc4699ba6e05af115ffed17e2938e3176f3f930a Author: Kohei Yoshida kohei.yosh...@suse.com Date: Wed Jan 4 12:59:32 2012 -0500 New unit test to test jumping to precedent / dependent cells. The test doesn't do the actual jumping, but it only tests the validity of the destination range(s). diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx index f98195d..5471c47 100644 --- a/sc/qa/unit/ucalc.cxx +++ b/sc/qa/unit/ucalc.cxx @@ -47,6 +47,7 @@ #include postit.hxx #include attrib.hxx #include dbdata.hxx +#include reftokenhelper.hxx #include docsh.hxx #include docfunc.hxx @@ -160,6 +161,12 @@ public: */ void testToggleRefFlag(); +/** + * Test to make sure correct precedent / dependent cells are obtained when + * preparing to jump to them. + */ +void testJumpToPrecedentsDependents(); + CPPUNIT_TEST_SUITE(Test); CPPUNIT_TEST(testCollator); CPPUNIT_TEST(testInput); @@ -187,6 +194,7 @@ public: CPPUNIT_TEST(testCopyPaste); CPPUNIT_TEST(testMergedCells); CPPUNIT_TEST(testUpdateReference); +CPPUNIT_TEST(testJumpToPrecedentsDependents); CPPUNIT_TEST_SUITE_END(); private: @@ -2875,6 +2883,90 @@ void Test::testUpdateReference() m_pDoc-DeleteTab(0); } +namespace { + +bool hasRange(const std::vectorScTokenRef rRefTokens, const ScRange rRange) +{ +std::vectorScTokenRef::const_iterator it = rRefTokens.begin(), itEnd = rRefTokens.end(); +for (; it != itEnd; ++it) +{ +const ScTokenRef p = *it; +if (!ScRefTokenHelper::isRef(p) || ScRefTokenHelper::isExternalRef(p)) +continue; + +switch (p-GetType()) +{ +case formula::svSingleRef: +{ +ScSingleRefData aData = p-GetSingleRef(); +if (rRange.aStart != rRange.aEnd) +break; + +ScAddress aThis(aData.nCol, aData.nRow, aData.nTab); +if (aThis == rRange.aStart) +return true; +} +break; +case formula::svDoubleRef: +{ +ScComplexRefData aData = p-GetDoubleRef(); +ScRange aThis(aData.Ref1.nCol, aData.Ref1.nRow, aData.Ref1.nTab, aData.Ref2.nCol, aData.Ref2.nRow, aData.Ref2.nTab); +if (aThis == rRange) +return true; +} +break; +default: +; +} +} +return false; +} + +} + +void Test::testJumpToPrecedentsDependents() +{ +// Precedent is another cell that the cell references, while dependent is +// another cell that references it. +m_pDoc-InsertTab(0, rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(Test))); + +m_pDoc-SetString(2, 0, 0, rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(=A1+A2+B3))); // C1 +m_pDoc-SetString(2, 1, 0, rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(=A1))); // C2 +m_pDoc-CalcAll(); + +std::vectorScTokenRef aRefTokens; +ScDocFunc rDocFunc = m_xDocShRef-GetDocFunc(); + +{ +// C1's precedent should be A1:A2,B3. +ScRangeList aRange(ScRange(2, 0, 0)); +rDocFunc.DetectiveCollectAllPreds(aRange, aRefTokens); +CPPUNIT_ASSERT_MESSAGE(A1:A2 should be a precedent of C1., + hasRange(aRefTokens, ScRange(0, 0, 0, 0, 1, 0))); +CPPUNIT_ASSERT_MESSAGE(B3 should be a precedent of C1., + hasRange(aRefTokens, ScRange(1, 2, 0))); +} + +{ +// C2's precedent should be A1 only. +ScRangeList aRange(ScRange(2, 1, 0)); +rDocFunc.DetectiveCollectAllPreds(aRange, aRefTokens); +CPPUNIT_ASSERT_MESSAGE(there should only be one reference token., + aRefTokens.size() == 1); +CPPUNIT_ASSERT_MESSAGE(A1 should be a precedent of C1., + hasRange(aRefTokens, ScRange(0, 0, 0))); +} + +{ +// A1's dependent should be C1:C2. +ScRangeList aRange(ScRange(0, 0, 0)); +rDocFunc.DetectiveCollectAllSuccs(aRange, aRefTokens); +CPPUNIT_ASSERT_MESSAGE(C1:C2 should be the only dependent of A1., + aRefTokens.size() == 1 hasRange(aRefTokens, ScRange(2, 0, 0, 2, 1, 0))); +} + +m_pDoc-DeleteTab(0); +} CPPUNIT_TEST_SUITE_REGISTRATION(Test); ___ Libreoffice-commits mailing list Libreoffice-commits@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] .: sc/qa
sc/qa/extras/xnamecontainer.cxx | 85 1 file changed, 85 insertions(+) New commits: commit b77902d38d06df87694564ded859733bdb1d4fb2 Author: Markus Mohrhard markus.mohrh...@googlemail.com Date: Tue Dec 20 07:44:19 2011 +0100 add test case for ScTableSheetsObj::XNameContainer::removeByName diff --git a/sc/qa/extras/xnamecontainer.cxx b/sc/qa/extras/xnamecontainer.cxx new file mode 100644 index 000..0a42335 --- /dev/null +++ b/sc/qa/extras/xnamecontainer.cxx @@ -0,0 +1,85 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 markus.mohrh...@googlemail.com (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. + */ + +#include test/unoapi_test.hxx +#include com/sun/star/container/XNameContainer.hpp +#include com/sun/star/sheet/XSpreadsheetDocument.hpp + + +namespace ScTableSheetsObj +{ + +class ScXNameContainer : public UnoApiTest +{ +uno::Reference container::XNameContainer init(); + +void testRemoveByName(); + +CPPUNIT_TEST_SUITE(ScXNameContainer); +CPPUNIT_TEST(testRemoveByName); +CPPUNIT_TEST_SUITE_END(); +}; + +void ScXNameContainer::testRemoveByName() +{ +rtl::OUString aSheet2(RTL_CONSTASCII_USTRINGPARAM(Sheet2)); +uno::Reference container::XNameContainer xNameContainer = init(); +CPPUNIT_ASSERT(xNameContainer-hasByName(aSheet2)); +xNameContainer-removeByName(aSheet2); +CPPUNIT_ASSERT(!xNameContainer-hasByName(aSheet2)); + +bool bExceptionThrown = false; +try +{ +xNameContainer-removeByName(aSheet2); +} +catch( const container::NoSuchElementException ) +{ +std::cout Exception Caught std::endl; +bExceptionThrown = true; +} + +CPPUNIT_ASSERT_MESSAGE(no exception thrown, bExceptionThrown); +} + +uno::Reference container::XNameContainer ScXNameContainer::init() +{ +uno::Reference lang::XComponent xComponent; +xComponent = loadFromDesktop(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(private:factory/scalc))); +CPPUNIT_ASSERT(xComponent.is()); +uno::Reference sheet::XSpreadsheetDocument xDoc (xComponent, UNO_QUERY_THROW); +uno::Reference container::XNameContainer xNameContainer ( xDoc-getSheets(), UNO_QUERY_THROW); +CPPUNIT_ASSERT(xNameContainer.is()); +return xNameContainer; +} + +CPPUNIT_TEST_SUITE_REGISTRATION(ScXNameContainer); + +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ ___ Libreoffice-commits mailing list Libreoffice-commits@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] .: sc/qa
sc/qa/unit/ucalc.cxx |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) New commits: commit b71919511f7748af7c69a2d2da4e93af7eb7 Author: Markus Mohrhard markus.mohrh...@googlemail.com Date: Tue Dec 20 08:58:01 2011 +0100 disable failing test after my last rework of the copy paste code my old assumptions for the copy paste code are no longer valid diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx index a4158c3..c3d47ef 100644 --- a/sc/qa/unit/ucalc.cxx +++ b/sc/qa/unit/ucalc.cxx @@ -184,7 +184,7 @@ public: CPPUNIT_TEST(testFunctionLists); CPPUNIT_TEST(testToggleRefFlag); CPPUNIT_TEST(testAutofilter); -CPPUNIT_TEST(testCopyPaste); +//CPPUNIT_TEST(testCopyPaste); CPPUNIT_TEST(testMergedCells); CPPUNIT_TEST(testUpdateReference); CPPUNIT_TEST_SUITE_END(); ___ Libreoffice-commits mailing list Libreoffice-commits@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] .: sc/qa sc/source
sc/qa/extras/cellproperties.cxx |4 ++-- sc/qa/extras/tableautoformatfield.cxx |4 ++-- sc/source/filter/html/htmlpars.cxx|2 +- 3 files changed, 5 insertions(+), 5 deletions(-) New commits: commit e678311175acca14eca7ce07b3734f664f6f1b6a Author: Markus Mohrhard markus.mohrh...@googlemail.com Date: Tue Dec 6 00:59:20 2011 +0100 WaE: uninitialized value diff --git a/sc/qa/extras/cellproperties.cxx b/sc/qa/extras/cellproperties.cxx index 6ed0878..2f59002 100644 --- a/sc/qa/extras/cellproperties.cxx +++ b/sc/qa/extras/cellproperties.cxx @@ -53,7 +53,7 @@ void ScCellProperties::testVertJustify() uno::Reference beans::XPropertySet xCellRangeBase = init(); rtl::OUString aVertJustify(RTL_CONSTASCII_USTRINGPARAM(VertJustify)); uno::Any aOldVertJustify = xCellRangeBase-getPropertyValue(aVertJustify); -sal_Int32 aValue; +sal_Int32 aValue = 0; CPPUNIT_ASSERT(aOldVertJustify = aValue); std::cout Old VertJustify value: aValue std::endl; @@ -71,7 +71,7 @@ void ScCellProperties::testRotateReference() uno::Reference beans::XPropertySet xCellRangeBase = init(); rtl::OUString aRotateReference(RTL_CONSTASCII_USTRINGPARAM(RotateReference)); uno::Any aOldRotateReference = xCellRangeBase-getPropertyValue(aRotateReference); -sal_Int32 aValue; +sal_Int32 aValue = 0; CPPUNIT_ASSERT(aOldRotateReference = aValue); std::cout Old RotateReference Value: aValue std::endl; diff --git a/sc/qa/extras/tableautoformatfield.cxx b/sc/qa/extras/tableautoformatfield.cxx index e53758a..c4f5962 100644 --- a/sc/qa/extras/tableautoformatfield.cxx +++ b/sc/qa/extras/tableautoformatfield.cxx @@ -64,7 +64,7 @@ void ScTableAutoFormatField::testRotateReference() uno::Reference beans::XPropertySet xTableAutoFormatField = init(); rtl::OUString aRotateReference(RTL_CONSTASCII_USTRINGPARAM(RotateReference)); uno::Any aOldRotateReference = xTableAutoFormatField-getPropertyValue(aRotateReference); -sal_Int32 aValue; +sal_Int32 aValue = 0; CPPUNIT_ASSERT(aOldRotateReference = aValue); std::cout Old RotateReferene Value: aValue std::endl; @@ -82,7 +82,7 @@ void ScTableAutoFormatField::testVertJustify() uno::Reference beans::XPropertySet xTableAutoFormatField = init(); rtl::OUString aVertJustify(RTL_CONSTASCII_USTRINGPARAM(VertJustify)); uno::Any aOldVertJustify = xTableAutoFormatField-getPropertyValue(aVertJustify); -sal_Int32 aValue; +sal_Int32 aValue = 0; CPPUNIT_ASSERT(aOldVertJustify = aValue); std::cout Old VertJustify value: aValue std::endl; diff --git a/sc/source/filter/html/htmlpars.cxx b/sc/source/filter/html/htmlpars.cxx index cdd0534..323e1a2 100644 --- a/sc/source/filter/html/htmlpars.cxx +++ b/sc/source/filter/html/htmlpars.cxx @@ -532,7 +532,7 @@ void ScHTMLLayoutParser::Adjust() xLockedList-RemoveAll(); ScHTMLAdjustStack aStack; -ScHTMLAdjustStackEntry* pS; +ScHTMLAdjustStackEntry* pS = NULL; sal_uInt16 nTab = 0; SCCOL nLastCol = SCCOL_MAX; SCROW nNextRow = 0; ___ Libreoffice-commits mailing list Libreoffice-commits@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] .: sc/qa
sc/qa/extras/xcellrangesquery.cxx |8 1 file changed, 8 deletions(-) New commits: commit eb251522ebe462903c96881ae9b99814700c84d3 Author: Stephan Bergmann sberg...@redhat.com Date: Thu Dec 1 09:44:57 2011 +0100 -Werror=unused-parameter fix (completely removed unused setRowVisible()) diff --git a/sc/qa/extras/xcellrangesquery.cxx b/sc/qa/extras/xcellrangesquery.cxx index 9fc9139..5df4f71 100644 --- a/sc/qa/extras/xcellrangesquery.cxx +++ b/sc/qa/extras/xcellrangesquery.cxx @@ -47,8 +47,6 @@ public: uno::Referencesheet::XCellRangesQuery init(); -void setRowVisible(bool bVisible); - //Testcases void testQueryColumnDifference(); void testQueryContentDifference(); @@ -158,7 +156,6 @@ void ScXCellRangesQuery::testQueryRowDifference() void ScXCellRangesQuery::testQueryVisibleCells() { -setRowVisible(false); rtl::OUString aExpected(RTL_CONSTASCII_USTRINGPARAM(Sheet1.A2)); uno::Referencesheet::XCellRangesQuery xCellRangesQuery = init(); uno::Referencesheet::XSheetCellRanges xRanges = xCellRangesQuery-queryVisibleCells(); @@ -167,11 +164,6 @@ void ScXCellRangesQuery::testQueryVisibleCells() CPPUNIT_ASSERT_MESSAGE(testQueryFormulaCells, aResult == aExpected); } -void ScXCellRangesQuery::setRowVisible(bool bVisible) -{ - -} - CPPUNIT_TEST_SUITE_REGISTRATION(ScXCellRangesQuery); CPPUNIT_PLUGIN_IMPLEMENT(); ___ Libreoffice-commits mailing list Libreoffice-commits@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] .: sc/qa
sc/qa/unit/filters-test.cxx |3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) New commits: commit eda3e5dcb63e6bce71df2c1c941eacd7f0c79191 Author: François Tigeot ftig...@wolfpond.org Date: Fri Nov 25 09:41:25 2011 +0100 Disable password test on DragonFly diff --git a/sc/qa/unit/filters-test.cxx b/sc/qa/unit/filters-test.cxx index 587b71e..7fb1d5e 100644 --- a/sc/qa/unit/filters-test.cxx +++ b/sc/qa/unit/filters-test.cxx @@ -200,7 +200,8 @@ public: CPPUNIT_TEST(testBugFixesXLS); CPPUNIT_TEST(testBugFixesXLSX); //disable testPassword on MacOSX due to problems with libsqlite3 -#if !defined(MACOSX) +//also crashes on DragonFly due to problems with nss/nspr headers +#if !defined(MACOSX) !defined(DRAGONFLY) CPPUNIT_TEST(testPassword); #endif ___ Libreoffice-commits mailing list Libreoffice-commits@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] .: sc/qa solenv/gbuild
sc/qa/unit/filters-test.cxx|2 +- solenv/gbuild/platform/com_GCC_defs.mk |5 + solenv/gbuild/platform/macosx.mk |3 ++- solenv/gbuild/platform/solaris.mk |8 +++- solenv/gbuild/platform/unxgcc.mk |3 ++- 5 files changed, 17 insertions(+), 4 deletions(-) New commits: commit 450c49d93ffe9b49e643ade30a650105b9e5701c Author: Markus Mohrhard markus.mohrh...@googlemail.com Date: Tue Nov 15 09:02:41 2011 +0100 add sqlite path to library path and enable testPassword plus gb_Helper_extend_ld_path normalization by sberg...@redhat.com diff --git a/sc/qa/unit/filters-test.cxx b/sc/qa/unit/filters-test.cxx index 20cf95e..bcda710 100644 --- a/sc/qa/unit/filters-test.cxx +++ b/sc/qa/unit/filters-test.cxx @@ -187,7 +187,7 @@ public: CPPUNIT_TEST(testBugFixesODS); CPPUNIT_TEST(testBugFixesXLS); CPPUNIT_TEST(testBugFixesXLSX); -//CPPUNIT_TEST(testPassword); +CPPUNIT_TEST(testPassword); CPPUNIT_TEST_SUITE_END(); diff --git a/solenv/gbuild/platform/com_GCC_defs.mk b/solenv/gbuild/platform/com_GCC_defs.mk index c73219e..f91b58e 100644 --- a/solenv/gbuild/platform/com_GCC_defs.mk +++ b/solenv/gbuild/platform/com_GCC_defs.mk @@ -117,6 +117,11 @@ endif gb_Helper_set_ld_path := $(gb_Helper_LIBRARY_PATH_VAR)=$(OUTDIR_FOR_BUILD)/lib +# $(1): list of directory pathnames to append at the end of the ld path +define gb_Helper_extend_ld_path +$(gb_Helper_set_ld_path)$(foreach dir,$(1),:$(dir)) +endef + # convert parameters filesystem root to native notation # does some real work only on windows, make sure not to diff --git a/solenv/gbuild/platform/macosx.mk b/solenv/gbuild/platform/macosx.mk index 7fa338a..9d70d0b 100644 --- a/solenv/gbuild/platform/macosx.mk +++ b/solenv/gbuild/platform/macosx.mk @@ -363,7 +363,8 @@ endef # CppunitTest class -gb_CppunitTest_CPPTESTPRECOMMAND := DYLD_LIBRARY_PATH=$(OUTDIR)/lib +gb_CppunitTest_CPPTESTPRECOMMAND := \ +$(call gb_Helper_extend_ld_path,$(OUTDIR_FOR_BUILD)/lib/sqlite) gb_CppunitTest_SYSPRE := libtest_ gb_CppunitTest_EXT := .dylib gb_CppunitTest_LIBDIR := $(gb_Helper_OUTDIRLIBDIR) diff --git a/solenv/gbuild/platform/solaris.mk b/solenv/gbuild/platform/solaris.mk index 711216a..28dbba8 100644 --- a/solenv/gbuild/platform/solaris.mk +++ b/solenv/gbuild/platform/solaris.mk @@ -137,6 +137,11 @@ gb_Helper_abbreviate_dirs_native = $(gb_Helper_abbreviate_dirs) gb_Helper_set_ld_path := LD_LIBRARY_PATH=$(OUTDIR_FOR_BUILD)/lib +# $(1): list of directory pathnames to append at the end of the ld path +define gb_Helper_extend_ld_path +$(gb_Helper_set_ld_path)$(foreach dir,$(1),:$(dir)) +endef + # convert parameters filesystem root to native notation # does some real work only on windows, make sure not to # break the dummy implementations on unx* @@ -342,7 +347,8 @@ endef # CppunitTest class -gb_CppunitTest_CPPTESTPRECOMMAND := $(gb_Helper_set_ld_path) +gb_CppunitTest_CPPTESTPRECOMMAND := \ +$(call gb_Helper_extend_ld_path,$(OUTDIR_FOR_BUILD)/lib/sqlite) gb_CppunitTest_SYSPRE := libtest_ gb_CppunitTest_EXT := .so gb_CppunitTest_LIBDIR := $(gb_Helper_OUTDIRLIBDIR) diff --git a/solenv/gbuild/platform/unxgcc.mk b/solenv/gbuild/platform/unxgcc.mk index a96f90a..7df93f0 100644 --- a/solenv/gbuild/platform/unxgcc.mk +++ b/solenv/gbuild/platform/unxgcc.mk @@ -362,7 +362,8 @@ endef # CppunitTest class -gb_CppunitTest_CPPTESTPRECOMMAND := $(gb_Helper_set_ld_path) +gb_CppunitTest_CPPTESTPRECOMMAND := \ +$(call gb_Helper_extend_ld_path,$(OUTDIR_FOR_BUILD)/lib/sqlite) gb_CppunitTest_SYSPRE := libtest_ gb_CppunitTest_EXT := .so gb_CppunitTest_LIBDIR := $(gb_Helper_OUTDIRLIBDIR) ___ Libreoffice-commits mailing list Libreoffice-commits@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] .: sc/qa
sc/qa/unit/ucalc.cxx | 46 +++--- 1 file changed, 23 insertions(+), 23 deletions(-) New commits: commit 2f61bdff4435fd25b2d7da3c2366d663bd7e5085 Author: Kohei Yoshida kohei.yosh...@suse.com Date: Mon Nov 14 11:57:15 2011 -0500 Modified VLOOKUP test case to account for mixed comparisons. When the lookup value is of type Text, and the last match is of type Number, it should return #N/A according to the ODFF spec. diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx index cbc45d0..3faa208 100644 --- a/sc/qa/unit/ucalc.cxx +++ b/sc/qa/unit/ucalc.cxx @@ -452,7 +452,7 @@ void testFuncVLOOKUP(ScDocument* pDoc) { 50, 7 }, { 60, 8 }, { 70, 9 }, -{ A, 10 }, +{ B, 10 }, { B, 11 }, { C, 12 }, { D, 13 }, @@ -472,26 +472,26 @@ void testFuncVLOOKUP(ScDocument* pDoc) // Formula data struct { -const char* pLookup; const char* pFormula; double fResult; +const char* pLookup; const char* pFormula; const char* pRes; } aChecks[] = { { Lookup, Formula, 0 }, -{ 12, =VLOOKUP(D2;A2:B14;2;1), 3 }, -{ 29, =VLOOKUP(D3;A2:B14;2;1), 4 }, -{ 31, =VLOOKUP(D4;A2:B14;2;1), 5 }, -{ 45, =VLOOKUP(D5;A2:B14;2;1), 6 }, -{ 56, =VLOOKUP(D6;A2:B14;2;1), 7 }, -{ 65, =VLOOKUP(D7;A2:B14;2;1), 8 }, -{ 78, =VLOOKUP(D8;A2:B14;2;1), 9 }, -{ Andy,=VLOOKUP(D9;A2:B14;2;1), 10 }, -{ Bruce, =VLOOKUP(D10;A2:B14;2;1), 11 }, -{ Charlie, =VLOOKUP(D11;A2:B14;2;1), 12 }, -{ David, =VLOOKUP(D12;A2:B14;2;1), 13 }, -{ Edward, =VLOOKUP(D13;A2:B14;2;1), 14 }, -{ Frank, =VLOOKUP(D14;A2:B14;2;1), 15 }, -{ Henry, =VLOOKUP(D15;A2:B14;2;1), 15 }, -{ 100, =VLOOKUP(D16;A2:B14;2;1), 9 }, -{ 1000,=VLOOKUP(D17;A2:B14;2;1), 9 }, -{ Zena,=VLOOKUP(D18;A2:B14;2;1), 15 } +{ 12, =VLOOKUP(D2;A2:B14;2;1), 3 }, +{ 29, =VLOOKUP(D3;A2:B14;2;1), 4 }, +{ 31, =VLOOKUP(D4;A2:B14;2;1), 5 }, +{ 45, =VLOOKUP(D5;A2:B14;2;1), 6 }, +{ 56, =VLOOKUP(D6;A2:B14;2;1), 7 }, +{ 65, =VLOOKUP(D7;A2:B14;2;1), 8 }, +{ 78, =VLOOKUP(D8;A2:B14;2;1), 9 }, +{ Andy,=VLOOKUP(D9;A2:B14;2;1), #N/A }, +{ Bruce, =VLOOKUP(D10;A2:B14;2;1), 11 }, +{ Charlie, =VLOOKUP(D11;A2:B14;2;1), 12 }, +{ David, =VLOOKUP(D12;A2:B14;2;1), 13 }, +{ Edward, =VLOOKUP(D13;A2:B14;2;1), 14 }, +{ Frank, =VLOOKUP(D14;A2:B14;2;1), 15 }, +{ Henry, =VLOOKUP(D15;A2:B14;2;1), 15 }, +{ 100, =VLOOKUP(D16;A2:B14;2;1),9 }, +{ 1000,=VLOOKUP(D17;A2:B14;2;1),9 }, +{ Zena,=VLOOKUP(D18;A2:B14;2;1), 15 } }; // Insert formula data into D1:E18. @@ -510,13 +510,13 @@ void testFuncVLOOKUP(ScDocument* pDoc) // Skip the header row. continue; -double result; -pDoc-GetValue(4, i, 0, result); -bool bGood = result == aChecks[i].fResult; +rtl::OUString aRes; +pDoc-GetString(4, i, 0, aRes); +bool bGood = aRes.equalsAscii(aChecks[i].pRes); if (!bGood) { cerr row (i+1) : lookup value=' aChecks[i].pLookup - ' expected= aChecks[i].fResultactual= result endl; + ' expected=' aChecks[i].pRes ' actual=' aRes ' endl; CPPUNIT_ASSERT_MESSAGE(Unexpected result for VLOOKUP, false); } } ___ Libreoffice-commits mailing list Libreoffice-commits@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] .: sc/qa
sc/qa/unit/ucalc.cxx | 13 +++-- 1 file changed, 7 insertions(+), 6 deletions(-) New commits: commit 51494ab7291ad97eca5acfe2d9a4943ddfb4800d Author: Kohei Yoshida kohei.yosh...@suse.com Date: Mon Nov 14 12:07:48 2011 -0500 Likewise, adjusted the test cases for MATCH to handle mixed comparisons. diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx index 3faa208..b18bfe0 100644 --- a/sc/qa/unit/ucalc.cxx +++ b/sc/qa/unit/ucalc.cxx @@ -589,7 +589,7 @@ void testFuncMATCH(ScDocument* pDoc) 7, 8, 9, -A, +B, B, C, }; @@ -608,7 +608,7 @@ void testFuncMATCH(ScDocument* pDoc) { 9.59, 9 }, { 10, 9 }, { 100, 9 }, -{ Andy,10 }, +{ Andy, #N/A }, { Bruce, 11 }, { Charlie, 12 } }; @@ -621,9 +621,9 @@ void testFuncMATCH(ScDocument* pDoc) // data range (A1:A9) const char* aData[] = { +D, C, B, -A, 9, 8, 7, @@ -649,9 +649,10 @@ void testFuncMATCH(ScDocument* pDoc) { 0.8, 12 }, { 0, 12 }, { -2, 12 }, -{ Andy,2 }, -{ Bruce, 1 }, -{ Charlie, #N/A }, +{ Andy,3 }, +{ Bruce, 2 }, +{ Charlie, 1 }, +{ David, #N/A } }; runTestMATCHSAL_N_ELEMENTS(aData),SAL_N_ELEMENTS(aChecks),-1(pDoc, aData, aChecks); ___ Libreoffice-commits mailing list Libreoffice-commits@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] .: sc/qa
sc/qa/unit/filters-test.cxx | 29 - 1 file changed, 29 deletions(-) New commits: commit 97b5ed250d531382564d64521f8b803c92f775a0 Author: Markus Mohrhard markus.mohrh...@googlemail.com Date: Thu Nov 3 17:26:28 2011 +0100 remove all debug output from filters-test that was for the xls bug diff --git a/sc/qa/unit/filters-test.cxx b/sc/qa/unit/filters-test.cxx index 74a9006..b9e9e23 100644 --- a/sc/qa/unit/filters-test.cxx +++ b/sc/qa/unit/filters-test.cxx @@ -468,33 +468,6 @@ 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; -pDoc-GetLanguage(aLang, aCjkLang, aCtlLang); -std::cout Language Settings in ScDocument: normal: aLang Cjk: aCjkLang Ctl: aCtlLang std::endl; -std::cout Language for NumberFormatter: pDoc-GetFormatTable()-GetLanguage() std::endl; - //test Sheet1 with csv file rtl::OUString aCSVFileName; createCSVPath(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(numberFormat.)), aCSVFileName); @@ -553,7 +526,6 @@ void ScFiltersTest::testFormats() if ( i == ODS ) { rtl::OUString aCondString = getConditionalFormatString(pDoc, 3,0,2); -std::cerr rtl::OUStringToOString(aCondString, RTL_TEXTENCODING_UTF8).getStr() std::endl; createCSVPath(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(conditionalFormatting.)), aCSVFileName); testCondFile(aCSVFileName, pDoc, 2); } @@ -577,7 +549,6 @@ void ScFiltersTest::testMatrix() CPPUNIT_ASSERT_MESSAGE(Failed to load matrix.*, xDocSh.Is()); ScDocument* pDoc = xDocSh-GetDocument(); - rtl::OUString aCSVFileName; createCSVPath(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(matrix.)), aCSVFileName); testFile(aCSVFileName, pDoc, 0); ___ Libreoffice-commits mailing list Libreoffice-commits@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] .: sc/qa
sc/qa/unit/macros-test.cxx |2 -- 1 file changed, 2 deletions(-) New commits: commit 06899e6b77f5ca878ba7fd8b60bb62f5f97e90a2 Author: Kohei Yoshida kohei.yosh...@suse.com Date: Tue Nov 1 11:02:45 2011 -0400 Re-enabling the macros test. It was due to those pesky .~lock* files preventing the test files from being loaded. Maybe this is also what's breaking the mac os build!? diff --git a/sc/qa/unit/macros-test.cxx b/sc/qa/unit/macros-test.cxx index aff5bc5..22faa26 100644 --- a/sc/qa/unit/macros-test.cxx +++ b/sc/qa/unit/macros-test.cxx @@ -126,7 +126,6 @@ public: void testStarBasic(); void testVba(); CPPUNIT_TEST_SUITE(ScMacrosTest); -#if 0 #ifndef MACOSX //enable this test if you want to play with star basic macros in unit tests //works but does nothing useful yet @@ -135,7 +134,6 @@ public: //does not work, still problems during loading CPPUNIT_TEST(testVba); #endif -#endif CPPUNIT_TEST_SUITE_END(); ___ Libreoffice-commits mailing list Libreoffice-commits@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] .: sc/qa
sc/qa/unit/data/contentCSV/spreadsheet-functions.csv |4 ++-- sc/qa/unit/data/ods/functions.ods|binary 2 files changed, 2 insertions(+), 2 deletions(-) New commits: commit 0eae161aa3bd0a7abef6f9a5cf6afef171b09704 Author: Markus Mohrhard markus.mohrh...@googlemail.com Date: Tue Nov 1 23:09:17 2011 +0100 add tests related to fdo#41807 diff --git a/sc/qa/unit/data/contentCSV/spreadsheet-functions.csv b/sc/qa/unit/data/contentCSV/spreadsheet-functions.csv index da53433..83a33b2 100644 --- a/sc/qa/unit/data/contentCSV/spreadsheet-functions.csv +++ b/sc/qa/unit/data/contentCSV/spreadsheet-functions.csv @@ -1,4 +1,4 @@ $C$2, $A$1, Sheet.B$2, Sheet!R2C2 -2, 4, 4, 5, 6, 15, 15, 6 +2, 4, 4, 5, 6, 15, 15, 6, 9 1, 3, 4, 4, 2, 2 -2, 4, 7, 8 +2, 4, 7, 8, 4 diff --git a/sc/qa/unit/data/ods/functions.ods b/sc/qa/unit/data/ods/functions.ods index 2317473..cfdd263 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] .: sc/qa
sc/qa/unit/data/contentCSV/bugFix_Sheet2.csv |6 ++ sc/qa/unit/data/ods/bug-fixes.ods|binary sc/qa/unit/filters-test.cxx |6 +- 3 files changed, 11 insertions(+), 1 deletion(-) New commits: commit 84ae3c9853b7b90d7b859fd562dabc7b31e8deb8 Author: Markus Mohrhard markus.mohrh...@googlemail.com Date: Wed Nov 2 00:49:39 2011 +0100 add test cases for fdo#40967 diff --git a/sc/qa/unit/data/contentCSV/bugFix_Sheet2.csv b/sc/qa/unit/data/contentCSV/bugFix_Sheet2.csv new file mode 100644 index 000..c6fbdda --- /dev/null +++ b/sc/qa/unit/data/contentCSV/bugFix_Sheet2.csv @@ -0,0 +1,6 @@ +success +fail +success +fail +success +fail diff --git a/sc/qa/unit/data/ods/bug-fixes.ods b/sc/qa/unit/data/ods/bug-fixes.ods index dcdbd69..6864235 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/filters-test.cxx b/sc/qa/unit/filters-test.cxx index 059ef17..74a9006 100644 --- a/sc/qa/unit/filters-test.cxx +++ b/sc/qa/unit/filters-test.cxx @@ -599,7 +599,11 @@ void ScFiltersTest::testBugFixesODS() CPPUNIT_ASSERT_MESSAGE(Failed to load bugFixes.ods, xDocSh.Is()); ScDocument* pDoc = xDocSh-GetDocument(); -CPPUNIT_ASSERT_MESSAGE(No Document, pDoc); //remove with first test + +rtl::OUString aCSVFileName; + createCSVPath(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(bugFix_Sheet2.)), aCSVFileName); +testFile(aCSVFileName, pDoc, 1); + xDocSh-DoClose(); } ___ Libreoffice-commits mailing list Libreoffice-commits@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] .: sc/qa
sc/qa/unit/macros-test.cxx |4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) New commits: commit d3c18a6436e5e27f9d229a3b80a25d61d599461f Author: Noel Power noel.po...@novell.com Date: Thu Oct 27 16:46:45 2011 +0100 attempt to disable macro_test tests for macosx diff --git a/sc/qa/unit/macros-test.cxx b/sc/qa/unit/macros-test.cxx index a971d20..a58c92d 100644 --- a/sc/qa/unit/macros-test.cxx +++ b/sc/qa/unit/macros-test.cxx @@ -125,15 +125,15 @@ public: void testStarBasic(); void testVba(); - CPPUNIT_TEST_SUITE(ScMacrosTest); +#ifndef MACOSX //enable this test if you want to play with star basic macros in unit tests //works but does nothing useful yet CPPUNIT_TEST(testStarBasic); //enable if you want to hack vba support for unit tests //does not work, still problems during loading CPPUNIT_TEST(testVba); - +#endif CPPUNIT_TEST_SUITE_END(); ___ Libreoffice-commits mailing list Libreoffice-commits@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] .: sc/qa
sc/qa/unit/data/xlsx/named-ranges-global.xlsx |binary sc/qa/unit/filters-test.cxx |2 +- 2 files changed, 1 insertion(+), 1 deletion(-) New commits: commit a9730ec265c4aeab6724741d66d17c6b44f307ed Author: Markus Mohrhard markus.mohrh...@googlemail.com Date: Fri Oct 28 00:00:34 2011 +0200 we can now enable the range name test for xlsx too diff --git a/sc/qa/unit/data/xlsx/named-ranges-global.xlsx b/sc/qa/unit/data/xlsx/named-ranges-global.xlsx new file mode 100644 index 000..a1ae8e7 Binary files /dev/null and b/sc/qa/unit/data/xlsx/named-ranges-global.xlsx differ diff --git a/sc/qa/unit/filters-test.cxx b/sc/qa/unit/filters-test.cxx index 71a4339..059ef17 100644 --- a/sc/qa/unit/filters-test.cxx +++ b/sc/qa/unit/filters-test.cxx @@ -299,7 +299,7 @@ void ScFiltersTest::testRangeName() { const rtl::OUString aFileNameBase(RTL_CONSTASCII_USTRINGPARAM(named-ranges-global.)); //XLSX does not work yet -for (sal_uInt32 i = 0; i 2; ++i) +for (sal_uInt32 i = 0; i 3; ++i) { rtl::OUString aFileExtension(aFileFormats[i].pName, strlen(aFileFormats[i].pName), RTL_TEXTENCODING_UTF8 ); rtl::OUString aFilterName(aFileFormats[i].pFilterName, strlen(aFileFormats[i].pFilterName), RTL_TEXTENCODING_UTF8) ; ___ Libreoffice-commits mailing list Libreoffice-commits@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] .: sc/qa
sc/qa/unit/ucalc.cxx | 33 - 1 file changed, 32 insertions(+), 1 deletion(-) New commits: commit c35fb339f5aaf3ed8dea71baefb1521f0506e2cb Author: Markus Mohrhard markus.mohrh...@googlemail.com Date: Wed Oct 19 01:25:49 2011 +0200 add unit test for fdo#41868 test should be extended as soon as possible tests a central point of our formula compiler/reference handling diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx index 0ccf27b..19741ed 100644 --- a/sc/qa/unit/ucalc.cxx +++ b/sc/qa/unit/ucalc.cxx @@ -237,6 +237,7 @@ public: void testAutofilter(); void testCopyPaste(); void testMergedCells(); +void testSheetDelete(); /** * Make sure the sheet streams are invalidated properly. @@ -281,6 +282,7 @@ public: CPPUNIT_TEST(testAutofilter); CPPUNIT_TEST(testCopyPaste); CPPUNIT_TEST(testMergedCells); +CPPUNIT_TEST(testSheetDelete); CPPUNIT_TEST_SUITE_END(); private: @@ -2305,11 +2307,40 @@ void Test::testMergedCells() aDocFunc.InsertCells(aRange, aMark, INS_INSROWS, true, true); m_pDoc-ExtendMerge( 1, 1, nEndCol, nEndRow, 0, false); cout nEndRow nEndCol; -//have a look why this does not work +//ScEditableTester won't work without an SfxMedium/XStorage //CPPUNIT_ASSERT_MESSAGE(did not increase merge area, nEndCol == 3 nEndRow == 4); m_pDoc-DeleteTab(0); } +void Test::testSheetDelete() +{ +//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))); + +m_pDoc-SetValue(0,0,2, 1); +m_pDoc-SetValue(1,0,2, 2); +m_pDoc-SetString(2,0,2, rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(=A1+B1))); + +double aValue; +m_pDoc-GetValue(2,0,2, aValue); +CPPUNIT_ASSERT_MESSAGE(formula does not return correct result, aValue == 3); + +//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-DeleteTab(0); +m_pDoc-GetValue(2,0,0, aValue); +CPPUNIT_ASSERT_MESSAGE(after deleting second sheet formula does not return correct result, aValue == 3); +} + + CPPUNIT_TEST_SUITE_REGISTRATION(Test); } ___ Libreoffice-commits mailing list Libreoffice-commits@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] .: sc/qa
sc/qa/unit/filters-test.cxx |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) New commits: commit fed75d001e6a48a84bc46606848af3ba0219df29 Author: Markus Mohrhard markus.mohrh...@googlemail.com Date: Fri Oct 7 23:32:09 2011 +0200 set the correct url for vba unit test it seems like the method name is the same as the module name unit test still crashs because it can't find XSpreadsheetView but works in general diff --git a/sc/qa/unit/filters-test.cxx b/sc/qa/unit/filters-test.cxx index 3e80c37..4a56ce1 100644 --- a/sc/qa/unit/filters-test.cxx +++ b/sc/qa/unit/filters-test.cxx @@ -618,7 +618,7 @@ void ScFiltersTest::testVba() //it seems that the basic ide does it differently, but then we would need to init all parts ourself //the problem is that CallXScript inits the basic part BasicIDE::RunMethod takes an SbMethod as parametre -rtl::OUString aURL(RTL_CONSTASCII_USTRINGPARAM(vnd.sun.Star.script:VBAProject.Modul1.macro1?language=Basiclocation=document)); +rtl::OUString aURL(RTL_CONSTASCII_USTRINGPARAM(vnd.sun.Star.script:VBAProject.Modul1.Modul1?language=Basiclocation=document)); String sUrl = aURL; Any aRet; Sequence sal_Int16 aOutParamIndex; ___ Libreoffice-commits mailing list Libreoffice-commits@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits