summaryrefslogtreecommitdiff
path: root/Tools/QtTestBrowser
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@nokia.com>2012-02-03 09:55:33 +0100
committerSimon Hausmann <simon.hausmann@nokia.com>2012-02-03 09:55:33 +0100
commitcd44dc59cdfc39534aef4d417e9f3c412e3be139 (patch)
tree8d89889ba95ed6ec9322e733846cc9cce9d7dff1 /Tools/QtTestBrowser
parentd11f84f5b5cdc0d92a08af01b13472fdd5f9acb9 (diff)
downloadqtwebkit-cd44dc59cdfc39534aef4d417e9f3c412e3be139.tar.gz
Imported WebKit commit fce473cb4d55aa9fe9d0b0322a2fffecb731b961 (http://svn.webkit.org/repository/webkit/trunk@106560)
Diffstat (limited to 'Tools/QtTestBrowser')
-rw-r--r--Tools/QtTestBrowser/QtTestBrowser.pro6
-rw-r--r--Tools/QtTestBrowser/cookiejar.h1
-rw-r--r--Tools/QtTestBrowser/launcherwindow.h6
-rw-r--r--Tools/QtTestBrowser/main.cpp60
4 files changed, 8 insertions, 65 deletions
diff --git a/Tools/QtTestBrowser/QtTestBrowser.pro b/Tools/QtTestBrowser/QtTestBrowser.pro
index 3147ddae0..7fbb1e924 100644
--- a/Tools/QtTestBrowser/QtTestBrowser.pro
+++ b/Tools/QtTestBrowser/QtTestBrowser.pro
@@ -6,11 +6,14 @@
TEMPLATE = app
-INCLUDEPATH += $${ROOT_WEBKIT_DIR}/Source/WebKit/qt/WebCoreSupport
+INCLUDEPATH += \
+ $${ROOT_WEBKIT_DIR}/Source/WebKit/qt/WebCoreSupport \
+ $${ROOT_WEBKIT_DIR}/Tools/DumpRenderTree/qt/ \
load(features)
SOURCES += \
+ $${ROOT_WEBKIT_DIR}/Tools/DumpRenderTree/qt/QtInitializeTestFonts.cpp \
locationedit.cpp \
launcherwindow.cpp \
main.cpp \
@@ -23,6 +26,7 @@ SOURCES += \
cookiejar.cpp
HEADERS += \
+ $${ROOT_WEBKIT_DIR}/Tools/DumpRenderTree/qt/QtInitializeTestFonts.h \
locationedit.h \
launcherwindow.h \
mainwindow.h \
diff --git a/Tools/QtTestBrowser/cookiejar.h b/Tools/QtTestBrowser/cookiejar.h
index ad6bd3cb9..6e5e73b93 100644
--- a/Tools/QtTestBrowser/cookiejar.h
+++ b/Tools/QtTestBrowser/cookiejar.h
@@ -29,6 +29,7 @@
#define cookiejar_h
#include <QFile>
+#include <QNetworkCookie>
#include <QNetworkCookieJar>
#include <QTimer>
diff --git a/Tools/QtTestBrowser/launcherwindow.h b/Tools/QtTestBrowser/launcherwindow.h
index 3495bada8..9aed6c01a 100644
--- a/Tools/QtTestBrowser/launcherwindow.h
+++ b/Tools/QtTestBrowser/launcherwindow.h
@@ -83,9 +83,6 @@ public:
#ifndef QT_NO_OPENGL
, useQGLWidgetViewport(false)
#endif
-#if defined(Q_WS_X11)
- , useTestFonts(false)
-#endif
, printLoadedUrls(false)
, startMaximized(false)
{
@@ -109,9 +106,6 @@ public:
#ifndef QT_NO_OPENGL
bool useQGLWidgetViewport;
#endif
-#if defined(Q_WS_X11)
- bool useTestFonts;
-#endif
bool printLoadedUrls;
QUrl inspectorUrl;
quint16 remoteInspectorPort;
diff --git a/Tools/QtTestBrowser/main.cpp b/Tools/QtTestBrowser/main.cpp
index 603ad6160..34852910b 100644
--- a/Tools/QtTestBrowser/main.cpp
+++ b/Tools/QtTestBrowser/main.cpp
@@ -31,6 +31,7 @@
*/
#include "DumpRenderTreeSupportQt.h"
+#include "QtInitializeTestFonts.h"
#include "launcherwindow.h"
#include "urlloader.h"
@@ -42,61 +43,8 @@ WindowOptions windowOptions;
#include <QFileInfo>
#include <QFontDatabase>
-#if defined(Q_WS_X11)
-#include <fontconfig/fontconfig.h>
-#endif
-
-
-#if defined(Q_WS_X11)
-// Very similar to WebCore::DumpRenderTree::initializeFonts();
-// Duplicated here so that QtTestBrowser would display contents
-// with the same fonts as run-webkit-tests/DumpRenderTree.
-static void initTestFonts()
-{
- static int numFonts = -1;
-
- // Some test cases may add or remove application fonts (via @font-face).
- // Make sure to re-initialize the font set if necessary.
- FcFontSet* appFontSet = FcConfigGetFonts(0, FcSetApplication);
- if (appFontSet && numFonts >= 0 && appFontSet->nfont == numFonts)
- return;
-
- QByteArray fontDir = getenv("WEBKIT_TESTFONTS");
- if (fontDir.isEmpty() || !QDir(fontDir).exists()) {
- fprintf(stderr,
- "\n\n"
- "----------------------------------------------------------------------\n"
- "WEBKIT_TESTFONTS environment variable is not set correctly.\n"
- "This variable has to point to the directory containing the fonts\n"
- "you can clone from git://gitorious.org/qtwebkit/testfonts.git\n"
- "----------------------------------------------------------------------\n"
- );
- exit(1);
- }
- // Looks for qt/fonts.conf relative to the directory of the QtTestBrowser
- // executable.
- QString configFileString = QCoreApplication::applicationDirPath();
- configFileString += "/../../../Tools/DumpRenderTree/qt/fonts.conf";
- QByteArray configFileArray = configFileString.toUtf8();
- FcConfig* config = FcConfigCreate();
- if (!FcConfigParseAndLoad (config, (FcChar8*) configFileArray.data(), true))
- qFatal("Couldn't load font configuration file");
- if (!FcConfigAppFontAddDir (config, (FcChar8*) fontDir.data()))
- qFatal("Couldn't add font dir!");
- FcConfigSetCurrent(config);
-
- appFontSet = FcConfigGetFonts(config, FcSetApplication);
- numFonts = appFontSet->nfont;
-}
-#endif
-
int launcherMain(const QApplication& app)
{
-#ifdef Q_WS_X11
- if (windowOptions.useTestFonts)
- initTestFonts();
-#endif
-
#ifndef NDEBUG
int retVal = app.exec();
DumpRenderTreeSupportQt::garbageCollectorCollect();
@@ -199,9 +147,7 @@ void LauncherApplication::handleUserOptions()
<< "[-offline-storage-database-enabled]"
<< "[-offline-web-application-cache-enabled]"
<< "[-set-offline-storage-default-quota maxSize]"
-#if defined(Q_WS_X11)
<< "[-use-test-fonts]"
-#endif
<< "[-print-loaded-urls]"
<< "URLs";
appQuit(0);
@@ -294,10 +240,8 @@ void LauncherApplication::handleUserOptions()
}
#endif
-#if defined(Q_WS_X11)
if (args.contains("-use-test-fonts"))
- windowOptions.useTestFonts = true;
-#endif
+ WebKit::initializeTestFonts();
if (args.contains("-print-loaded-urls"))
windowOptions.printLoadedUrls = true;