$include_dir="/home/hyper-archives/boost-commit/include"; include("$include_dir/msg-header.inc") ?>
From: juergen.hunold_at_[hidden]
Date: 2008-07-13 14:40:04
Author: jhunold
Date: 2008-07-13 14:40:02 EDT (Sun, 13 Jul 2008)
New Revision: 47391
URL: http://svn.boost.org/trac/boost/changeset/47391
Log:
Refactoring of library declaration in qt4.jam.
Simplyfied declaration of Qt component libraries.
Removed duplicated code.
Add test cases for most of the Qt component libraries.
Added:
   trunk/tools/build/v2/test/qt4/
   trunk/tools/build/v2/test/qt4.py   (contents, props changed)
   trunk/tools/build/v2/test/qt4/Jamroot   (contents, props changed)
   trunk/tools/build/v2/test/qt4/phonon.cpp   (contents, props changed)
   trunk/tools/build/v2/test/qt4/qt3support.cpp   (contents, props changed)
   trunk/tools/build/v2/test/qt4/qtassistant.cpp   (contents, props changed)
   trunk/tools/build/v2/test/qt4/qtcore.cpp   (contents, props changed)
   trunk/tools/build/v2/test/qt4/qtcorefail.cpp   (contents, props changed)
   trunk/tools/build/v2/test/qt4/qtgui.cpp   (contents, props changed)
   trunk/tools/build/v2/test/qt4/qthelp.cpp   (contents, props changed)
   trunk/tools/build/v2/test/qt4/qtnetwork.cpp   (contents, props changed)
   trunk/tools/build/v2/test/qt4/qtscript.cpp   (contents, props changed)
   trunk/tools/build/v2/test/qt4/qtsql.cpp   (contents, props changed)
   trunk/tools/build/v2/test/qt4/qtsvg.cpp   (contents, props changed)
   trunk/tools/build/v2/test/qt4/qttest.cpp   (contents, props changed)
   trunk/tools/build/v2/test/qt4/qtwebkit.cpp   (contents, props changed)
   trunk/tools/build/v2/test/qt4/qtxml.cpp   (contents, props changed)
   trunk/tools/build/v2/test/qt4/qtxmlpatterns.cpp   (contents, props changed)
Text files modified: 
   trunk/tools/build/v2/test/test_all.py |     1                                         
   trunk/tools/build/v2/tools/qt4.jam    |   459 ++++++++++----------------------------- 
   2 files changed, 126 insertions(+), 334 deletions(-)
