summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.com>2021-06-08 20:47:57 +0200
committerMiklos Vajna <vmiklos@collabora.com>2021-06-09 09:03:34 +0200
commit6cd8dd2123354578a1499a1e85e268f702f38954 (patch)
tree6d43e2c2936695d895b1db4b8bd5bd51b621b432
parent13666bb9e5d5a45210322c339efef776dbc59f3f (diff)
CppunitTest_sw_ooxmlimport: rework to avoid the FailTest hack
Change-Id: Ic59398c15f4caa04191dbf4d6252361a330fc8c1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/116863 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
-rw-r--r--sw/qa/extras/ooxmlimport/ooxmlimport.cxx37
1 files changed, 5 insertions, 32 deletions
diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
index b9b09d765eef..deb17d50fb23 100644
--- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
+++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
@@ -68,45 +68,16 @@
#include <vcl/TypeSerializer.hxx>
#include <comphelper/scopeguard.hxx>
+constexpr OUStringLiteral DATA_DIRECTORY = u"/sw/qa/extras/ooxmlimport/data/";
class Test : public SwModelTestBase
{
public:
- Test() : SwModelTestBase("/sw/qa/extras/ooxmlimport/data/", "Office Open XML Text")
+ Test() : SwModelTestBase(DATA_DIRECTORY, "Office Open XML Text")
{
}
};
-class FailTest : public Test
-{
-public:
- // UGLY: hacky manual override of MacrosTest::loadFromDesktop
- void executeImportTest(const char* filename, const char* /*password*/)
- {
- header();
- preTest(filename);
- {
- if (mxComponent.is())
- mxComponent->dispose();
- std::cout << filename << ",";
- mnStartTime = osl_getGlobalTimer();
- {
- OUString aURL(m_directories.getURLFromSrc(mpTestDocumentPath) + OUString::createFromAscii(filename));
- CPPUNIT_ASSERT_MESSAGE("no desktop", mxDesktop.is());
- uno::Sequence<beans::PropertyValue> args( comphelper::InitPropertySequence({
- { "DocumentService", uno::Any(OUString("com.sun.star.text.TextDocument")) }
- }));
-
- uno::Reference<lang::XComponent> xComponent = mxDesktop->loadComponentFromURL(aURL, "_default", 0, args);
- OUString sMessage = "loading succeeded: " + aURL;
- CPPUNIT_ASSERT_MESSAGE(OUStringToOString(sMessage, RTL_TEXTENCODING_UTF8).getStr(), !xComponent.is());
- }
- }
- verify();
- finish();
- }
-};
-
CPPUNIT_TEST_FIXTURE(Test, testImageHyperlink)
{
load(mpTestDocumentPath, "image-hyperlink.docx");
@@ -114,8 +85,10 @@ CPPUNIT_TEST_FIXTURE(Test, testImageHyperlink)
CPPUNIT_ASSERT_EQUAL(OUString("http://www.libreoffice.org/"), URL);
}
-DECLARE_SW_IMPORT_TEST(testMathMalformedXml, "math-malformed_xml.docx", nullptr, FailTest)
+CPPUNIT_TEST_FIXTURE(Test, testMathMalformedXml)
{
+ OUString aURL = m_directories.getURLFromSrc(DATA_DIRECTORY) + "math-malformed_xml.docx";
+ mxComponent = mxDesktop->loadComponentFromURL(aURL, "_default", 0, {});
CPPUNIT_ASSERT(!mxComponent.is());
}