tdf#130857 qt weld: Implement QtInstanceWidget::get_text_height
[LibreOffice.git] / writerperfect / qa / unit / WpftFilterTestBase.cxx
blob85f8e1d79e49bd2bb7ff18e50056d693f59a8704
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 "WpftFilterTestBase.hxx"
12 #include <com/sun/star/document/XFilter.hpp>
14 #include <tools/urlobj.hxx>
16 #include "WpftLoader.hxx"
18 namespace uno = css::uno;
20 namespace writerperfect::test
22 WpftFilterTestBase::WpftFilterTestBase(const OUString& rFactoryURL)
23 : ::test::FiltersTest()
24 , WpftFilterFixture()
25 , m_aFactoryURL(rFactoryURL)
26 , m_pOptionalMap(nullptr)
30 bool WpftFilterTestBase::load(const OUString&, const OUString& rURL, const OUString&,
31 SfxFilterFlags, SotClipboardFormatId, unsigned int)
33 if (m_pOptionalMap)
35 // first check if this test file is supported by the used version of the library
36 const INetURLObject aUrl(rURL);
37 const WpftOptionalMap_t::const_iterator it(m_pOptionalMap->find(aUrl.getName()));
38 if ((it != m_pOptionalMap->end()) && !it->second)
39 return true; // skip the file
42 const WpftLoader aLoader(rURL, m_xFilter, m_aFactoryURL, m_xDesktop, m_xTypeMap, m_xContext);
43 return aLoader.getDocument().is();
46 void WpftFilterTestBase::doTest(const OUString& rFilter, std::u16string_view rPath)
48 m_xFilter.set(m_xFactory->createInstanceWithContext(rFilter, m_xContext), uno::UNO_QUERY_THROW);
49 testDir(OUString(), m_directories.getURLFromSrc(rPath));
52 void WpftFilterTestBase::doTest(const OUString& rFilter, std::u16string_view rPath,
53 const WpftOptionalMap_t& rOptionalMap)
55 m_xFilter.set(m_xFactory->createInstanceWithContext(rFilter, m_xContext), uno::UNO_QUERY_THROW);
56 m_pOptionalMap = &rOptionalMap;
57 testDir(OUString(), m_directories.getURLFromSrc(rPath));
58 m_pOptionalMap = nullptr;
62 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */