Kaydet (Commit) cc272644 authored tarafından Miklos Vajna's avatar Miklos Vajna

CppunitTest_sw_ooxmlexport: speed this up a bit

We don't have too much testcases where we assert directly the resulting
zipped XML files, but where we did, we actully invoked filter() 5 times,
even if 3 times is enough, fix this.

That causes the testcase to run in 1m24.754s (previously it was
1m30.278s).  Additionally, at one case the XML result is an expected
one, having matching testcase and manual results is always good.

Change-Id: Ie905002b113bc84f1e517c35f14739f423fd8ea2
üst d646612f
...@@ -26,6 +26,7 @@ $(eval $(call gb_CppunitTest_use_libraries,sw_odfimport, \ ...@@ -26,6 +26,7 @@ $(eval $(call gb_CppunitTest_use_libraries,sw_odfimport, \
unotest \ unotest \
vcl \ vcl \
tl \ tl \
utl \
$(gb_UWINAPI) \ $(gb_UWINAPI) \
)) ))
......
...@@ -26,6 +26,7 @@ $(eval $(call gb_CppunitTest_use_libraries,sw_uiwriter, \ ...@@ -26,6 +26,7 @@ $(eval $(call gb_CppunitTest_use_libraries,sw_uiwriter, \
unotest \ unotest \
vcl \ vcl \
tl \ tl \
utl \
$(gb_UWINAPI) \ $(gb_UWINAPI) \
)) ))
......
...@@ -23,6 +23,7 @@ $(eval $(call gb_CppunitTest_use_libraries,sw_ww8import, \ ...@@ -23,6 +23,7 @@ $(eval $(call gb_CppunitTest_use_libraries,sw_ww8import, \
test \ test \
unotest \ unotest \
sw \ sw \
utl \
$(gb_UWINAPI) \ $(gb_UWINAPI) \
)) ))
......
...@@ -89,7 +89,11 @@ class SwModelTestBase : public test::BootstrapFixture, public unotest::MacrosTes ...@@ -89,7 +89,11 @@ class SwModelTestBase : public test::BootstrapFixture, public unotest::MacrosTes
{ {
public: public:
SwModelTestBase(const char* pTestDocumentPath = "", const char* pFilter = "") SwModelTestBase(const char* pTestDocumentPath = "", const char* pFilter = "")
: mpXmlBuffer(0), mpTestDocumentPath(pTestDocumentPath), mpFilter(pFilter) : mpXmlBuffer(0),
mpTestDocumentPath(pTestDocumentPath),
mpFilter(pFilter),
m_nStartTime(0),
m_bExported(false)
{ {
} }
...@@ -419,12 +423,12 @@ protected: ...@@ -419,12 +423,12 @@ protected:
uno::Sequence<beans::PropertyValue> aArgs(1); uno::Sequence<beans::PropertyValue> aArgs(1);
aArgs[0].Name = "FilterName"; aArgs[0].Name = "FilterName";
aArgs[0].Value <<= OUString::createFromAscii(pFilter); aArgs[0].Value <<= OUString::createFromAscii(pFilter);
utl::TempFile aTempFile; m_aTempFile.EnableKillingFile();
aTempFile.EnableKillingFile(); xStorable->storeToURL(m_aTempFile.GetURL(), aArgs);
xStorable->storeToURL(aTempFile.GetURL(), aArgs);
uno::Reference<lang::XComponent> xComponent(xStorable, uno::UNO_QUERY); uno::Reference<lang::XComponent> xComponent(xStorable, uno::UNO_QUERY);
xComponent->dispose(); xComponent->dispose();
mxComponent = loadFromDesktop(aTempFile.GetURL(), "com.sun.star.text.TextDocument"); m_bExported = true;
mxComponent = loadFromDesktop(m_aTempFile.GetURL(), "com.sun.star.text.TextDocument");
if (mpXmlBuffer) if (mpXmlBuffer)
{ {
xmlBufferFree(mpXmlBuffer); xmlBufferFree(mpXmlBuffer);
...@@ -478,6 +482,8 @@ protected: ...@@ -478,6 +482,8 @@ protected:
void (T::*pMethod)(); void (T::*pMethod)();
}; };
sal_uInt32 m_nStartTime; sal_uInt32 m_nStartTime;
utl::TempFile m_aTempFile;
bool m_bExported; ///< Does m_aTempFile already contain something useful?
}; };
/** /**
......
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