Kaydet (Commit) e0285cd5 authored tarafından Jan Holesovsky's avatar Jan Holesovsky

sc unit tests: Prefix the format names.

Otherwise we conflict with the officecfg includes; and it is a bad idea to
have too broad names for #define's anyway.

Change-Id: Ie48e6f109f654a9ee4aedb3eb37df5e67f88a905
üst 9a405abc
......@@ -101,7 +101,7 @@ private:
void ScFiltersTest::testTdf64229()
{
ScDocShellRef xDocSh = loadDoc("fdo64229b.", ODS);
ScDocShellRef xDocSh = loadDoc("fdo64229b.", FORMAT_ODS);
xDocSh->DoHardRecalc(true);
......@@ -119,7 +119,7 @@ void ScFiltersTest::testTdf64229()
void ScFiltersTest::testTdf36933()
{
ScDocShellRef xDocSh = loadDoc("fdo36933test.", ODS);
ScDocShellRef xDocSh = loadDoc("fdo36933test.", FORMAT_ODS);
xDocSh->DoHardRecalc(true);
......@@ -137,7 +137,7 @@ void ScFiltersTest::testTdf36933()
void ScFiltersTest::testTdf43700()
{
ScDocShellRef xDocSh = loadDoc("fdo43700test.", ODS);
ScDocShellRef xDocSh = loadDoc("fdo43700test.", FORMAT_ODS);
xDocSh->DoHardRecalc(true);
......@@ -155,7 +155,7 @@ void ScFiltersTest::testTdf43700()
void ScFiltersTest::testTdf43534()
{
ScDocShellRef xDocSh = loadDoc("fdo43534test.", ODS);
ScDocShellRef xDocSh = loadDoc("fdo43534test.", FORMAT_ODS);
xDocSh->DoHardRecalc(true);
......@@ -213,7 +213,7 @@ void ScFiltersTest::testTdf91979()
/*
void ScFiltersTest::testTdf40110()
{
ScDocShellRef xDocSh = loadDoc("fdo40110test.", ODS);
ScDocShellRef xDocSh = loadDoc("fdo40110test.", FORMAT_ODS);
CPPUNIT_ASSERT_MESSAGE("Failed to load fdo40110test.*", xDocSh.Is());
xDocSh->DoHardRecalc(true);
......
......@@ -53,7 +53,7 @@ void ScCopyPasteTest::testCopyPasteXLS()
CPPUNIT_ASSERT( xTargetFrame.is() );
// 1. Open the document
ScDocShellRef xDocSh = loadDoc("chartx.", XLS);
ScDocShellRef xDocSh = loadDoc("chartx.", FORMAT_XLS);
CPPUNIT_ASSERT_MESSAGE("Failed to load chartx.xls.", xDocSh.Is());
uno::Reference< frame::XModel2 > xModel2 ( xDocSh->GetModel(), UNO_QUERY );
......
......@@ -179,7 +179,7 @@ void testRangeNameImpl(ScDocument& rDoc)
void ScFiltersTest::testRangeNameODS()
{
ScDocShellRef xDocSh = loadDoc("named-ranges-global.", ODS);
ScDocShellRef xDocSh = loadDoc("named-ranges-global.", FORMAT_ODS);
CPPUNIT_ASSERT_MESSAGE("Failed to load named-ranges-globals.*", xDocSh.Is());
......@@ -224,7 +224,7 @@ void testContentImpl(ScDocument& rDoc, sal_Int32 nFormat ) //same code for ods,
CPPUNIT_ASSERT_MESSAGE("=C1+C2", fValue == 11);
//check merged cells import
if(nFormat != LOTUS123 && nFormat != DIF)
if (nFormat != FORMAT_LOTUS123 && nFormat != FORMAT_DIF)
{
SCCOL nCol = 4;
SCROW nRow = 1;
......@@ -245,58 +245,58 @@ void testContentImpl(ScDocument& rDoc, sal_Int32 nFormat ) //same code for ods,
void ScFiltersTest::testContentODS()
{
ScDocShellRef xDocSh = loadDoc("universal-content.", ODS);
ScDocShellRef xDocSh = loadDoc("universal-content.", FORMAT_ODS);
xDocSh->DoHardRecalc(true);
ScDocument& rDoc = xDocSh->GetDocument();
testContentImpl(rDoc, ODS);
testContentImpl(rDoc, FORMAT_ODS);
xDocSh->DoClose();
}
void ScFiltersTest::testContentXLS()
{
ScDocShellRef xDocSh = loadDoc("universal-content.", XLS);
ScDocShellRef xDocSh = loadDoc("universal-content.", FORMAT_XLS);
xDocSh->DoHardRecalc(true);
ScDocument& rDoc = xDocSh->GetDocument();
testContentImpl(rDoc, XLS);
testContentImpl(rDoc, FORMAT_XLS);
xDocSh->DoClose();
}
void ScFiltersTest::testContentXLSX()
{
ScDocShellRef xDocSh = loadDoc("universal-content.", XLSX);
ScDocShellRef xDocSh = loadDoc("universal-content.", FORMAT_XLSX);
xDocSh->DoHardRecalc(true);
ScDocument& rDoc = xDocSh->GetDocument();
testContentImpl(rDoc, XLSX);
testContentImpl(rDoc, FORMAT_XLSX);
xDocSh->DoClose();
}
void ScFiltersTest::testContentXLSXStrict()
{
ScDocShellRef xDocSh = loadDoc("universal-content-strict.", XLSX);
ScDocShellRef xDocSh = loadDoc("universal-content-strict.", FORMAT_XLSX);
xDocSh->DoHardRecalc(true);
ScDocument& rDoc = xDocSh->GetDocument();
testContentImpl(rDoc, XLSX);
testContentImpl(rDoc, FORMAT_XLSX);
xDocSh->DoClose();
}
void ScFiltersTest::testContentLotus123()
{
ScDocShellRef xDocSh = loadDoc("universal-content.", LOTUS123);
ScDocShellRef xDocSh = loadDoc("universal-content.", FORMAT_LOTUS123);
xDocSh->DoHardRecalc(true);
ScDocument& rDoc = xDocSh->GetDocument();
CPPUNIT_ASSERT(&rDoc);
testContentImpl(rDoc, LOTUS123);
testContentImpl(rDoc, FORMAT_LOTUS123);
xDocSh->DoClose();
}
void ScFiltersTest::testContentDIF()
{
ScDocShellRef xDocSh = loadDoc("universal-content.", DIF);
ScDocShellRef xDocSh = loadDoc("universal-content.", FORMAT_DIF);
ScDocument& rDoc = xDocSh->GetDocument();
CPPUNIT_ASSERT(&rDoc);
......@@ -305,28 +305,28 @@ void ScFiltersTest::testContentDIF()
void ScFiltersTest::testContentXLSB()
{
ScDocShellRef xDocSh = loadDoc("universal-content.", XLSB);
ScDocShellRef xDocSh = loadDoc("universal-content.", FORMAT_XLSB);
xDocSh->DoHardRecalc(true);
ScDocument& rDoc = xDocSh->GetDocument();
testContentImpl(rDoc, XLSB);
testContentImpl(rDoc, FORMAT_XLSB);
xDocSh->DoClose();
}
// void ScFiltersTest::testContentXLS_XML()
// {
// ScDocShellRef xDocSh = loadDoc("universal-content.", XLS_XML);
// ScDocShellRef xDocSh = loadDoc("universal-content.", FORMAT_XLS_XML);
// CPPUNIT_ASSERT(xDocSh);
//
// ScDocument& rDoc = xDocSh->GetDocument();
// CPPUNIT_ASSERT(&rDoc);
// testContentImpl(pDoc, XLS_XML);
// testContentImpl(pDoc, FORMAT_XLS_XML);
// xDocSh->DoClose();
// }
void ScFiltersTest::testSharedFormulaXLS()
{
ScDocShellRef xDocSh = loadDoc("shared-formula/basic.", XLS);
ScDocShellRef xDocSh = loadDoc("shared-formula/basic.", FORMAT_XLS);
CPPUNIT_ASSERT(xDocSh.Is());
ScDocument& rDoc = xDocSh->GetDocument();
xDocSh->DoHardRecalc(true);
......@@ -350,7 +350,7 @@ void ScFiltersTest::testSharedFormulaXLS()
// Excel can easily mess up shared formula ranges, so we need to be able
// to handle these wrong ranges that Excel stores.
xDocSh = loadDoc("shared-formula/gap.", XLS);
xDocSh = loadDoc("shared-formula/gap.", FORMAT_XLS);
CPPUNIT_ASSERT(xDocSh.Is());
ScDocument& rDoc2 = xDocSh->GetDocument();
rDoc2.CalcAll();
......@@ -395,7 +395,7 @@ void ScFiltersTest::testSharedFormulaXLS()
void ScFiltersTest::testSharedFormulaXLSX()
{
ScDocShellRef xDocSh = loadDoc("shared-formula/basic.", XLSX);
ScDocShellRef xDocSh = loadDoc("shared-formula/basic.", FORMAT_XLSX);
ScDocument& rDoc = xDocSh->GetDocument();
CPPUNIT_ASSERT(&rDoc);
xDocSh->DoHardRecalc(true);
......@@ -418,7 +418,7 @@ void ScFiltersTest::testSharedFormulaXLSX()
void ScFiltersTest::testSheetNamesXLSX()
{
ScDocShellRef xDocSh = loadDoc("sheet-names.", XLSX);
ScDocShellRef xDocSh = loadDoc("sheet-names.", FORMAT_XLSX);
ScDocument& rDoc = xDocSh->GetDocument();
std::vector<OUString> aTabNames = rDoc.GetAllTableNames();
......@@ -469,7 +469,7 @@ void ScFiltersTest::testLegacyCellAnchoredRotatedShape()
// This example doc contains cell anchored shape that is rotated, the
// rotated shape is in fact clipped by the sheet boundries (and thus
// is a good edge case test to see if we import it still correctly)
ScDocShellRef xDocSh = loadDoc("legacycellanchoredrotatedclippedshape.", ODS);
ScDocShellRef xDocSh = loadDoc("legacycellanchoredrotatedclippedshape.", FORMAT_ODS);
ScDocument& rDoc = xDocSh->GetDocument();
CPPUNIT_ASSERT(&rDoc);
......@@ -486,7 +486,7 @@ void ScFiltersTest::testLegacyCellAnchoredRotatedShape()
// test save and reload
// for some reason having this test in subsequent_export-test.cxx causes
// a core dump in editeng ( so moved to here )
xDocSh = saveAndReload( &(*xDocSh), ODS);
xDocSh = saveAndReload( &(*xDocSh), FORMAT_ODS);
ScDocument& rDoc2 = xDocSh->GetDocument();
CPPUNIT_ASSERT(&rDoc2);
impl_testLegacyCellAnchoredRotatedShape( rDoc2, aRect, aAnchor );
......@@ -498,7 +498,7 @@ void ScFiltersTest::testLegacyCellAnchoredRotatedShape()
// rotated shape is in fact clipped by the sheet boundries, additionally
// the shape is completely hidden because the rows the shape occupies
// are hidden
ScDocShellRef xDocSh = loadDoc("legacycellanchoredrotatedhiddenshape.", ODS, true);
ScDocShellRef xDocSh = loadDoc("legacycellanchoredrotatedhiddenshape.", FORMAT_ODS, true);
ScDocument& rDoc = xDocSh->GetDocument();
CPPUNIT_ASSERT(&rDoc);
// ensure the imported legacy rotated shape is in the expected position
......@@ -525,7 +525,7 @@ void ScFiltersTest::testLegacyCellAnchoredRotatedShape()
}
{
// This example doc contains cell anchored shape that is rotated
ScDocShellRef xDocSh = loadDoc("legacycellanchoredrotatedshape.", ODS);
ScDocShellRef xDocSh = loadDoc("legacycellanchoredrotatedshape.", FORMAT_ODS);
ScDocument& rDoc = xDocSh->GetDocument();
CPPUNIT_ASSERT(&rDoc);
......@@ -542,7 +542,7 @@ void ScFiltersTest::testLegacyCellAnchoredRotatedShape()
// test import
impl_testLegacyCellAnchoredRotatedShape( rDoc, aRect, aAnchor );
// test save and reload
xDocSh = saveAndReload( &(*xDocSh), ODS);
xDocSh = saveAndReload( &(*xDocSh), FORMAT_ODS);
ScDocument& rDoc2 = xDocSh->GetDocument();
CPPUNIT_ASSERT(&rDoc2);
impl_testLegacyCellAnchoredRotatedShape( rDoc2, aRect, aAnchor );
......@@ -570,7 +570,7 @@ void testEnhancedProtectionImpl( ScDocument& rDoc )
void ScFiltersTest::testEnhancedProtectionXLS()
{
ScDocShellRef xDocSh = loadDoc("enhanced-protection.", XLS);
ScDocShellRef xDocSh = loadDoc("enhanced-protection.", FORMAT_XLS);
CPPUNIT_ASSERT(xDocSh.Is());
ScDocument& rDoc = xDocSh->GetDocument();
......@@ -581,7 +581,7 @@ void ScFiltersTest::testEnhancedProtectionXLS()
void ScFiltersTest::testEnhancedProtectionXLSX()
{
ScDocShellRef xDocSh = loadDoc("enhanced-protection.", XLSX);
ScDocShellRef xDocSh = loadDoc("enhanced-protection.", FORMAT_XLSX);
CPPUNIT_ASSERT(xDocSh.Is());
ScDocument& rDoc = xDocSh->GetDocument();
......@@ -592,7 +592,7 @@ void ScFiltersTest::testEnhancedProtectionXLSX()
void ScFiltersTest::testSortWithSharedFormulasODS()
{
ScDocShellRef xDocSh = loadDoc("shared-formula/sort-crash.", ODS, true);
ScDocShellRef xDocSh = loadDoc("shared-formula/sort-crash.", FORMAT_ODS, true);
CPPUNIT_ASSERT(xDocSh.Is());
ScDocument& rDoc = xDocSh->GetDocument();
......@@ -644,7 +644,7 @@ void ScFiltersTest::testSortWithSharedFormulasODS()
// Document contains cached external references.
void ScFiltersTest::testSortWithSheetExternalReferencesODS()
{
ScDocShellRef xDocSh = loadDoc("sort-with-sheet-external-references.", ODS, true);
ScDocShellRef xDocSh = loadDoc("sort-with-sheet-external-references.", FORMAT_ODS, true);
CPPUNIT_ASSERT(xDocSh.Is());
ScDocument& rDoc = xDocSh->GetDocument();
sc::AutoCalcSwitch aACSwitch(rDoc, true); // turn auto calc on.
......
......@@ -206,7 +206,7 @@ void testFormats(ScBootstrapFixture* pTest, ScDocument* pDoc, sal_Int32 nFormat)
pPattern->GetFont(aFont, SC_AUTOCOL_RAW);
CPPUNIT_ASSERT_EQUAL_MESSAGE("font should be striked out with a single line", STRIKEOUT_SINGLE, aFont.GetStrikeout());
//some tests on sheet2 only for ods
if (nFormat == ODS)
if (nFormat == FORMAT_ODS)
{
pPattern = pDoc->GetPattern(1,2,1);
pPattern->GetFont(aFont, SC_AUTOCOL_RAW);
......@@ -247,12 +247,12 @@ void testFormats(ScBootstrapFixture* pTest, ScDocument* pDoc, sal_Int32 nFormat)
CPPUNIT_ASSERT_EQUAL_MESSAGE("cell content should be aligned block horizontally", SVX_HOR_JUSTIFY_BLOCK, eHorJustify);
//test Sheet3 only for ods and xlsx
if ( nFormat == ODS || nFormat == XLSX )
if ( nFormat == FORMAT_ODS || nFormat == FORMAT_XLSX )
{
pTest->createCSVPath("conditionalFormatting.", aCSVFileName);
testCondFile(aCSVFileName, pDoc, 2);
// test parent cell style import ( fdo#55198 )
if ( nFormat == XLSX )
if ( nFormat == FORMAT_XLSX )
{
pPattern = pDoc->GetPattern(1,1,3);
ScStyleSheet* pStyleSheet = const_cast<ScStyleSheet*>(pPattern->GetStyleSheet());
......
......@@ -50,16 +50,16 @@
#define XLS_XML_FORMAT_TYPE (SfxFilterFlags::IMPORT | SfxFilterFlags::EXPORT | SfxFilterFlags::ALIEN)
#define XLSB_XML_FORMAT_TYPE (SfxFilterFlags::IMPORT | SfxFilterFlags::ALIEN | SfxFilterFlags::STARONEFILTER | SfxFilterFlags::PREFERED)
#define ODS 0
#define XLS 1
#define XLSX 2
#define XLSM 3
#define CSV 4
#define HTML 5
#define LOTUS123 6
#define DIF 7
#define XLS_XML 8
#define XLSB 9
#define FORMAT_ODS 0
#define FORMAT_XLS 1
#define FORMAT_XLSX 2
#define FORMAT_XLSM 3
#define FORMAT_CSV 4
#define FORMAT_HTML 5
#define FORMAT_LOTUS123 6
#define FORMAT_DIF 7
#define FORMAT_XLS_XML 8
#define FORMAT_XLSB 9
enum StringType { PureString, FormulaValue, StringValue };
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment