[Libreoffice-commits] .: Branch 'libreoffice-4-0' - sc/qa sfx2/source

2013-02-02 Thread Michael Stahl
 sc/qa/unit/subsequent_export-test.cxx |8 
 sfx2/source/doc/docfile.cxx   |   19 ++-
 2 files changed, 10 insertions(+), 17 deletions(-)

New commits:
commit 6523f78456c9f78fb842b7215eb84a96f4e92472
Author: Michael Stahl mst...@redhat.com
Date:   Thu Jan 31 23:19:54 2013 +0100

fdo#59022: revert SfxMedium::GetOutputStream(): re-use existing XStream

Revert commit 0c2206081de38a41597aadfb2255540d6308be63, since this
apparently causes failure to open ODF files via SMB on Linux.

Instead of changing SfxMedium, adjust the ScExportTest: when saving
XLSX files interactively, the SfxFilter::lFormat is always 0, which
causes SfxObjectShell::SaveTo_Impl not to call
SfxMedium::GetOutputStorage() at all, working around the locking issue
on WNT.

Change-Id: I0ab8b4262475e4c8425eebb1413997457e5e9417
(cherry picked from commit 0799130b0ba954715d00feb93cef83dd48e29889)
Reviewed-on: https://gerrit.libreoffice.org/1952
Reviewed-by: Miklos Vajna vmik...@suse.cz
Tested-by: Miklos Vajna vmik...@suse.cz

diff --git a/sc/qa/unit/subsequent_export-test.cxx 
b/sc/qa/unit/subsequent_export-test.cxx
index 7b0fde8..26fe25c 100644
--- a/sc/qa/unit/subsequent_export-test.cxx
+++ b/sc/qa/unit/subsequent_export-test.cxx
@@ -125,7 +125,7 @@ ScDocShellRef 
ScExportTest::saveAndReloadPassword(ScDocShell* pShell, const rtl:
 aTempFile.EnableKillingFile();
 SfxMedium aStoreMedium( aTempFile.GetURL(), STREAM_STD_WRITE );
 sal_uInt32 nExportFormat = 0;
-if (nFormatType)
+if (nFormatType == ODS_FORMAT_TYPE)
 nExportFormat = SFX_FILTER_EXPORT | SFX_FILTER_USESOPTIONS;
 SfxFilter* pExportFilter = new SfxFilter(
 rFilter,
@@ -148,7 +148,7 @@ ScDocShellRef 
ScExportTest::saveAndReloadPassword(ScDocShell* pShell, const rtl:
 //std::cout  File:   aTempFile.GetURL()  std::endl;
 
 sal_uInt32 nFormat = 0;
-if (nFormatType)
+if (nFormatType == ODS_FORMAT_TYPE)
 nFormat = SFX_FILTER_IMPORT | SFX_FILTER_USESOPTIONS;
 
 OUString aPass(test);
@@ -163,7 +163,7 @@ ScDocShellRef ScExportTest::saveAndReload(ScDocShell* 
pShell, const rtl::OUStrin
 aTempFile.EnableKillingFile();
 SfxMedium aStoreMedium( aTempFile.GetURL(), STREAM_STD_WRITE );
 sal_uInt32 nExportFormat = 0;
-if (nFormatType)
+if (nFormatType == ODS_FORMAT_TYPE)
 nExportFormat = SFX_FILTER_EXPORT | SFX_FILTER_USESOPTIONS;
 SfxFilter* pExportFilter = new SfxFilter(
 rFilter,
@@ -177,7 +177,7 @@ ScDocShellRef ScExportTest::saveAndReload(ScDocShell* 
pShell, const rtl::OUStrin
 //std::cout  File:   aTempFile.GetURL()  std::endl;
 
 sal_uInt32 nFormat = 0;
-if (nFormatType)
+if (nFormatType == ODS_FORMAT_TYPE)
 nFormat = SFX_FILTER_IMPORT | SFX_FILTER_USESOPTIONS;
 
 return load(aTempFile.GetURL(), rFilter, rUserData, rTypeName, nFormat, 
nFormatType);
diff --git a/sfx2/source/doc/docfile.cxx b/sfx2/source/doc/docfile.cxx
index 85b7981..3ce8ab7 100644
--- a/sfx2/source/doc/docfile.cxx
+++ b/sfx2/source/doc/docfile.cxx
@@ -636,20 +636,13 @@ SvStream* SfxMedium::GetOutStream()
 
 if ( pImp-pTempFile )
 {
-// try to re-use XOutStream from xStream if that exists;
-// opening new SvFileStream in this situation may fail on
-// Windows with ERROR_SHARING_VIOLATION
-if (pImp-xStream.is())
-{
-assert(pImp-xStream-getOutputStream().is()); // need that...
-pImp-m_pOutStream = utl::UcbStreamHelper::CreateStream(
-pImp-xStream, false);
-}
-else
-{
-pImp-m_pOutStream = new SvFileStream(
+// don't try to re-use XOutStream from xStream if that exists;
+// it causes fdo#59022 (fails opening files via SMB on Linux)
+// OTOH opening new SvFileStream in this situation may fail on
+// Windows with ERROR_SHARING_VIOLATION... but that is apparently
+// not a problem in practice currently
+pImp-m_pOutStream = new SvFileStream(
 pImp-m_aName, STREAM_STD_READWRITE);
-}
 CloseStorage();
 }
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] .: Branch 'libreoffice-4-0' - sc/qa sc/source

2013-01-15 Thread Libreoffice Gerrit user
 sc/qa/unit/subsequent_filters-test.cxx |2 -
 sc/source/filter/xml/xmlcelli.cxx  |   34 +++--
 2 files changed, 29 insertions(+), 7 deletions(-)

New commits:
commit 143c102df00d8ae84094ffd13454dffaa6fc6c7a
Author: Markus Mohrhard markus.mohrh...@googlemail.com
Date:   Tue Jan 15 05:13:17 2013 +0100

for error value in matrix force recalc, fdo#59293

Change-Id: I202526bb3cf6e0f6c55913b44a15694e0794e273
Reviewed-on: https://gerrit.libreoffice.org/1683
Reviewed-by: Eike Rathke er...@redhat.com
Tested-by: Eike Rathke er...@redhat.com

diff --git a/sc/qa/unit/subsequent_filters-test.cxx 
b/sc/qa/unit/subsequent_filters-test.cxx
index 04a7ffe..b6918ce 100644
--- a/sc/qa/unit/subsequent_filters-test.cxx
+++ b/sc/qa/unit/subsequent_filters-test.cxx
@@ -480,7 +480,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();
 }
diff --git a/sc/source/filter/xml/xmlcelli.cxx 
b/sc/source/filter/xml/xmlcelli.cxx
index bdf5748..6e73782 100644
--- a/sc/source/filter/xml/xmlcelli.cxx
+++ b/sc/source/filter/xml/xmlcelli.cxx
@@ -736,7 +736,7 @@ void 
ScXMLTableRowCellContext::SetFormulaCell(ScFormulaCell* pFCell) const
 pFCell-SetHybridDouble(fValue);
 pFCell-ResetDirty();
 }
-
+pFCell-StartListeningTo(rXMLImport.GetDocument());
 // Leave the cell dirty when the cached result is not given.
 }
 }
@@ -754,15 +754,36 @@ void ScXMLTableRowCellContext::PutTextCell( const 
ScAddress rCurrentPos,
 if ( bDoIncrement )
 {
 ScFormulaCell* pFCell = static_castScFormulaCell*(pCell);
+OUString aCellString;
 if (pOUTextValue  !pOUTextValue-isEmpty())
-pFCell-SetHybridString( *pOUTextValue );
+aCellString = *pOUTextValue;
 else if (pOUTextContent  !pOUTextContent-isEmpty())
-pFCell-SetHybridString( *pOUTextContent );
+aCellString = *pOUTextContent;
 else if ( nCurrentCol  0  pOUText  !pOUText-isEmpty() )
-pFCell-SetHybridString( *pOUText );
+aCellString = *pOUText;
 else
 bDoIncrement = false;
-pFCell-ResetDirty();
+
+if(!aCellString.isEmpty())
+{
+if (bDoIncrement  
!GetScImport().IsFormulaErrorConstant(aCellString))
+{
+pFCell-SetHybridString( aCellString );
+pFCell-ResetDirty();
+}
+else
+{
+ScAddress aTopLeftMatrixCell;
+if(pFCell-GetMatrixOrigin(aTopLeftMatrixCell))
+{
+ScBaseCell* pMatrixCell = 
rXMLImport.GetDocument()-GetCell( aTopLeftMatrixCell );
+static_castScFormulaCell*(pMatrixCell)-SetDirty();
+}
+else
+SAL_WARN(sc, matrix cell without matrix);
+}
+}
+pFCell-StartListeningTo(rXMLImport.GetDocument());
 }
 }
 else //regular text cells
@@ -800,6 +821,7 @@ void ScXMLTableRowCellContext::PutValueCell( const 
ScAddress rCurrentPos )
 ScFormulaCell* pFCell = static_castScFormulaCell*(pCell);
 SetFormulaCell(pFCell);
 }
+
 }
 else  //regular value cell
 {
@@ -1036,7 +1058,6 @@ void ScXMLTableRowCellContext::PutFormulaCell( const 
ScAddress rCellPos )
 pNewCell = new ScFormulaCell( pDoc, rCellPos, pCode.get(), 
eGrammar, MM_NONE );
 
 ScFormulaCell* pFCell = static_castScFormulaCell*(pNewCell);
-pFCell-StartListeningTo(pDoc);
 SetFormulaCell(pFCell);
 }
 else if ( aText[0] == '\''  aText.getLength()  1 )
