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 7 : class BasicTestBase : public test::BootstrapFixture
21 : {
22 : private:
23 : bool mbError;
24 : public:
25 7 : BasicTestBase() : BootstrapFixture(true, false), mbError(false) {};
26 :
27 :
28 : DECL_LINK( BasicErrorHdl, StarBASIC * );
29 6 : bool HasError() { return mbError; }
30 8 : void ResetError()
31 : {
32 8 : StarBASIC::SetGlobalErrorHdl( Link() );
33 8 : mbError = false;
34 8 : }
35 8 : BasicDLL& basicDLL()
36 : {
37 8 : static BasicDLL maDll; // we need a dll instance for resouce manager etc.
38 8 : 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: */
|