Added: trunk/tools/build/v2/test/qt4.py
==============================================================================
--- (empty file)
+++ trunk/tools/build/v2/test/qt4.py	2008-07-13 14:40:02 EDT (Sun, 13 Jul 2008)
@@ -0,0 +1,18 @@
+#!/usr/bin/python
+
+#  (c) Copyright Juergen Hunold 2008
+#  Use, modification, and distribution are subject to the 
+#  Boost Software License, Version 1.0. (See accompanying file 
+#  LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+import os
+
+from BoostBuild import Tester
+
+# Run test in real directory in order to find Boost.Test via Boost Top-Level Jamroot
+qt4_dir = os.getcwd() + "/qt4"
+
+t = Tester(workdir=qt4_dir)
+
+t.run_build_system()
+t.cleanup()
Added: trunk/tools/build/v2/test/qt4/Jamroot
==============================================================================
--- (empty file)
+++ trunk/tools/build/v2/test/qt4/Jamroot	2008-07-13 14:40:02 EDT (Sun, 13 Jul 2008)
@@ -0,0 +1,56 @@
+#  (c) Copyright Juergen Hunold 2008
+#  Use, modification, and distribution are subject to the 
+#  Boost Software License, Version 1.0. (See accompanying file 
+#  LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+import qt4 ;
+import testing ; 
+import cast ;
+
+    
+
+if [ qt4.initialized ]
+{
+    use-project /boost : ../../../../.. ;
+
+    project qttest 
+      : requirements 
+          <library>/boost/test//boost_unit_test_framework
+      ;
+    
+    alias qt-tests :
+      # Check for explicit libraries, <use>/qt should not link any lib
+      [ link-fail qtcorefail.cpp : <use>/qt ]
+           
+      [ run qtcore.cpp /qt//QtCore ]
+      [ run qtsql.cpp  /qt//QtSql  ]
+      [ run qtxml.cpp  /qt//QtXml  ]   
+      [ run qtnetwork.cpp /qt//QtNetwork ]
+      [ run qtscript.cpp  /qt//QtScript  ]
+      [ run qtxmlpatterns.cpp  /qt//QtXmlPatterns  ]
+    
+      # ToDo: runable example code
+      [ link qtsvg.cpp /qt//QtSvg ]
+      [ link qtgui.cpp /qt//QtGui ]
+
+      # Multimedia toolkits.
+      [ link qtwebkit.cpp /qt//QtWebKit ]
+      [ link phonon.cpp   /qt//phonon  ]
+
+      # Help systems.
+      [ link qthelp.cpp      /qt//QtHelp ]
+      [ link qtassistant.cpp /qt//QtAssistantClient ]
+
+      # Check working and disabled Qt3Support
+      [ link qt3support.cpp /qt//Qt3Support : <qt3support>on ]
+      [ compile-fail qt3support.cpp /qt//Qt3Support : <qt3support>off ]
+
+      # Testing using QtTest. Simple sample
+      # ToDo: better support for "automoc" aka '#include "qttest.moc"'
+      [ run qttest.cpp [ cast _ moccable-cpp : qttest.cpp ] /qt//QtTest ]
+
+   : # requirements
+   : # default-build
+   : # usage-requirements
+   ; 
+}
Added: trunk/tools/build/v2/test/qt4/phonon.cpp
==============================================================================
--- (empty file)
+++ trunk/tools/build/v2/test/qt4/phonon.cpp	2008-07-13 14:40:02 EDT (Sun, 13 Jul 2008)
@@ -0,0 +1,23 @@
+// (c) Copyright Juergen Hunold 2008
+// Use, modification and distribution is subject to the Boost Software
+// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#define BOOST_TEST_MODULE QtPhonon
+
+#include <phonon>
+
+#include <boost/test/unit_test.hpp>
+
+BOOST_AUTO_TEST_CASE( defines)
+{
+    BOOST_CHECK_EQUAL(BOOST_IS_DEFINED(QT_CORE_LIB), true);
+    BOOST_CHECK_EQUAL(BOOST_IS_DEFINED(QT_GUI_LIB), true);
+    BOOST_CHECK_EQUAL(BOOST_IS_DEFINED(QT_XML_LIB), true);
+    BOOST_CHECK_EQUAL(BOOST_IS_DEFINED(QT_PHONON_LIB), true);
+}
+
+BOOST_AUTO_TEST_CASE( phonon_object)
+{
+    Phonon::MediaObject player;
+}
Added: trunk/tools/build/v2/test/qt4/qt3support.cpp
==============================================================================
--- (empty file)
+++ trunk/tools/build/v2/test/qt4/qt3support.cpp	2008-07-13 14:40:02 EDT (Sun, 13 Jul 2008)
@@ -0,0 +1,29 @@
+// (c) Copyright Juergen Hunold 2008
+// Use, modification and distribution is subject to the Boost Software
+// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#define BOOST_TEST_MODULE Qt3Support
+
+#include <Q3Table>
+
+#include <boost/test/unit_test.hpp>
+
+
+BOOST_AUTO_TEST_CASE( defines)
+{
+    BOOST_CHECK_EQUAL(BOOST_IS_DEFINED(QT_CORE_LIB), true);
+    BOOST_CHECK_EQUAL(BOOST_IS_DEFINED(QT_GUI_LIB), true);
+    BOOST_CHECK_EQUAL(BOOST_IS_DEFINED(QT_XML_LIB), true);
+    BOOST_CHECK_EQUAL(BOOST_IS_DEFINED(QT_SQL_LIB), true);
+    BOOST_CHECK_EQUAL(BOOST_IS_DEFINED(QT_NETWORK_LIB), true);
+    BOOST_CHECK_EQUAL(BOOST_IS_DEFINED(QT_QT3SUPPORT_LIB), true);
+    BOOST_CHECK_EQUAL(BOOST_IS_DEFINED(QT3_SUPPORT), true);
+}
+
+BOOST_AUTO_TEST_CASE( q3table )
+{
+    Q3Table q3table;
+
+}
+
Added: trunk/tools/build/v2/test/qt4/qtassistant.cpp
==============================================================================
--- (empty file)
+++ trunk/tools/build/v2/test/qt4/qtassistant.cpp	2008-07-13 14:40:02 EDT (Sun, 13 Jul 2008)
@@ -0,0 +1,21 @@
+// (c) Copyright Juergen Hunold 2008
+// Use, modification and distribution is subject to the Boost Software
+// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#define BOOST_TEST_MODULE QtAssistant
+
+#include <QAssistantClient>
+
+#include <boost/test/unit_test.hpp>
+
+BOOST_AUTO_TEST_CASE( defines)
+{
+    BOOST_CHECK_EQUAL(BOOST_IS_DEFINED(QT_CORE_LIB), true);
+    BOOST_CHECK_EQUAL(BOOST_IS_DEFINED(QT_GUI_LIB), true);
+}
+
+BOOST_AUTO_TEST_CASE( empty_assistant)
+{
+    QAssistantClient client(QString());
+}
Added: trunk/tools/build/v2/test/qt4/qtcore.cpp
==============================================================================
--- (empty file)
+++ trunk/tools/build/v2/test/qt4/qtcore.cpp	2008-07-13 14:40:02 EDT (Sun, 13 Jul 2008)
@@ -0,0 +1,22 @@
+// (c) Copyright Juergen Hunold 2008
+// Use, modification and distribution is subject to the Boost Software
+// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#define BOOST_TEST_MODULE QtCore
+#include <QtCore>
+
+#include <boost/test/unit_test.hpp>
+
+BOOST_AUTO_TEST_CASE (defines)
+{
+    BOOST_CHECK_EQUAL(BOOST_IS_DEFINED(QT_CORE_LIB), true);
+}
+
+
+BOOST_AUTO_TEST_CASE( qstring_test)
+{
+    QString dummy;
+
+    BOOST_CHECK_EQUAL(dummy.isEmpty(), true);
+}
Added: trunk/tools/build/v2/test/qt4/qtcorefail.cpp
==============================================================================
--- (empty file)
+++ trunk/tools/build/v2/test/qt4/qtcorefail.cpp	2008-07-13 14:40:02 EDT (Sun, 13 Jul 2008)
@@ -0,0 +1,23 @@
+// (c) Copyright Juergen Hunold 2008
+// Use, modification and distribution is subject to the Boost Software
+// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#define BOOST_TEST_MODULE QtCoreFail
+
+#include <QtCore>
+
+#include <boost/test/unit_test.hpp>
+
+BOOST_AUTO_TEST_CASE (defines)
+{
+    BOOST_CHECK_EQUAL(BOOST_IS_DEFINED(QT_CORE_LIB), true);
+}
+
+
+BOOST_AUTO_TEST_CASE( qstring_test)
+{
+    QString dummy;
+
+    BOOST_CHECK_EQUAL(dummy.isEmpty(), true);
+}
Added: trunk/tools/build/v2/test/qt4/qtgui.cpp
==============================================================================
--- (empty file)
+++ trunk/tools/build/v2/test/qt4/qtgui.cpp	2008-07-13 14:40:02 EDT (Sun, 13 Jul 2008)
@@ -0,0 +1,42 @@
+// (c) Copyright Juergen Hunold 2008
+// Use, modification and distribution is subject to the Boost Software
+// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#define BOOST_TEST_MODULE QtGui
+
+#include <QApplication>
+
+#include <boost/test/unit_test.hpp>
+
+struct Fixture
+{
+    Fixture()
+        : application(boost::unit_test::framework::master_test_suite().argc,
+                      boost::unit_test::framework::master_test_suite().argv,
+                      false)
+    {
+        BOOST_TEST_MESSAGE( "setup QApplication fixture" );
+    }
+
+    ~Fixture()
+    {
+        BOOST_TEST_MESSAGE( "teardown QApplication fixture" );
+    }
+
+    QApplication application;
+};
+
+BOOST_GLOBAL_FIXTURE( Fixture )
+
+BOOST_AUTO_TEST_CASE( defines)
+{
+    BOOST_CHECK_EQUAL(BOOST_IS_DEFINED(QT_CORE_LIB), true);
+    BOOST_CHECK_EQUAL(BOOST_IS_DEFINED(QT_GUI_LIB), true);
+}
+
+
+BOOST_AUTO_TEST_CASE( qtgui_test)
+{
+    BOOST_CHECK_EQUAL(true, true);
+}
Added: trunk/tools/build/v2/test/qt4/qthelp.cpp
==============================================================================
--- (empty file)
+++ trunk/tools/build/v2/test/qt4/qthelp.cpp	2008-07-13 14:40:02 EDT (Sun, 13 Jul 2008)
@@ -0,0 +1,22 @@
+// (c) Copyright Juergen Hunold 2008
+// Use, modification and distribution is subject to the Boost Software
+// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#define BOOST_TEST_MODULE QtHelp
+
+#include <QtHelp>
+
+#include <boost/test/unit_test.hpp>
+
+BOOST_AUTO_TEST_CASE( defines)
+{
+    BOOST_CHECK_EQUAL(BOOST_IS_DEFINED(QT_CORE_LIB), true);
+    BOOST_CHECK_EQUAL(BOOST_IS_DEFINED(QT_GUI_LIB), true);
+    BOOST_CHECK_EQUAL(BOOST_IS_DEFINED(QT_XML_LIB), true);
+}
+
+BOOST_AUTO_TEST_CASE( empty_engine)
+{
+    QHelpEngine engine(QString());
+}
Added: trunk/tools/build/v2/test/qt4/qtnetwork.cpp
==============================================================================
--- (empty file)
+++ trunk/tools/build/v2/test/qt4/qtnetwork.cpp	2008-07-13 14:40:02 EDT (Sun, 13 Jul 2008)
@@ -0,0 +1,33 @@
+// (c) Copyright Juergen Hunold 2008
+// Use, modification and distribution is subject to the Boost Software
+// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#define BOOST_TEST_MODULE QtNetwork
+
+#include <QHostInfo>
+
+#include <QTextStream>
+
+#include <boost/test/unit_test.hpp>
+
+#include <iostream>
+
+BOOST_AUTO_TEST_CASE (defines)
+{
+    BOOST_CHECK_EQUAL(BOOST_IS_DEFINED(QT_CORE_LIB), true);
+    BOOST_CHECK_EQUAL(BOOST_IS_DEFINED(QT_NETWORK_LIB), true);
+}
+
+BOOST_AUTO_TEST_CASE( hostname )
+{
+    QHostInfo info(QHostInfo::fromName("www.boost.org")); //blocking lookup
+
+    QTextStream stream(stdout, QIODevice::WriteOnly);
+
+    Q_FOREACH(QHostAddress address, info.addresses())
+    {
+        BOOST_CHECK_EQUAL(address.isNull(), false);
+        stream << address.toString() << endl;
+    }
+}
Added: trunk/tools/build/v2/test/qt4/qtscript.cpp
==============================================================================
--- (empty file)
+++ trunk/tools/build/v2/test/qt4/qtscript.cpp	2008-07-13 14:40:02 EDT (Sun, 13 Jul 2008)
@@ -0,0 +1,34 @@
+// (c) Copyright Juergen Hunold 2008
+// Use, modification and distribution is subject to the Boost Software
+// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#define BOOST_TEST_MODULE QtScript
+
+#include <QScriptEngine>
+
+#include <boost/test/unit_test.hpp>
+
+#include <iostream>
+
+std::ostream&
+operator << (std::ostream& stream, QString const& string)
+{
+    stream << qPrintable(string);
+    return stream;
+}
+
+BOOST_AUTO_TEST_CASE( defines)
+{
+    BOOST_CHECK_EQUAL(BOOST_IS_DEFINED(QT_CORE_LIB), true);
+}
+
+BOOST_AUTO_TEST_CASE( script )
+{
+   QScriptEngine myEngine;
+   QScriptValue three = myEngine.evaluate("1 + 2");
+
+   BOOST_CHECK_EQUAL(three.toNumber(), 3);
+   BOOST_CHECK_EQUAL(three.toString(), QLatin1String("3"));
+
+}
Added: trunk/tools/build/v2/test/qt4/qtsql.cpp
==============================================================================
--- (empty file)
+++ trunk/tools/build/v2/test/qt4/qtsql.cpp	2008-07-13 14:40:02 EDT (Sun, 13 Jul 2008)
@@ -0,0 +1,37 @@
+// (c) Copyright Juergen Hunold 2008
+// Use, modification and distribution is subject to the Boost Software
+// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#define BOOST_TEST_MODULE QtSql
+
+#include <QSqlDatabase>
+
+#include <QTextStream>
+#include <QStringList>
+
+#include <boost/test/unit_test.hpp>
+
+#include <iostream>
+
+BOOST_AUTO_TEST_CASE (defines)
+{
+    BOOST_CHECK_EQUAL(BOOST_IS_DEFINED(QT_CORE_LIB), true);
+    BOOST_CHECK_EQUAL(BOOST_IS_DEFINED(QT_SQL_LIB), true);
+}
+
+BOOST_AUTO_TEST_CASE( drivers )
+{
+    QTextStream stream(stdout, QIODevice::WriteOnly);
+
+    Q_FOREACH(QString it, QSqlDatabase:: drivers())
+    {
+        stream << it << endl;
+    }
+}
+
+BOOST_AUTO_TEST_CASE( construct )
+{
+    QSqlDatabase database;
+    BOOST_CHECK_EQUAL(database.isOpen(), false);
+}
Added: trunk/tools/build/v2/test/qt4/qtsvg.cpp
==============================================================================
--- (empty file)
+++ trunk/tools/build/v2/test/qt4/qtsvg.cpp	2008-07-13 14:40:02 EDT (Sun, 13 Jul 2008)
@@ -0,0 +1,21 @@
+// (c) Copyright Juergen Hunold 2008
+// Use, modification and distribution is subject to the Boost Software
+// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#define BOOST_TEST_MODULE QtSvg
+
+#include <QtSvg>
+
+#include <boost/test/unit_test.hpp>
+
+BOOST_AUTO_TEST_CASE( defines)
+{
+    BOOST_CHECK_EQUAL(BOOST_IS_DEFINED(QT_CORE_LIB), true);
+    BOOST_CHECK_EQUAL(BOOST_IS_DEFINED(QT_SVG_LIB), true);
+}
+
+BOOST_AUTO_TEST_CASE( generator_construct)
+{
+    QSvgGenerator generator;
+}
Added: trunk/tools/build/v2/test/qt4/qttest.cpp
==============================================================================
--- (empty file)
+++ trunk/tools/build/v2/test/qt4/qttest.cpp	2008-07-13 14:40:02 EDT (Sun, 13 Jul 2008)
@@ -0,0 +1,26 @@
+// (c) Copyright Juergen Hunold 2008
+// Use, modification and distribution is subject to the Boost Software
+// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#include <QtTest>
+
+class QtTest: public QObject
+{
+    Q_OBJECT
+
+private Q_SLOTS:
+    void toUpper();
+
+};
+
+void
+QtTest::toUpper()
+{
+    QString str = "Hello";
+    QCOMPARE(str.toUpper(), QString("HELLO"));
+}
+
+QTEST_MAIN(QtTest)
+#include "qttest.moc"
+
Added: trunk/tools/build/v2/test/qt4/qtwebkit.cpp
==============================================================================
--- (empty file)
+++ trunk/tools/build/v2/test/qt4/qtwebkit.cpp	2008-07-13 14:40:02 EDT (Sun, 13 Jul 2008)
@@ -0,0 +1,24 @@
+// (c) Copyright Juergen Hunold 2008
+// Use, modification and distribution is subject to the Boost Software
+// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#define BOOST_TEST_MODULE QtWebKit
+
+#include <QWebPage>
+#include <QApplication>
+
+#include <boost/test/unit_test.hpp>
+
+BOOST_AUTO_TEST_CASE( defines)
+{
+    BOOST_CHECK_EQUAL(BOOST_IS_DEFINED(QT_CORE_LIB), true);
+    BOOST_CHECK_EQUAL(BOOST_IS_DEFINED(QT_GUI_LIB), true);
+    BOOST_CHECK_EQUAL(BOOST_IS_DEFINED(QT_WEBKIT_LIB), true);
+}
+
+BOOST_AUTO_TEST_CASE( webkit )
+{
+    QWebPage page;
+    BOOST_CHECK_EQUAL(page.isModified(), false);
+}
Added: trunk/tools/build/v2/test/qt4/qtxml.cpp
==============================================================================
--- (empty file)
+++ trunk/tools/build/v2/test/qt4/qtxml.cpp	2008-07-13 14:40:02 EDT (Sun, 13 Jul 2008)
@@ -0,0 +1,29 @@
+// (c) Copyright Juergen Hunold 2008
+// Use, modification and distribution is subject to the Boost Software
+// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#define BOOST_TEST_MODULE QtXml
+
+#include <QtXml>
+
+#include <boost/test/unit_test.hpp>
+
+BOOST_AUTO_TEST_CASE( defines)
+{
+    BOOST_CHECK_EQUAL(BOOST_IS_DEFINED(QT_CORE_LIB), true);
+    BOOST_CHECK_EQUAL(BOOST_IS_DEFINED(QT_XML_LIB), true);
+}
+
+BOOST_AUTO_TEST_CASE( reader_construct)
+{
+    QXmlStreamReader reader;
+    BOOST_CHECK_EQUAL(reader.atEnd(), false);
+}
+
+BOOST_AUTO_TEST_CASE( writer_construct)
+{
+    QXmlStreamWriter writer;
+    BOOST_CHECK_EQUAL(writer.device(), static_cast<QIODevice*>(0));
+}
+
Added: trunk/tools/build/v2/test/qt4/qtxmlpatterns.cpp
==============================================================================
--- (empty file)
+++ trunk/tools/build/v2/test/qt4/qtxmlpatterns.cpp	2008-07-13 14:40:02 EDT (Sun, 13 Jul 2008)
@@ -0,0 +1,76 @@
+// (c) Copyright Juergen Hunold 2008
+// Use, modification and distribution is subject to the Boost Software
+// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#define BOOST_TEST_MODULE QtXmlPatterns
+
+#include <QXmlQuery>
+#include <QXmlSerializer>
+
+#include <QCoreApplication>
+#include <QString>
+#include <QTextStream>
+#include <QBuffer>
+
+#include <boost/test/unit_test.hpp>
+
+
+struct Fixture
+{
+    Fixture()
+        : application(boost::unit_test::framework::master_test_suite().argc,
+                      boost::unit_test::framework::master_test_suite().argv)
+    {
+        BOOST_TEST_MESSAGE( "setup QCoreApplication fixture" );
+    }
+
+    ~Fixture()
+    {
+        BOOST_TEST_MESSAGE( "teardown QCoreApplication fixture" );
+    }
+
+    QCoreApplication application;
+};
+
+BOOST_GLOBAL_FIXTURE( Fixture )
+
+QByteArray doc("<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
+               "<html xmlns=\"http://www.w3.org/1999/xhtml/\" xml:lang=\"en\" lang=\"en\">"
+"   <head>"
+"      <title>Global variables report for globals.gccxml</title>"
+"   </head>"
+"<body><p>Some Test text</p></body></html>");
+
+BOOST_AUTO_TEST_CASE( defines)
+{
+    BOOST_CHECK_EQUAL(BOOST_IS_DEFINED(QT_CORE_LIB), true);
+    BOOST_CHECK_EQUAL(BOOST_IS_DEFINED(QT_XMLPATTERNS_LIB), true);
+
+    BOOST_CHECK_EQUAL(BOOST_IS_DEFINED(QT_XML_LIB), false);
+}
+
+BOOST_AUTO_TEST_CASE( extract )
+{
+
+     QBuffer buffer(&doc); // This is a QIODevice.
+     buffer.open(QIODevice::ReadOnly);
+     QXmlQuery query;
+     query.bindVariable("myDocument", &buffer);
+     query.setQuery("declare variable $myDocument external;"
+                    "doc($myDocument)");///p[1]");
+
+     BOOST_CHECK_EQUAL(query.isValid(), true);
+
+     QByteArray result;
+     QBuffer out(&result);
+     out.open(QIODevice::WriteOnly);
+     
+     QXmlSerializer serializer(query, &out);
+     BOOST_CHECK_EQUAL(query.evaluateTo(&serializer), true);
+
+     QTextStream stream(stdout);
+     BOOST_CHECK_EQUAL(result.isEmpty(), false);
+     stream << "hallo" << result << endl;
+}
+
Modified: trunk/tools/build/v2/test/test_all.py
==============================================================================
--- trunk/tools/build/v2/test/test_all.py	(original)
+++ trunk/tools/build/v2/test/test_all.py	2008-07-13 14:40:02 EDT (Sun, 13 Jul 2008)
@@ -189,6 +189,7 @@
 
 if "--extras" in sys.argv:
     tests.append("boostbook")
+    tests.append("qt4")
     tests.append("example_qt4")
     # Requires ./whatever.py to work, so is
     # not guaranted to work everywhere.
Modified: trunk/tools/build/v2/tools/qt4.jam
==============================================================================
--- trunk/tools/build/v2/tools/qt4.jam	(original)
+++ trunk/tools/build/v2/tools/qt4.jam	2008-07-13 14:40:02 EDT (Sun, 13 Jul 2008)
@@ -161,24 +161,17 @@
         # dependency scanner for wrapped files.
         type.set-scanner QRC : qrc-scanner ;
         
-        # List of all Qt libraries
-        local all-libraries = QtCore QtGui QtNetwork QtXml QtSql QtSvg QtOpenGL Qt3Support QtTest QtAssistantClient QtDesigner QtUiTools QtDBus QtScript QtHelp QtXmlPatterns QtWebKit phonon ;
-
         # Test for a buildable Qt.
         if [ glob $(.prefix)/Jamroot ]
         {
-            # Import all Qt Modules
-            for local l in $(all-libraries)
-            {
-                alias $(l)
-                    : $(.prefix)//$(l)
-                    :
-                    :
-                    : <allow>qt4 ;
-            }
+            .bjam-qt = true
+
+            # this will declare QtCore (and qtmain on <target-os>windows)
+            add-shared-library QtCore ;
         }
         else
-        # Use pre-built Qt.
+        # Setup common pre-built Qt.
+        # Special setup for QtCore on which everything depends
         {
             local usage-requirements =
                 <include>$(.incprefix)
@@ -193,12 +186,12 @@
                 # On NT, the libs have "4" suffix, and "d" suffix in debug
                 # builds. Also, on NT we must link against the qtmain library
                 # (for WinMain).
-                suffix_version = "4" ;
-                suffix_debug = "d" ;
+                .suffix_version = "4" ;
+                .suffix_debug = "d" ;
                 lib qtmain
                     : # sources
                     : # requirements
-                      <name>qtmain$(suffix_debug)
+                      <name>qtmain$(.suffix_debug)
                       <variant>debug
                     ;
 
@@ -212,20 +205,20 @@
             else if [ os.name ] = MACOSX
             {
                 # On MacOS X, both debug and release libraries are available.
-                suffix_version = "" ;
-                suffix_debug = "_debug" ;
+                .suffix_version = "" ;
+                .suffix_debug = "_debug" ;
             }
             else
             {
                 # Since Qt-4.2, debug versions on unix have to be built
                 # separately and therefore have no suffix.
-                suffix_version = "" ;
-                suffix_debug = "" ;
+                .suffix_version = "" ;
+                .suffix_debug = "" ;
             }
 
             lib QtCore : $(main)
                 : # requirements
-                  <name>QtCore$(suffix_version)
+                  <name>QtCore$(.suffix_version)
                 : # default-build
                 : # usage-requirements
                   <define>QT_CORE_LIB
@@ -235,7 +228,7 @@
                 ;
             lib QtCore : $(main)
                 : # requirements
-                  <name>QtCore$(suffix_debug)$(suffix_version)
+                  <name>QtCore$(.suffix_debug)$(.suffix_version)
                   <variant>debug
                 : # default-build
                 : # usage-requirements
@@ -243,333 +236,60 @@
                   <include>$(.incprefix)/QtCore
                   $(usage-requirements)
                 ;
+         }
 
-            lib QtGui : QtCore
-                : # requirements
-                  <name>QtGui$(suffix_version)
-                : # default-build
-                : # usage-requirements
-                  <define>QT_GUI_LIB
-                  <include>$(.incprefix)/QtGui
-                ;
+         # Initialising the remaining libraries is canonical
+         add-shared-library QtGui     : QtCore : QT_GUI_LIB     ;
+         add-shared-library QtNetwork : QtCore : QT_NETWORK_LIB ;
+         add-shared-library QtSql     : QtCore : QT_SQL_LIB     ;
+         add-shared-library QtXml     : QtCore : QT_XML_LIB     ;
 
-            lib QtGui : QtCore
-                : # requirements
-                  <name>QtGui$(suffix_debug)$(suffix_version)
-                  <variant>debug
-                : # default-build
-                : # usage-requirements
-                  <define>QT_GUI_LIB
-                  <include>$(.incprefix)/QtGui
-                ;
+         add-shared-library Qt3Support : QtGui QtNetwork QtXml QtSql 
+                                       : QT_QT3SUPPORT_LIB QT3_SUPPORT
+                                       : <qt3support>on ;
 
-            lib QtNetwork : QtCore
-                : # requirements
-                  <name>QtNetwork$(suffix_version)
-                : # default-build
-                : # usage-requirements
-                  <define>QT_NETWORK_LIB
-                  <include>$(.incprefix)/QtNetwork
-                ;
-            lib QtNetwork : QtCore
-                : # requirements
-                  <name>QtNetwork$(suffix_debug)$(suffix_version)
-                  <variant>debug
-                : # default-build
-                : # usage-requirements
-                  <define>QT_NETWORK_LIB
-                  <include>$(.incprefix)/QtNetwork
-                ;
+         # Dummy target to enable "<qt3support>off" and
+         # "<library>/qt//Qt3Support" at the same time. This enables quick
+         # switching from one to the other for test/porting purposes.
+         alias Qt3Support : : : : <qt3support>off ;
 
-            lib QtSql : QtCore
-                : # requirements
-                  <name>QtSql$(suffix_version)
-                : # default-build
-                : # usage-requirements
-                  <define>QT_SQL_LIB
-                  <include>$(.incprefix)/QtSql
-                ;
-            lib QtSql : QtCore
-                : # requirements
-                  <name>QtSql$(suffix_debug)$(suffix_version)
-                  <variant>debug
-                : # default-build
-                : # usage-requirements
-                  <define>QT_SQL_LIB
-                  <include>$(.incprefix)/QtSql
-                ;
+         # OpenGl Support
+         add-shared-library QtOpenGL : QtGui : QT_OPENGL_LIB ;
 
-            lib QtXml : QtCore
-                : # requirements
-                  <name>QtXml$(suffix_version)
-                : # default-build
-                : # usage-requirements
-                  <define>QT_XML_LIB
-                  <include>$(.incprefix)/QtXml
-                ;
-            lib QtXml : QtCore
-                : # requirements
-                  <name>QtXml$(suffix_debug)$(suffix_version)
-                  <variant>debug
-                : # default-build
-                : # usage-requirements
-                  <define>QT_XML_LIB
-                  <include>$(.incprefix)/QtXml
-                ;
+         # SVG-Support (Qt 4.1)
+         add-shared-library QtSvg : QtXml QtOpenGL : QT_SVG_LIB ;
 
-            lib Qt3Support : QtGui QtNetwork QtXml QtSql
-                : # requirements
-                  <name>Qt3Support$(suffix_version)
-                  <qt3support>on
-                : # default-build
-                : # usage-requirements
-                  <define>QT_QT3SUPPORT_LIB
-                  <define>QT3_SUPPORT
-                  <include>$(.incprefix)/Qt3Support
-                ;
+         # Test-Support (Qt 4.1)
+         add-shared-library QtTest : QtCore ;
 
-            lib Qt3Support : QtGui QtNetwork QtXml QtSql
-                : # requirements
-                  <name>Qt3Support$(suffix_debug)$(suffix_version)
-                  <qt3support>on
-                  <variant>debug
-                : # default-build
-                : # usage-requirements
-                  <define>QT_QT3SUPPORT_LIB
-                  <define>QT3_SUPPORT
-                  <include>$(.incprefix)/Qt3Support
-                ;
+         # Qt designer library
+         add-shared-library QtDesigner : QtGui QtXml ;
 
-            # Dummy target to enable "<qt3support>off" and
-            # "<library>/qt//Qt3Support" at the same time. This enables quick
-            # switching from one to the other for test/porting purposes.
-            alias Qt3Support : : <qt3support>off ;
+         # Support for dynamic Widgets (Qt 4.1)
+         add-static-library  QtUiTools : QtGui QtXml ;
 
-            # OpenGl Support
-            lib QtOpenGL : QtGui
-                : # requirements
-                  <name>QtOpenGL$(suffix_version)
-                : # default-build
-                : # usage-requirements
-                  <define>QT_OPENGL_LIB
-                  <include>$(.incprefix)/QtOpenGL
-                ;
-            lib QtOpenGL : QtGui
-                : # requirements
-                  <name>QtOpenGL$(suffix_debug)$(suffix_version)
-                  <variant>debug
-                : # default-build
-                : # usage-requirements
-                  <define>QT_OPENGL_LIB
-                  <include>$(.incprefix)/QtOpenGL
-                ;
+         # DBus-Support (Qt 4.2)
+         add-shared-library QtDBus : QtXml ;
 
-            # SVG-Support (Qt 4.1)
-            lib QtSvg : QtXml QtOpenGL
-                : # requirements
-                  <name>QtSvg$(suffix_version)
-                : # default-build
-                : # usage-requirements
-                  <define>QT_SVG_LIB
-                  <include>$(.incprefix)/QtSvg
-                ;
-            lib QtSvg : QtXml QtOpenGL
-                : # requirements
-                  <name>QtSvg$(suffix_debug)$(suffix_version)
-                  <variant>debug
-                : # default-build
-                : # usage-requirements
-                  <define>QT_SVG_LIB
-                  <include>$(.incprefix)/QtSvg
-                ;
+         # Script-Engine (Qt 4.3)
+         add-shared-library QtScript : QtGui QtXml ;
 
-            # Test-Support (Qt 4.1)
-            lib QtTest : QtCore
-                : # requirements
-                  <name>QtTest$(suffix_version)
-                : # default-build
-                : # usage-requirements
-                  <include>$(.incprefix)/QtTest
-                ;
-            lib QtTest : QtCore
-                : # requirements
-                  <name>QtTest$(suffix_debug)$(suffix_version)
-                  <variant>debug
-                : # default-build
-                : # usage-requirements
-                  <include>$(.incprefix)/QtTest
-                ;
+         # WebKit (Qt 4.4)
+         add-shared-library QtWebKit : QtGui : QT_WEBKIT_LIB ;
 
-            # Qt designer library
-            lib QtDesigner : QtGui QtXml
-                : # requirements
-                  <name>QtDesigner$(suffix_version)
-                : # default-build
-                : # usage-requirements
-                  <include>$(.incprefix)/QtDesigner
-                ;
+         # Phonon Multimedia (Qt 4.4) 
+         add-shared-library phonon : QtGui QtXml : QT_PHONON_LIB ;
 
-            lib QtDesigner : QtGui QtXml
-                : # requirements
-                  <name>QtDesigner$(suffix_debug)$(suffix_version)
-                  <variant>debug
-                : # default-build
-                : # usage-requirements
-                  <include>$(.incprefix)/QtDesigner
-                ;
+         # XmlPatterns-Engine (Qt 4.4) 
+         add-shared-library QtXmlPatterns : QtNetwork : QT_XMLPATTERNS_LIB ;
 
-            # Support for dynamic Widgets (Qt 4.1)
-            # Static library without version number
-            lib QtUiTools : QtGui QtXml
-                : # requirements
-                  <name>QtUiTools
-                : # default-build
-                : # usage-requirements
-                  <include>$(.incprefix)/QtUiTools
-                ;
-            lib QtUiTools : QtGui QtXml
-                : # requirements
-                  <name>QtUiTools$(suffix_debug)
-                  <variant>debug
-                : # default-build
-                : # usage-requirements
-                  <include>$(.incprefix)/QtUiTools
-                ;
-
-            # DBus-Support (Qt 4.2)
-            lib QtDBus : QtXml
-                : # requirements
-                  <name>QtDBus$(suffix_version)
-                : # default-build
-                : # usage-requirements
-                  <include>$(.incprefix)/QtDBus
-                ;
-            lib QtDBus : QtXml
-                : # requirements
-                  <name>QtDBus$(suffix_debug)$(suffix_version)
-                  <variant>debug
-                : # default-build
-                : # usage-requirements
-                  <include>$(.incprefix)/QtDBus
-                ;
-
-            # Script-Engine (Qt 4.3)
-            lib QtScript : QtGui QtXml
-                : # requirements
-                  <name>QtScript$(suffix_version)
-                : # default-build
-                : # usage-requirements
-                  <include>$(.incprefix)/QtScript
-                ;
-            lib QtScript : QtGui QtXml
-                : # requirements
-                  <name>QtScript$(suffix_debug)$(suffix_version)
-                  <variant>debug
-                : # default-build
-                : # usage-requirements
-                  <include>$(.incprefix)/QtScript
-                ;
-
-            # WebKit (Qt 4.4)
-            lib QtWebKit : QtGui
-                : # requirements
-                  <name>QtWebKit$(suffix_version) 
-                : # default-build
-                : # usage-requirements
-                  <define>QT_WEBKIT_LIB
-                  <include>$(.incprefix)/QtWebKit 
-                ;
-            lib QtWebKit : QtGui
-                : # requirements
-                  <name>QtWebKit$(suffix_debug)$(suffix_version) 
-                  <variant>debug 
-                : # default-build
-                : # usage-requirements
-                  <define>QT_WEBKIT_LIB
-                  <include>$(.incprefix)/QtWebKit
-                ;
-
-            # Phonon Multimedia (Qt 4.4) 
-            lib phonon : QtGui QtXml
-                : # requirements
-                  <name>phonon$(suffix_version) 
-                : # default-build
-                : # usage-requirements
-                  <define>QT_PHONON_LIB
-                  <include>$(.incprefix)/phonon 
-                ;
-            lib phonon : QtGui QtXml
-                : # requirements
-                  <name>phonon$(suffix_debug)$(suffix_version) 
-                  <variant>debug 
-                : # default-build
-                : # usage-requirements
-                  <define>QT_PHONON_LIB
-                  <include>$(.incprefix)/phonon
-                ;
-
-            # XmlPatterns-Engine (Qt 4.4) 
-            lib QtXmlPatterns : QtNetwork
-                : # requirements
-                  <name>QtXmlPatterns$(suffix_version) 
-                : # default-build
-                : # usage-requirements
-                  <define>QT_XMLPATTERNS_LIB
-                  <include>$(.incprefix)/QtXmlPatterns 
-                ;
-            lib QtXmlPatterns : QtNetwork
-                : # requirements
-                  <name>QtXmlPatterns$(suffix_debug)$(suffix_version) 
-                  <variant>debug 
-                : # default-build
-                : # usage-requirements
-                  <define>QT_XMLPATTERNS_LIB
-                  <include>$(.incprefix)/QtXmlPatterns
-                ;
+         # Help-Engine (Qt 4.4) 
+         add-shared-library QtHelp : QtGui QtSql QtXml ;
 
-            # Help-Engine (Qt 4.4) 
-            lib QtHelp : QtGui QtSql QtXml
-                : # requirements
-                  <name>QtHelp$(suffix_version) 
-                : # default-build
-                : # usage-requirements
-                  <include>$(.incprefix)/QtHelp 
-                ;
-            lib QtHelp : QtGui QtSql QtXml
-                : # requirements
-                  <name>QtHelp$(suffix_debug)$(suffix_version) 
-                  <variant>debug 
-                : # default-build
-                : # usage-requirements
-                  <include>$(.incprefix)/QtHelp
-                ;
-
-            # AssistantClient Support
-            # Compat library
-            # Pre-4.4 help system, use QtHelp for new programs
-            lib QtAssistantClient : QtGui
-                : # requirements
-                  <name>QtAssistantClient$(suffix_version) 
-                : # default-build
-                : # usage-requirements
-                  <include>$(.incprefix)/QtAssistant
-                ;
-            lib QtAssistantClient : QtGui
-                : # requirements
-                  <name>QtAssistantClient$(suffix_debug)$(suffix_version) 
-                  <variant>debug 
-                : # default-build
-                : # usage-requirements
-                  <include>$(.incprefix)/QtAssistant 
-                ;
-       }
-
-       # Make library names explicit so that a simple <use>qt4 will not bring in everything.
-       # And some components like QtDBus/Phonon may not be available on some platforms.
-       for local l in $(all-libraries)
-       {
-           explicit $(l) ;
-       }
+         # AssistantClient Support
+         # Compat library
+         # Pre-4.4 help system, use QtHelp for new programs
+         add-shared-library QtAssistantClient : QtGui : : : QtAssistant ;
     }
 
     project.pop-current ;
@@ -703,6 +423,77 @@
     return $(.prefix) ;
 }
 
+# Add a shared Qt library.
+rule add-shared-library ( lib-name : depends-on * : usage-defines * : requirements * :  include ? )
+{
+     add-library $(lib-name) : $(.suffix_version) : $(depends-on) : $(usage-defines) : $(requirements) : $(include) ;
+}
+
+# Add a static Qt library.
+rule add-static-library ( lib-name : depends-on * : usage-defines * : requirements * : include ? )
+{
+     add-library $(lib-name) : : $(depends-on) : $(usage-defines) : $(requirements) : $(include) ;
+}
+
+# Add a Qt library.
+# Static libs are unversioned, whereas shared libs have the major number as suffix.
+# Creates both release and debug versions on platforms where both are enabled by Qt configure.
+# Flags:
+# - lib-name Qt library Name
+# - version  Qt major number used as shared library suffix (QtCore4.so)
+# - depends-on other Qt libraries
+# - usage-defines those are set by qmake, so set them when using this library
+# - requirements addional requirements
+# - include non-canonical include path. The canonical path is $(.incprefix)/$(lib-name).
+rule add-library ( lib-name : version ? : depends-on * : usage-defines * : requirements * : include ? )
+{
+    if $(.bjam-qt)
+    {
+        # Import Qt module
+        # Eveything will be setup there
+        alias $(lib-name)
+           : $(.prefix)//$(lib-name)
+           :
+           :
+           : <allow>qt4 ;
+    }
+    else
+    {
+        local real_include ;
+        real_include ?= $(include) ;
+        real_include ?= $(lib-name) ;
+        
+        lib $(lib-name) 
+           : # sources
+             $(depends-on)
+           : # requirements
+             <name>$(lib-name)$(version)
+             $(requirements)
+           : # default-build
+           : # usage-requirements
+             <define>$(usage-defines)
+             <include>$(.incprefix)/$(real_include)
+           ;
+        
+        lib $(lib-name) 
+           : # sources
+             $(depends-on)
+           : # requirements
+             <name>$(lib-name)$(.suffix_debug)$(version)
+             $(requirements)
+             <variant>debug
+           : # default-build
+           : # usage-requirements
+             <define>$(usage-defines)
+             <include>$(.incprefix)/$(real_include)
+           ;
+    } 
+
+    # Make library explicit so that a simple <use>qt4 will not bring in everything.
+    # And some components like QtDBus/Phonon may not be available on all platforms.
+    explicit $(lib-name) ;
+}
+
 
 # Get <include> and <defines> from current toolset.
 flags qt4.moc INCLUDES <include> ;