[Libreoffice-commits] .: 4 commits - sc/inc sc/qa
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Thu Nov 8 19:14:07 PST 2012
sc/inc/conditio.hxx | 6 --
sc/qa/unit/subsequent_export-test.cxx | 81 ++++++++++++++++++++++++++++++----
2 files changed, 72 insertions(+), 15 deletions(-)
New commits:
commit fa4b644b67c7547b94b1e1d2749cf6ccb6e718ab
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date: Thu Nov 8 01:05:09 2012 +0100
remove unused methods in ScConditionalFormat
Change-Id: I36e57f8eac028e72fedd81a5fb05698ff1c57fe0
diff --git a/sc/inc/conditio.hxx b/sc/inc/conditio.hxx
index 89b451f..afcfd01 100644
--- a/sc/inc/conditio.hxx
+++ b/sc/inc/conditio.hxx
@@ -335,7 +335,6 @@ class SC_DLLPUBLIC ScConditionalFormat
typedef boost::ptr_vector<ScFormatEntry> CondFormatContainer;
CondFormatContainer maEntries;
- bool bIsUsed; // temporary at Save
ScRangeList maRanges; // Ranges for conditional format
public:
@@ -378,9 +377,6 @@ public:
sal_uInt32 GetKey() const { return nKey; }
void SetKey(sal_uInt32 nNew) { nKey = nNew; } // only if not inserted!
- void SetUsed(bool bSet) { bIsUsed = bSet; }
- bool IsUsed() const { return bIsUsed; }
-
bool MarkUsedExternalReferences() const;
#if DUMP_FORMAT_INFO
commit b710bef572cff000f61a9df6a691fec5d5af857e
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date: Wed Nov 7 22:58:05 2012 +0100
add initial xlsx cond format export test
Change-Id: Ie2c55af903ef0fdf21444ee1f59d25382648d9fa
diff --git a/sc/qa/unit/subsequent_export-test.cxx b/sc/qa/unit/subsequent_export-test.cxx
index 6ef97c1..d67224f 100644
--- a/sc/qa/unit/subsequent_export-test.cxx
+++ b/sc/qa/unit/subsequent_export-test.cxx
@@ -76,12 +76,14 @@ public:
void test();
void testPasswordExport();
+ void testConditionalFormatExportXLSX();
CPPUNIT_TEST_SUITE(ScExportTest);
CPPUNIT_TEST(test);
#if !defined(MACOSX) && !defined(DRAGONFLY) && !defined(WNT)
CPPUNIT_TEST(testPasswordExport);
#endif
+ CPPUNIT_TEST(testConditionalFormatExportXLSX);
CPPUNIT_TEST_SUITE_END();
private:
@@ -89,18 +91,27 @@ private:
uno::Reference<uno::XInterface> m_xCalcComponent;
ScDocShellRef saveAndReload( ScDocShell* pShell, sal_Int32 nFormat );
+ ScDocShellRef loadDocument( const rtl::OUString& rFileNameBase, sal_Int32 nFormat );
+ void createFileURL( const rtl::OUString& aFileBase, const rtl::OUString& rFileExtension, rtl::OUString& rFilePath);
+ void createCSVPath(const rtl::OUString& rFileBase, rtl::OUString& rCSVPath);
};
-/*
-void ScFiltersTest::createFileURL(const rtl::OUString& aFileBase, const rtl::OUString& aFileExtension, rtl::OUString& rFilePath)
+void ScExportTest::createFileURL(const rtl::OUString& aFileBase, const rtl::OUString& aFileExtension, rtl::OUString& rFilePath)
{
- rtl::OUString aSep(RTL_CONSTASCII_USTRINGPARAM("/"));
+ rtl::OUString aSep("/");
rtl::OUStringBuffer aBuffer( getSrcRootURL() );
aBuffer.append(m_aBaseString).append(aSep).append(aFileExtension);
aBuffer.append(aSep).append(aFileBase).append(aFileExtension);
rFilePath = aBuffer.makeStringAndClear();
}
-*/
+
+void ScExportTest::createCSVPath(const rtl::OUString& aFileBase, rtl::OUString& rCSVPath)
+{
+ rtl::OUStringBuffer aBuffer(getSrcRootPath());
+ aBuffer.append(m_aBaseString).append(rtl::OUString("/contentCSV/"));
+ aBuffer.append(aFileBase).append(rtl::OUString("csv"));
+ rCSVPath = aBuffer.makeStringAndClear();
+}
ScDocShellRef ScExportTest::saveAndReloadPassword(ScDocShell* pShell, const rtl::OUString &rFilter,
const rtl::OUString &rUserData, const rtl::OUString& rTypeName, sal_uLong nFormatType)
@@ -210,6 +221,35 @@ ScDocShellRef ScExportTest::saveAndReload( ScDocShell* pShell, sal_Int32 nFormat
return xDocSh;
}
+ScDocShellRef ScExportTest::loadDocument(const rtl::OUString& rFileName, sal_Int32 nFormat)
+{
+ rtl::OUString aFileExtension(aFileFormats[nFormat].pName, strlen(aFileFormats[nFormat].pName), RTL_TEXTENCODING_UTF8 );
+ rtl::OUString aFilterName(aFileFormats[nFormat].pFilterName, strlen(aFileFormats[nFormat].pFilterName), RTL_TEXTENCODING_UTF8) ;
+ rtl::OUString aFileName;
+ createFileURL( rFileName, aFileExtension, aFileName );
+ rtl::OUString aFilterType(aFileFormats[nFormat].pTypeName, strlen(aFileFormats[nFormat].pTypeName), RTL_TEXTENCODING_UTF8);
+ unsigned int nFormatType = aFileFormats[nFormat].nFormatType;
+ unsigned int nClipboardId = nFormatType ? SFX_FILTER_IMPORT | SFX_FILTER_USESOPTIONS : 0;
+
+ SfxFilter* pFilter = new SfxFilter(
+ aFilterName,
+ rtl::OUString(), nFormatType, nClipboardId, aFilterType, 0, rtl::OUString(),
+ rtl::OUString(), rtl::OUString("private:factory/scalc*") );
+ pFilter->SetVersion(SOFFICE_FILEFORMAT_CURRENT);
+
+ ScDocShellRef xDocShRef = new ScDocShell;
+ SfxMedium* pSrcMed = new SfxMedium(aFileName, STREAM_STD_READ);
+ pSrcMed->SetFilter(pFilter);
+ if (!xDocShRef->DoLoad(pSrcMed))
+ {
+ xDocShRef->DoClose();
+ // load failed.
+ xDocShRef.Clear();
+ }
+
+ return xDocShRef;
+}
+
void ScExportTest::test()
{
ScDocShell* pShell = new ScDocShell(
@@ -256,6 +296,20 @@ void ScExportTest::testPasswordExport()
CPPUNIT_ASSERT_DOUBLES_EQUAL(aVal, 1.0, 1e-8);
}
+void ScExportTest::testConditionalFormatExportXLSX()
+{
+ ScDocShellRef xShell = loadDocument("new_cond_format_test.", XLSX);
+ CPPUNIT_ASSERT(xShell.Is());
+
+ ScDocShellRef xDocSh = saveAndReload(&(*xShell), XLSX);
+ CPPUNIT_ASSERT(xDocSh.Is());
+ ScDocument* pDoc = xDocSh->GetDocument();
+ rtl::OUString aCSVFile("new_cond_format_test.");
+ rtl::OUString aCSVPath;
+ createCSVPath( aCSVFile, aCSVPath );
+ testCondFile(aCSVPath, pDoc, 0);
+}
+
ScExportTest::ScExportTest()
: m_aBaseString(RTL_CONSTASCII_USTRINGPARAM("/sc/qa/unit/data"))
{
commit b9f84939fd9b45f07003cf115f9c39c8e2e83254
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date: Wed Nov 7 21:45:17 2012 +0100
make the eport test easier to use
Change-Id: I10a524c49169611e2bf2e34988667e46474e17a8
diff --git a/sc/qa/unit/subsequent_export-test.cxx b/sc/qa/unit/subsequent_export-test.cxx
index b3fd4de..6ef97c1 100644
--- a/sc/qa/unit/subsequent_export-test.cxx
+++ b/sc/qa/unit/subsequent_export-test.cxx
@@ -87,6 +87,8 @@ public:
private:
rtl::OUString m_aBaseString;
uno::Reference<uno::XInterface> m_xCalcComponent;
+
+ ScDocShellRef saveAndReload( ScDocShell* pShell, sal_Int32 nFormat );
};
/*
@@ -197,6 +199,17 @@ ScDocShellRef ScExportTest::saveAndReload(ScDocShell* pShell, const rtl::OUStrin
return xDocShRef;
}
+ScDocShellRef ScExportTest::saveAndReload( ScDocShell* pShell, sal_Int32 nFormat )
+{
+ rtl::OUString aFileExtension(aFileFormats[nFormat].pName, strlen(aFileFormats[nFormat].pName), RTL_TEXTENCODING_UTF8 );
+ rtl::OUString aFilterName(aFileFormats[nFormat].pFilterName, strlen(aFileFormats[nFormat].pFilterName), RTL_TEXTENCODING_UTF8) ;
+ rtl::OUString aFilterType(aFileFormats[nFormat].pTypeName, strlen(aFileFormats[nFormat].pTypeName), RTL_TEXTENCODING_UTF8);
+ ScDocShellRef xDocSh = saveAndReload(pShell, aFilterName, rtl::OUString(), aFilterType, aFileFormats[nFormat].nFormatType);
+
+ CPPUNIT_ASSERT(xDocSh.Is());
+ return xDocSh;
+}
+
void ScExportTest::test()
{
ScDocShell* pShell = new ScDocShell(
@@ -210,11 +223,7 @@ void ScExportTest::test()
pDoc->SetValue(0,0,0, 1.0);
CPPUNIT_ASSERT(pDoc);
- sal_Int32 nFormat = ODS;
- rtl::OUString aFileExtension(aFileFormats[nFormat].pName, strlen(aFileFormats[nFormat].pName), RTL_TEXTENCODING_UTF8 );
- rtl::OUString aFilterName(aFileFormats[nFormat].pFilterName, strlen(aFileFormats[nFormat].pFilterName), RTL_TEXTENCODING_UTF8) ;
- rtl::OUString aFilterType(aFileFormats[nFormat].pTypeName, strlen(aFileFormats[nFormat].pTypeName), RTL_TEXTENCODING_UTF8);
- ScDocShellRef xDocSh = saveAndReload(pShell, aFilterName, rtl::OUString(), aFilterType, aFileFormats[nFormat].nFormatType);
+ ScDocShellRef xDocSh = saveAndReload( pShell, ODS );
CPPUNIT_ASSERT(xDocSh.Is());
ScDocument* pLoadedDoc = xDocSh->GetDocument();
commit b5809563ecdddd633ede17617d8e13f0275afde9
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date: Mon Nov 5 04:40:04 2012 +0100
remove unused define
Change-Id: I5d529cef6e75ccdfe57800bceace99353d4b4b47
diff --git a/sc/inc/conditio.hxx b/sc/inc/conditio.hxx
index 2f2eb49..89b451f 100644
--- a/sc/inc/conditio.hxx
+++ b/sc/inc/conditio.hxx
@@ -50,8 +50,6 @@ class ScFormulaCell;
class ScTokenArray;
-#define SC_COND_GROW 16
-
// nOptions Flags
#define SC_COND_NOBLANKS 1
More information about the Libreoffice-commits
mailing list