Merge remote-tracking branch 'origin/5.6.1' into 5.6

Conflicts:
	src/network/socket/qnativesocketengine_winrt.cpp

Change-Id: I8edb72f8ba958d80c3d7993b3feaaae782ca8d9c
This commit is contained in:
Liang Qi 2016-05-19 06:30:59 +02:00
commit 640441882d
34 changed files with 200 additions and 46 deletions

View File

@ -1,5 +1,4 @@
load(qt_build_config) load(qt_build_config)
CONFIG += qt_example_installs
CONFIG += warning_clean CONFIG += warning_clean
QT_SOURCE_TREE = $$PWD QT_SOURCE_TREE = $$PWD

2
configure vendored
View File

@ -4039,7 +4039,7 @@ if true; then ###[ '!' -f "$outpath/bin/qmake" ];
setBootstrapVariable QMAKE_LFLAGS setBootstrapVariable QMAKE_LFLAGS
setBootstrapVariable QMAKE_LFLAGS_GCSECTIONS setBootstrapVariable QMAKE_LFLAGS_GCSECTIONS
if [ "$CFG_RELEASE_TOOLS" = "yes" ]; then if [ "$CFG_DEBUG" = "no" ] || [ "$CFG_RELEASE_TOOLS" = "yes" ]; then
setBootstrapVariable QMAKE_CFLAGS_RELEASE setBootstrapVariable QMAKE_CFLAGS_RELEASE
setBootstrapVariable QMAKE_CXXFLAGS_RELEASE setBootstrapVariable QMAKE_CXXFLAGS_RELEASE
EXTRA_CFLAGS="$EXTRA_CFLAGS \$(QMAKE_CFLAGS_RELEASE)" EXTRA_CFLAGS="$EXTRA_CFLAGS \$(QMAKE_CFLAGS_RELEASE)"

View File

@ -11,9 +11,13 @@
lex.variable_out = GENERATED_SOURCES lex.variable_out = GENERATED_SOURCES
} }
isEmpty(QMAKE_LEXFLAGS_MANGLE):QMAKE_LEXFLAGS_MANGLE = -P${QMAKE_FILE_BASE}
QMAKE_LEXEXTRAFLAGS = $$QMAKE_LEXFLAGS
!yacc_no_name_mangle:QMAKE_LEXEXTRAFLAGS += $$QMAKE_LEXFLAGS_MANGLE
contains(QMAKE_LEX, .*flex) { contains(QMAKE_LEX, .*flex) {
# GNU flex, we can use -o outfile # GNU flex, we can use -o outfile
lex.commands = $$QMAKE_LEX $$QMAKE_LEXFLAGS --nounistd -o ${QMAKE_FILE_OUT} ${QMAKE_FILE_IN} lex.commands = $$QMAKE_LEX $$QMAKE_LEXEXTRAFLAGS --nounistd -o ${QMAKE_FILE_OUT} ${QMAKE_FILE_IN}
} else { } else {
# stupid POSIX lex, it only generates a file called lex.yy.c # stupid POSIX lex, it only generates a file called lex.yy.c
# or lex.prefix.c if the -P<prefix> option is active # or lex.prefix.c if the -P<prefix> option is active

View File

@ -71,6 +71,7 @@ CONFIG += \
create_prl link_prl \ create_prl link_prl \
prepare_docs qt_docs_targets \ prepare_docs qt_docs_targets \
no_private_qt_headers_warning QTDIR_build \ no_private_qt_headers_warning QTDIR_build \
qt_example_installs \
# Qt modules get compiled without exceptions enabled by default. # Qt modules get compiled without exceptions enabled by default.
# However, testcases should be still built with exceptions. # However, testcases should be still built with exceptions.
exceptions_off testcase_exceptions exceptions_off testcase_exceptions

View File

@ -100,6 +100,20 @@ probase = $$relative_path($$_PRO_FILE_PWD_, $$dirname(_QMAKE_CONF_)/examples)
!isEmpty(allfiles): warning("remaining files in $$_PRO_FILE_PWD_: $$allfiles") !isEmpty(allfiles): warning("remaining files in $$_PRO_FILE_PWD_: $$allfiles")
} }
equals(TEMPLATE, app)|equals(TEMPLATE, lib) {
!contains(INSTALLS, target) {
!install_ok: \
error("$$_PRO_FILE_ is lacking an install target.")
else: check_examples: \
warning("$$_PRO_FILE_ is lacking an install target.")
} else: !equals(target.path, $$sources.path) {
!install_ok: \
error("$$_PRO_FILE_ installs target to unexpected location.")
else: check_examples: \
warning("$$_PRO_FILE_ installs target to unexpected location.")
}
}
!equals(TEMPLATE, subdirs):!compile_examples { !equals(TEMPLATE, subdirs):!compile_examples {
TEMPLATE = aux TEMPLATE = aux
CONFIG -= have_target qt staticlib dll CONFIG -= have_target qt staticlib dll

View File

@ -13,6 +13,7 @@ load(qt_build_paths)
TEMPLATE = lib TEMPLATE = lib
CONFIG -= qt CONFIG -= qt
QT = # In case qt is re-added.
CONFIG -= warning_clean # Don't presume 3rd party code to be clean CONFIG -= warning_clean # Don't presume 3rd party code to be clean
load(qt_common) load(qt_common)

View File

@ -2370,6 +2370,19 @@ unsigned int Renderer11::getReservedFragmentUniformBuffers() const
bool Renderer11::getShareHandleSupport() const bool Renderer11::getShareHandleSupport() const
{ {
if (mDriverType == D3D_DRIVER_TYPE_WARP)
{
#if !defined(ANGLE_ENABLE_WINDOWS_STORE)
// Warp mode does not support shared handles in Windows versions below Windows 8
OSVERSIONINFO result = { sizeof(OSVERSIONINFO), 0, 0, 0, 0, {'\0'}};
if (GetVersionEx(&result) &&
((result.dwMajorVersion == 6 && result.dwMinorVersion < 2) || result.dwMajorVersion < 6))
{
// WARP on Windows 7 doesn't support shared handles
return false;
}
#endif // ANGLE_ENABLE_WINDOWS_STORE
}
// We only currently support share handles with BGRA surfaces, because // We only currently support share handles with BGRA surfaces, because
// chrome needs BGRA. Once chrome fixes this, we should always support them. // chrome needs BGRA. Once chrome fixes this, we should always support them.
// PIX doesn't seem to support using share handles, so disable them. // PIX doesn't seem to support using share handles, so disable them.

View File

@ -64,10 +64,10 @@ win32 {
INCLUDEPATH += $$PWD/include INCLUDEPATH += $$PWD/include
DEFINES += FT2_BUILD_LIBRARY DEFINES += FT2_BUILD_LIBRARY
contains(QT_CONFIG, system-zlib) {
DEFINES += FT_CONFIG_OPTION_SYSTEM_ZLIB DEFINES += FT_CONFIG_OPTION_SYSTEM_ZLIB
include($$PWD/../zlib_dependency.pri) include(../zlib_dependency.pri)
}
contains(QT_CONFIG, system-png) { contains(QT_CONFIG, system-png) {
DEFINES += FT_CONFIG_OPTION_USE_PNG DEFINES += FT_CONFIG_OPTION_USE_PNG
include($$PWD/../png_dependency.pri) include($$PWD/../png_dependency.pri)

View File

@ -7,4 +7,8 @@ contains(QT_CONFIG, system-zlib) {
} }
} else { } else {
INCLUDEPATH += $$PWD/zlib INCLUDEPATH += $$PWD/zlib
!no_core_dep {
CONFIG += qt
QT_PRIVATE += core
}
} }

View File

@ -0,0 +1,44 @@
From db13a9cf7e41207660f080827983655864df802d Mon Sep 17 00:00:00 2001
From: Oliver Wolff <oliver.wolff@qt.io>
Date: Wed, 11 May 2016 13:51:54 +0200
Subject: [PATCH] ANGLE: Disable support for shared handles in warp mode on
Windows < 8
Shared handles are not supported on Windows 7 and below. If the
according flag is set CreateTexture2D will fail with E_OUTOFMEMORY. The
check already happens with newer ANGLE versions, which we use in 5.7
but has to happen here as well. Otherwise Qt applications running on
Windows 7 and below will crash at startup.
Change-Id: I8f539f16dce298611fb1ec7b2f6804d4a04d04e0
---
.../angle/src/libANGLE/renderer/d3d/d3d11/Renderer11.cpp | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/Renderer11.cpp b/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/Renderer11.cpp
index 223e2b0..dd554f4 100644
--- a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/Renderer11.cpp
+++ b/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/Renderer11.cpp
@@ -2370,6 +2370,19 @@ unsigned int Renderer11::getReservedFragmentUniformBuffers() const
bool Renderer11::getShareHandleSupport() const
{
+ if (mDriverType == D3D_DRIVER_TYPE_WARP)
+ {
+#if !defined(ANGLE_ENABLE_WINDOWS_STORE)
+ // Warp mode does not support shared handles in Windows versions below Windows 8
+ OSVERSIONINFO result = { sizeof(OSVERSIONINFO), 0, 0, 0, 0, {'\0'}};
+ if (GetVersionEx(&result) &&
+ ((result.dwMajorVersion == 6 && result.dwMinorVersion < 2) || result.dwMajorVersion < 6))
+ {
+ // WARP on Windows 7 doesn't support shared handles
+ return false;
+ }
+#endif // ANGLE_ENABLE_WINDOWS_STORE
+ }
// We only currently support share handles with BGRA surfaces, because
// chrome needs BGRA. Once chrome fixes this, we should always support them.
// PIX doesn't seem to support using share handles, so disable them.
--
2.7.0.windows.1

View File

@ -4,7 +4,7 @@ project = QtConcurrent
description = Qt Concurrent Reference Documentation description = Qt Concurrent Reference Documentation
version = $QT_VERSION version = $QT_VERSION
examplesinstallpath = qtbase/qtconcurrent examplesinstallpath = qtconcurrent
qhp.projects = QtConcurrent qhp.projects = QtConcurrent

View File

@ -4,7 +4,7 @@ project = QtCore
description = Qt Core Reference Documentation description = Qt Core Reference Documentation
version = $QT_VERSION version = $QT_VERSION
examplesinstallpath = qtbase/corelib examplesinstallpath = corelib
qhp.projects = QtCore qhp.projects = QtCore

View File

@ -3653,7 +3653,7 @@ bool QAbstractListModel::dropMimeData(const QMimeData *data, Qt::DropAction acti
\fn QAbstractItemModel::modelAboutToBeReset() \fn QAbstractItemModel::modelAboutToBeReset()
\since 4.2 \since 4.2
This signal is emitted when reset() is called, before the model's internal This signal is emitted when beginResetModel() is called, before the model's internal
state (e.g. persistent model indexes) has been invalidated. state (e.g. persistent model indexes) has been invalidated.
\sa beginResetModel(), modelReset() \sa beginResetModel(), modelReset()
@ -3663,7 +3663,7 @@ bool QAbstractListModel::dropMimeData(const QMimeData *data, Qt::DropAction acti
\fn QAbstractItemModel::modelReset() \fn QAbstractItemModel::modelReset()
\since 4.1 \since 4.1
This signal is emitted when reset() or endResetModel() is called, after the This signal is emitted when endResetModel() is called, after the
model's internal state (e.g. persistent model indexes) has been invalidated. model's internal state (e.g. persistent model indexes) has been invalidated.
Note that if a model is reset it should be considered that all information Note that if a model is reset it should be considered that all information

View File

@ -158,6 +158,7 @@ else:SOURCES += tools/qelapsedtimer_generic.cpp
contains(QT_CONFIG, zlib) { contains(QT_CONFIG, zlib) {
include($$PWD/../../3rdparty/zlib.pri) include($$PWD/../../3rdparty/zlib.pri)
} else { } else {
CONFIG += no_core_dep
include($$PWD/../../3rdparty/zlib_dependency.pri) include($$PWD/../../3rdparty/zlib_dependency.pri)
} }

View File

@ -19,7 +19,7 @@ sourcedirs += .. \
../../../examples/dbus/doc/src ../../../examples/dbus/doc/src
excludedirs += ../../../examples/widgets/doc excludedirs += ../../../examples/widgets/doc
examplesinstallpath = qtbase/dbus examplesinstallpath = dbus
depends += qtdoc qtcore depends += qtdoc qtcore

View File

@ -4,7 +4,7 @@ project = QtGui
description = Qt GUI Reference Documentation description = Qt GUI Reference Documentation
version = $QT_VERSION version = $QT_VERSION
examplesinstallpath = qtbase/gui examplesinstallpath = gui
qhp.projects = QtGui qhp.projects = QtGui

View File

@ -6268,7 +6268,7 @@ static void drawTextItemDecoration(QPainter *painter, const QPointF &pos, const
pen.setColor(uc); pen.setColor(uc);
// Adapt wave to underlineOffset or pen width, whatever is larger, to make it work on all platforms // Adapt wave to underlineOffset or pen width, whatever is larger, to make it work on all platforms
const QPixmap wave = generateWavyPixmap(qMin(qMax(underlineOffset, pen.widthF()), maxHeight / 2.), pen); const QPixmap wave = generateWavyPixmap(qMin(qMax(underlineOffset, pen.widthF()), maxHeight / qreal(2.)), pen);
const int descent = qFloor(maxHeight); const int descent = qFloor(maxHeight);
painter->setBrushOrigin(painter->brushOrigin().x(), 0); painter->setBrushOrigin(painter->brushOrigin().x(), 0);
@ -6279,7 +6279,7 @@ static void drawTextItemDecoration(QPainter *painter, const QPointF &pos, const
// the text above it, but limit it to stay within descent. // the text above it, but limit it to stay within descent.
qreal adjustedUnderlineOffset = std::ceil(underlineOffset) + 0.5; qreal adjustedUnderlineOffset = std::ceil(underlineOffset) + 0.5;
if (underlineOffset <= fe->descent().toReal()) if (underlineOffset <= fe->descent().toReal())
adjustedUnderlineOffset = qMin(adjustedUnderlineOffset, fe->descent().toReal() - 0.5); adjustedUnderlineOffset = qMin(adjustedUnderlineOffset, fe->descent().toReal() - qreal(0.5));
const qreal underlinePos = pos.y() + adjustedUnderlineOffset; const qreal underlinePos = pos.y() + adjustedUnderlineOffset;
QColor uc = charFormat.underlineColor(); QColor uc = charFormat.underlineColor();
if (uc.isValid()) if (uc.isValid())

View File

@ -4,7 +4,7 @@ project = QtNetwork
description = Qt Network Reference Documentation description = Qt Network Reference Documentation
version = $QT_VERSION version = $QT_VERSION
examplesinstallpath = qtbase/network examplesinstallpath = network
qhp.projects = QtNetwork qhp.projects = QtNetwork

View File

@ -458,6 +458,7 @@ void QNativeSocketEngine::close()
} }
#if _MSC_VER >= 1900 #if _MSC_VER >= 1900
if (d->socketType == QAbstractSocket::TcpSocket) {
hr = QEventDispatcherWinRT::runOnXamlThread([d]() { hr = QEventDispatcherWinRT::runOnXamlThread([d]() {
HRESULT hr; HRESULT hr;
// To close the connection properly (not with a hard reset) all pending read operation have to // To close the connection properly (not with a hard reset) all pending read operation have to
@ -474,6 +475,7 @@ void QNativeSocketEngine::close()
return S_OK; return S_OK;
}); });
Q_ASSERT_SUCCEEDED(hr); Q_ASSERT_SUCCEEDED(hr);
}
#endif // _MSC_VER >= 1900 #endif // _MSC_VER >= 1900
if (d->readOp) { if (d->readOp) {

View File

@ -21,7 +21,7 @@ imagedirs += images \
depends += qtdoc qtcore qtgui qtwidgets qmake depends += qtdoc qtcore qtgui qtwidgets qmake
examplesinstallpath = qtbase/opengl examplesinstallpath = opengl
# The following parameters are for creating a qhp file, the qhelpgenerator # The following parameters are for creating a qhp file, the qhelpgenerator
# program can convert the qhp file into a qch file which can be opened in # program can convert the qhp file into a qch file which can be opened in

View File

@ -4,7 +4,7 @@ project = QtPlatformHeaders
description = Qt Platform Headers Reference Documentation description = Qt Platform Headers Reference Documentation
version = $QT_VERSION version = $QT_VERSION
examplesinstallpath = qtbase/qtplatformheaders examplesinstallpath = qtplatformheaders
qhp.projects = QtPlatformHeaders qhp.projects = QtPlatformHeaders

View File

@ -54,7 +54,7 @@ QT_BEGIN_NAMESPACE
typedef struct typedef struct
{ {
quint8 bWidth; // Width of the image quint8 bWidth; // Width of the image
quint8 bHeight; // Height of the image (times 2) quint8 bHeight; // Height of the image (actual height, not times 2)
quint8 bColorCount; // Number of colors in image (0 if >=8bpp) [ not ture ] quint8 bColorCount; // Number of colors in image (0 if >=8bpp) [ not ture ]
quint8 bReserved; // Reserved quint8 bReserved; // Reserved
quint16 wPlanes; // Color Planes quint16 wPlanes; // Color Planes
@ -681,8 +681,8 @@ bool ICOReader::write(QIODevice *device, const QVector<QImage> &images)
entries[i].bColorCount = 0; entries[i].bColorCount = 0;
entries[i].bReserved = 0; entries[i].bReserved = 0;
entries[i].wBitCount = nbits; entries[i].wBitCount = nbits;
entries[i].bHeight = image.height(); entries[i].bHeight = image.height() < 256 ? image.height() : 0; // 0 means 256
entries[i].bWidth = image.width(); entries[i].bWidth = image.width() < 256 ? image.width() : 0; // 0 means 256
entries[i].dwBytesInRes = BMP_INFOHDR_SIZE + (bpl_bmp * image.height()) entries[i].dwBytesInRes = BMP_INFOHDR_SIZE + (bpl_bmp * image.height())
+ (maskImage.bytesPerLine() * maskImage.height()); + (maskImage.bytesPerLine() * maskImage.height());
entries[i].wPlanes = 1; entries[i].wPlanes = 1;
@ -696,11 +696,11 @@ bool ICOReader::write(QIODevice *device, const QVector<QImage> &images)
bmpHeaders[i].biClrImportant = 0; bmpHeaders[i].biClrImportant = 0;
bmpHeaders[i].biClrUsed = entries[i].bColorCount; bmpHeaders[i].biClrUsed = entries[i].bColorCount;
bmpHeaders[i].biCompression = 0; bmpHeaders[i].biCompression = 0;
bmpHeaders[i].biHeight = entries[i].bHeight * 2; // 2 is for the mask bmpHeaders[i].biHeight = entries[i].bHeight ? entries[i].bHeight * 2 : 256 * 2; // 2 is for the mask
bmpHeaders[i].biPlanes = entries[i].wPlanes; bmpHeaders[i].biPlanes = entries[i].wPlanes;
bmpHeaders[i].biSize = BMP_INFOHDR_SIZE; bmpHeaders[i].biSize = BMP_INFOHDR_SIZE;
bmpHeaders[i].biSizeImage = entries[i].dwBytesInRes - BMP_INFOHDR_SIZE; bmpHeaders[i].biSizeImage = entries[i].dwBytesInRes - BMP_INFOHDR_SIZE;
bmpHeaders[i].biWidth = entries[i].bWidth; bmpHeaders[i].biWidth = entries[i].bWidth ? entries[i].bWidth : 256;
bmpHeaders[i].biXPelsPerMeter = 0; bmpHeaders[i].biXPelsPerMeter = 0;
bmpHeaders[i].biYPelsPerMeter = 0; bmpHeaders[i].biYPelsPerMeter = 0;

View File

@ -110,6 +110,8 @@ QCocoaMenuItem::~QCocoaMenuItem()
if (m_merged) { if (m_merged) {
[m_native setHidden:YES]; [m_native setHidden:YES];
} else { } else {
if (m_menu && m_menu->attachedItem() == m_native)
m_menu->setAttachedItem(nil);
[m_native release]; [m_native release];
} }

View File

@ -90,6 +90,18 @@
"features": [ "features": [
"disable_angle" "disable_angle"
] ]
},
{
"id": 8,
"description": "Standard VGA: Insufficent support for OpenGL, D3D9 and D3D11",
"vendor_id": "0x0000",
"device_id": ["0x0000"],
"os": {
"type": "win"
},
"features": [
"disable_desktopgl", "disable_d3d11", "disable_d3d9"
]
} }
] ]
} }

View File

@ -4,7 +4,7 @@ project = QtPrintSupport
description = Qt Print Support Reference Documentation description = Qt Print Support Reference Documentation
version = $QT_VERSION version = $QT_VERSION
examplesinstallpath = qtbase/printsupport examplesinstallpath = printsupport
qhp.projects = QtPrintSupport qhp.projects = QtPrintSupport

View File

@ -4,7 +4,7 @@ project = QtSql
description = Qt SQL Reference Documentation description = Qt SQL Reference Documentation
version = $QT_VERSION version = $QT_VERSION
examplesinstallpath = qtbase/sql examplesinstallpath = sql
qhp.projects = QtSql qhp.projects = QtSql

View File

@ -129,7 +129,12 @@ src_plugins.depends = src_sql src_xml src_network
src_android.subdir = $$PWD/android src_android.subdir = $$PWD/android
# this order is important # this order is important
contains(QT_CONFIG, zlib)|cross_compile: SUBDIRS += src_qtzlib contains(QT_CONFIG, zlib)|cross_compile {
SUBDIRS += src_qtzlib
contains(QT_CONFIG, zlib) {
src_3rdparty_freetype.depends += src_corelib
}
}
SUBDIRS += src_tools_bootstrap src_tools_moc src_tools_rcc SUBDIRS += src_tools_bootstrap src_tools_moc src_tools_rcc
!contains(QT_DISABLED_FEATURES, regularexpression):pcre { !contains(QT_DISABLED_FEATURES, regularexpression):pcre {
SUBDIRS += src_3rdparty_pcre SUBDIRS += src_3rdparty_pcre

View File

@ -4,7 +4,7 @@ project = QtTestLib
description = Qt Test Reference Documentation description = Qt Test Reference Documentation
version = $QT_VERSION version = $QT_VERSION
examplesinstallpath = qtbase/testlib examplesinstallpath = testlib
qhp.projects = QtTestLib qhp.projects = QtTestLib

View File

@ -132,8 +132,12 @@ macx {
../../corelib/io/qstandardpaths_win.cpp ../../corelib/io/qstandardpaths_win.cpp
} }
if(contains(QT_CONFIG, zlib)|cross_compile):include(../../3rdparty/zlib.pri) contains(QT_CONFIG, zlib)|cross_compile {
else:include(../../3rdparty/zlib_dependency.pri) include(../../3rdparty/zlib.pri)
} else {
CONFIG += no_core_dep
include(../../3rdparty/zlib_dependency.pri)
}
win32:LIBS += -luser32 -lole32 -ladvapi32 -lshell32 win32:LIBS += -luser32 -lole32 -ladvapi32 -lshell32

View File

@ -4,7 +4,7 @@ project = QtWidgets
description = Qt Widgets Reference Documentation description = Qt Widgets Reference Documentation
version = $QT_VERSION version = $QT_VERSION
examplesinstallpath = qtbase/widgets examplesinstallpath = widgets
qhp.projects = QtWidgets qhp.projects = QtWidgets

View File

@ -4,7 +4,7 @@ project = QtXml
description = Qt XML Reference Documentation description = Qt XML Reference Documentation
version = $QT_VERSION version = $QT_VERSION
examplesinstallpath = qtbase/xml examplesinstallpath = xml
qhp.projects = QtXml qhp.projects = QtXml

View File

@ -64,6 +64,8 @@ private slots:
void nextImageDelay(); void nextImageDelay();
void pngCompression_data(); void pngCompression_data();
void pngCompression(); void pngCompression();
void write_data();
void write();
private: private:
QString m_IconPath; QString m_IconPath;
@ -335,6 +337,51 @@ void tst_QIcoImageFormat::pngCompression()
QCOMPARE(image.height(), height); QCOMPARE(image.height(), height);
} }
void tst_QIcoImageFormat::write_data()
{
QTest::addColumn<QSize>("inSize");
QTest::addColumn<QSize>("outSize");
QTest::newRow("64x64") << QSize(64, 64) << QSize(64, 64);
QTest::newRow("128x200") << QSize(128, 200) << QSize(128, 200);
QTest::newRow("256x256") << QSize(256, 256) << QSize(256, 256);
QTest::newRow("400x400") << QSize(400, 400) << QSize(256, 256);
}
void tst_QIcoImageFormat::write()
{
QFETCH(QSize, inSize);
QFETCH(QSize, outSize);
QImage inImg;
{
QImageReader reader(m_IconPath + "/valid/Qt.ico");
reader.jumpToImage(4);
reader.setScaledSize(inSize);
inImg = reader.read();
QVERIFY(!inImg.isNull());
QCOMPARE(inImg.size(), inSize);
}
QBuffer buf;
{
buf.open(QIODevice::WriteOnly);
QImageWriter writer(&buf, "ico");
QVERIFY(writer.write(inImg));
buf.close();
}
{
buf.open(QIODevice::ReadOnly);
QImageReader reader(&buf);
QVERIFY(reader.canRead());
QCOMPARE(reader.format(), QByteArray("ico"));
QImage outImg = reader.read();
QVERIFY(!outImg.isNull());
QCOMPARE(outImg.size(), outSize);
buf.close();
}
}
QTEST_MAIN(tst_QIcoImageFormat) QTEST_MAIN(tst_QIcoImageFormat)
#include "tst_qicoimageformat.moc" #include "tst_qicoimageformat.moc"

Binary file not shown.

After

Width:  |  Height:  |  Size: 318 B

View File

@ -199,6 +199,7 @@ void tst_QImageWriter::writeImage_data()
QTest::newRow("PBM: ship63") << QString("ship63.pbm") << true << QByteArray("pbm"); QTest::newRow("PBM: ship63") << QString("ship63.pbm") << true << QByteArray("pbm");
QTest::newRow("XBM: gnus") << QString("gnus.xbm") << false << QByteArray("xbm"); QTest::newRow("XBM: gnus") << QString("gnus.xbm") << false << QByteArray("xbm");
QTest::newRow("JPEG: beavis") << QString("beavis.jpg") << true << QByteArray("jpeg"); QTest::newRow("JPEG: beavis") << QString("beavis.jpg") << true << QByteArray("jpeg");
QTest::newRow("ICO: App") << QString("App.ico") << true << QByteArray("ico");
} }
void tst_QImageWriter::writeImage() void tst_QImageWriter::writeImage()
@ -260,7 +261,7 @@ void tst_QImageWriter::writeImage2_data()
QTest::addColumn<QImage>("image"); QTest::addColumn<QImage>("image");
const QStringList formats = QStringList() << "bmp" << "xpm" << "png" const QStringList formats = QStringList() << "bmp" << "xpm" << "png"
<< "ppm"; //<< "jpeg"; << "ppm" << "ico"; //<< "jpeg";
QImage image0(70, 70, QImage::Format_ARGB32); QImage image0(70, 70, QImage::Format_ARGB32);
image0.fill(QColor(Qt::red).rgb()); image0.fill(QColor(Qt::red).rgb());