fix baseline build (old cairo) - 'cairo_rectangle_int_t' does not name a type
[LibreOffice.git] / sd / qa / unit / uimpress.cxx
blobf1704a6d5699de6e57a9ccdaf3f08cabfb1fca4a
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 <sal/types.h>
11 #include "cppunit/TestAssert.h"
12 #include "cppunit/TestFixture.h"
13 #include "cppunit/extensions/HelperMacros.h"
14 #include "cppunit/plugin/TestPlugIn.h"
16 #include <cppuhelper/bootstrap.hxx>
17 #include <comphelper/processfactory.hxx>
19 #include <vcl/svapp.hxx>
20 #include <sddll.hxx>
21 #include <drawdoc.hxx>
23 #include <iostream>
24 #include <vector>
26 using namespace ::com::sun::star;
28 namespace {
30 class Test : public CppUnit::TestFixture {
31 public:
32 Test();
33 virtual ~Test();
35 virtual void setUp() SAL_OVERRIDE;
36 virtual void tearDown() SAL_OVERRIDE;
38 void testAddPage();
39 void testCustomShow();
41 CPPUNIT_TEST_SUITE(Test);
42 CPPUNIT_TEST(testAddPage);
43 CPPUNIT_TEST(testCustomShow);
44 CPPUNIT_TEST_SUITE_END();
46 private:
47 uno::Reference< uno::XComponentContext > m_xContext;
48 SdDrawDocument* m_pDoc;
51 Test::Test()
52 : m_pDoc(0)
54 m_xContext = cppu::defaultBootstrap_InitialComponentContext();
56 uno::Reference<lang::XMultiComponentFactory> xFactory(m_xContext->getServiceManager());
57 uno::Reference<lang::XMultiServiceFactory> xSM(xFactory, uno::UNO_QUERY_THROW);
59 //Without this we're crashing because callees are using
60 //getProcessServiceFactory. In general those should be removed in favour
61 //of retaining references to the root ServiceFactory as its passed around
62 comphelper::setProcessServiceFactory(xSM);
64 InitVCL();
66 SdDLL::Init();
69 void Test::setUp()
71 m_pDoc = new SdDrawDocument(DOCUMENT_TYPE_IMPRESS, NULL);
74 void Test::tearDown()
76 delete m_pDoc;
79 Test::~Test()
81 uno::Reference< lang::XComponent >(m_xContext, uno::UNO_QUERY_THROW)->dispose();
84 void Test::testAddPage()
86 SdrPage* pPage = m_pDoc->AllocPage(false);
87 m_pDoc->InsertPage(pPage);
88 CPPUNIT_ASSERT_MESSAGE("added one page to model",
89 m_pDoc->GetPageCount()==1);
90 m_pDoc->DeletePage(0);
91 CPPUNIT_ASSERT_MESSAGE("removed one page to model",
92 m_pDoc->GetPageCount()==0);
94 SdrPage* pMasterPage = m_pDoc->AllocPage(true);
95 m_pDoc->InsertMasterPage(pMasterPage);
96 CPPUNIT_ASSERT_MESSAGE("added one master page to model",
97 m_pDoc->GetMasterPageCount()==1);
98 m_pDoc->DeleteMasterPage(0);
99 CPPUNIT_ASSERT_MESSAGE("removed one master page to model",
100 m_pDoc->GetMasterPageCount()==0);
103 void Test::testCustomShow()
105 CPPUNIT_ASSERT_MESSAGE("test generation of custom show list!",
106 m_pDoc->GetCustomShowList(true));
109 CPPUNIT_TEST_SUITE_REGISTRATION(Test);
113 CPPUNIT_PLUGIN_IMPLEMENT();
115 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */