diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-27 18:24:20 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-27 18:24:20 +0000 |
commit | 483eb2f56657e8e7f419ab1a4fab8dce9ade8609 (patch) | |
tree | e5d88d25d870d5dedacb6bbdbe2a966086a0a5cf /src/boost/tools/build/test/qt4 | |
parent | Initial commit. (diff) | |
download | ceph-483eb2f56657e8e7f419ab1a4fab8dce9ade8609.tar.xz ceph-483eb2f56657e8e7f419ab1a4fab8dce9ade8609.zip |
Adding upstream version 14.2.21.upstream/14.2.21upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/boost/tools/build/test/qt4')
23 files changed, 722 insertions, 0 deletions
diff --git a/src/boost/tools/build/test/qt4/jamroot.jam b/src/boost/tools/build/test/qt4/jamroot.jam new file mode 100644 index 00000000..3d8e7d73 --- /dev/null +++ b/src/boost/tools/build/test/qt4/jamroot.jam @@ -0,0 +1,82 @@ +# (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 qtscripttools.cpp /qt//QtScriptTools ] + [ 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 ] + [ link qtmultimedia.cpp /qt//QtMultimedia ] + + # QML + [ link qtdeclarative.cpp /qt//QtDeclarative ] + + # Help systems. + [ link qthelp.cpp /qt//QtHelp ] + [ link qtassistant.cpp /qt//QtAssistantClient : <conditional>@check_for_assistant ] + + # 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 : : : <define>TEST_MOCK ] + + # Test moc rule + [ run mock.cpp mock.h /qt//QtCore : : : <define>TEST_MOCK ] + + # Test resource compiler + [ run rcc.cpp rcc.qrc /qt//QtCore : : : <rccflags>"-compress 9 -threshold 10" ] + + : # requirements + : # default-build + : # usage-requirements + ; +} + +# QtAssistant is removed from Qt >= 4.6 +rule check_for_assistant ( properties * ) +{ + # Extract version number from toolset + local version = [ MATCH "<qt>([0-9.]+).*" + : $(properties) ] ; + + if $(version) > "4.6.99" + { + result += <build>no ; + } +} + + diff --git a/src/boost/tools/build/test/qt4/mock.cpp b/src/boost/tools/build/test/qt4/mock.cpp new file mode 100644 index 00000000..8f7a35c2 --- /dev/null +++ b/src/boost/tools/build/test/qt4/mock.cpp @@ -0,0 +1,26 @@ +// (c) Copyright Juergen Hunold 2011 +// 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 QtMoc + +#include "mock.h" + +#include <boost/test/unit_test.hpp> + +Mock::Mock() +{ +} + +/*! + Check that the compiler get the correct #defines. + The logic to test the moc is in the header file "mock.h" + */ +BOOST_AUTO_TEST_CASE(construct_mock) +{ + delete new Mock(); + + BOOST_CHECK_EQUAL(BOOST_IS_DEFINED(QT_CORE_LIB), true); + BOOST_CHECK_EQUAL(BOOST_IS_DEFINED(TEST_MOCK), true); +} diff --git a/src/boost/tools/build/test/qt4/mock.h b/src/boost/tools/build/test/qt4/mock.h new file mode 100644 index 00000000..1cc95b05 --- /dev/null +++ b/src/boost/tools/build/test/qt4/mock.h @@ -0,0 +1,21 @@ +// (c) Copyright Juergen Hunold 2011 +// 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 <QtCore/QObject> + +class Mock : public QObject +{ + /*! + Test that the moc gets the necessary #defines + Else the moc will not see the Q_OBJECT macro, issue a warning + and linking will fail due to missing vtable symbols. + */ +#if defined(TEST_MOCK) + Q_OBJECT +#endif + public: + + Mock(); +}; diff --git a/src/boost/tools/build/test/qt4/phonon.cpp b/src/boost/tools/build/test/qt4/phonon.cpp new file mode 100644 index 00000000..3151f591 --- /dev/null +++ b/src/boost/tools/build/test/qt4/phonon.cpp @@ -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/MediaObject> + +#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; +} diff --git a/src/boost/tools/build/test/qt4/qt3support.cpp b/src/boost/tools/build/test/qt4/qt3support.cpp new file mode 100644 index 00000000..35d8c73b --- /dev/null +++ b/src/boost/tools/build/test/qt4/qt3support.cpp @@ -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; + +} + diff --git a/src/boost/tools/build/test/qt4/qtassistant.cpp b/src/boost/tools/build/test/qt4/qtassistant.cpp new file mode 100644 index 00000000..e2a6ed7b --- /dev/null +++ b/src/boost/tools/build/test/qt4/qtassistant.cpp @@ -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()); +} diff --git a/src/boost/tools/build/test/qt4/qtcore.cpp b/src/boost/tools/build/test/qt4/qtcore.cpp new file mode 100644 index 00000000..f3c09039 --- /dev/null +++ b/src/boost/tools/build/test/qt4/qtcore.cpp @@ -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); +} diff --git a/src/boost/tools/build/test/qt4/qtcorefail.cpp b/src/boost/tools/build/test/qt4/qtcorefail.cpp new file mode 100644 index 00000000..15fd36ae --- /dev/null +++ b/src/boost/tools/build/test/qt4/qtcorefail.cpp @@ -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); +} diff --git a/src/boost/tools/build/test/qt4/qtdeclarative.cpp b/src/boost/tools/build/test/qt4/qtdeclarative.cpp new file mode 100644 index 00000000..817855ba --- /dev/null +++ b/src/boost/tools/build/test/qt4/qtdeclarative.cpp @@ -0,0 +1,27 @@ +// (c) Copyright Juergen Hunold 2011 +// 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 QtMultimedia + +#include <QApplication> +#include <QDeclarativeView> + +#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_DECLARATIVE_LIB), true); +} + + +BOOST_AUTO_TEST_CASE( declarative ) +{ + QApplication app(boost::unit_test::framework::master_test_suite().argc, + boost::unit_test::framework::master_test_suite().argv); + QDeclarativeView view; +} diff --git a/src/boost/tools/build/test/qt4/qtgui.cpp b/src/boost/tools/build/test/qt4/qtgui.cpp new file mode 100644 index 00000000..75d9dacb --- /dev/null +++ b/src/boost/tools/build/test/qt4/qtgui.cpp @@ -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); +} diff --git a/src/boost/tools/build/test/qt4/qthelp.cpp b/src/boost/tools/build/test/qt4/qthelp.cpp new file mode 100644 index 00000000..32327de5 --- /dev/null +++ b/src/boost/tools/build/test/qt4/qthelp.cpp @@ -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()); +} diff --git a/src/boost/tools/build/test/qt4/qtmultimedia.cpp b/src/boost/tools/build/test/qt4/qtmultimedia.cpp new file mode 100644 index 00000000..dc5914af --- /dev/null +++ b/src/boost/tools/build/test/qt4/qtmultimedia.cpp @@ -0,0 +1,25 @@ +// (c) Copyright Juergen Hunold 2009 +// 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 QtMultimedia + +#include <QAudioDeviceInfo> + +#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_MULTIMEDIA_LIB), true); +} + +BOOST_AUTO_TEST_CASE( audiodevices) +{ + QList<QAudioDeviceInfo> devices = QAudioDeviceInfo::availableDevices(QAudio::AudioOutput); + for(int i = 0; i < devices.size(); ++i) { + BOOST_TEST_MESSAGE(QAudioDeviceInfo(devices.at(i)).deviceName().constData()); + } +} diff --git a/src/boost/tools/build/test/qt4/qtnetwork.cpp b/src/boost/tools/build/test/qt4/qtnetwork.cpp new file mode 100644 index 00000000..3f628d88 --- /dev/null +++ b/src/boost/tools/build/test/qt4/qtnetwork.cpp @@ -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; + } +} diff --git a/src/boost/tools/build/test/qt4/qtscript.cpp b/src/boost/tools/build/test/qt4/qtscript.cpp new file mode 100644 index 00000000..65353dae --- /dev/null +++ b/src/boost/tools/build/test/qt4/qtscript.cpp @@ -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 QtScript + +#include <QScriptEngine> + +#include <QCoreApplication> + +#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_SCRIPT_LIB), true); +} + +BOOST_AUTO_TEST_CASE( script ) +{ + QCoreApplication app(boost::unit_test::framework::master_test_suite().argc, + boost::unit_test::framework::master_test_suite().argv); + QScriptEngine myEngine; + QScriptValue three = myEngine.evaluate("1 + 2"); + + BOOST_CHECK_EQUAL(three.toNumber(), 3); + BOOST_CHECK_EQUAL(three.toString(), QLatin1String("3")); +} diff --git a/src/boost/tools/build/test/qt4/qtscripttools.cpp b/src/boost/tools/build/test/qt4/qtscripttools.cpp new file mode 100644 index 00000000..4d0b7f25 --- /dev/null +++ b/src/boost/tools/build/test/qt4/qtscripttools.cpp @@ -0,0 +1,47 @@ +// (c) Copyright Juergen Hunold 2009 +// 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 QtScriptTools + +#include <QScriptEngine> + +#include <QScriptEngineDebugger> + +#include <QApplication> + +#include <boost/test/unit_test.hpp> + +#include <iostream> + +namespace utf = boost::unit_test::framework; + +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_SCRIPTTOOLS_LIB), true); +} + +BOOST_AUTO_TEST_CASE( script ) +{ + QApplication app(utf::master_test_suite().argc, + utf::master_test_suite().argv); + + QScriptEngine myEngine; + QScriptValue three = myEngine.evaluate("1 + 2"); + + QScriptEngineDebugger debugger; + debugger.attachTo(&myEngine); + + BOOST_CHECK_EQUAL(three.toNumber(), 3); + BOOST_CHECK_EQUAL(three.toString(), QLatin1String("3")); + + debugger.detach(); +} diff --git a/src/boost/tools/build/test/qt4/qtsql.cpp b/src/boost/tools/build/test/qt4/qtsql.cpp new file mode 100644 index 00000000..aa506b1c --- /dev/null +++ b/src/boost/tools/build/test/qt4/qtsql.cpp @@ -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); +} diff --git a/src/boost/tools/build/test/qt4/qtsvg.cpp b/src/boost/tools/build/test/qt4/qtsvg.cpp new file mode 100644 index 00000000..8a139438 --- /dev/null +++ b/src/boost/tools/build/test/qt4/qtsvg.cpp @@ -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; +} diff --git a/src/boost/tools/build/test/qt4/qttest.cpp b/src/boost/tools/build/test/qt4/qttest.cpp new file mode 100644 index 00000000..a2744cdc --- /dev/null +++ b/src/boost/tools/build/test/qt4/qttest.cpp @@ -0,0 +1,30 @@ +// (c) Copyright Juergen Hunold 2008-2011 +// 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 +{ + /*! + Test if the moc gets the #define + */ +#if defined(TEST_MOCK) + Q_OBJECT +#endif + +private Q_SLOTS: + void toUpper(); +}; + +void +QtTest::toUpper() +{ + QString str = "Hello"; + QCOMPARE(str.toUpper(), QString("HELLO")); +} + +QTEST_MAIN(QtTest) +#include "qttest.moc" + diff --git a/src/boost/tools/build/test/qt4/qtwebkit.cpp b/src/boost/tools/build/test/qt4/qtwebkit.cpp new file mode 100644 index 00000000..7d85f147 --- /dev/null +++ b/src/boost/tools/build/test/qt4/qtwebkit.cpp @@ -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); +} diff --git a/src/boost/tools/build/test/qt4/qtxml.cpp b/src/boost/tools/build/test/qt4/qtxml.cpp new file mode 100644 index 00000000..8002c265 --- /dev/null +++ b/src/boost/tools/build/test/qt4/qtxml.cpp @@ -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)); +} + diff --git a/src/boost/tools/build/test/qt4/qtxmlpatterns.cpp b/src/boost/tools/build/test/qt4/qtxmlpatterns.cpp new file mode 100644 index 00000000..6835fdad --- /dev/null +++ b/src/boost/tools/build/test/qt4/qtxmlpatterns.cpp @@ -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; +} + diff --git a/src/boost/tools/build/test/qt4/rcc.cpp b/src/boost/tools/build/test/qt4/rcc.cpp new file mode 100644 index 00000000..cae553bb --- /dev/null +++ b/src/boost/tools/build/test/qt4/rcc.cpp @@ -0,0 +1,20 @@ +// (c) Copyright Juergen Hunold 2012 +// 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> + +std::ostream& operator<<(std::ostream& out, QString const& text) +{ + out << text.toUtf8().constData(); + return out; +} + +BOOST_AUTO_TEST_CASE (check_exists) +{ + BOOST_CHECK(QFile::exists(":/test/rcc.cpp")); +} diff --git a/src/boost/tools/build/test/qt4/rcc.qrc b/src/boost/tools/build/test/qt4/rcc.qrc new file mode 100644 index 00000000..13ca38a5 --- /dev/null +++ b/src/boost/tools/build/test/qt4/rcc.qrc @@ -0,0 +1,5 @@ +<!DOCTYPE RCC><RCC version="1.0"> + <qresource prefix="/test/"> + <file>rcc.cpp</file> + </qresource> +</RCC> |