/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* * This file is part of the LibreOffice project. * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #include #include #include #include #include #include #include #include #include #include #include #include #include "WpftFilterFixture.hxx" #include "WpftLoader.hxx" namespace { namespace beans = css::beans; namespace container = css::container; namespace document = css::document; namespace lang = css::lang; namespace sheet = css::sheet; namespace table = css::table; namespace uno = css::uno; using uno::UNO_QUERY; using writerperfect::test::WpftLoader; class ImportTest : public writerperfect::test::WpftFilterFixture { public: virtual void setUp() override; void testWK3WithFM3(); CPPUNIT_TEST_SUITE(ImportTest); CPPUNIT_TEST(testWK3WithFM3); CPPUNIT_TEST_SUITE_END(); private: WpftLoader createCalcLoader(std::u16string_view rFile) const; WpftLoader createLoader(const OUString& rUrl, const OUString& rFactoryUrl) const; OUString makeUrl(std::u16string_view rFile) const; private: uno::Reference m_xFilterFactory; }; void ImportTest::setUp() { writerperfect::test::WpftFilterFixture::setUp(); m_xFilterFactory.set(m_xFactory->createInstanceWithContext( u"com.sun.star.document.FilterFactory"_ustr, m_xContext), UNO_QUERY); assert(m_xFilterFactory.is()); } void ImportTest::testWK3WithFM3() { WpftLoader aLoader(createCalcLoader(u"SOLVE.WK3")); uno::Reference xDoc(aLoader.getDocument(), UNO_QUERY); CPPUNIT_ASSERT(xDoc.is()); uno::Reference xSheets(xDoc->getSheets(), UNO_QUERY); CPPUNIT_ASSERT(xSheets.is()); uno::Reference xSheet(xSheets->getByIndex(0), UNO_QUERY); CPPUNIT_ASSERT(xSheet.is()); uno::Reference xCellProps(xSheet->getCellByPosition(1, 1), UNO_QUERY); CPPUNIT_ASSERT(xCellProps.is()); Color nCharColor; CPPUNIT_ASSERT(xCellProps->getPropertyValue(u"CharColor"_ustr) >>= nCharColor); CPPUNIT_ASSERT_EQUAL(COL_LIGHTBLUE, nCharColor); // blue text } WpftLoader ImportTest::createCalcLoader(std::u16string_view rFile) const { return createLoader(makeUrl(rFile), u"private:factory/scalc"_ustr); } WpftLoader ImportTest::createLoader(const OUString& rUrl, const OUString& rFactoryUrl) const { utl::MediaDescriptor aDesc; aDesc[utl::MediaDescriptor::PROP_URL] <<= rUrl; aDesc[utl::MediaDescriptor::PROP_READONLY] <<= true; uno::Sequence lDesc(aDesc.getAsConstPropertyValueList()); m_xTypeDetection->queryTypeByDescriptor(lDesc, true); aDesc = lDesc; OUString sFilter; aDesc[utl::MediaDescriptor::PROP_FILTERNAME] >>= sFilter; CPPUNIT_ASSERT(!sFilter.isEmpty()); const uno::Reference xFilter(m_xFilterFactory->createInstance(sFilter), UNO_QUERY); CPPUNIT_ASSERT(xFilter.is()); return WpftLoader(rUrl, xFilter, rFactoryUrl, m_xDesktop, m_xTypeMap, m_xContext); } OUString ImportTest::makeUrl(std::u16string_view rFile) const { return const_cast(this)->m_directories.getURLFromSrc( Concat2View(OUString::Concat("/" TEST_DIR "/") + rFile)); } CPPUNIT_TEST_SUITE_REGISTRATION(ImportTest); } CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ op'>distro/collabora/cp-5.3-desktop LibreOffice 核心代码仓库文档基金会
summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2021-03-23tdf#124176 Use pragma once in s*Vincent LE GARREC
sc, scaddins, sccomp, scripting Change-Id: Ia99fec9e238033821cb784810edd4762c09bd5db Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112049 Tested-by: Jenkins Reviewed-by: Ilmari Lauhakangas <ilmari.lauhakangas@libreoffice.org>
2020-11-19tdf#123936 Formatting files in module sc with clang-formatPhilipp Hofer
Change-Id: I66cafda863e3e1e4559a57289c09925d68b0719c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105701 Reviewed-by: Christian Lohmaier <lohmaier+LibreOffice@googlemail.com> Tested-by: Jenkins