diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 18:45:59 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 18:45:59 +0000 |
commit | 19fcec84d8d7d21e796c7624e521b60d28ee21ed (patch) | |
tree | 42d26aa27d1e3f7c0b8bd3fd14e7d7082f5008dc /src/boost/tools/build/test/qt5 | |
parent | Initial commit. (diff) | |
download | ceph-upstream.tar.xz ceph-upstream.zip |
Adding upstream version 16.2.11+ds.upstream/16.2.11+dsupstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/boost/tools/build/test/qt5')
45 files changed, 1356 insertions, 0 deletions
diff --git a/src/boost/tools/build/test/qt5/jamroot.jam b/src/boost/tools/build/test/qt5/jamroot.jam new file mode 100644 index 000000000..782922557 --- /dev/null +++ b/src/boost/tools/build/test/qt5/jamroot.jam @@ -0,0 +1,104 @@ +# (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 qt5 ; +import testing ; +import cast ; + +path-constant CWD : . ; + + +if [ qt5.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 /qt5//QtCore ] + [ run qtsql.cpp /qt5//QtSql ] + [ run qtxml.cpp /qt5//QtXml ] + [ run qtnetwork.cpp /qt5//QtNetwork ] + [ run qtscript.cpp /qt5//QtScript ] + [ run qtscripttools.cpp /qt5//QtScriptTools ] + [ run qtxmlpatterns.cpp /qt5//QtXmlPatterns ] + + [ run qtpositioning.cpp /qt5//QtPositioning ] + + # ToDo: runable example code + [ link qtsvg.cpp /qt5//QtSvg ] + [ link qtwidgets.cpp /qt5//QtWidgets ] + + # Multimedia toolkits. + [ link qtwebkit.cpp /qt5//QtWebKit ] + [ link qtwebkitwidgets.cpp /qt5//QtWebKitWidgets ] + [ link qtmultimedia.cpp /qt5//QtMultimedia ] + + # QtQuick version1 + [ link qtdeclarative.cpp /qt5//QtDeclarative ] + + # QtQuick version2 + [ run qtquick.cpp /qt5//QtQuick : "--" -platform offscreen : $(CWD)/qtquick.qml ] + + [ run qtwebengine.cpp /qt5//QtWebEngine ] + [ run qtwebenginewidgets.cpp /qt5//QtWebEngineWidgets ] + + # QtSerialPort + [ run qtserialport.cpp /qt5//QtSerialPort ] + + [ run qtlocation.cpp /qt5//QtLocation ] + + [ run qtwebchannel.cpp /qt5//QtWebChannel ] + [ run qtwebsockets.cpp /qt5//QtWebSockets ] + [ run qtwebview.cpp /qt5//QtWebView ] + + [ run qtpurchasing.cpp /qt5//QtPurchasing ] + + [ run qtcharts.cpp /qt5//QtCharts ] + + [ run qt3dcore.cpp /qt5//Qt3DCore ] + [ run qt3drender.cpp /qt5//Qt3DRender ] + [ run qt3dinput.cpp /qt5//Qt3DInput ] + [ run qt3dlogic.cpp /qt5//Qt3DLogic ] + + [ run qtdatavisualization.cpp /qt5//QtDataVisualization ] + + # Qt Connectivity + [ run qtbluetooth.cpp /qt5//QtBluetooth ] + [ run qtnfc.cpp /qt5//QtNfc ] + + [ run qtgamepad.cpp /qt5//QtGamepad ] + + [ run qtscxml.cpp /qt5//QtScxml ] + + [ run qtserialbus.cpp /qt5//QtSerialBus ] + + + # Help systems. + [ link qthelp.cpp /qt5//QtHelp ] + + # Testing using QtTest. Simple sample + # ToDo: better support for "automoc" aka '#include "qttest.moc"' + [ run qttest.cpp [ cast _ moccable5-cpp : qttest.cpp ] /qt5//QtTest : : : <define>TEST_MOCK ] + + # Test moc rule + [ run mock.cpp mock.h /qt5//QtCore : : : <define>TEST_MOCK ] + + # Test resource compiler + [ run rcc.cpp rcc.qrc /qt5//QtCore : : : <rccflags>"-compress 9 -threshold 10" ] + + : # requirements + : # default-build + : # usage-requirements + ; +} + + diff --git a/src/boost/tools/build/test/qt5/mock.cpp b/src/boost/tools/build/test/qt5/mock.cpp new file mode 100644 index 000000000..82fc608dc --- /dev/null +++ b/src/boost/tools/build/test/qt5/mock.cpp @@ -0,0 +1,26 @@ +// (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 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/qt5/mock.h b/src/boost/tools/build/test/qt5/mock.h new file mode 100644 index 000000000..eac177d4d --- /dev/null +++ b/src/boost/tools/build/test/qt5/mock.h @@ -0,0 +1,21 @@ +// (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) + +#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/qt5/qt3dcore.cpp b/src/boost/tools/build/test/qt5/qt3dcore.cpp new file mode 100644 index 000000000..9d1871bdc --- /dev/null +++ b/src/boost/tools/build/test/qt5/qt3dcore.cpp @@ -0,0 +1,21 @@ +// (c) Copyright Juergen Hunold 2015 +// 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 Qt3DCore +#include <Qt3DCore> + +#include <boost/test/unit_test.hpp> + +BOOST_AUTO_TEST_CASE (defines) +{ + BOOST_CHECK_EQUAL(BOOST_IS_DEFINED(QT_3DCORE_LIB), true); +} + +BOOST_AUTO_TEST_CASE ( sample_code ) +{ + Qt3DCore::QTransform torusTransform; + torusTransform.setScale3D(QVector3D(1.5, 1, 0.5)); + torusTransform.setRotation(QQuaternion::fromAxisAndAngle(QVector3D(1, 0, 0), 45.0f)); +} diff --git a/src/boost/tools/build/test/qt5/qt3dinput.cpp b/src/boost/tools/build/test/qt5/qt3dinput.cpp new file mode 100644 index 000000000..46cee14a3 --- /dev/null +++ b/src/boost/tools/build/test/qt5/qt3dinput.cpp @@ -0,0 +1,24 @@ +// (c) Copyright Juergen Hunold 2015 +// 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 Qt3DInput +#include <Qt3DInput> + +#include <boost/test/unit_test.hpp> + +BOOST_AUTO_TEST_CASE (defines) +{ + BOOST_CHECK_EQUAL(BOOST_IS_DEFINED(QT_3DINPUT_LIB), true); + BOOST_CHECK_EQUAL(BOOST_IS_DEFINED(QT_3DCORE_LIB), true); + BOOST_CHECK_EQUAL(BOOST_IS_DEFINED(QT_3DRENDER_LIB), true); +} + + +BOOST_AUTO_TEST_CASE ( sample_code ) +{ + Qt3DCore::QEntity rootEntity; + +} + diff --git a/src/boost/tools/build/test/qt5/qt3dlogic.cpp b/src/boost/tools/build/test/qt5/qt3dlogic.cpp new file mode 100644 index 000000000..088f42099 --- /dev/null +++ b/src/boost/tools/build/test/qt5/qt3dlogic.cpp @@ -0,0 +1,20 @@ +// (c) Copyright Juergen Hunold 2015 +// 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 Qt3DLogic +#include <Qt3DLogic> + +#include <boost/test/unit_test.hpp> + +BOOST_AUTO_TEST_CASE (defines) +{ + BOOST_CHECK_EQUAL(BOOST_IS_DEFINED(QT_3DCORE_LIB), true); + BOOST_CHECK_EQUAL(BOOST_IS_DEFINED(QT_3DLOGIC_LIB), true); +} + +BOOST_AUTO_TEST_CASE ( sample_code ) +{ + Qt3DLogic::QLogicAspect logicAspect; +} diff --git a/src/boost/tools/build/test/qt5/qt3drender.cpp b/src/boost/tools/build/test/qt5/qt3drender.cpp new file mode 100644 index 000000000..d4578054d --- /dev/null +++ b/src/boost/tools/build/test/qt5/qt3drender.cpp @@ -0,0 +1,21 @@ +// (c) Copyright Juergen Hunold 2015 +// 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 Qt3DRender +#include <Qt3DRender> + +#include <boost/test/unit_test.hpp> + +BOOST_AUTO_TEST_CASE (defines) +{ + BOOST_CHECK_EQUAL(BOOST_IS_DEFINED(QT_3DCORE_LIB), true); + BOOST_CHECK_EQUAL(BOOST_IS_DEFINED(QT_3DRENDER_LIB), true); +} + +BOOST_AUTO_TEST_CASE ( sample_code ) +{ + Qt3DCore::QEntity rootEntity; + Qt3DRender::QMaterial material(&rootEntity); +} diff --git a/src/boost/tools/build/test/qt5/qtassistant.cpp b/src/boost/tools/build/test/qt5/qtassistant.cpp new file mode 100644 index 000000000..c15ee4eca --- /dev/null +++ b/src/boost/tools/build/test/qt5/qtassistant.cpp @@ -0,0 +1,21 @@ +// (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 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/qt5/qtbluetooth.cpp b/src/boost/tools/build/test/qt5/qtbluetooth.cpp new file mode 100644 index 000000000..53beff17b --- /dev/null +++ b/src/boost/tools/build/test/qt5/qtbluetooth.cpp @@ -0,0 +1,34 @@ +// (c) Copyright Juergen Hunold 2016 +// 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 QtBluetooth + +#include <QtBluetooth> + +#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_BLUETOOTH_LIB), true); +} + +/*! + Try to detect a device + */ +BOOST_AUTO_TEST_CASE( bluetooth ) +{ + QList<QBluetoothHostInfo> localAdapters = QBluetoothLocalDevice::allDevices(); + + if (!localAdapters.empty()) + { + QBluetoothLocalDevice adapter(localAdapters.at(0).address()); + adapter.setHostMode(QBluetoothLocalDevice::HostDiscoverable); + } + else + { + BOOST_TEST(localAdapters.size() == 0); + } +} diff --git a/src/boost/tools/build/test/qt5/qtcharts.cpp b/src/boost/tools/build/test/qt5/qtcharts.cpp new file mode 100644 index 000000000..d29c4fd03 --- /dev/null +++ b/src/boost/tools/build/test/qt5/qtcharts.cpp @@ -0,0 +1,15 @@ +// (c) Copyright Juergen Hunold 2015 +// 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 QtCharts +#include <QtCharts> + +#include <boost/test/unit_test.hpp> + +BOOST_AUTO_TEST_CASE (defines) +{ + BOOST_CHECK_EQUAL(BOOST_IS_DEFINED(QT_WIDGETS_LIB), true); + BOOST_CHECK_EQUAL(BOOST_IS_DEFINED(QT_CHARTS_LIB), true); +} diff --git a/src/boost/tools/build/test/qt5/qtcore.cpp b/src/boost/tools/build/test/qt5/qtcore.cpp new file mode 100644 index 000000000..6a2c62c8d --- /dev/null +++ b/src/boost/tools/build/test/qt5/qtcore.cpp @@ -0,0 +1,22 @@ +// (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> + +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/qt5/qtcorefail.cpp b/src/boost/tools/build/test/qt5/qtcorefail.cpp new file mode 100644 index 000000000..8032d47cd --- /dev/null +++ b/src/boost/tools/build/test/qt5/qtcorefail.cpp @@ -0,0 +1,23 @@ +// (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 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/qt5/qtdatavisualization.cpp b/src/boost/tools/build/test/qt5/qtdatavisualization.cpp new file mode 100644 index 000000000..bc35c04c5 --- /dev/null +++ b/src/boost/tools/build/test/qt5/qtdatavisualization.cpp @@ -0,0 +1,31 @@ +// (c) Copyright Juergen Hunold 2016 +// 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 QtDataVisualization + +#include <QtDataVisualization> + +#include <QGuiApplication> + +#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_DATAVISUALIZATION_LIB), true); +} + +BOOST_AUTO_TEST_CASE( datavisualization ) +{ + QGuiApplication app(boost::unit_test::framework::master_test_suite().argc, + boost::unit_test::framework::master_test_suite().argv); + + QtDataVisualization::Q3DBars graph; + + graph.setShadowQuality(QtDataVisualization::QAbstract3DGraph::ShadowQualitySoftMedium); + graph.activeTheme()->setBackgroundEnabled(false); + graph.activeTheme()->setLabelBackgroundEnabled(true); +} diff --git a/src/boost/tools/build/test/qt5/qtdeclarative.cpp b/src/boost/tools/build/test/qt5/qtdeclarative.cpp new file mode 100644 index 000000000..df70f5e46 --- /dev/null +++ b/src/boost/tools/build/test/qt5/qtdeclarative.cpp @@ -0,0 +1,26 @@ +// (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 QtDeclarative + +#include <QCoreApplication> +#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_XML_LIB), true); + BOOST_CHECK_EQUAL(BOOST_IS_DEFINED(QT_DECLARATIVE_LIB), true); +} + + +BOOST_AUTO_TEST_CASE( declarative ) +{ + QCoreApplication 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/qt5/qtgamepad.cpp b/src/boost/tools/build/test/qt5/qtgamepad.cpp new file mode 100644 index 000000000..c6c6aea50 --- /dev/null +++ b/src/boost/tools/build/test/qt5/qtgamepad.cpp @@ -0,0 +1,29 @@ +// (c) Copyright Juergen Hunold 2016 +// 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 QtGamepad + +#include <QtGamepad> + +#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_GAMEPAD_LIB), true); +} + +/*! + Try to detect a device + */ +BOOST_AUTO_TEST_CASE( gamepad ) +{ + auto gamepads = QGamepadManager::instance()->connectedGamepads(); + if (gamepads.isEmpty()) { + return; + } + + QGamepad gamepad(*gamepads.begin()); +} diff --git a/src/boost/tools/build/test/qt5/qthelp.cpp b/src/boost/tools/build/test/qt5/qthelp.cpp new file mode 100644 index 000000000..b0e877a6a --- /dev/null +++ b/src/boost/tools/build/test/qt5/qthelp.cpp @@ -0,0 +1,22 @@ +// (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 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/qt5/qtlocation.cpp b/src/boost/tools/build/test/qt5/qtlocation.cpp new file mode 100644 index 000000000..9806dca93 --- /dev/null +++ b/src/boost/tools/build/test/qt5/qtlocation.cpp @@ -0,0 +1,30 @@ +// (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 QtPositioning + +#include <QGeoAddress> +#include <QGeoLocation> + +#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_POSITIONING_LIB), true); + BOOST_CHECK_EQUAL(BOOST_IS_DEFINED(QT_NETWORK_LIB), true); + BOOST_CHECK_EQUAL(BOOST_IS_DEFINED(QT_LOCATION_LIB), true); +} + +BOOST_TEST_DONT_PRINT_LOG_VALUE(QGeoAddress) + +BOOST_AUTO_TEST_CASE( geo_location ) +{ + QGeoLocation geolocation; + + QGeoAddress address; + + BOOST_CHECK_EQUAL(geolocation.address(), address); +} diff --git a/src/boost/tools/build/test/qt5/qtmultimedia.cpp b/src/boost/tools/build/test/qt5/qtmultimedia.cpp new file mode 100644 index 000000000..dc5914aff --- /dev/null +++ b/src/boost/tools/build/test/qt5/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/qt5/qtnetwork.cpp b/src/boost/tools/build/test/qt5/qtnetwork.cpp new file mode 100644 index 000000000..d34246689 --- /dev/null +++ b/src/boost/tools/build/test/qt5/qtnetwork.cpp @@ -0,0 +1,33 @@ +// (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 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/qt5/qtnfc.cpp b/src/boost/tools/build/test/qt5/qtnfc.cpp new file mode 100644 index 000000000..df3805f67 --- /dev/null +++ b/src/boost/tools/build/test/qt5/qtnfc.cpp @@ -0,0 +1,28 @@ +// (c) Copyright Juergen Hunold 2016 +// 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 QtNfc + +#include <QtNfc> + +#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_NFC_LIB), true); +} + +/*! + Try to detect a device + */ +BOOST_AUTO_TEST_CASE( nfc ) +{ + QNearFieldManager manager; + if (!manager.isAvailable()) + { + BOOST_TEST_MESSAGE("No Nfc"); + } +} diff --git a/src/boost/tools/build/test/qt5/qtpositioning.cpp b/src/boost/tools/build/test/qt5/qtpositioning.cpp new file mode 100644 index 000000000..427b41ba9 --- /dev/null +++ b/src/boost/tools/build/test/qt5/qtpositioning.cpp @@ -0,0 +1,23 @@ +// (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 QtPositioning + +#include <QGeoCoordinate> + +#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_POSITIONING_LIB), true); +} + +BOOST_AUTO_TEST_CASE( geo_coordinate ) +{ + QGeoCoordinate geocoordinate; + + BOOST_CHECK_EQUAL(geocoordinate.type(), QGeoCoordinate::InvalidCoordinate); +} diff --git a/src/boost/tools/build/test/qt5/qtpurchasing.cpp b/src/boost/tools/build/test/qt5/qtpurchasing.cpp new file mode 100644 index 000000000..9a49ed2cc --- /dev/null +++ b/src/boost/tools/build/test/qt5/qtpurchasing.cpp @@ -0,0 +1,44 @@ +// (c) Copyright Juergen Hunold 2016 +// 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 QtPurchasing + +#include <QtPurchasing> + +#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_PURCHASING_LIB), true); +} + +class DummyProduct : public QInAppProduct +{ +public: + + DummyProduct() : QInAppProduct{QStringLiteral("One"), + QString{}, + QString{}, + Consumable, + QStringLiteral("DummyProduct"), + nullptr} {}; + void purchase() override {}; +}; + +std::ostream& +operator << (std::ostream& stream, QString const& string) +{ + stream << qPrintable(string); + return stream; +} + +BOOST_AUTO_TEST_CASE (purchase) +{ + DummyProduct product; + + BOOST_TEST(product.price() == QLatin1String("One")); + BOOST_TEST(product.identifier() == QLatin1String("DummyProduct")); +} diff --git a/src/boost/tools/build/test/qt5/qtquick.cpp b/src/boost/tools/build/test/qt5/qtquick.cpp new file mode 100644 index 000000000..bec0d809c --- /dev/null +++ b/src/boost/tools/build/test/qt5/qtquick.cpp @@ -0,0 +1,43 @@ +// (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 QtQuick +#include <QDir> +#include <QTimer> +#include <QGuiApplication> +#include <QQmlEngine> +#include <QQuickView> +#include <QDebug> + +#include <boost/test/unit_test.hpp> + +BOOST_AUTO_TEST_CASE (defines) +{ + BOOST_CHECK_EQUAL(BOOST_IS_DEFINED(QT_QML_LIB), true); + BOOST_CHECK_EQUAL(BOOST_IS_DEFINED(QT_QUICK_LIB), true); +} + +BOOST_AUTO_TEST_CASE (simple_test) +{ + QGuiApplication app(boost::unit_test::framework::master_test_suite().argc, + boost::unit_test::framework::master_test_suite().argv); + QQuickView view; + + QString fileName(boost::unit_test::framework::master_test_suite().argv[1]); + + view.connect(view.engine(), SIGNAL(quit()), &app, SLOT(quit())); + view.setSource(QUrl::fromLocalFile(fileName)); \ + + QTimer::singleShot(2000, &app, SLOT(quit())); // Auto-close window + + if (QGuiApplication::platformName() == QLatin1String("qnx") || + QGuiApplication::platformName() == QLatin1String("eglfs")) { + view.setResizeMode(QQuickView::SizeRootObjectToView); + view.showFullScreen(); + } else { + view.show(); + } + BOOST_CHECK_EQUAL(app.exec(), 0); +} diff --git a/src/boost/tools/build/test/qt5/qtquick.qml b/src/boost/tools/build/test/qt5/qtquick.qml new file mode 100644 index 000000000..26b23eb2a --- /dev/null +++ b/src/boost/tools/build/test/qt5/qtquick.qml @@ -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) + +import QtQuick 2.0 + +Rectangle { + id: page + width: 400; height: 200 + color: "#d6d6d6" + Text { + id: helloText + text: "B2 built!" + color: "darkgray" + anchors.horizontalCenter: page.horizontalCenter + anchors.verticalCenter: page.verticalCenter + font.pointSize: 30; font.italic: true ; font.bold: true + } +} diff --git a/src/boost/tools/build/test/qt5/qtscript.cpp b/src/boost/tools/build/test/qt5/qtscript.cpp new file mode 100644 index 000000000..d48c073eb --- /dev/null +++ b/src/boost/tools/build/test/qt5/qtscript.cpp @@ -0,0 +1,37 @@ +// (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 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/qt5/qtscripttools.cpp b/src/boost/tools/build/test/qt5/qtscripttools.cpp new file mode 100644 index 000000000..002056a0f --- /dev/null +++ b/src/boost/tools/build/test/qt5/qtscripttools.cpp @@ -0,0 +1,47 @@ +// (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 QtScriptTools + +#include <QScriptEngine> + +#include <QScriptEngineDebugger> + +#include <QCoreApplication> + +#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 ) +{ + QCoreApplication 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/qt5/qtscxml.cpp b/src/boost/tools/build/test/qt5/qtscxml.cpp new file mode 100644 index 000000000..9e423a18a --- /dev/null +++ b/src/boost/tools/build/test/qt5/qtscxml.cpp @@ -0,0 +1,33 @@ +// (c) Copyright Juergen Hunold 2016 +// 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 QtScxml + +#include <QtScxml> + +#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_SCXML_LIB), true); +} + +std::ostream& +operator << (std::ostream& stream, QString const& string) +{ + stream << qPrintable(string); + return stream; +} + +/*! + */ +BOOST_AUTO_TEST_CASE( scxml ) +{ + QString sessionId = QScxmlStateMachine::generateSessionId(QStringLiteral("dummy")); + + BOOST_TEST(sessionId.isEmpty() == false); + BOOST_TEST(sessionId == QString{"dummy1"}); +} diff --git a/src/boost/tools/build/test/qt5/qtserialbus.cpp b/src/boost/tools/build/test/qt5/qtserialbus.cpp new file mode 100644 index 000000000..5849351d8 --- /dev/null +++ b/src/boost/tools/build/test/qt5/qtserialbus.cpp @@ -0,0 +1,25 @@ +// (c) Copyright Juergen Hunold 2016 +// 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 QtSerialBus + +#include <QtSerialBus> + +#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_SERIALBUS_LIB), true); +} + +/*! + create a canbus instance + */ +BOOST_AUTO_TEST_CASE( serialBus ) +{ + auto canbus = QCanBus::instance(); + Q_UNUSED(canbus); +} diff --git a/src/boost/tools/build/test/qt5/qtserialport.cpp b/src/boost/tools/build/test/qt5/qtserialport.cpp new file mode 100644 index 000000000..fd24ed92b --- /dev/null +++ b/src/boost/tools/build/test/qt5/qtserialport.cpp @@ -0,0 +1,22 @@ +// (c) Copyright Juergen Hunold 2016 +// 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 QtSerialPort + +#include <QtSerialPort> + +#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_SERIALPORT_LIB), true); +} + +BOOST_AUTO_TEST_CASE( serialport ) +{ + QSerialPort serialPort; + serialPort.setPortName(QStringLiteral("test serialport")); +} diff --git a/src/boost/tools/build/test/qt5/qtsql.cpp b/src/boost/tools/build/test/qt5/qtsql.cpp new file mode 100644 index 000000000..127c5a3f4 --- /dev/null +++ b/src/boost/tools/build/test/qt5/qtsql.cpp @@ -0,0 +1,37 @@ +// (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 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/qt5/qtsvg.cpp b/src/boost/tools/build/test/qt5/qtsvg.cpp new file mode 100644 index 000000000..ccfd6b4d1 --- /dev/null +++ b/src/boost/tools/build/test/qt5/qtsvg.cpp @@ -0,0 +1,21 @@ +// (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 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/qt5/qttest.cpp b/src/boost/tools/build/test/qt5/qttest.cpp new file mode 100644 index 000000000..ddc8f686a --- /dev/null +++ b/src/boost/tools/build/test/qt5/qttest.cpp @@ -0,0 +1,30 @@ +// (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) + +#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/qt5/qtwebchannel.cpp b/src/boost/tools/build/test/qt5/qtwebchannel.cpp new file mode 100644 index 000000000..e4f05b7f2 --- /dev/null +++ b/src/boost/tools/build/test/qt5/qtwebchannel.cpp @@ -0,0 +1,29 @@ +// (c) Copyright Juergen Hunold 2016 +// 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 QtWebChannel + +#include <QtWebChannel> + +#include <QGuiApplication> + +#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_WEBCHANNEL_LIB), true); +} + +BOOST_AUTO_TEST_CASE( webchannel ) +{ + QGuiApplication app(boost::unit_test::framework::master_test_suite().argc, + boost::unit_test::framework::master_test_suite().argv); + + QWebChannel channel; + QObject dummy; + channel.registerObject(QStringLiteral("dummy"), &dummy); +} diff --git a/src/boost/tools/build/test/qt5/qtwebengine.cpp b/src/boost/tools/build/test/qt5/qtwebengine.cpp new file mode 100644 index 000000000..d4c1b0726 --- /dev/null +++ b/src/boost/tools/build/test/qt5/qtwebengine.cpp @@ -0,0 +1,30 @@ +// (c) Copyright Juergen Hunold 2016 +// 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 QtWebEngine + +#include <QtWebEngine> +#include <QGuiApplication> + + +#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_WEBENGINE_LIB), true); +} + +/*! + Just call the global initialization function + */ +BOOST_AUTO_TEST_CASE( webengine ) +{ + QGuiApplication app(boost::unit_test::framework::master_test_suite().argc, + boost::unit_test::framework::master_test_suite().argv); + + QtWebEngine::initialize(); +} diff --git a/src/boost/tools/build/test/qt5/qtwebenginewidgets.cpp b/src/boost/tools/build/test/qt5/qtwebenginewidgets.cpp new file mode 100644 index 000000000..f0c3c2d8b --- /dev/null +++ b/src/boost/tools/build/test/qt5/qtwebenginewidgets.cpp @@ -0,0 +1,40 @@ +// (c) Copyright Juergen Hunold 2016 +// 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 QtWebEngineWidgets + +#include <QtWebEngineWidgets> + +#include <QWebEngineProfile> +#include <QWebEngineSettings> +#include <QWebEngineScript> + +#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_WIDGETS_LIB), true); + BOOST_CHECK_EQUAL(BOOST_IS_DEFINED(QT_WEBENGINE_LIB), true); + BOOST_CHECK_EQUAL(BOOST_IS_DEFINED(QT_WEBENGINECORE_LIB), true); + BOOST_CHECK_EQUAL(BOOST_IS_DEFINED(QT_WEBENGINEWIDGETS_LIB), true); +} + +/*! + Also tests the core library + */ +BOOST_AUTO_TEST_CASE( webengine_widgets ) +{ + QApplication app(boost::unit_test::framework::master_test_suite().argc, + boost::unit_test::framework::master_test_suite().argv); + + QWebEngineSettings *defaultSettings = QWebEngineSettings::globalSettings(); + QWebEngineProfile *defaultProfile = QWebEngineProfile::defaultProfile(); + + defaultSettings->setAttribute(QWebEngineSettings::FullScreenSupportEnabled, true); + defaultProfile->setPersistentCookiesPolicy(QWebEngineProfile::NoPersistentCookies); +} diff --git a/src/boost/tools/build/test/qt5/qtwebkit.cpp b/src/boost/tools/build/test/qt5/qtwebkit.cpp new file mode 100644 index 000000000..aa6fdc92f --- /dev/null +++ b/src/boost/tools/build/test/qt5/qtwebkit.cpp @@ -0,0 +1,22 @@ +// (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 QtWebKit + +#include <QWebSettings> + +#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 ) +{ + BOOST_CHECK(QWebSettings::globalSettings()); +} diff --git a/src/boost/tools/build/test/qt5/qtwebkitwidgets.cpp b/src/boost/tools/build/test/qt5/qtwebkitwidgets.cpp new file mode 100644 index 000000000..52c05c9a9 --- /dev/null +++ b/src/boost/tools/build/test/qt5/qtwebkitwidgets.cpp @@ -0,0 +1,23 @@ +// (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 QtWebKitWidgets + +#include <QWebPage> + +#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_WEBKITWIDGETS_LIB), true); +} + +BOOST_AUTO_TEST_CASE( webkit ) +{ + QWebPage page; + BOOST_CHECK_EQUAL(page.isModified(), false); +} diff --git a/src/boost/tools/build/test/qt5/qtwebsocket.cpp b/src/boost/tools/build/test/qt5/qtwebsocket.cpp new file mode 100644 index 000000000..f46aa58b3 --- /dev/null +++ b/src/boost/tools/build/test/qt5/qtwebsocket.cpp @@ -0,0 +1,26 @@ +// (c) Copyright Juergen Hunold 2016 +// 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 QtWebSockets + +#include <QtWebSockets> + +#include <QCoreApplication> + +#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_WEBSOCKETS_LIB), true); +} + +BOOST_AUTO_TEST_CASE( websocket ) +{ + QCoreApplication app(boost::unit_test::framework::master_test_suite().argc, + boost::unit_test::framework::master_test_suite().argv); + + QWebSocket socket; +} diff --git a/src/boost/tools/build/test/qt5/qtwebsockets.cpp b/src/boost/tools/build/test/qt5/qtwebsockets.cpp new file mode 100644 index 000000000..9829ce916 --- /dev/null +++ b/src/boost/tools/build/test/qt5/qtwebsockets.cpp @@ -0,0 +1,24 @@ +// (c) Copyright Juergen Hunold 2016 +// 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 QtWebSockets + +#include <QtWebSockets> + +#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_WEBSOCKETS_LIB), true); +} + +BOOST_AUTO_TEST_CASE( websocket ) +{ + QWebSocket socket; + socket.setPauseMode(QAbstractSocket::PauseNever); + + BOOST_TEST(socket.isValid() == false); +} diff --git a/src/boost/tools/build/test/qt5/qtwebview.cpp b/src/boost/tools/build/test/qt5/qtwebview.cpp new file mode 100644 index 000000000..dfd130f37 --- /dev/null +++ b/src/boost/tools/build/test/qt5/qtwebview.cpp @@ -0,0 +1,31 @@ +// (c) Copyright Juergen Hunold 2016 +// 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 QtWebView + +#include <QtWebView> + +#include <QGuiApplication> + +#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_WEBENGINE_LIB), true); + BOOST_CHECK_EQUAL(BOOST_IS_DEFINED(QT_WEBENGINECORE_LIB), true); + BOOST_CHECK_EQUAL(BOOST_IS_DEFINED(QT_WEBVIEW_LIB), true); +} + +/*! + Just call the global initialization function + */ +BOOST_AUTO_TEST_CASE( webview ) +{ + QGuiApplication app(boost::unit_test::framework::master_test_suite().argc, + boost::unit_test::framework::master_test_suite().argv); + + QtWebView::initialize(); +} diff --git a/src/boost/tools/build/test/qt5/qtwidgets.cpp b/src/boost/tools/build/test/qt5/qtwidgets.cpp new file mode 100644 index 000000000..b868240a5 --- /dev/null +++ b/src/boost/tools/build/test/qt5/qtwidgets.cpp @@ -0,0 +1,43 @@ +// (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 QtGui + +#include <QtWidgets/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_CHECK_EQUAL(BOOST_IS_DEFINED(QT_WIDGETS_LIB), true); +} + + +BOOST_AUTO_TEST_CASE( qtgui_test) +{ + BOOST_CHECK_EQUAL(true, true); +} diff --git a/src/boost/tools/build/test/qt5/qtxml.cpp b/src/boost/tools/build/test/qt5/qtxml.cpp new file mode 100644 index 000000000..3df6dd2c1 --- /dev/null +++ b/src/boost/tools/build/test/qt5/qtxml.cpp @@ -0,0 +1,29 @@ +// (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 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/qt5/qtxmlpatterns.cpp b/src/boost/tools/build/test/qt5/qtxmlpatterns.cpp new file mode 100644 index 000000000..d87e3d3fe --- /dev/null +++ b/src/boost/tools/build/test/qt5/qtxmlpatterns.cpp @@ -0,0 +1,76 @@ +// (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 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/qt5/rcc.cpp b/src/boost/tools/build/test/qt5/rcc.cpp new file mode 100644 index 000000000..cae553bb1 --- /dev/null +++ b/src/boost/tools/build/test/qt5/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/qt5/rcc.qrc b/src/boost/tools/build/test/qt5/rcc.qrc new file mode 100644 index 000000000..13ca38a5d --- /dev/null +++ b/src/boost/tools/build/test/qt5/rcc.qrc @@ -0,0 +1,5 @@ +<!DOCTYPE RCC><RCC version="1.0"> + <qresource prefix="/test/"> + <file>rcc.cpp</file> + </qresource> +</RCC> |