Beispiel #1
0
int main(int argc, char** argv)
{
    QVarLengthArray<char*, 8> arguments;
    for (int i = 0; i < argc; ++i)
        arguments.append(argv[i]);

    arguments.append(const_cast<char*>("-import"));
    arguments.append(const_cast<char*>(IMPORT_DIR));

    argc = arguments.count();
    argv = arguments.data();

    suppressDebugOutput();
    addQtWebProcessToPath();

    // Instantiate QApplication to prevent quick_test_main to instantiate a QGuiApplication.
    // This can be removed as soon as we do not use QtWidgets any more.
    QGuiApplication app(argc, argv);
    qmlRegisterType<ByteArrayTestData>("Test", 1, 0, "ByteArrayTestData");

#ifdef DISABLE_FLICKABLE_VIEWPORT
    QQuickWebViewExperimental::setFlickableViewportEnabled(false);
#endif
    return quick_test_main(argc, argv, "qmltests", 0, QUICK_TEST_SOURCE_DIR);
}
int main(int argc, char** argv)
{
    bool suppressQtDebugOutput = true; // Suppress debug output from Qt if not started with --verbose.
    bool useDesktopBehavior = true; // Use traditional desktop behavior if not started with --flickable.

    for (int i = 1; i < argc; ++i) {
        if (!qstrcmp(argv[i], "--verbose"))
            suppressQtDebugOutput = false;
        else if (!qstrcmp(argv[i], "--flickable"))
            useDesktopBehavior = false;
    }

    QQuickWebViewExperimental::setFlickableViewportEnabled(!useDesktopBehavior);

    // Has to be done before QApplication is constructed in case
    // QApplication itself produces debug output.
    if (suppressQtDebugOutput) {
        qInstallMessageHandler(messageHandler);
        if (qgetenv("QT_WEBKIT_SUPPRESS_WEB_PROCESS_OUTPUT").isEmpty())
            qputenv("QT_WEBKIT_SUPPRESS_WEB_PROCESS_OUTPUT", "1");
    }

    QGuiApplication app(argc, argv);
    addQtWebProcessToPath();

    return TestWebKitAPI::TestsController::shared().run(argc, argv) ? EXIT_SUCCESS : EXIT_FAILURE;
}