b27b41748a314f1217ac0aab88feb52604257fd7joncruz#ifndef SEEN_TEST_HELPERS_H
b27b41748a314f1217ac0aab88feb52604257fd7joncruz#define SEEN_TEST_HELPERS_H
b27b41748a314f1217ac0aab88feb52604257fd7joncruz
b27b41748a314f1217ac0aab88feb52604257fd7joncruz
b27b41748a314f1217ac0aab88feb52604257fd7joncruz#include <cxxtest/TestSuite.h>
b27b41748a314f1217ac0aab88feb52604257fd7joncruz
b27b41748a314f1217ac0aab88feb52604257fd7joncruz#include "document.h"
6cc2da37c4f1d408dbc9ca92ee622d4093f554fbLiam P. White#include "inkscape.h"
b27b41748a314f1217ac0aab88feb52604257fd7joncruz
b27b41748a314f1217ac0aab88feb52604257fd7joncruz
d830a80c36766626896696ee2283f8c5683a5e39Kris// Dummy functions to keep linker happy
b27b41748a314f1217ac0aab88feb52604257fd7joncruz#if !defined(DUMMY_MAIN_TEST_CALLS_SEEN)
b27b41748a314f1217ac0aab88feb52604257fd7joncruz#define DUMMY_MAIN_TEST_CALLS_SEEN
b27b41748a314f1217ac0aab88feb52604257fd7joncruzint sp_main_gui (int, char const**) { return 0; }
b27b41748a314f1217ac0aab88feb52604257fd7joncruzint sp_main_console (int, char const**) { return 0; }
b27b41748a314f1217ac0aab88feb52604257fd7joncruz#endif // DUMMY_MAIN_TEST_CALLS_SEEN
b27b41748a314f1217ac0aab88feb52604257fd7joncruz
b27b41748a314f1217ac0aab88feb52604257fd7joncruznamespace Inkscape
b27b41748a314f1217ac0aab88feb52604257fd7joncruz{
b27b41748a314f1217ac0aab88feb52604257fd7joncruz
b27b41748a314f1217ac0aab88feb52604257fd7joncruztemplate <class T>
b27b41748a314f1217ac0aab88feb52604257fd7joncruzT* createSuiteAndDocument( void (*fun)(T*&) )
b27b41748a314f1217ac0aab88feb52604257fd7joncruz{
b27b41748a314f1217ac0aab88feb52604257fd7joncruz T* suite = 0;
b27b41748a314f1217ac0aab88feb52604257fd7joncruz
66dfa5c3094a0271d3640678e2a8cb8eafb3f141Alex Valavanis#if !GLIB_CHECK_VERSION(2,36,0)
b27b41748a314f1217ac0aab88feb52604257fd7joncruz g_type_init();
66dfa5c3094a0271d3640678e2a8cb8eafb3f141Alex Valavanis#endif
66dfa5c3094a0271d3640678e2a8cb8eafb3f141Alex Valavanis
b27b41748a314f1217ac0aab88feb52604257fd7joncruz Inkscape::GC::init();
b10327c3fcaaac8dc616b6236d0dd1b59588fcc4Liam P. White if ( !Inkscape::Application::exists() )
b27b41748a314f1217ac0aab88feb52604257fd7joncruz {
b27b41748a314f1217ac0aab88feb52604257fd7joncruz // Create the global inkscape object.
b10327c3fcaaac8dc616b6236d0dd1b59588fcc4Liam P. White Inkscape::Application::create("", false);
b27b41748a314f1217ac0aab88feb52604257fd7joncruz }
b27b41748a314f1217ac0aab88feb52604257fd7joncruz
2b635337710b879262acf4906dd85ee99b69f474Abhishek Sharma Public SPDocument* tmp = SPDocument::createNewDoc( NULL, TRUE, true );
b27b41748a314f1217ac0aab88feb52604257fd7joncruz if ( tmp ) {
b27b41748a314f1217ac0aab88feb52604257fd7joncruz fun( suite );
b27b41748a314f1217ac0aab88feb52604257fd7joncruz if ( suite )
b27b41748a314f1217ac0aab88feb52604257fd7joncruz {
b27b41748a314f1217ac0aab88feb52604257fd7joncruz suite->_doc = tmp;
b27b41748a314f1217ac0aab88feb52604257fd7joncruz }
b27b41748a314f1217ac0aab88feb52604257fd7joncruz else
b27b41748a314f1217ac0aab88feb52604257fd7joncruz {
d5ad05ac17abfd7d2eae333a8c1233971e1c1a8fAbhishek Sharma Public tmp->doUnref();
b27b41748a314f1217ac0aab88feb52604257fd7joncruz }
b27b41748a314f1217ac0aab88feb52604257fd7joncruz }
b27b41748a314f1217ac0aab88feb52604257fd7joncruz
b27b41748a314f1217ac0aab88feb52604257fd7joncruz return suite;
b27b41748a314f1217ac0aab88feb52604257fd7joncruz}
b27b41748a314f1217ac0aab88feb52604257fd7joncruz
b27b41748a314f1217ac0aab88feb52604257fd7joncruz} // namespace Inkscape
b27b41748a314f1217ac0aab88feb52604257fd7joncruz
b27b41748a314f1217ac0aab88feb52604257fd7joncruz#endif // SEEN_TEST_HELPERS_H
b27b41748a314f1217ac0aab88feb52604257fd7joncruz
b27b41748a314f1217ac0aab88feb52604257fd7joncruz/*
b27b41748a314f1217ac0aab88feb52604257fd7joncruz Local Variables:
b27b41748a314f1217ac0aab88feb52604257fd7joncruz mode:c++
b27b41748a314f1217ac0aab88feb52604257fd7joncruz c-file-style:"stroustrup"
b27b41748a314f1217ac0aab88feb52604257fd7joncruz c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
b27b41748a314f1217ac0aab88feb52604257fd7joncruz indent-tabs-mode:nil
b27b41748a314f1217ac0aab88feb52604257fd7joncruz fill-column:99
b27b41748a314f1217ac0aab88feb52604257fd7joncruz End:
b27b41748a314f1217ac0aab88feb52604257fd7joncruz*/
a4030d5ca449e7e384bc699cd249ee704faaeab0Chris Morgan// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 :