void InjectedBundle::platformInitialize(WKTypeRef) { QWindowsStyle* styleForTests = new QWindowsStyle; QApplication::setStyle(styleForTests); // Force Qt to use the style's standard palette, instead of platform default palette. This is needed // because we are setting the style after QApplication is instantiated. QApplication::setPalette(styleForTests->standardPalette()); if (qgetenv("QT_WEBKIT2_DEBUG") == "1") return; WTFInstallReportBacktraceOnCrashHook(); }
int main(int argc, char** argv) { WTFInstallReportBacktraceOnCrashHook(); #ifdef HAVE_ECORE_X XSetExtensionErrorHandler(dummyExtensionErrorHandler); #endif if (!ewk_init()) return 1; { // Test controller has own ptr containing WebView and WebView must be deleted // before its evas object is deleted. Call of ewk_shutdown() leads to evas objects deletion. WTR::TestController controller(argc, const_cast<const char**>(argv)); } ewk_shutdown(); return 0; }
void InjectedBundle::platformInitialize(WKTypeRef) { WTFInstallReportBacktraceOnCrashHook(); }
int main(int argc, char* argv[]) { #ifdef Q_OS_WIN _setmode(1, _O_BINARY); _setmode(2, _O_BINARY); #endif // Suppress debug output from Qt if not started with -v bool suppressQtDebugOutput = true; for (int i = 1; i < argc; ++i) { if (!qstrcmp(argv[i], "-v")) { suppressQtDebugOutput = false; break; } } // Has to be done before QApplication is constructed in case // QApplication itself produces debug output. if (suppressQtDebugOutput) qInstallMsgHandler(messageHandler); WebKit::initializeTestFonts(); QApplication::setGraphicsSystem("raster"); QApplication::setStyle(new QWindowsStyle); QApplication app(argc, argv); app.setQuitOnLastWindowClosed(false); #if HAVE(QT5) QCoreApplication::setAttribute(Qt::AA_Use96Dpi, true); #else #ifdef Q_WS_X11 QX11Info::setAppDpiY(0, 96); QX11Info::setAppDpiX(0, 96); #endif /* * QApplication will initialize the default application font based * on the application DPI at construction time, which might be * different from the DPI we explicitly set using QX11Info above. * See: https://bugreports.qt.nokia.com/browse/QTBUG-21603 * * To ensure that the application font DPI matches the application * DPI, we override the application font using the font we get from * a QWidget, which has already been resolved against the existing * default font, but with the correct paint-device DPI. */ QApplication::setFont(QWidget().font()); #endif WTFInstallReportBacktraceOnCrashHook(); QStringList args = app.arguments(); if (args.count() < (!suppressQtDebugOutput ? 3 : 2)) { printUsage(); exit(1); } // Remove the first arguments, it is application name itself args.removeAt(0); WebCore::DumpRenderTree dumper; int index = args.indexOf(QLatin1String("--stdout")); if (index != -1) { QString fileName = takeOptionValue(args, index); dumper.setRedirectOutputFileName(fileName); if (fileName.isEmpty() || !freopen(qPrintable(fileName), "w", stdout)) { fprintf(stderr, "STDOUT redirection failed."); exit(1); } } index = args.indexOf(QLatin1String("--stderr")); if (index != -1) { QString fileName = takeOptionValue(args, index); dumper.setRedirectErrorFileName(fileName); if (!freopen(qPrintable(fileName), "w", stderr)) { fprintf(stderr, "STDERR redirection failed."); exit(1); } } QWebDatabase::removeAllDatabases(); index = args.indexOf(QLatin1String("--timeout")); if (index != -1) { int timeout = takeOptionValue(args, index).toInt(); dumper.setTimeout(timeout); } index = args.indexOf(QLatin1String("--no-timeout")); if (index != -1) { dumper.setShouldTimeout(false); args.removeAt(index); } index = args.indexOf(QLatin1String("-")); if (index != -1) { args.removeAt(index); // Continue waiting in STDIN for more test case after process one test case QObject::connect(&dumper, SIGNAL(ready()), &dumper, SLOT(readLine()), Qt::QueuedConnection); // Read and only read the first test case, ignore the others if (args.size() > 0) { // Process the argument first dumper.processLine(args[0]); } else QTimer::singleShot(0, &dumper, SLOT(readLine())); } else { // Go into standalone mode // Standalone mode need at least one test case if (args.count() < 1) { printUsage(); exit(1); } dumper.processArgsLine(args); } return app.exec(); }
int main(int argc, char* argv[]) { #ifdef Q_OS_WIN _setmode(1, _O_BINARY); _setmode(2, _O_BINARY); #endif // Suppress debug output from Qt if not started with -v bool suppressQtDebugOutput = true; for (int i = 1; i < argc; ++i) { if (!qstrcmp(argv[i], "-v")) { suppressQtDebugOutput = false; break; } } // Has to be done before QApplication is constructed in case // QApplication itself produces debug output. if (suppressQtDebugOutput) qInstallMessageHandler(messageHandler); WebKit::QtTestSupport::initializeTestFonts(); QApplication::setStyle(QStyleFactory::create(QLatin1String("windows"))); QApplication::setDesktopSettingsAware(false); QApplication app(argc, argv); app.setQuitOnLastWindowClosed(false); QCoreApplication::setAttribute(Qt::AA_Use96Dpi, true); WTFInstallReportBacktraceOnCrashHook(); QStringList args = app.arguments(); if (args.count() < (!suppressQtDebugOutput ? 3 : 2)) { printUsage(); exit(1); } // Remove the first arguments, it is application name itself args.removeAt(0); DumpRenderTree dumper; int index = args.indexOf(QLatin1String("--stdout")); if (index != -1) { QString fileName = takeOptionValue(args, index); dumper.setRedirectOutputFileName(fileName); if (fileName.isEmpty() || !freopen(qPrintable(fileName), "w", stdout)) { fprintf(stderr, "STDOUT redirection failed."); exit(1); } } index = args.indexOf(QLatin1String("--stderr")); if (index != -1) { QString fileName = takeOptionValue(args, index); dumper.setRedirectErrorFileName(fileName); if (!freopen(qPrintable(fileName), "w", stderr)) { fprintf(stderr, "STDERR redirection failed."); exit(1); } } index = args.indexOf("--pixel-tests"); if (index == -1) index = args.indexOf("-p"); if (index != -1) { dumper.setShouldDumpPixelsForAllTests(); args.removeAt(index); } QWebDatabase::removeAllDatabases(); index = args.indexOf(QLatin1String("--timeout")); if (index != -1) { int timeout = takeOptionValue(args, index).toInt(); dumper.setTimeout(timeout); } index = args.indexOf(QLatin1String("--no-timeout")); if (index != -1) { dumper.setShouldTimeout(false); args.removeAt(index); } index = args.indexOf(QLatin1String("-")); if (index != -1) { args.removeAt(index); // Continue waiting in STDIN for more test case after process one test case QObject::connect(&dumper, SIGNAL(ready()), &dumper, SLOT(readLine()), Qt::QueuedConnection); // Read and only read the first test case, ignore the others if (args.size() > 0) { // Process the argument first dumper.processLine(args[0]); } else QTimer::singleShot(0, &dumper, SLOT(readLine())); } else { // Go into standalone mode // Standalone mode need at least one test case if (args.count() < 1) { printUsage(); exit(1); } dumper.processArgsLine(args); } return app.exec(); }