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 #include <QDomDocument> 00022 #include <QFile> 00023 #include <omgmodellerlocalplugin.h> 00024 00025 class OmgModellerLocalPluginTest: public QObject 00026 { 00027 Q_OBJECT; 00028 private slots: 00029 void getAlgorithms(); 00030 void getLayers(); 00031 }; 00032 00033 void OmgModellerLocalPluginTest::getAlgorithms() 00034 { 00035 OmgModellerLocalPlugin mypPlugin; 00036 QStringList myList = mypPlugin.getAlgorithmList(); 00037 qDebug("Algorithms Found:"); 00038 qDebug(myList.join("\n").toLocal8Bit()); 00039 QVERIFY(myList.size()>0); 00040 } 00041 void OmgModellerLocalPluginTest::getLayers() 00042 { 00043 OmgModellerLocalPlugin mypPlugin; 00044 QString myString = mypPlugin.getLayers("/home/timlinux/gisdata/Africa/"); 00045 //NOTE debuggin the doc to std out seems to truncate it 00046 //this to really see if it worked we write it to a file as shown below 00047 //qDebug(myString.toLocal8Bit()); 00048 //try to load the returned doc back to xml again... 00049 QDomDocument myDocument("TestDoc"); 00050 QVERIFY(myDocument.setContent(myString)); 00051 //write the doc fo a file 00052 QFile file("/tmp/layerset.xml"); 00053 if (!file.open(QIODevice::Append)) 00054 { 00055 QFAIL("Could not write temporary layerset xml to disk"); 00056 } 00057 file.write(myString.toAscii()); 00058 file.close(); 00059 } 00060 00061 QTEST_MAIN(OmgModellerLocalPluginTest) 00062 #include "moc_omgmodellerlocalplugintest.cxx"