summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2011-03-04 09:40:56 +0000
committerCaolán McNamara <caolanm@redhat.com>2011-03-04 11:28:37 +0000
commit2d9659f3856f901f76430b0e6d110727a5088f3f (patch)
treee7828221a22babe60d346fe3c5bbecb72b1046b9
parent1b53761034647542e8b49739b4f8c6181ce16e09 (diff)
setup UCB for qa tests
-rw-r--r--sw/qa/core/makefile.mk4
-rw-r--r--sw/qa/core/swdoc-test.cxx58
2 files changed, 23 insertions, 39 deletions
diff --git a/sw/qa/core/makefile.mk b/sw/qa/core/makefile.mk
index 7fb2a9c8d577..94233207e89b 100644
--- a/sw/qa/core/makefile.mk
+++ b/sw/qa/core/makefile.mk
@@ -132,11 +132,13 @@ $(MISC)/$(TARGET)/services.rdb .ERRREMOVE : $(MISC)/$(TARGET)/udkapi.rdb makefil
-c $(DLLPRE)fileacc$(DLLPOST) \
-c $(DLLPRE)fwk$(DLLPOSTFIX)$(DLLPOST) \
-c $(DLLPRE)sfx$(DLLPOSTFIX)$(DLLPOST) \
+ -c $(DLLPRE)ucb1$(DLLPOST) \
+ -c $(DLLPRE)ucpfile1$(DLLPOST) \
-c $(DLLPRE)unoxml$(DLLPOSTFIX)$(DLLPOST) \
+ -c stocservices.uno$(DLLPOST) \
-c i18npool.uno$(DLLPOST) \
-c sax.uno$(DLLPOST)
-
#Tweak things so that we use the .res files in the solver
STAR_RESOURCEPATH:=$(PWD)/$(BIN)$(PATH_SEPERATOR)$(SOLARBINDIR)
.EXPORT : STAR_RESOURCEPATH
diff --git a/sw/qa/core/swdoc-test.cxx b/sw/qa/core/swdoc-test.cxx
index 343fcceafb0d..8c1b43e752de 100644
--- a/sw/qa/core/swdoc-test.cxx
+++ b/sw/qa/core/swdoc-test.cxx
@@ -85,22 +85,14 @@ public:
virtual void setUp();
virtual void tearDown();
- bool testLoad(const rtl::OUString &rFilter, const rtl::OUString &rURL);
-
void randomTest();
void testPageDescName();
void testFileNameFields();
- /**
- * Ensure CVEs remain unbroken
- */
- void testCVEs();
-
CPPUNIT_TEST_SUITE(SwDocTest);
CPPUNIT_TEST(randomTest);
CPPUNIT_TEST(testPageDescName);
CPPUNIT_TEST(testFileNameFields);
- CPPUNIT_TEST(testCVEs);
CPPUNIT_TEST_SUITE_END();
private:
@@ -108,7 +100,6 @@ private:
uno::Reference<lang::XMultiComponentFactory> m_xFactory;
SwDoc *m_pDoc;
SwDocShellRef m_xDocShRef;
- ::rtl::OUString m_aPWDURL;
};
void SwDocTest::testPageDescName()
@@ -142,6 +133,12 @@ void SwDocTest::testFileNameFields()
String sFileURL = aTempFileURL.GetMainURL(INetURLObject::NO_DECODE);
SfxMedium aDstMed(sFileURL, STREAM_STD_READWRITE, true);
+ SfxFilter aFilter(
+ rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Text")),
+ rtl::OUString(), 0, 0, rtl::OUString(), 0, rtl::OUString(),
+ rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("TEXT")), rtl::OUString() );
+ aDstMed.SetFilter(&aFilter);
+
m_xDocShRef->DoSaveAs(aDstMed);
m_xDocShRef->DoSaveCompleted(&aDstMed);
@@ -182,32 +179,6 @@ void SwDocTest::testFileNameFields()
m_xDocShRef->DoInitNew(0);
}
-bool SwDocTest::testLoad(const rtl::OUString &rFilter, const rtl::OUString &rURL)
-{
- SfxFilter aFilter(
- rFilter,
- rtl::OUString(), 0, 0, rtl::OUString(), 0, rtl::OUString(),
- rtl::OUString(), rtl::OUString() );
-
- SwDocShellRef xDocShRef = new SwDocShell;
- SfxMedium aSrcMed(rURL, STREAM_STD_READ, true);
- aSrcMed.SetFilter(&aFilter);
- return xDocShRef->DoLoad(&aSrcMed);
-}
-
-void SwDocTest::testCVEs()
-{
-//To-Do: I know this works on Linux, please check if this test works under
-//windows and enable it if so
-#ifndef WNT
- bool bResult;
-
- bResult = testLoad(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("StarOffice XML (Writer)")),
- m_aPWDURL + rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("/CVE/CVE-2006-3117-1.sxw")));
- CPPUNIT_ASSERT_MESSAGE("CVE-2006-3117 regression", bResult == false);
-#endif
-}
-
void SwDocTest::randomTest()
{
CPPUNIT_ASSERT_MESSAGE("SwDoc::IsRedlineOn()", !m_pDoc->IsRedlineOn());
@@ -225,13 +196,24 @@ SwDocTest::SwDocTest()
//of retaining references to the root ServiceFactory as its passed around
comphelper::setProcessServiceFactory(xSM);
+ // initialise UCB-Broker
+ uno::Sequence<uno::Any> aUcbInitSequence(2);
+ aUcbInitSequence[0] <<= rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Local"));
+ aUcbInitSequence[1] <<= rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Office"));
+ bool bInitUcb = ucbhelper::ContentBroker::initialize(xSM, aUcbInitSequence);
+ CPPUNIT_ASSERT_MESSAGE("Should be able to initialize UCB", bInitUcb);
+
+ uno::Reference<ucb::XContentProviderManager> xUcb =
+ ucbhelper::ContentBroker::get()->getContentProviderManagerInterface();
+ uno::Reference<ucb::XContentProvider> xFileProvider(xSM->createInstance(
+ rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.ucb.FileContentProvider"))), uno::UNO_QUERY);
+ xUcb->registerContentProvider(xFileProvider, rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("file")), sal_True);
+
+
InitVCL(xSM);
SwDLL::Init();
- oslProcessError err = osl_getProcessWorkingDir(&m_aPWDURL.pData);
- CPPUNIT_ASSERT_MESSAGE("no PWD!", err == osl_Process_E_None);
-
ErrorHandler::RegisterDisplay(&aWndFunc);
}