00001 /*************************************************************************** 00002 * Copyright (C) 2005 by Tim Sutton * 00003 * tim@linfiniti.com * 00004 * * 00005 * This program is free software; you can redistribute it and/or modify * 00006 * it under the terms of the GNU General Public License as published by * 00007 * the Free Software Foundation; either version 2 of the License, or * 00008 * (at your option) any later version. * 00009 * * 00010 * This program is distributed in the hope that it will be useful, * 00011 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 00012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 00013 * GNU General Public License for more details. * 00014 * * 00015 * You should have received a copy of the GNU General Public License * 00016 * along with this program; if not, write to the * 00017 * Free Software Foundation, Inc., * 00018 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * 00019 ***************************************************************************/ 00020 #include <QtTest/QtTest> 00021 //om includes 00022 #include <openmodeller/om.hh> 00023 #include <openmodeller/Configuration.hh> 00024 #include <openmodeller/Exceptions.hh> 00025 #include <openmodeller/Log.hh> 00026 // 00027 #include <QTextStream> 00028 00029 00030 //void modelCallback( float theProgress, void *thePlugin ); 00031 //void mapCallback( float theProgress, void *thePlugin ); 00032 class OmgOmLogCallback : public QObject, public Log::LogCallback 00033 { 00034 public: 00035 OmgOmLogCallback() : 00036 QObject(), 00037 LogCallback() 00038 { 00039 00040 } 00041 00042 ~OmgOmLogCallback( ) 00043 { 00044 00045 } 00046 00047 //do not try to use the text stream! 00048 OmgOmLogCallback( QTextStream& theTextStream ) : 00049 QObject(), 00050 LogCallback( ) 00051 { 00052 00053 } 00054 00055 00056 void operator()(Log::Level theLevel, const std::string& theLogMessage ) 00057 { 00058 qDebug("--->"); 00059 qDebug(theLogMessage.c_str()); 00060 } 00061 }; 00062 00063 class openmodellerlogtest: public QObject 00064 { 00065 Q_OBJECT; 00066 private: 00067 OpenModeller * mpOpenModeller; 00068 OmgOmLogCallback * mpLogCallBack; 00069 QTextStream mTextStream; 00070 private slots: 00071 void loadOpenModeller(); 00072 }; 00073 00074 void openmodellerlogtest::loadOpenModeller() 00075 { 00076 QTextStream* output = new QTextStream(); 00077 mpOpenModeller = new OpenModeller(); 00078 Log::instance()->setLevel( Log::Debug ); 00079 //Log::instance()->setLevel( Log::Default ); 00080 //set up callbacks 00081 mpLogCallBack = new OmgOmLogCallback(*(output)); 00082 Log::instance()->setCallback(mpLogCallBack ); 00083 AlgorithmFactory::searchDefaultDirs(); 00084 00085 //mpOpenModeller->setModelCallback( modelCallback, this ); 00086 //mpOpenModeller->setMapCallback( mapCallback, this ); 00087 //QVERIFY(myList.size()>0); 00088 //QFAIL("Could not write temporary layerset xml to disk"); 00089 } 00090 00091 QTEST_MAIN(openmodellerlogtest) 00092 #include "moc_openmodellerlogtest.cxx" 00093