Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*
3 : : * Copyright 2012 LibreOffice contributors.
4 : : *
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 : : */
9 : : #ifndef _BASICTEST_HXX
10 : : #define _BASICTEST_HXX
11 : :
12 : : #include <sal/types.h>
13 : : #include "cppunit/TestFixture.h"
14 : : #include "cppunit/extensions/HelperMacros.h"
15 : : #include "cppunit/plugin/TestPlugIn.h"
16 : : #include <test/bootstrapfixture.hxx>
17 : : #include "basic/sbstar.hxx"
18 : : #include "basic/basrdll.hxx"
19 : :
20 [ - + ]: 18 : class BasicTestBase : public test::BootstrapFixture
21 : : {
22 : : private:
23 : : bool mbError;
24 : : public:
25 : 18 : BasicTestBase() : mbError(false) {};
26 : :
27 : :
28 : : DECL_LINK( BasicErrorHdl, StarBASIC * );
29 : 18 : bool HasError() { return mbError; }
30 : 18 : void ResetError()
31 : : {
32 [ + - ]: 18 : StarBASIC::SetGlobalErrorHdl( Link() );
33 : 18 : mbError = false;
34 : 18 : }
35 : 18 : BasicDLL& basicDLL()
36 : : {
37 [ + + ][ + - ]: 18 : static BasicDLL maDll; // we need a dll instance for resouce manager etc.
[ + - ][ # # ]
38 : 18 : return maDll;
39 : : }
40 : : };
41 : :
42 : 0 : IMPL_LINK( BasicTestBase, BasicErrorHdl, StarBASIC *, /*pBasic*/)
43 : : {
44 [ # # ][ # # ]: 0 : fprintf(stderr,"Got error: \n\t%s!!!\n", rtl::OUStringToOString( StarBASIC::GetErrorText(), RTL_TEXTENCODING_UTF8 ).getStr() );
45 : 0 : mbError = true;
46 : 0 : return 0;
47 : : }
48 : :
49 : : #endif
50 : :
51 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|