fix baseline build (old cairo) - 'cairo_rectangle_int_t' does not name a type
[LibreOffice.git] / writerfilter / qa / cppunittests / rtftok / testrtftok.cxx
blobdd9e474433c9e806f6c0bffb7561f14e2be77c75
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 */
10 #include <unotest/filters-test.hxx>
11 #include <test/bootstrapfixture.hxx>
12 #include <com/sun/star/document/XFilter.hpp>
13 #include <com/sun/star/io/WrongFormatException.hpp>
14 #include <com/sun/star/lang/WrappedTargetRuntimeException.hpp>
16 #include <osl/file.hxx>
17 #include <osl/process.h>
19 using namespace ::com::sun::star;
21 /**
22 * Unit test invoking the Writer RTF import filter.
24 * This does only minimal testing, checking if the filter crashes and returns
25 * the expected bool value for given inputs. More fine-grained tests can be
26 * found under sw/qa/extras/rtfimport/.
28 class RtfTest
29 : public test::FiltersTest
30 , public test::BootstrapFixture
32 public:
34 virtual void setUp() SAL_OVERRIDE;
36 virtual bool load(const OUString&,
37 const OUString& rURL, const OUString&,
38 SfxFilterFlags, SotClipboardFormatId, unsigned int) SAL_OVERRIDE;
40 void test();
42 CPPUNIT_TEST_SUITE(RtfTest);
43 CPPUNIT_TEST(test);
44 CPPUNIT_TEST_SUITE_END();
45 private:
46 uno::Reference<document::XFilter> m_xFilter;
49 void RtfTest::setUp()
51 test::BootstrapFixture::setUp();
53 m_xFilter = uno::Reference< document::XFilter >(m_xSFactory->createInstance("com.sun.star.comp.Writer.RtfFilter"), uno::UNO_QUERY_THROW);
56 bool RtfTest::load(const OUString&,
57 const OUString& rURL, const OUString&,
58 SfxFilterFlags, SotClipboardFormatId, unsigned int)
60 uno::Sequence< beans::PropertyValue > aDescriptor =
62 beans::PropertyValue("URL", sal_Int32(0), uno::makeAny(rURL), beans::PropertyState_DIRECT_VALUE)
64 try
66 return m_xFilter->filter(aDescriptor);
68 catch (const lang::WrappedTargetRuntimeException& rWrapped)
70 io::WrongFormatException e;
71 if (rWrapped.TargetException >>= e)
73 return false;
75 throw;
79 void RtfTest::test()
81 #ifndef DISABLE_CVE_TESTS
82 testDir(OUString(),
83 getURLFromSrc("/writerfilter/qa/cppunittests/rtftok/data/"),
84 OUString());
85 #endif
88 CPPUNIT_TEST_SUITE_REGISTRATION(RtfTest);
90 CPPUNIT_PLUGIN_IMPLEMENT();
92 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */