summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorQt Continuous Integration System <qt-info@nokia.com>2011-05-05 13:01:42 (GMT)
committerQt Continuous Integration System <qt-info@nokia.com>2011-05-05 13:01:42 (GMT)
commit0ca404def7262ad7293592bbb7888a6df5ea27b7 (patch)
treebdb81cd468bfcc1bb957c2ab9768b89c51c01525
parentd1ac6af4f30e822e161fd8772104aa2e30e55a2f (diff)
parent2d8852d51b15ed48e8e665882b5d70c298201299 (diff)
downloadQt-0ca404def7262ad7293592bbb7888a6df5ea27b7.zip
Qt-0ca404def7262ad7293592bbb7888a6df5ea27b7.tar.gz
Qt-0ca404def7262ad7293592bbb7888a6df5ea27b7.tar.bz2
Merge branch 'master' of scm.dev.nokia.troll.no:qt/qt-fire-staging into master-integration
* 'master' of scm.dev.nokia.troll.no:qt/qt-fire-staging: Compile on Windows Support gamma correction of text on GL Remove QFontEngineFT::loadGlyphMetrics Make autotest more resilient against network timeout Do not filter adhoc clients Lancelot: Add configurable client filtering to baseline server Improve error reporting on failure to connect to baseline server Fixed bug in X11 backend when creating translucent windows. Only cleanup share widget if it has been created. Add required font metrics functions to QRawFont Fixed bug in QPdfEngine::addImage causing mono images to be made 32 bit Make pixel size a qreal in QRawFont Make sure removed QTextBlock is invalid Make sure QFont's resolve mask is copied on compilers with C++0x support Fix glyph position issue with fallback fonts
-rw-r--r--src/gui/kernel/qapplication_win.cpp13
-rw-r--r--src/gui/kernel/qwidget_x11.cpp9
-rw-r--r--src/gui/painting/qdrawhelper.cpp10
-rw-r--r--src/gui/painting/qprintengine_pdf.cpp5
-rw-r--r--src/gui/text/qfont.h2
-rw-r--r--src/gui/text/qfontengine_ft.cpp100
-rw-r--r--src/gui/text/qfontengine_ft_p.h1
-rw-r--r--src/gui/text/qrawfont.cpp58
-rw-r--r--src/gui/text/qrawfont.h8
-rw-r--r--src/gui/text/qtextlayout.cpp3
-rw-r--r--src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp31
-rw-r--r--src/opengl/qgl.cpp7
-rw-r--r--src/opengl/qgl_p.h3
-rw-r--r--src/opengl/qglextensions_p.h8
-rw-r--r--src/opengl/qwindowsurface_gl.cpp12
-rw-r--r--tests/arthur/baselineserver/src/baselineserver.cpp39
-rw-r--r--tests/arthur/baselineserver/src/baselineserver.h4
-rw-r--r--tests/arthur/common/baselineprotocol.cpp12
-rw-r--r--tests/arthur/common/baselineprotocol.h2
-rw-r--r--tests/auto/lancelot/tst_lancelot.cpp3
-rw-r--r--tests/auto/qrawfont/tst_qrawfont.cpp32
21 files changed, 204 insertions, 158 deletions
diff --git a/src/gui/kernel/qapplication_win.cpp b/src/gui/kernel/qapplication_win.cpp
index 6658300..63e2319 100644
--- a/src/gui/kernel/qapplication_win.cpp
+++ b/src/gui/kernel/qapplication_win.cpp
@@ -237,6 +237,7 @@ static void resolveAygLibs()
# define FE_FONTSMOOTHINGCLEARTYPE 0x0002
#endif
+Q_GUI_EXPORT qreal qt_fontsmoothing_gamma;
Q_GUI_EXPORT bool qt_cleartype_enabled;
Q_GUI_EXPORT bool qt_win_owndc_required; // CS_OWNDC is required if we use the GL graphicssystem as default
@@ -653,8 +654,18 @@ static void qt_win_read_cleartype_settings()
if (SystemParametersInfo(SPI_GETFONTSMOOTHINGTYPE, 0, &result, 0))
qt_cleartype_enabled = (result == FE_FONTSMOOTHINGCLEARTYPE);
#endif
-}
+ int winSmooth;
+ if (SystemParametersInfo(0x200C /* SPI_GETFONTSMOOTHINGCONTRAST */, 0, &winSmooth, 0)) {
+ qt_fontsmoothing_gamma = winSmooth / qreal(1000.0);
+ } else {
+ qt_fontsmoothing_gamma = 1.0;
+ }
+
+ // Safeguard ourselves against corrupt registry values...
+ if (qt_fontsmoothing_gamma > 5 || qt_fontsmoothing_gamma < 1)
+ qt_fontsmoothing_gamma = qreal(1.4);
+}
static void qt_set_windows_resources()
{
diff --git a/src/gui/kernel/qwidget_x11.cpp b/src/gui/kernel/qwidget_x11.cpp
index 241a13f..3eec5c7 100644
--- a/src/gui/kernel/qwidget_x11.cpp
+++ b/src/gui/kernel/qwidget_x11.cpp
@@ -952,8 +952,13 @@ static void qt_x11_recreateWidget(QWidget *widget)
// recreate their GL context, which in turn causes them to choose
// their visual again. Now that WA_TranslucentBackground is set,
// QGLContext::chooseVisual will select an ARGB visual.
- QEvent e(QEvent::ParentChange);
- QApplication::sendEvent(widget, &e);
+
+ // QGLWidget expects a ParentAboutToChange to be sent first
+ QEvent aboutToChangeEvent(QEvent::ParentAboutToChange);
+ QApplication::sendEvent(widget, &aboutToChangeEvent);
+
+ QEvent parentChangeEvent(QEvent::ParentChange);
+ QApplication::sendEvent(widget, &parentChangeEvent);
} else {
// For regular widgets, reparent them with their parent which
// also triggers a recreation of the native window
diff --git a/src/gui/painting/qdrawhelper.cpp b/src/gui/painting/qdrawhelper.cpp
index ae9993e..360292c 100644
--- a/src/gui/painting/qdrawhelper.cpp
+++ b/src/gui/painting/qdrawhelper.cpp
@@ -7068,14 +7068,8 @@ void qt_build_pow_tables() {
#endif
#ifdef Q_WS_WIN
- int winSmooth;
- if (SystemParametersInfo(0x200C /* SPI_GETFONTSMOOTHINGCONTRAST */, 0, &winSmooth, 0))
- smoothing = winSmooth / qreal(1000.0);
-
- // Safeguard ourselves against corrupt registry values...
- if (smoothing > 5 || smoothing < 1)
- smoothing = qreal(1.4);
-
+ extern qreal qt_fontsmoothing_gamma; // qapplication_win.cpp
+ smoothing = qt_fontsmoothing_gamma;
#endif
#ifdef Q_WS_X11
diff --git a/src/gui/painting/qprintengine_pdf.cpp b/src/gui/painting/qprintengine_pdf.cpp
index b7f5160..353869f 100644
--- a/src/gui/painting/qprintengine_pdf.cpp
+++ b/src/gui/painting/qprintengine_pdf.cpp
@@ -534,7 +534,10 @@ int QPdfEnginePrivate::addImage(const QImage &img, bool *bitmap, qint64 serial_n
QImage image = img;
QImage::Format format = image.format();
- if (image.depth() == 1 && *bitmap && img.colorTable().size() == 0) {
+ if (image.depth() == 1 && *bitmap && img.colorTable().size() == 2
+ && img.colorTable().at(0) == QColor(Qt::black).rgba()
+ && img.colorTable().at(1) == QColor(Qt::white).rgba())
+ {
if (format == QImage::Format_MonoLSB)
image = image.convertToFormat(QImage::Format_Mono);
format = QImage::Format_Mono;
diff --git a/src/gui/text/qfont.h b/src/gui/text/qfont.h
index 8dbc746..0c7b6f8 100644
--- a/src/gui/text/qfont.h
+++ b/src/gui/text/qfont.h
@@ -239,7 +239,7 @@ public:
bool isCopyOf(const QFont &) const;
#ifdef Q_COMPILER_RVALUE_REFS
inline QFont &operator=(QFont &&other)
- { qSwap(d, other.d); return *this; }
+ { qSwap(d, other.d); qSwap(resolve_mask, other.resolve_mask); return *this; }
#endif
#ifdef Q_WS_WIN
diff --git a/src/gui/text/qfontengine_ft.cpp b/src/gui/text/qfontengine_ft.cpp
index 58bcca8..237cde4 100644
--- a/src/gui/text/qfontengine_ft.cpp
+++ b/src/gui/text/qfontengine_ft.cpp
@@ -803,106 +803,6 @@ int QFontEngineFT::loadFlags(QGlyphSet *set, GlyphFormat format, int flags,
return load_flags;
}
-QFontEngineFT::Glyph *QFontEngineFT::loadGlyphMetrics(QGlyphSet *set, uint glyph, GlyphFormat format) const
-{
- Glyph *g = set->getGlyph(glyph);
- if (g && g->format == format)
- return g;
-
- bool hsubpixel = false;
- int vfactor = 1;
- int load_flags = loadFlags(set, format, 0, hsubpixel, vfactor);
-
- // apply our matrix to this, but note that the metrics will not be affected by this.
- FT_Face face = lockFace();
- FT_Matrix matrix = this->matrix;
- FT_Matrix_Multiply(&set->transformationMatrix, &matrix);
- FT_Set_Transform(face, &matrix, 0);
- freetype->matrix = matrix;
-
- bool transform = matrix.xx != 0x10000 || matrix.yy != 0x10000 || matrix.xy != 0 || matrix.yx != 0;
- if (transform)
- load_flags |= FT_LOAD_NO_BITMAP;
-
- FT_Error err = FT_Load_Glyph(face, glyph, load_flags);
- if (err && (load_flags & FT_LOAD_NO_BITMAP)) {
- load_flags &= ~FT_LOAD_NO_BITMAP;
- err = FT_Load_Glyph(face, glyph, load_flags);
- }
- if (err == FT_Err_Too_Few_Arguments) {
- // this is an error in the bytecode interpreter, just try to run without it
- load_flags |= FT_LOAD_FORCE_AUTOHINT;
- err = FT_Load_Glyph(face, glyph, load_flags);
- }
- if (err != FT_Err_Ok)
- qWarning("load glyph failed err=%x face=%p, glyph=%d", err, face, glyph);
-
- unlockFace();
- if (set->outline_drawing)
- return 0;
-
- if (!g) {
- g = new Glyph;
- g->uploadedToServer = false;
- g->data = 0;
- }
-
- FT_GlyphSlot slot = face->glyph;
- if (embolden) Q_FT_GLYPHSLOT_EMBOLDEN(slot);
- int left = slot->metrics.horiBearingX;
- int right = slot->metrics.horiBearingX + slot->metrics.width;
- int top = slot->metrics.horiBearingY;
- int bottom = slot->metrics.horiBearingY - slot->metrics.height;
- if (transform && slot->format != FT_GLYPH_FORMAT_BITMAP) { // freetype doesn't apply the transformation on the metrics
- int l, r, t, b;
- FT_Vector vector;
- vector.x = left;
- vector.y = top;
- FT_Vector_Transform(&vector, &matrix);
- l = r = vector.x;
- t = b = vector.y;
- vector.x = right;
- vector.y = top;
- FT_Vector_Transform(&vector, &matrix);
- if (l > vector.x) l = vector.x;
- if (r < vector.x) r = vector.x;
- if (t < vector.y) t = vector.y;
- if (b > vector.y) b = vector.y;
- vector.x = right;
- vector.y = bottom;
- FT_Vector_Transform(&vector, &matrix);
- if (l > vector.x) l = vector.x;
- if (r < vector.x) r = vector.x;
- if (t < vector.y) t = vector.y;
- if (b > vector.y) b = vector.y;
- vector.x = left;
- vector.y = bottom;
- FT_Vector_Transform(&vector, &matrix);
- if (l > vector.x) l = vector.x;
- if (r < vector.x) r = vector.x;
- if (t < vector.y) t = vector.y;
- if (b > vector.y) b = vector.y;
- left = l;
- right = r;
- top = t;
- bottom = b;
- }
- left = FLOOR(left);
- right = CEIL(right);
- bottom = FLOOR(bottom);
- top = CEIL(top);
-
- g->linearAdvance = face->glyph->linearHoriAdvance >> 10;
- g->width = TRUNC(right-left);
- g->height = TRUNC(top-bottom);
- g->x = TRUNC(left);
- g->y = TRUNC(top);
- g->advance = TRUNC(ROUND(face->glyph->advance.x));
- g->format = Format_None;
-
- return g;
-}
-
QFontEngineFT::Glyph *QFontEngineFT::loadGlyph(QGlyphSet *set, uint glyph,
QFixed subPixelPosition,
GlyphFormat format,
diff --git a/src/gui/text/qfontengine_ft_p.h b/src/gui/text/qfontengine_ft_p.h
index 6dbca7a..a620006 100644
--- a/src/gui/text/qfontengine_ft_p.h
+++ b/src/gui/text/qfontengine_ft_p.h
@@ -349,7 +349,6 @@ protected:
private:
friend class QFontEngineFTRawFont;
- QFontEngineFT::Glyph *loadGlyphMetrics(QGlyphSet *set, uint glyph, GlyphFormat format) const;
int loadFlags(QGlyphSet *set, GlyphFormat format, int flags, bool &hsubpixel, int &vfactor) const;
GlyphFormat defaultFormat;
diff --git a/src/gui/text/qrawfont.cpp b/src/gui/text/qrawfont.cpp
index 6ac2677..46c892c 100644
--- a/src/gui/text/qrawfont.cpp
+++ b/src/gui/text/qrawfont.cpp
@@ -302,16 +302,68 @@ qreal QRawFont::descent() const
}
/*!
+ Returns the xHeight of this QRawFont in pixel units.
+
+ \sa QFontMetricsF::xHeight()
+*/
+qreal QRawFont::xHeight() const
+{
+ if (!isValid())
+ return 0.0;
+
+ return d->fontEngine->xHeight().toReal();
+}
+
+/*!
+ Returns the leading of this QRawFont in pixel units.
+
+ \sa QFontMetricsF::leading()
+*/
+qreal QRawFont::leading() const
+{
+ if (!isValid())
+ return 0.0;
+
+ return d->fontEngine->leading().toReal();
+}
+
+/*!
+ Returns the average character width of this QRawFont in pixel units.
+
+ \sa QFontMetricsF::averageCharWidth()
+*/
+qreal QRawFont::averageCharWidth() const
+{
+ if (!isValid())
+ return 0.0;
+
+ return d->fontEngine->averageCharWidth().toReal();
+}
+
+/*!
+ Returns the width of the widest character in the font.
+
+ \sa QFontMetricsF::maxWidth()
+*/
+qreal QRawFont::maxCharWidth() const
+{
+ if (!isValid())
+ return 0.0;
+
+ return d->fontEngine->maxCharWidth();
+}
+
+/*!
Returns the pixel size set for this QRawFont. The pixel size affects how glyphs are
rasterized, the size of glyphs returned by pathForGlyph(), and is used to convert
internal metrics from design units to logical pixel units.
\sa setPixelSize()
*/
-int QRawFont::pixelSize() const
+qreal QRawFont::pixelSize() const
{
if (!isValid())
- return -1;
+ return 0.0;
return d->fontEngine->fontDef.pixelSize;
}
@@ -577,7 +629,7 @@ QRawFont QRawFont::fromFont(const QFont &font, QFontDatabase::WritingSystem writ
/*!
Sets the pixel size with which this font should be rendered to \a pixelSize.
*/
-void QRawFont::setPixelSize(int pixelSize)
+void QRawFont::setPixelSize(qreal pixelSize)
{
if (d->fontEngine == 0)
return;
diff --git a/src/gui/text/qrawfont.h b/src/gui/text/qrawfont.h
index 96dc838..900c07a 100644
--- a/src/gui/text/qrawfont.h
+++ b/src/gui/text/qrawfont.h
@@ -96,13 +96,17 @@ public:
const QTransform &transform = QTransform()) const;
QPainterPath pathForGlyph(quint32 glyphIndex) const;
- void setPixelSize(int pixelSize);
- int pixelSize() const;
+ void setPixelSize(qreal pixelSize);
+ qreal pixelSize() const;
QFont::HintingPreference hintingPreference() const;
qreal ascent() const;
qreal descent() const;
+ qreal leading() const;
+ qreal xHeight() const;
+ qreal averageCharWidth() const;
+ qreal maxCharWidth() const;
qreal unitsPerEm() const;
diff --git a/src/gui/text/qtextlayout.cpp b/src/gui/text/qtextlayout.cpp
index 8fdf4b2..01748b9 100644
--- a/src/gui/text/qtextlayout.cpp
+++ b/src/gui/text/qtextlayout.cpp
@@ -2147,6 +2147,9 @@ QList<QGlyphs> QTextLine::glyphs(int from, int length) const
QGlyphLayout subLayout = glyphLayout.mid(start, end - start);
glyphLayoutHash.insertMulti(multiFontEngine->engine(which),
GlyphInfo(subLayout, pos, flags));
+ for (int i = 0; i < subLayout.numGlyphs; i++)
+ pos += QPointF(subLayout.advances_x[i].toReal(),
+ subLayout.advances_y[i].toReal());
start = end;
which = e;
diff --git a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp
index a2707e0..38bd58d 100644
--- a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp
+++ b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp
@@ -1554,6 +1554,14 @@ namespace {
}
+#if defined(Q_WS_WIN)
+static bool fontSmoothingApproximately(qreal target)
+{
+ extern Q_GUI_EXPORT qreal qt_fontsmoothing_gamma; // qapplication_win.cpp
+ return (qAbs(qt_fontsmoothing_gamma - target) < 0.2);
+}
+#endif
+
// #define QT_OPENGL_DRAWCACHEDGLYPHS_INDEX_ARRAY_VBO
void QGL2PaintEngineExPrivate::drawCachedGlyphs(QFontEngineGlyphCache::Type glyphType,
@@ -1792,7 +1800,6 @@ void QGL2PaintEngineExPrivate::drawCachedGlyphs(QFontEngineGlyphCache::Type glyp
shaderManager->setMaskType(QGLEngineShaderManager::PixelMask);
prepareForDraw(false); // Text always causes src pixels to be transparent
}
- //### TODO: Gamma correction
QGLTextureGlyphCache::FilterMode filterMode = (s->matrix.type() > QTransform::TxTranslate)?QGLTextureGlyphCache::Linear:QGLTextureGlyphCache::Nearest;
if (lastMaskTextureUsed != cache->texture() || cache->filterMode() != filterMode) {
@@ -1815,12 +1822,31 @@ void QGL2PaintEngineExPrivate::drawCachedGlyphs(QFontEngineGlyphCache::Type glyp
}
}
+ bool srgbFrameBufferEnabled = false;
+ if (ctx->d_ptr->extension_flags & QGLExtensions::SRGBFrameBuffer) {
+#if defined(Q_WS_MAC)
+ if (glyphType == QFontEngineGlyphCache::Raster_RGBMask)
+#elif defined(Q_WS_WIN)
+ if (glyphType != QFontEngineGlyphCache::Raster_RGBMask || fontSmoothingApproximately(2.1))
+#else
+ if (false)
+#endif
+ {
+ glEnable(FRAMEBUFFER_SRGB_EXT);
+ srgbFrameBufferEnabled = true;
+ }
+ }
+
#if defined(QT_OPENGL_DRAWCACHEDGLYPHS_INDEX_ARRAY_VBO)
glDrawElements(GL_TRIANGLE_STRIP, 6 * numGlyphs, GL_UNSIGNED_SHORT, 0);
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
#else
glDrawElements(GL_TRIANGLE_STRIP, 6 * numGlyphs, GL_UNSIGNED_SHORT, elementIndices.data());
#endif
+
+ if (srgbFrameBufferEnabled)
+ glDisable(FRAMEBUFFER_SRGB_EXT);
+
}
void QGL2PaintEngineEx::drawPixmapFragments(const QPainter::PixmapFragment *fragments, int fragmentCount, const QPixmap &pixmap,
@@ -1992,7 +2018,8 @@ bool QGL2PaintEngineEx::begin(QPaintDevice *pdev)
#if !defined(QT_OPENGL_ES_2)
#if defined(Q_WS_WIN)
- if (qt_cleartype_enabled)
+ if (qt_cleartype_enabled
+ && (fontSmoothingApproximately(1.0) || fontSmoothingApproximately(2.1)))
#endif
#if defined(Q_WS_MAC)
if (qt_applefontsmoothing_enabled)
diff --git a/src/opengl/qgl.cpp b/src/opengl/qgl.cpp
index 057fb55..099cc00 100644
--- a/src/opengl/qgl.cpp
+++ b/src/opengl/qgl.cpp
@@ -5490,6 +5490,13 @@ QGLExtensions::Extensions QGLExtensions::currentContextExtensions()
if (extensions.match("GL_EXT_bgra"))
glExtensions |= BGRATextureFormat;
+ {
+ GLboolean srgbCapableFramebuffers;
+ glGetBooleanv(FRAMEBUFFER_SRGB_CAPABLE_EXT, &srgbCapableFramebuffers);
+ if (srgbCapableFramebuffers)
+ glExtensions |= SRGBFrameBuffer;
+ }
+
return glExtensions;
}
diff --git a/src/opengl/qgl_p.h b/src/opengl/qgl_p.h
index 50d13c9..ac54e2f 100644
--- a/src/opengl/qgl_p.h
+++ b/src/opengl/qgl_p.h
@@ -288,7 +288,8 @@ public:
PVRTCTextureCompression = 0x00020000,
FragmentShader = 0x00040000,
ElementIndexUint = 0x00080000,
- Depth24 = 0x00100000
+ Depth24 = 0x00100000,
+ SRGBFrameBuffer = 0x00200000
};
Q_DECLARE_FLAGS(Extensions, Extension)
diff --git a/src/opengl/qglextensions_p.h b/src/opengl/qglextensions_p.h
index 529c7a1..ac80ce8 100644
--- a/src/opengl/qglextensions_p.h
+++ b/src/opengl/qglextensions_p.h
@@ -477,6 +477,14 @@ struct QGLExtensionFuncs
// OpenGL constants
+#ifndef FRAMEBUFFER_SRGB_CAPABLE_EXT
+#define FRAMEBUFFER_SRGB_CAPABLE_EXT 0x8DBA
+#endif
+
+#ifndef FRAMEBUFFER_SRGB_EXT
+#define FRAMEBUFFER_SRGB_EXT 0x8DB9
+#endif
+
#ifndef GL_ARRAY_BUFFER
#define GL_ARRAY_BUFFER 0x8892
#endif
diff --git a/src/opengl/qwindowsurface_gl.cpp b/src/opengl/qwindowsurface_gl.cpp
index 8494283..49b3dc2 100644
--- a/src/opengl/qwindowsurface_gl.cpp
+++ b/src/opengl/qwindowsurface_gl.cpp
@@ -184,7 +184,9 @@ QGLGraphicsSystem::QGLGraphicsSystem(bool useX11GL)
class QGLGlobalShareWidget
{
public:
- QGLGlobalShareWidget() : firstPixmap(0), widgetRefCount(0), widget(0), initializing(false) {}
+ QGLGlobalShareWidget() : firstPixmap(0), widgetRefCount(0), widget(0), initializing(false) {
+ created = true;
+ }
QGLWidget *shareWidget() {
if (!initializing && !widget && !cleanedUp) {
@@ -223,6 +225,7 @@ public:
}
static bool cleanedUp;
+ static bool created;
QGLPixmapData *firstPixmap;
int widgetRefCount;
@@ -233,6 +236,7 @@ private:
};
bool QGLGlobalShareWidget::cleanedUp = false;
+bool QGLGlobalShareWidget::created = false;
static void qt_cleanup_gl_share_widget();
Q_GLOBAL_STATIC_WITH_INITIALIZER(QGLGlobalShareWidget, _qt_gl_share_widget,
@@ -242,7 +246,8 @@ Q_GLOBAL_STATIC_WITH_INITIALIZER(QGLGlobalShareWidget, _qt_gl_share_widget,
static void qt_cleanup_gl_share_widget()
{
- _qt_gl_share_widget()->cleanup();
+ if (QGLGlobalShareWidget::created)
+ _qt_gl_share_widget()->cleanup();
}
QGLWidget* qt_gl_share_widget()
@@ -254,7 +259,8 @@ QGLWidget* qt_gl_share_widget()
void qt_destroy_gl_share_widget()
{
- _qt_gl_share_widget()->destroy();
+ if (QGLGlobalShareWidget::created)
+ _qt_gl_share_widget()->destroy();
}
const QGLContext *qt_gl_share_context()
diff --git a/tests/arthur/baselineserver/src/baselineserver.cpp b/tests/arthur/baselineserver/src/baselineserver.cpp
index 0c0871a..97ee80c 100644
--- a/tests/arthur/baselineserver/src/baselineserver.cpp
+++ b/tests/arthur/baselineserver/src/baselineserver.cpp
@@ -60,6 +60,7 @@ const QString PI_CreationDate(QLS("CreationDate"));
QString BaselineServer::storage;
QString BaselineServer::url;
+QString BaselineServer::settingsFile;
BaselineServer::BaselineServer(QObject *parent)
: QTcpServer(parent), lastRunIdIdx(0)
@@ -91,6 +92,15 @@ QString BaselineServer::baseUrl()
return url;
}
+QString BaselineServer::settingsFilePath()
+{
+ if (settingsFile.isEmpty()) {
+ QString exeName = QCoreApplication::applicationFilePath().section(QLC('/'), -1);
+ settingsFile = storagePath() + QLC('/') + exeName + QLS(".ini");
+ }
+ return settingsFile;
+}
+
void BaselineServer::incomingConnection(int socketDescriptor)
{
QString runId = QDateTime::currentDateTime().toString(QLS("MMMdd-hhmmss"));
@@ -144,6 +154,8 @@ void BaselineThread::run()
BaselineHandler::BaselineHandler(const QString &runId, int socketDescriptor)
: QObject(), runId(runId), connectionEstablished(false)
{
+ settings = new QSettings(BaselineServer::settingsFilePath(), QSettings::IniFormat, this);
+
if (socketDescriptor == -1)
return;
@@ -162,6 +174,7 @@ bool BaselineHandler::establishConnection()
{
if (!proto.acceptConnection(&plat)) {
qWarning() << runId << logtime() << "Accepting new connection from" << proto.socket.peerAddress().toString() << "failed." << proto.errorMessage();
+ proto.sendBlock(BaselineProtocol::Abort, proto.errorMessage().toLatin1()); // In case the client can hear us, tell it what's wrong.
proto.socket.disconnectFromHost();
return false;
}
@@ -173,17 +186,23 @@ bool BaselineHandler::establishConnection()
qDebug() << runId << logtime() << "Connection established with" << plat.value(PI_HostName)
<< "[" << qPrintable(plat.value(PI_HostAddress)) << "]" << logMsg;
- // Filter on branch
- QString branch = plat.value(PI_PulseGitBranch);
- if (branch.isEmpty()) {
- // Not run by Pulse, i.e. ad hoc run: Ok.
- }
- else if (branch != QLS("master-integration") || !plat.value(PI_GitCommit).contains(QLS("Merge branch 'master' of scm.dev.nokia.troll.no:qt/qt-fire-staging into master-integration"))) {
- qDebug() << runId << logtime() << "Did not pass branch/staging repo filter, disconnecting.";
- proto.sendBlock(BaselineProtocol::Abort, QByteArray("This branch/staging repo is not assigned to be tested."));
- proto.socket.disconnectFromHost();
- return false;
+ settings->beginGroup("ClientFilters");
+ if (!settings->childKeys().isEmpty() && !plat.value(PI_PulseGitBranch).isEmpty()) { // i.e. not adhoc client
+ // Abort if client does not match the filters
+ foreach (QString filterKey, settings->childKeys()) {
+ QString filter = settings->value(filterKey).toString();
+ QString platVal = plat.value(filterKey);
+ if (filter.isEmpty() || platVal.isEmpty())
+ continue; // tbd: add a syntax for specifying a "value-must-be-present" filter
+ if (!platVal.contains(filter)) {
+ qDebug() << runId << logtime() << "Did not pass client filter on" << filterKey << "; disconnecting.";
+ proto.sendBlock(BaselineProtocol::Abort, QByteArray("Configured to not do testing for this client or repo, ref. ") + BaselineServer::settingsFilePath().toLatin1());
+ proto.socket.disconnectFromHost();
+ return false;
+ }
+ }
}
+ settings->endGroup();
proto.sendBlock(BaselineProtocol::Ack, QByteArray());
diff --git a/tests/arthur/baselineserver/src/baselineserver.h b/tests/arthur/baselineserver/src/baselineserver.h
index cae490f..0dcd4ea 100644
--- a/tests/arthur/baselineserver/src/baselineserver.h
+++ b/tests/arthur/baselineserver/src/baselineserver.h
@@ -48,6 +48,7 @@
#include <QScopedPointer>
#include <QTimer>
#include <QDateTime>
+#include <QSettings>
#include "baselineprotocol.h"
#include "report.h"
@@ -65,6 +66,7 @@ public:
static QString storagePath();
static QString baseUrl();
+ static QString settingsFilePath();
protected:
void incomingConnection(int socketDescriptor);
@@ -79,6 +81,7 @@ private:
int lastRunIdIdx;
static QString storage;
static QString url;
+ static QString settingsFile;
};
@@ -132,6 +135,7 @@ private:
QString runId;
bool connectionEstablished;
Report report;
+ QSettings *settings;
};
#endif // BASELINESERVER_H
diff --git a/tests/arthur/common/baselineprotocol.cpp b/tests/arthur/common/baselineprotocol.cpp
index 88cea36..8879b78 100644
--- a/tests/arthur/common/baselineprotocol.cpp
+++ b/tests/arthur/common/baselineprotocol.cpp
@@ -374,7 +374,7 @@ bool BaselineProtocol::connect(const QString &testCase, bool *dryrun)
Command cmd = UnknownError;
if (!receiveBlock(&cmd, &block)) {
- errMsg += QLS("Failed to get response from server.");
+ errMsg.prepend(QLS("Failed to get response from server. "));
return false;
}
@@ -424,15 +424,17 @@ bool BaselineProtocol::requestBaselineChecksums(const QString &testFunction, Ima
it->testFunction = testFunction;
QByteArray block;
- QDataStream ds(&block, QIODevice::ReadWrite);
+ QDataStream ds(&block, QIODevice::WriteOnly);
ds << *itemList;
if (!sendBlock(RequestBaselineChecksums, block))
return false;
+
Command cmd;
- if (!receiveBlock(&cmd, &block))
+ QByteArray rcvBlock;
+ if (!receiveBlock(&cmd, &rcvBlock) || cmd != BaselineProtocol::Ack)
return false;
- ds.device()->seek(0);
- ds >> *itemList;
+ QDataStream rds(&rcvBlock, QIODevice::ReadOnly);
+ rds >> *itemList;
return true;
}
diff --git a/tests/arthur/common/baselineprotocol.h b/tests/arthur/common/baselineprotocol.h
index 8a99ace..bc1a3eb 100644
--- a/tests/arthur/common/baselineprotocol.h
+++ b/tests/arthur/common/baselineprotocol.h
@@ -146,7 +146,7 @@ public:
enum Constant {
ProtocolVersion = 5,
ServerPort = 54129,
- Timeout = 5000
+ Timeout = 15000
};
enum Command {
diff --git a/tests/auto/lancelot/tst_lancelot.cpp b/tests/auto/lancelot/tst_lancelot.cpp
index 9721665..2eb3f20 100644
--- a/tests/auto/lancelot/tst_lancelot.cpp
+++ b/tests/auto/lancelot/tst_lancelot.cpp
@@ -254,7 +254,8 @@ void tst_Lancelot::runTestSuite(GraphicsEngine engine, QImage::Format format)
if (baseline.status == ImageItem::BaselineNotFound) {
- proto.submitNewBaseline(rendered, 0);
+ if (!proto.submitNewBaseline(rendered, 0))
+ QWARN("Failed to submit new baseline: " + proto.errorMessage().toLatin1());
QSKIP("Baseline not found; new baseline created.", SkipSingle);
}
diff --git a/tests/auto/qrawfont/tst_qrawfont.cpp b/tests/auto/qrawfont/tst_qrawfont.cpp
index 3aa4006..4b42c74 100644
--- a/tests/auto/qrawfont/tst_qrawfont.cpp
+++ b/tests/auto/qrawfont/tst_qrawfont.cpp
@@ -104,7 +104,7 @@ void tst_QRawFont::invalidRawFont()
{
QRawFont font;
QVERIFY(!font.isValid());
- QCOMPARE(font.pixelSize(), -1);
+ QCOMPARE(font.pixelSize(), 0.0);
QVERIFY(font.familyName().isEmpty());
QCOMPARE(font.style(), QFont::StyleNormal);
QCOMPARE(font.weight(), -1);
@@ -165,7 +165,7 @@ void tst_QRawFont::correctFontData_data()
QTest::addColumn<QFont::Weight>("weight");
QTest::addColumn<QFont::HintingPreference>("hintingPreference");
QTest::addColumn<qreal>("unitsPerEm");
- QTest::addColumn<int>("pixelSize");
+ QTest::addColumn<qreal>("pixelSize");
int hintingPreferences[] = {
int(QFont::PreferDefaultHinting),
@@ -189,7 +189,7 @@ void tst_QRawFont::correctFontData_data()
<< QFont::Normal
<< QFont::HintingPreference(*hintingPreference)
<< 1000.0
- << 10;
+ << 10.0;
fileName = QLatin1String(SRCDIR "testfont_bold_italic.ttf");
title = fileName
@@ -203,7 +203,7 @@ void tst_QRawFont::correctFontData_data()
<< QFont::Bold
<< QFont::HintingPreference(*hintingPreference)
<< 1000.0
- << 10;
+ << 10.0;
++hintingPreference;
}
@@ -217,7 +217,7 @@ void tst_QRawFont::correctFontData()
QFETCH(QFont::Weight, weight);
QFETCH(QFont::HintingPreference, hintingPreference);
QFETCH(qreal, unitsPerEm);
- QFETCH(int, pixelSize);
+ QFETCH(qreal, pixelSize);
QRawFont font(fileName, 10, hintingPreference);
QVERIFY(font.isValid());
@@ -284,7 +284,7 @@ void tst_QRawFont::textLayout()
QString familyName = QString::fromLatin1("QtBidiTestFont");
QFont font(familyName);
- font.setPixelSize(18);
+ font.setPixelSize(18.0);
QCOMPARE(QFontInfo(font).family(), familyName);
QTextLayout layout(QLatin1String("Foobar"));
@@ -301,7 +301,7 @@ void tst_QRawFont::textLayout()
QRawFont rawFont = glyphs.font();
QVERIFY(rawFont.isValid());
QCOMPARE(rawFont.familyName(), familyName);
- QCOMPARE(rawFont.pixelSize(), 18);
+ QCOMPARE(rawFont.pixelSize(), 18.0);
QVector<quint32> expectedGlyphIndices;
expectedGlyphIndices << 44 << 83 << 83 << 70 << 69 << 86;
@@ -597,12 +597,12 @@ void tst_QRawFont::fromFont()
QFont font(familyName);
font.setHintingPreference(hintingPreference);
- font.setPixelSize(26);
+ font.setPixelSize(26.0);
QRawFont rawFont = QRawFont::fromFont(font, writingSystem);
QVERIFY(rawFont.isValid());
QCOMPARE(rawFont.familyName(), familyName);
- QCOMPARE(rawFont.pixelSize(), 26);
+ QCOMPARE(rawFont.pixelSize(), 26.0);
QVERIFY(fontDatabase.removeApplicationFont(id));
}
@@ -623,7 +623,7 @@ void tst_QRawFont::copyConstructor()
{
QString rawFontFamilyName;
- int rawFontPixelSize;
+ qreal rawFontPixelSize;
qreal rawFontAscent;
qreal rawFontDescent;
int rawFontTableSize;
@@ -691,7 +691,7 @@ void tst_QRawFont::detach()
{
QString rawFontFamilyName;
- int rawFontPixelSize;
+ qreal rawFontPixelSize;
qreal rawFontAscent;
qreal rawFontDescent;
int rawFontTableSize;
@@ -773,15 +773,15 @@ void tst_QRawFont::unsupportedWritingSystem()
QFont font("QtBidiTestFont");
font.setHintingPreference(hintingPreference);
- font.setPixelSize(12);
+ font.setPixelSize(12.0);
QRawFont rawFont = QRawFont::fromFont(font, QFontDatabase::Any);
QCOMPARE(rawFont.familyName(), QString::fromLatin1("QtBidiTestFont"));
- QCOMPARE(rawFont.pixelSize(), 12);
+ QCOMPARE(rawFont.pixelSize(), 12.0);
rawFont = QRawFont::fromFont(font, QFontDatabase::Hebrew);
QCOMPARE(rawFont.familyName(), QString::fromLatin1("QtBidiTestFont"));
- QCOMPARE(rawFont.pixelSize(), 12);
+ QCOMPARE(rawFont.pixelSize(), 12.0);
QString arabicText = QFontDatabase::writingSystemSample(QFontDatabase::Arabic);
@@ -798,11 +798,11 @@ void tst_QRawFont::unsupportedWritingSystem()
QGlyphs glyphs = glyphss.at(0);
QRawFont layoutFont = glyphs.font();
QVERIFY(layoutFont.familyName() != QString::fromLatin1("QtBidiTestFont"));
- QCOMPARE(layoutFont.pixelSize(), 12);
+ QCOMPARE(layoutFont.pixelSize(), 12.0);
rawFont = QRawFont::fromFont(font, QFontDatabase::Arabic);
QCOMPARE(rawFont.familyName(), layoutFont.familyName());
- QCOMPARE(rawFont.pixelSize(), 12);
+ QCOMPARE(rawFont.pixelSize(), 12.0);
fontDatabase.removeApplicationFont(id);
}