Files
libreoffice/sw/qa/core/layout-test.cxx
Alexander Wilms a27462189d Remove visual noise from sw
Conflicts:
	sw/inc/unodraw.hxx
	sw/inc/unoframe.hxx
	sw/sdi/swriter.sdi
	sw/source/core/unocore/unoframe.cxx
	sw/source/core/unocore/unoparagraph.cxx
	sw/source/filter/ww8/rtfexportfilter.cxx
	sw/source/ui/inc/unotxvw.hxx
	sw/source/ui/lingu/hyp.cxx
	sw/source/ui/lingu/sdrhhcwrap.cxx
	sw/source/ui/uno/swdetect.hxx

Change-Id: Ic0a3fb2392187c277c9b36915ffb10dcf0317908
Reviewed-on: https://gerrit.libreoffice.org/8322
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
2014-02-27 09:41:00 -06:00

104 lines
3.0 KiB
C++

/* -*- 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 <sal/config.h>
#include <unotest/macros_test.hxx>
#include <test/bootstrapfixture.hxx>
#include <rtl/strbuf.hxx>
#include <osl/file.hxx>
#include <com/sun/star/frame/Desktop.hpp>
#include <com/sun/star/lang/XComponent.hpp>
#include <com/sun/star/frame/XComponentLoader.hpp>
#include <com/sun/star/document/MacroExecMode.hpp>
#include <sfx2/app.hxx>
#include <sfx2/docfilt.hxx>
#include <sfx2/docfile.hxx>
#include <sfx2/sfxmodelfactory.hxx>
#include <svl/intitem.hxx>
using namespace ::com::sun::star::uno;
using namespace com::sun::star;
/* Implementation of Macros test */
class SwLayoutTest : public test::BootstrapFixture, public unotest::MacrosTest
{
public:
SwLayoutTest();
void createFileURL(const OUString& aFileBase, const OUString& aFileExtension, OUString& rFilePath);
virtual void setUp();
virtual void tearDown();
void test();
CPPUNIT_TEST_SUITE(SwLayoutTest);
#if !defined(MACOSX) && !defined(WNT)
CPPUNIT_TEST(test);
#endif
CPPUNIT_TEST_SUITE_END();
private:
uno::Reference<uno::XInterface> m_xWriterComponent;
OUString m_aBaseString;
};
void SwLayoutTest::createFileURL(const OUString& aFileBase, const OUString& aFileExtension, OUString& rFilePath)
{
OUString aSep("/");
OUStringBuffer aBuffer( getSrcRootURL() );
aBuffer.append(m_aBaseString).append(aSep).append(aFileExtension);
aBuffer.append(aSep).append(aFileBase).append(aFileExtension);
rFilePath = aBuffer.makeStringAndClear();
}
void SwLayoutTest::test()
{
OUString aFilePath;
OUString aFileBase("test.");
OUString aExtension("odt");
createFileURL(aFileBase, aExtension, aFilePath);
uno::Reference< lang::XComponent > xComponent = loadFromDesktop(aFilePath, "com.sun.star.text.TextDocument");
CPPUNIT_ASSERT(xComponent.is());
}
SwLayoutTest::SwLayoutTest()
: m_aBaseString("/sw/qa/core/data")
{
}
void SwLayoutTest::setUp()
{
test::BootstrapFixture::setUp();
// This is a bit of a fudge, we do this to ensure that SwGlobals::ensure,
// which is a private symbol to us, gets called
m_xWriterComponent =
getMultiServiceFactory()->createInstance(OUString(
"com.sun.star.comp.Writer.TextDocument"));
CPPUNIT_ASSERT_MESSAGE("no calc component!", m_xWriterComponent.is());
mxDesktop = com::sun::star::frame::Desktop::create( comphelper::getComponentContext(getMultiServiceFactory()) );
}
void SwLayoutTest::tearDown()
{
uno::Reference< lang::XComponent >( m_xWriterComponent, UNO_QUERY_THROW )->dispose();
test::BootstrapFixture::tearDown();
}
CPPUNIT_TEST_SUITE_REGISTRATION(SwLayoutTest);
CPPUNIT_PLUGIN_IMPLEMENT();
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */