]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
1 | // (c) Copyright Juergen Hunold 2012 |
2 | // Use, modification and distribution is subject to the Boost Software | |
1e59de90 TL |
3 | // License, Version 1.0. (See accompanying file LICENSE.txt or copy at |
4 | // https://www.bfgroup.xyz/b2/LICENSE.txt) | |
7c673cae FG |
5 | |
6 | #define BOOST_TEST_MODULE QtQuick | |
7 | #include <QDir> | |
8 | #include <QTimer> | |
9 | #include <QGuiApplication> | |
10 | #include <QQmlEngine> | |
11 | #include <QQuickView> | |
12 | #include <QDebug> | |
13 | ||
14 | #include <boost/test/unit_test.hpp> | |
15 | ||
16 | BOOST_AUTO_TEST_CASE (defines) | |
17 | { | |
18 | BOOST_CHECK_EQUAL(BOOST_IS_DEFINED(QT_QML_LIB), true); | |
19 | BOOST_CHECK_EQUAL(BOOST_IS_DEFINED(QT_QUICK_LIB), true); | |
20 | } | |
21 | ||
22 | BOOST_AUTO_TEST_CASE (simple_test) | |
23 | { | |
24 | QGuiApplication app(boost::unit_test::framework::master_test_suite().argc, | |
25 | boost::unit_test::framework::master_test_suite().argv); | |
26 | QQuickView view; | |
27 | ||
28 | QString fileName(boost::unit_test::framework::master_test_suite().argv[1]); | |
29 | ||
30 | view.connect(view.engine(), SIGNAL(quit()), &app, SLOT(quit())); | |
31 | view.setSource(QUrl::fromLocalFile(fileName)); \ | |
32 | ||
33 | QTimer::singleShot(2000, &app, SLOT(quit())); // Auto-close window | |
34 | ||
35 | if (QGuiApplication::platformName() == QLatin1String("qnx") || | |
36 | QGuiApplication::platformName() == QLatin1String("eglfs")) { | |
37 | view.setResizeMode(QQuickView::SizeRootObjectToView); | |
38 | view.showFullScreen(); | |
39 | } else { | |
40 | view.show(); | |
41 | } | |
42 | BOOST_CHECK_EQUAL(app.exec(), 0); | |
43 | } |