| 1 |
/* |
| 2 |
* Copyright (C) 2009 Ian Monroe <[email protected]> |
| 3 |
* released under public domain or: |
| 4 |
* This library is free software; you can redistribute it and/or |
| 5 |
* modify it under the terms of the GNU Lesser General Public |
| 6 |
* License as published by the Free Software Foundation; either |
| 7 |
* version 2.1 of the License, or (at your option) any later version. |
| 8 |
* |
| 9 |
* This library is distributed in the hope that it will be useful, |
| 10 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 12 |
* Lesser General Public License for more details. |
| 13 |
* |
| 14 |
* You should have received a copy of the GNU Lesser General Public |
| 15 |
* License along with this library; if not, write to the Free Software |
| 16 |
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
| 17 |
*/ |
| 18 |
|
| 19 |
#include <QtCore/QCoreApplication> |
| 20 |
#include <QtScript/QScriptEngine> |
| 21 |
#include <QtCore/QStringList> |
| 22 |
#include <QtCore/QDebug> |
| 23 |
|
| 24 |
#define FAIL 0xA |
| 25 |
|
| 26 |
int main(int argc, char **argv) |
| 27 |
{ |
| 28 |
QCoreApplication app( argc, argv ); |
| 29 |
|
| 30 |
QStringList allowedBindings; |
| 31 |
allowedBindings << "qt.core" << "qt.gui" << "qt.sql" << "qt.xml" << "qt.uitools" << "qt.network" << "qt.webkit"; |
| 32 |
QScriptEngine engine; |
| 33 |
foreach( QString binding, allowedBindings ) |
| 34 |
{ |
| 35 |
QScriptValue error = engine.importExtension( binding ); |
| 36 |
if( error.isUndefined() ) |
| 37 |
{ // undefined indiciates success |
| 38 |
continue; |
| 39 |
} |
| 40 |
|
| 41 |
qDebug() << "Extension" << binding << "not found:" << error.toString(); |
| 42 |
qDebug() << "Available extensions:" << engine.availableExtensions(); |
| 43 |
return FAIL; |
| 44 |
} |
| 45 |
return 0; |
| 46 |
} |