1.1.2
by Martin Pitt
Import upstream version 0.44 |
1 |
#ifndef SEEN_TEST_HELPERS_H
|
2 |
#define SEEN_TEST_HELPERS_H
|
|
3 |
||
4 |
||
5 |
#include <cxxtest/TestSuite.h> |
|
6 |
||
7 |
#include "document.h" |
|
8 |
#include "inkscape-private.h" |
|
9 |
||
10 |
||
11 |
/// Dummy functions to keep linker happy
|
|
12 |
#if !defined(DUMMY_MAIN_TEST_CALLS_SEEN)
|
|
13 |
#define DUMMY_MAIN_TEST_CALLS_SEEN
|
|
14 |
int sp_main_gui (int, char const**) { return 0; } |
|
15 |
int sp_main_console (int, char const**) { return 0; } |
|
16 |
#endif // DUMMY_MAIN_TEST_CALLS_SEEN |
|
17 |
||
18 |
namespace Inkscape |
|
19 |
{
|
|
20 |
||
21 |
template <class T> |
|
22 |
T* createSuiteAndDocument( void (*fun)(T*&) ) |
|
23 |
{
|
|
24 |
T* suite = 0; |
|
25 |
||
26 |
g_type_init(); |
|
27 |
Inkscape::GC::init(); |
|
28 |
if ( !inkscape_get_instance() ) |
|
29 |
{
|
|
30 |
// Create the global inkscape object.
|
|
31 |
static_cast<void>(g_object_new(inkscape_get_type(), NULL)); |
|
32 |
}
|
|
33 |
||
34 |
SPDocument* tmp = sp_document_new( NULL, TRUE, true ); |
|
1.1.6
by Kees Cook
Import upstream version 0.46~pre1 |
35 |
if ( tmp ) { |
1.1.2
by Martin Pitt
Import upstream version 0.44 |
36 |
fun( suite ); |
37 |
if ( suite ) |
|
38 |
{
|
|
39 |
suite->_doc = tmp; |
|
40 |
}
|
|
41 |
else
|
|
42 |
{
|
|
43 |
sp_document_unref( tmp ); |
|
44 |
}
|
|
45 |
}
|
|
46 |
||
47 |
return suite; |
|
48 |
}
|
|
49 |
||
50 |
} // namespace Inkscape |
|
51 |
||
52 |
#endif // SEEN_TEST_HELPERS_H |
|
53 |
||
54 |
/*
|
|
55 |
Local Variables:
|
|
56 |
mode:c++
|
|
57 |
c-file-style:"stroustrup"
|
|
58 |
c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
|
|
59 |
indent-tabs-mode:nil
|
|
60 |
fill-column:99
|
|
61 |
End:
|
|
62 |
*/
|
|
63 |
// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :
|
|
64 |