Properly #ifdef some per-platform test code

Change-Id: I286fb35e223f205ecc649aa388471ef1b0823d86
This commit is contained in:
Stephan Bergmann 2014-04-15 23:29:14 +02:00
parent 78fcb7f256
commit 1f742c520d
5 changed files with 31 additions and 0 deletions

View File

@ -36,9 +36,11 @@ class ScMacrosTest : public UnoApiTest
public: public:
ScMacrosTest(); ScMacrosTest();
#if !defined MACOSX
void testStarBasic(); void testStarBasic();
void testVba(); void testVba();
void testMSP(); void testMSP();
#endif
CPPUNIT_TEST_SUITE(ScMacrosTest); CPPUNIT_TEST_SUITE(ScMacrosTest);
#if !defined(MACOSX) #if !defined(MACOSX)
//enable this test if you want to play with star basic macros in unit tests //enable this test if you want to play with star basic macros in unit tests
@ -54,6 +56,8 @@ private:
uno::Reference<uno::XInterface> m_xCalcComponent; uno::Reference<uno::XInterface> m_xCalcComponent;
}; };
#if !defined MACOSX
// I suppose you could say this test doesn't really belong here, OTOH // I suppose you could say this test doesn't really belong here, OTOH
// we need a full document to run the test ( it related originally to an // we need a full document to run the test ( it related originally to an
// imported Excel VBA macro ) It's convenient and fast to unit test // imported Excel VBA macro ) It's convenient and fast to unit test
@ -276,6 +280,8 @@ void ScMacrosTest::testVba()
} }
} }
#endif
ScMacrosTest::ScMacrosTest() ScMacrosTest::ScMacrosTest()
: UnoApiTest("/sc/qa/extras/testdocuments") : UnoApiTest("/sc/qa/extras/testdocuments")
{ {

View File

@ -59,10 +59,14 @@ public:
virtual void setUp() SAL_OVERRIDE; virtual void setUp() SAL_OVERRIDE;
virtual void tearDown() SAL_OVERRIDE; virtual void tearDown() SAL_OVERRIDE;
#if !defined MACOSX && !defined DRAGONFLY
ScDocShellRef saveAndReloadPassword( ScDocShell*, const OUString&, const OUString&, const OUString&, sal_uLong ); ScDocShellRef saveAndReloadPassword( ScDocShell*, const OUString&, const OUString&, const OUString&, sal_uLong );
#endif
void test(); void test();
#if !defined MACOSX && !defined DRAGONFLY
void testPasswordExport(); void testPasswordExport();
#endif
void testConditionalFormatExportODS(); void testConditionalFormatExportODS();
void testConditionalFormatExportXLSX(); void testConditionalFormatExportXLSX();
void testColorScaleExportODS(); void testColorScaleExportODS();
@ -132,6 +136,7 @@ private:
}; };
#if !defined MACOSX && !defined DRAGONFLY
ScDocShellRef ScExportTest::saveAndReloadPassword(ScDocShell* pShell, const OUString &rFilter, ScDocShellRef ScExportTest::saveAndReloadPassword(ScDocShell* pShell, const OUString &rFilter,
const OUString &rUserData, const OUString& rTypeName, sal_uLong nFormatType) const OUString &rUserData, const OUString& rTypeName, sal_uLong nFormatType)
{ {
@ -168,6 +173,7 @@ ScDocShellRef ScExportTest::saveAndReloadPassword(ScDocShell* pShell, const OUSt
OUString aPass("test"); OUString aPass("test");
return load(aTempFile.GetURL(), rFilter, rUserData, rTypeName, nFormatType, nFormat, SOFFICE_FILEFORMAT_CURRENT, &aPass); return load(aTempFile.GetURL(), rFilter, rUserData, rTypeName, nFormatType, nFormat, SOFFICE_FILEFORMAT_CURRENT, &aPass);
} }
#endif
void ScExportTest::test() void ScExportTest::test()
{ {
@ -190,6 +196,7 @@ void ScExportTest::test()
ASSERT_DOUBLES_EQUAL(aVal, 1.0); ASSERT_DOUBLES_EQUAL(aVal, 1.0);
} }
#if !defined MACOSX && !defined DRAGONFLY
void ScExportTest::testPasswordExport() void ScExportTest::testPasswordExport()
{ {
ScDocShell* pShell = new ScDocShell( ScDocShell* pShell = new ScDocShell(
@ -215,6 +222,7 @@ void ScExportTest::testPasswordExport()
xDocSh->DoClose(); xDocSh->DoClose();
} }
#endif
void ScExportTest::testConditionalFormatExportODS() void ScExportTest::testConditionalFormatExportODS()
{ {

View File

@ -136,9 +136,11 @@ public:
void testRowIndex1BasedXLSX(); void testRowIndex1BasedXLSX();
//misc tests unrelated to the import filters //misc tests unrelated to the import filters
#if !defined(MACOSX) && !defined(DRAGONFLY) && !defined(WNT)
void testPasswordNew(); void testPasswordNew();
void testPasswordOld(); void testPasswordOld();
void testPasswordWrongSHA(); void testPasswordWrongSHA();
#endif
//test shape import //test shape import
void testControlImport(); void testControlImport();
@ -247,7 +249,10 @@ public:
CPPUNIT_TEST_SUITE_END(); CPPUNIT_TEST_SUITE_END();
private: private:
#if !defined(MACOSX) && !defined(DRAGONFLY) && !defined(WNT)
void testPassword_Impl(const OUString& rFileNameBase); void testPassword_Impl(const OUString& rFileNameBase);
#endif
uno::Reference<uno::XInterface> m_xCalcComponent; uno::Reference<uno::XInterface> m_xCalcComponent;
}; };
@ -1486,6 +1491,7 @@ void ScFiltersTest::testRowIndex1BasedXLSX()
xDocSh->DoClose(); xDocSh->DoClose();
} }
#if !defined(MACOSX) && !defined(DRAGONFLY) && !defined(WNT)
void ScFiltersTest::testPassword_Impl(const OUString& aFileNameBase) void ScFiltersTest::testPassword_Impl(const OUString& aFileNameBase)
{ {
OUString aFileExtension(getFileFormats()[0].pName, strlen(getFileFormats()[0].pName), RTL_TEXTENCODING_UTF8 ); OUString aFileExtension(getFileFormats()[0].pName, strlen(getFileFormats()[0].pName), RTL_TEXTENCODING_UTF8 );
@ -1541,6 +1547,7 @@ void ScFiltersTest::testPasswordWrongSHA()
const OUString aFileNameBase("passwordWrongSHA."); const OUString aFileNameBase("passwordWrongSHA.");
testPassword_Impl(aFileNameBase); testPassword_Impl(aFileNameBase);
} }
#endif
void ScFiltersTest::testControlImport() void ScFiltersTest::testControlImport()
{ {

View File

@ -51,13 +51,17 @@ class SwMacrosTest : public test::BootstrapFixture, public unotest::MacrosTest
public: public:
SwMacrosTest(); SwMacrosTest();
#if !defined MACOSX && !defined WNT
void createFileURL(const OUString& aFileBase, const OUString& aFileExtension, OUString& rFilePath); void createFileURL(const OUString& aFileBase, const OUString& aFileExtension, OUString& rFilePath);
#endif
virtual void setUp() SAL_OVERRIDE; virtual void setUp() SAL_OVERRIDE;
virtual void tearDown() SAL_OVERRIDE; virtual void tearDown() SAL_OVERRIDE;
//void testStarBasic(); //void testStarBasic();
#if !defined MACOSX && !defined WNT
void testVba(); void testVba();
#endif
void testFdo55289(); void testFdo55289();
CPPUNIT_TEST_SUITE(SwMacrosTest); CPPUNIT_TEST_SUITE(SwMacrosTest);
#if !defined(MACOSX) && !defined(WNT) #if !defined(MACOSX) && !defined(WNT)
@ -75,6 +79,7 @@ private:
OUString m_aBaseString; OUString m_aBaseString;
}; };
#if !defined MACOSX && !defined WNT
void SwMacrosTest::createFileURL(const OUString& aFileBase, const OUString& aFileExtension, OUString& rFilePath) void SwMacrosTest::createFileURL(const OUString& aFileBase, const OUString& aFileExtension, OUString& rFilePath)
{ {
OUString aSep("/"); OUString aSep("/");
@ -83,6 +88,7 @@ void SwMacrosTest::createFileURL(const OUString& aFileBase, const OUString& aFil
aBuffer.append(aSep).append(aFileBase).append(aFileExtension); aBuffer.append(aSep).append(aFileBase).append(aFileExtension);
rFilePath = aBuffer.makeStringAndClear(); rFilePath = aBuffer.makeStringAndClear();
} }
#endif
#if 0 #if 0
@ -113,6 +119,7 @@ void SwMacrosTest::testStarBasic()
#endif #endif
#if !defined MACOSX && !defined WNT
void SwMacrosTest::testVba() void SwMacrosTest::testVba()
{ {
TestMacroInfo testInfo[] = { TestMacroInfo testInfo[] = {
@ -148,6 +155,7 @@ void SwMacrosTest::testVba()
pFoundShell->DoClose(); pFoundShell->DoClose();
} }
} }
#endif
void SwMacrosTest::testFdo55289() void SwMacrosTest::testFdo55289()
{ {

View File

@ -84,6 +84,7 @@ public:
protected: protected:
/// Copy&paste helper. /// Copy&paste helper.
#if !defined MACOSX && !defined WNT
void paste(const OUString& aFilename, uno::Reference<text::XTextRange> xTextRange = uno::Reference<text::XTextRange>()) void paste(const OUString& aFilename, uno::Reference<text::XTextRange> xTextRange = uno::Reference<text::XTextRange>())
{ {
uno::Reference<document::XFilter> xFilter(m_xSFactory->createInstance("com.sun.star.comp.Writer.RtfFilter"), uno::UNO_QUERY_THROW); uno::Reference<document::XFilter> xFilter(m_xSFactory->createInstance("com.sun.star.comp.Writer.RtfFilter"), uno::UNO_QUERY_THROW);
@ -103,6 +104,7 @@ protected:
} }
xFilter->filter(aDescriptor); xFilter->filter(aDescriptor);
} }
#endif
AllSettings m_aSavedSettings; AllSettings m_aSavedSettings;
}; };