OLD | NEW |
| (Empty) |
1 /* | |
2 * Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). | |
3 * | |
4 * This library is free software; you can redistribute it and/or | |
5 * modify it under the terms of the GNU Library General Public | |
6 * License as published by the Free Software Foundation; either | |
7 * version 2 of the License, or (at your option) any later version. | |
8 * | |
9 * This library is distributed in the hope that it will be useful, | |
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
12 * Library General Public License for more details. | |
13 * | |
14 * You should have received a copy of the GNU Library General Public License | |
15 * along with this library; see the file COPYING.LIB. If not, write to | |
16 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | |
17 * Boston, MA 02110-1301, USA. | |
18 * | |
19 */ | |
20 | |
21 #include "config.h" | |
22 #include "TestsController.h" | |
23 | |
24 #include "qquickwebview_p.h" | |
25 #include <QGuiApplication> | |
26 | |
27 void addQtWebProcessToPath() | |
28 { | |
29 // Since tests won't find ./QtWebProcess, add it to PATH (at the end to prev
ent surprises). | |
30 // ROOT_BUILD_DIR should be defined by qmake. | |
31 qputenv("PATH", qgetenv("PATH") + QByteArray(":" ROOT_BUILD_DIR "/bin")); | |
32 } | |
33 | |
34 void messageHandler(QtMsgType type, const QMessageLogContext&, const QString& me
ssage) | |
35 { | |
36 if (type == QtCriticalMsg) { | |
37 fprintf(stderr, "%s\n", qPrintable(message)); | |
38 return; | |
39 } | |
40 | |
41 // Do nothing | |
42 } | |
43 | |
44 int main(int argc, char** argv) | |
45 { | |
46 bool suppressQtDebugOutput = true; // Suppress debug output from Qt if not s
tarted with --verbose. | |
47 bool useDesktopBehavior = true; // Use traditional desktop behavior if not s
tarted with --flickable. | |
48 | |
49 for (int i = 1; i < argc; ++i) { | |
50 if (!qstrcmp(argv[i], "--verbose")) | |
51 suppressQtDebugOutput = false; | |
52 else if (!qstrcmp(argv[i], "--flickable")) | |
53 useDesktopBehavior = false; | |
54 } | |
55 | |
56 QQuickWebViewExperimental::setFlickableViewportEnabled(!useDesktopBehavior); | |
57 | |
58 // Has to be done before QApplication is constructed in case | |
59 // QApplication itself produces debug output. | |
60 if (suppressQtDebugOutput) { | |
61 qInstallMessageHandler(messageHandler); | |
62 if (qgetenv("QT_WEBKIT_SUPPRESS_WEB_PROCESS_OUTPUT").isEmpty()) | |
63 qputenv("QT_WEBKIT_SUPPRESS_WEB_PROCESS_OUTPUT", "1"); | |
64 } | |
65 | |
66 QGuiApplication app(argc, argv); | |
67 addQtWebProcessToPath(); | |
68 | |
69 return TestWebKitAPI::TestsController::shared().run(argc, argv) ? EXIT_SUCCE
SS : EXIT_FAILURE; | |
70 } | |
OLD | NEW |