@@ -1105,6 +1126,7 @@ void ScXMLTableRowCellContext::AddFormulaCell( const 
ScAddress rCellPos )
 nMatrixCols, nMatrixRows, pMat, new 
formula::FormulaDoubleToken(fValue));
 pFCell-ResetDirty();
 }
+pFCell-StartListeningTo(rXMLImport.GetDocument());
 }
 }
 else
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] .: Branch 'libreoffice-4-0' - sc/qa

2013-01-07 Thread Libreoffice Gerrit user
 sc/qa/unit/ucalc.cxx |  178 +++
 1 file changed, 178 insertions(+)

New commits:
commit 6f3bdadf1d37fb02a2ab42ca3d59ef51a1ae15d6
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] .: Branch 'libreoffice-4-0' - sc/qa

2013-01-07 Thread Libreoffice Gerrit user
 sc/qa/unit/subsequent_filters-test.cxx |6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

New commits:
commit 0494167d0057e052acb768e57d786b00d5cd902b
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] .: Branch 'libreoffice-4-0' - sc/qa

2013-01-07 Thread Libreoffice Gerrit user
 sc/qa/unit/subsequent_filters-test.cxx |   88 -
 1 file changed, 23 insertions(+), 65 deletions(-)

New commits:
commit 4898e938a6730a0f4e53edc86871fa2480554c6f
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] .: Branch 'libreoffice-4-0' - sc/qa

2013-01-07 Thread Libreoffice Gerrit user
 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 6918c1e61933cfb9090de7438ac7416647fcee45
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] .: Branch 'libreoffice-4-0' - sc/qa

2013-01-04 Thread Libreoffice Gerrit user
 sc/qa/unit/data/ods/dependencyTree.ods |binary
 sc/qa/unit/subsequent_filters-test.cxx |   30 ++
 2 files changed, 30 insertions(+)

New commits:
commit c8f8a2d3f9867850ad7effb585ff6414815c73ce
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] .: Branch 'libreoffice-4-0' - sc/qa

2012-12-26 Thread Libreoffice Gerrit user
 sc/qa/unit/rangelst_test.cxx |   11 +++
 1 file changed, 3 insertions(+), 8 deletions(-)

New commits:
commit 095700d0859178e68d9a54f9efe8011a5d2b9c48
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] .: Branch 'libreoffice-4-0' - sc/qa

2012-12-17 Thread Libreoffice Gerrit user
 sc/qa/unit/data/contentCSV/new_cond_format_test.csv |   10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

New commits:
commit f5bf097d6afe500ace599e90b3bdfcf2a0eb965d
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