summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/gui/Qt5GuiConfigExtras.cmake.in22
-rw-r--r--src/gui/kernel/qwindow.cpp5
-rw-r--r--src/gui/text/qtextlayout.cpp5
-rw-r--r--src/network/access/qnetworkdiskcache.cpp10
-rw-r--r--src/plugins/platforms/windows/qwindowstabletsupport.cpp26
-rw-r--r--src/plugins/platforms/windows/qwindowswindow.cpp5
-rw-r--r--src/printsupport/kernel/qpaintengine_alpha.cpp5
-rw-r--r--src/widgets/kernel/qwidget.cpp2
-rw-r--r--src/widgets/widgets.pro3
-rw-r--r--src/widgets/widgets/qsplitter.cpp6
-rw-r--r--sync.profile1
-rw-r--r--tests/auto/corelib/io/qurl/tst_qurl.cpp7
-rw-r--r--tests/auto/gui/text/qcssparser/qcssparser.pro5
-rw-r--r--tests/auto/gui/text/qcssparser/testdata.qrc18
-rw-r--r--tests/auto/gui/text/qcssparser/tst_qcssparser.cpp4
-rw-r--r--tests/auto/gui/text/qglyphrun/qglyphrun.pro12
-rw-r--r--tests/auto/gui/text/qglyphrun/testdata.qrc5
-rw-r--r--tests/auto/gui/text/qglyphrun/tst_qglyphrun.cpp2
-rw-r--r--tests/auto/gui/text/qrawfont/qrawfont.pro5
-rw-r--r--tests/auto/gui/text/qrawfont/testdata.qrc6
-rw-r--r--tests/auto/gui/text/qzip/qzip.pro8
-rw-r--r--tests/auto/gui/text/qzip/testdata.qrc6
-rw-r--r--tests/auto/gui/text/qzip/tst_qzip.cpp4
-rw-r--r--tests/auto/network/access/qnetworkdiskcache/tst_qnetworkdiskcache.cpp71
-rw-r--r--tests/auto/widgets/dialogs/qdialog/tst_qdialog.cpp32
-rw-r--r--tests/auto/widgets/widgets/qsplitter/tst_qsplitter.cpp29
26 files changed, 263 insertions, 41 deletions
diff --git a/src/gui/Qt5GuiConfigExtras.cmake.in b/src/gui/Qt5GuiConfigExtras.cmake.in
index d734e56d23..9a846d435e 100644
--- a/src/gui/Qt5GuiConfigExtras.cmake.in
+++ b/src/gui/Qt5GuiConfigExtras.cmake.in
@@ -66,7 +66,8 @@ if (NOT _qt5gui_OPENGL_INCLUDE_DIR)
endif()
unset(_GL_INCDIRS)
-_qt5_Gui_check_file_exists(${_qt5gui_OPENGL_INCLUDE_DIR})
+# Don\'t check for existence of the "_qt5gui_OPENGL_INCLUDE_DIR" because it is
+# optional.
list(APPEND Qt5Gui_INCLUDE_DIRS ${_qt5gui_OPENGL_INCLUDE_DIR})
set_property(TARGET Qt5::Gui APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES ${_qt5gui_OPENGL_INCLUDE_DIR})
@@ -105,13 +106,18 @@ macro(_qt5gui_find_extra_libs Name Libs LibDir IncDirs)
)
!!IF mac
set(Qt5Gui_${_cmake_lib_name}_LIBRARY "${Qt5Gui_${_cmake_lib_name}_LIBRARY}/${_lib}")
+ if (NOT EXISTS "${Qt5Gui_${_cmake_lib_name}_LIBRARY}")
+ set(Qt5Gui_${_cmake_lib_name}_LIBRARY)
+ endif()
!!ENDIF
- if (WIN32 AND NOT Qt5Gui_${_cmake_lib_name}_LIBRARY)
+ if (NOT Qt5Gui_${_cmake_lib_name}_LIBRARY)
# The above find_library call doesn\'t work for finding
# libraries in Windows SDK paths outside of the proper
- # environment. Just add the library name to the result
- # variable instead.
- # We avoid doing this in the first case because Qt may be
+ # environment, even if the libraries are present. In other
+ # cases it is OK for the libraries to not be found
+ # because they are optional dependencies of Qt5Gui, needed
+ # only if the qopengl.h header is used.
+ # We try to find the libraries in the first place because Qt may be
# compiled with another set of GL libraries (such as coming
# from ANGLE). The point of these find calls is to try to
# find the same binaries as Qt is compiled with (as they are
@@ -119,7 +125,6 @@ macro(_qt5gui_find_extra_libs Name Libs LibDir IncDirs)
# above with paths known to qmake.
set(_Qt5Gui_${_cmake_lib_name}_LIBRARY_DONE TRUE)
unset(Qt5Gui_${_cmake_lib_name}_LIBRARY CACHE)
- list(APPEND Qt5Gui_${Name}_LIBRARIES ${_lib})
else()
add_library(Qt5::Gui_${_cmake_lib_name} SHARED IMPORTED)
set_property(TARGET Qt5::Gui_${_cmake_lib_name} APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES ${Qt5Gui_${Name}_INCLUDE_DIRS})
@@ -152,11 +157,6 @@ macro(_qt5gui_find_extra_libs Name Libs LibDir IncDirs)
endif()
endif()
endforeach()
- if (NOT CMAKE_CROSSCOMPILING)
- foreach(_dir ${Qt5Gui_${Name}_INCLUDE_DIRS})
- _qt5_Gui_check_file_exists(${_dir})
- endforeach()
- endif()
endmacro()
diff --git a/src/gui/kernel/qwindow.cpp b/src/gui/kernel/qwindow.cpp
index 327544c59c..8159b7746e 100644
--- a/src/gui/kernel/qwindow.cpp
+++ b/src/gui/kernel/qwindow.cpp
@@ -1119,6 +1119,11 @@ Qt::WindowState QWindow::windowState() const
void QWindow::setTransientParent(QWindow *parent)
{
Q_D(QWindow);
+ if (parent && !parent->isTopLevel()) {
+ qWarning() << Q_FUNC_INFO << parent << "must be a top level window.";
+ return;
+ }
+
d->transientParent = parent;
QGuiApplicationPrivate::updateBlockedStatus(this);
diff --git a/src/gui/text/qtextlayout.cpp b/src/gui/text/qtextlayout.cpp
index 435ef2637d..9919ce6bb4 100644
--- a/src/gui/text/qtextlayout.cpp
+++ b/src/gui/text/qtextlayout.cpp
@@ -108,6 +108,10 @@ QT_BEGIN_NAMESPACE
This class is only used if the text layout is used to lay out
parts of a QTextDocument.
+ Normally, you do not need to create a QTextInlineObject. It is
+ used by QAbstractTextDocumentLayout to handle inline objects when
+ implementing a custom layout.
+
The inline object has various attributes that can be set, for
example using, setWidth(), setAscent(), and setDescent(). The
rectangle it occupies is given by rect(), and its direction by
@@ -117,6 +121,7 @@ QT_BEGIN_NAMESPACE
/*!
\fn QTextInlineObject::QTextInlineObject(int i, QTextEngine *e)
+ \internal
Creates a new inline object for the item at position \a i in the
text engine \a e.
diff --git a/src/network/access/qnetworkdiskcache.cpp b/src/network/access/qnetworkdiskcache.cpp
index a1cbd9364e..86a3b20a9c 100644
--- a/src/network/access/qnetworkdiskcache.cpp
+++ b/src/network/access/qnetworkdiskcache.cpp
@@ -56,7 +56,7 @@
#define CACHE_POSTFIX QLatin1String(".d")
#define PREPARED_SLASH QLatin1String("prepared/")
-#define CACHE_VERSION 7
+#define CACHE_VERSION 8
#define DATA_DIR QLatin1String("data")
#define MAX_COMPRESSION_SIZE (1024 * 1024 * 3)
@@ -686,6 +686,7 @@ void QCacheItem::writeHeader(QFile *device) const
out << qint32(CacheMagic);
out << qint32(CurrentCacheVersion);
+ out << static_cast<qint32>(out.version());
out << metaData;
bool compressed = canCompress();
out << compressed;
@@ -719,6 +720,13 @@ bool QCacheItem::read(QFile *device, bool readData)
if (v != CurrentCacheVersion)
return false;
+ qint32 streamVersion;
+ in >> streamVersion;
+ // Default stream version is also the highest we can handle
+ if (streamVersion > in.version())
+ return false;
+ in.setVersion(streamVersion);
+
bool compressed;
QByteArray dataBA;
in >> metaData;
diff --git a/src/plugins/platforms/windows/qwindowstabletsupport.cpp b/src/plugins/platforms/windows/qwindowstabletsupport.cpp
index 2a1e5c58b9..8ceab02311 100644
--- a/src/plugins/platforms/windows/qwindowstabletsupport.cpp
+++ b/src/plugins/platforms/windows/qwindowstabletsupport.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the plugins of the Qt Toolkit.
@@ -347,7 +347,13 @@ QWindowsTabletDeviceData QWindowsTabletSupport::tabletInit(const quint64 uniqueI
bool QWindowsTabletSupport::translateTabletProximityEvent(WPARAM /* wParam */, LPARAM lParam)
{
- const bool enteredProximity = LOWORD(lParam) != 0;
+ if (!LOWORD(lParam)) {
+ qCDebug(lcQpaTablet) << "leave proximity for device #" << m_currentDevice;
+ QWindowSystemInterface::handleTabletLeaveProximityEvent(m_devices.at(m_currentDevice).currentDevice,
+ m_devices.at(m_currentDevice).currentPointerType,
+ m_devices.at(m_currentDevice).uniqueId);
+ return true;
+ }
PACKET proximityBuffer[1]; // we are only interested in the first packet in this case
const int totalPacks = QWindowsTabletSupport::m_winTab32DLL.wTPacketsGet(m_context, 1, proximityBuffer);
if (!totalPacks)
@@ -367,17 +373,11 @@ bool QWindowsTabletSupport::translateTabletProximityEvent(WPARAM /* wParam */, L
m_devices.push_back(tabletInit(uniqueId, cursorType));
}
m_devices[m_currentDevice].currentPointerType = pointerType(currentCursor);
- qCDebug(lcQpaTablet) << __FUNCTION__ << (enteredProximity ? "enter" : "leave")
- << " proximity for device #" << m_currentDevice << m_devices.at(m_currentDevice);
- if (enteredProximity) {
- QWindowSystemInterface::handleTabletEnterProximityEvent(m_devices.at(m_currentDevice).currentDevice,
- m_devices.at(m_currentDevice).currentPointerType,
- m_devices.at(m_currentDevice).uniqueId);
- } else {
- QWindowSystemInterface::handleTabletLeaveProximityEvent(m_devices.at(m_currentDevice).currentDevice,
- m_devices.at(m_currentDevice).currentPointerType,
- m_devices.at(m_currentDevice).uniqueId);
- }
+ qCDebug(lcQpaTablet) << "enter proximity for device #"
+ << m_currentDevice << m_devices.at(m_currentDevice);
+ QWindowSystemInterface::handleTabletEnterProximityEvent(m_devices.at(m_currentDevice).currentDevice,
+ m_devices.at(m_currentDevice).currentPointerType,
+ m_devices.at(m_currentDevice).uniqueId);
return true;
}
diff --git a/src/plugins/platforms/windows/qwindowswindow.cpp b/src/plugins/platforms/windows/qwindowswindow.cpp
index 51497b3300..c5978c125c 100644
--- a/src/plugins/platforms/windows/qwindowswindow.cpp
+++ b/src/plugins/platforms/windows/qwindowswindow.cpp
@@ -1709,8 +1709,11 @@ void QWindowsWindow::setWindowState_sys(Qt::WindowState newState)
if (!wasSync)
clearFlag(SynchronousGeometryChangeEvent);
// preserve maximized state
- if (visible)
+ if (visible) {
+ setFlag(WithinMaximize);
ShowWindow(m_data.hwnd, (newState == Qt::WindowMaximized) ? SW_MAXIMIZE : SW_SHOWNOACTIVATE);
+ clearFlag(WithinMaximize);
+ }
m_savedStyle = 0;
m_savedFrameGeometry = QRect();
}
diff --git a/src/printsupport/kernel/qpaintengine_alpha.cpp b/src/printsupport/kernel/qpaintengine_alpha.cpp
index ebb1b85e83..cdf5570979 100644
--- a/src/printsupport/kernel/qpaintengine_alpha.cpp
+++ b/src/printsupport/kernel/qpaintengine_alpha.cpp
@@ -359,7 +359,10 @@ void QAlphaPaintEngine::flushAndInit(bool init)
d->m_picpainter->setOpacity(painter()->opacity());
d->m_picpainter->setTransform(painter()->combinedTransform());
d->m_picengine->syncState();
- *d->m_picpainter->d_func()->state = *painter()->d_func()->state;
+ QPainterState &state = *d->m_picpainter->d_func()->state;
+ QPainter *oldPainter = state.painter;
+ state = *painter()->d_func()->state;
+ state.painter = oldPainter;
}
}
diff --git a/src/widgets/kernel/qwidget.cpp b/src/widgets/kernel/qwidget.cpp
index ef7bd8c3a5..e692a985eb 100644
--- a/src/widgets/kernel/qwidget.cpp
+++ b/src/widgets/kernel/qwidget.cpp
@@ -1435,7 +1435,7 @@ void QWidgetPrivate::create_sys(WId window, bool initializeWindow, bool destroyO
if (QWidget *nativeParent = q->nativeParentWidget()) {
if (nativeParent->windowHandle()) {
if (flags & Qt::Window) {
- win->setTransientParent(nativeParent->windowHandle());
+ win->setTransientParent(nativeParent->window()->windowHandle());
win->setParent(0);
} else {
win->setTransientParent(0);
diff --git a/src/widgets/widgets.pro b/src/widgets/widgets.pro
index c2cf4b7dfe..d819436f66 100644
--- a/src/widgets/widgets.pro
+++ b/src/widgets/widgets.pro
@@ -8,6 +8,9 @@ DEFINES += QT_NO_USING_NAMESPACE
win32-msvc*|win32-icc:QMAKE_LFLAGS += /BASE:0x65000000
irix-cc*:QMAKE_CXXFLAGS += -no_prelink -ptused
+MODULE_PLUGIN_TYPES += \
+ styles
+
QMAKE_DOCS = $$PWD/doc/qtwidgets.qdocconf
load(qt_module)
diff --git a/src/widgets/widgets/qsplitter.cpp b/src/widgets/widgets/qsplitter.cpp
index f58881af0d..1f29af319a 100644
--- a/src/widgets/widgets/qsplitter.cpp
+++ b/src/widgets/widgets/qsplitter.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the QtWidgets module of the Qt Toolkit.
@@ -1224,7 +1224,9 @@ void QSplitter::childEvent(QChildEvent *c)
return;
}
QWidget *w = static_cast<QWidget*>(c->child());
- if (c->added() && !d->blockChildAdd && !w->isWindow() && !d->findWidget(w)) {
+ if (w->isWindow())
+ return;
+ if (c->added() && !d->blockChildAdd && !d->findWidget(w)) {
d->insertWidget_helper(d->list.count(), w, false);
} else if (c->polished() && !d->blockChildAdd) {
if (isVisible() && !(w->isHidden() && w->testAttribute(Qt::WA_WState_ExplicitShowHide)))
diff --git a/sync.profile b/sync.profile
index de4db5bf85..e55a479de0 100644
--- a/sync.profile
+++ b/sync.profile
@@ -34,6 +34,7 @@
"qnamespace.h" => "Qt",
"qnumeric.h" => "QtNumeric",
"qvariant.h" => "QVariantHash,QVariantList,QVariantMap",
+ "qgl.h" => "QGL",
"qsql.h" => "QSql",
"qssl.h" => "QSsl",
"qtest.h" => "QTest",
diff --git a/tests/auto/corelib/io/qurl/tst_qurl.cpp b/tests/auto/corelib/io/qurl/tst_qurl.cpp
index df090c3de9..28b68dc750 100644
--- a/tests/auto/corelib/io/qurl/tst_qurl.cpp
+++ b/tests/auto/corelib/io/qurl/tst_qurl.cpp
@@ -1029,6 +1029,13 @@ void tst_QUrl::toString_data()
QTest::newRow("underscore") << QString::fromLatin1("http://foo_bar.host.com/rss.php")
<< uint(QUrl::None)
<< QString::fromLatin1("http://foo_bar.host.com/rss.php");
+
+ QTest::newRow("mailto-brackets") << QString::fromLatin1("mailto:test[at]gmail[dot]com")
+ << uint(QUrl::PrettyDecoded)
+ << QString::fromLatin1("mailto:test[at]gmail[dot]com");
+ QTest::newRow("mailto-query") << QString::fromLatin1("mailto:?to=test@example.com")
+ << uint(QUrl::PrettyDecoded)
+ << QString::fromLatin1("mailto:?to=test@example.com");
}
void tst_QUrl::toString()
diff --git a/tests/auto/gui/text/qcssparser/qcssparser.pro b/tests/auto/gui/text/qcssparser/qcssparser.pro
index 346a38d5f6..bb0c8c4f40 100644
--- a/tests/auto/gui/text/qcssparser/qcssparser.pro
+++ b/tests/auto/gui/text/qcssparser/qcssparser.pro
@@ -15,3 +15,8 @@ wince* {
DEPLOYMENT += addFiles timesFont
}
+android {
+ RESOURCES += \
+ testdata.qrc
+
+}
diff --git a/tests/auto/gui/text/qcssparser/testdata.qrc b/tests/auto/gui/text/qcssparser/testdata.qrc
new file mode 100644
index 0000000000..56e45cfbb0
--- /dev/null
+++ b/tests/auto/gui/text/qcssparser/testdata.qrc
@@ -0,0 +1,18 @@
+<RCC>
+ <qresource prefix="/">
+ <file>testdata/scanner/comments/input</file>
+ <file>testdata/scanner/comments/output</file>
+ <file>testdata/scanner/comments2/input</file>
+ <file>testdata/scanner/comments2/output</file>
+ <file>testdata/scanner/comments3/input</file>
+ <file>testdata/scanner/comments3/output</file>
+ <file>testdata/scanner/comments4/input</file>
+ <file>testdata/scanner/comments4/output</file>
+ <file>testdata/scanner/quotedstring/input</file>
+ <file>testdata/scanner/quotedstring/output</file>
+ <file>testdata/scanner/simple/input</file>
+ <file>testdata/scanner/simple/output</file>
+ <file>testdata/scanner/unicode/input</file>
+ <file>testdata/scanner/unicode/output</file>
+ </qresource>
+</RCC>
diff --git a/tests/auto/gui/text/qcssparser/tst_qcssparser.cpp b/tests/auto/gui/text/qcssparser/tst_qcssparser.cpp
index 86e282fad2..719ca5a0a7 100644
--- a/tests/auto/gui/text/qcssparser/tst_qcssparser.cpp
+++ b/tests/auto/gui/text/qcssparser/tst_qcssparser.cpp
@@ -130,7 +130,9 @@ void tst_QCssParser::scanner_data()
QTest::addColumn<QString>("input");
QTest::addColumn<QString>("output");
-#if !defined(Q_OS_IRIX) && !defined(Q_OS_WINCE)
+#if defined(Q_OS_ANDROID)
+ QDir d(":/");
+#elif !defined(Q_OS_IRIX) && !defined(Q_OS_WINCE)
QDir d(SRCDIR);
#else
QDir d(QDir::current());
diff --git a/tests/auto/gui/text/qglyphrun/qglyphrun.pro b/tests/auto/gui/text/qglyphrun/qglyphrun.pro
index db28a690a7..0993a5c49c 100644
--- a/tests/auto/gui/text/qglyphrun/qglyphrun.pro
+++ b/tests/auto/gui/text/qglyphrun/qglyphrun.pro
@@ -8,8 +8,14 @@ linux: CONFIG += insignificant_test
SOURCES += \
tst_qglyphrun.cpp
+android {
+ RESOURCES += \
+ testdata.qrc
+}
+
wince* {
- DEFINES += SRCDIR=\\\"\\\"
-} else {
- DEFINES += SRCDIR=\\\"$$PWD/\\\"
+ additionalFiles.files = test.ttf
+ additionalFiles.path = .
+ DEPLOYMENT += additionalFiles
}
+
diff --git a/tests/auto/gui/text/qglyphrun/testdata.qrc b/tests/auto/gui/text/qglyphrun/testdata.qrc
new file mode 100644
index 0000000000..c4e237ad2f
--- /dev/null
+++ b/tests/auto/gui/text/qglyphrun/testdata.qrc
@@ -0,0 +1,5 @@
+<RCC>
+ <qresource prefix="/">
+ <file>test.ttf</file>
+ </qresource>
+</RCC>
diff --git a/tests/auto/gui/text/qglyphrun/tst_qglyphrun.cpp b/tests/auto/gui/text/qglyphrun/tst_qglyphrun.cpp
index 3d2cde5fd3..f576627745 100644
--- a/tests/auto/gui/text/qglyphrun/tst_qglyphrun.cpp
+++ b/tests/auto/gui/text/qglyphrun/tst_qglyphrun.cpp
@@ -94,7 +94,7 @@ void tst_QGlyphRun::initTestCase()
{
m_testFont_ok = false;
- m_testFontId = QFontDatabase::addApplicationFont(SRCDIR "test.ttf");
+ m_testFontId = QFontDatabase::addApplicationFont(QFINDTESTDATA("test.ttf"));
QVERIFY(m_testFontId >= 0);
m_testFont = QFont("QtsSpecialTestFont");
diff --git a/tests/auto/gui/text/qrawfont/qrawfont.pro b/tests/auto/gui/text/qrawfont/qrawfont.pro
index 540ffb94d7..1891e7a9bf 100644
--- a/tests/auto/gui/text/qrawfont/qrawfont.pro
+++ b/tests/auto/gui/text/qrawfont/qrawfont.pro
@@ -8,3 +8,8 @@ SOURCES += \
tst_qrawfont.cpp
TESTDATA += testfont_bold_italic.ttf testfont.ttf
+
+android {
+ RESOURCES += \
+ testdata.qrc
+}
diff --git a/tests/auto/gui/text/qrawfont/testdata.qrc b/tests/auto/gui/text/qrawfont/testdata.qrc
new file mode 100644
index 0000000000..7bea0d5a39
--- /dev/null
+++ b/tests/auto/gui/text/qrawfont/testdata.qrc
@@ -0,0 +1,6 @@
+<RCC>
+ <qresource prefix="/">
+ <file>testfont_bold_italic.ttf</file>
+ <file>testfont.ttf</file>
+ </qresource>
+</RCC>
diff --git a/tests/auto/gui/text/qzip/qzip.pro b/tests/auto/gui/text/qzip/qzip.pro
index 309f2167d1..ebcd6ec022 100644
--- a/tests/auto/gui/text/qzip/qzip.pro
+++ b/tests/auto/gui/text/qzip/qzip.pro
@@ -7,7 +7,9 @@ wince* {
addFiles.files = testdata
addFiles.path = .
DEPLOYMENT += addFiles
- DEFINES += SRCDIR=\\\".\\\"
-} else {
- DEFINES += SRCDIR=\\\"$$PWD\\\"
+}
+
+android {
+ RESOURCES += \
+ testdata.qrc
}
diff --git a/tests/auto/gui/text/qzip/testdata.qrc b/tests/auto/gui/text/qzip/testdata.qrc
new file mode 100644
index 0000000000..c7e3a6b14e
--- /dev/null
+++ b/tests/auto/gui/text/qzip/testdata.qrc
@@ -0,0 +1,6 @@
+<RCC>
+ <qresource prefix="/">
+ <file>testdata/symlink.zip</file>
+ <file>testdata/test.zip</file>
+ </qresource>
+</RCC>
diff --git a/tests/auto/gui/text/qzip/tst_qzip.cpp b/tests/auto/gui/text/qzip/tst_qzip.cpp
index c5ce6c2676..9a5c4aaab9 100644
--- a/tests/auto/gui/text/qzip/tst_qzip.cpp
+++ b/tests/auto/gui/text/qzip/tst_qzip.cpp
@@ -68,7 +68,7 @@ void tst_QZip::cleanup()
void tst_QZip::basicUnpack()
{
- QZipReader zip(QString(SRCDIR) + "/testdata/test.zip", QIODevice::ReadOnly);
+ QZipReader zip(QFINDTESTDATA("/testdata/test.zip"), QIODevice::ReadOnly);
QList<QZipReader::FileInfo> files = zip.fileInfoList();
QCOMPARE(files.count(), 2);
@@ -104,7 +104,7 @@ void tst_QZip::basicUnpack()
void tst_QZip::symlinks()
{
- QZipReader zip(QString(SRCDIR) + "/testdata/symlink.zip", QIODevice::ReadOnly);
+ QZipReader zip(QFINDTESTDATA("/testdata/symlink.zip"), QIODevice::ReadOnly);
QList<QZipReader::FileInfo> files = zip.fileInfoList();
QCOMPARE(files.count(), 2);
diff --git a/tests/auto/network/access/qnetworkdiskcache/tst_qnetworkdiskcache.cpp b/tests/auto/network/access/qnetworkdiskcache/tst_qnetworkdiskcache.cpp
index 4740b92b84..d28f11ff9d 100644
--- a/tests/auto/network/access/qnetworkdiskcache/tst_qnetworkdiskcache.cpp
+++ b/tests/auto/network/access/qnetworkdiskcache/tst_qnetworkdiskcache.cpp
@@ -85,6 +85,9 @@ private slots:
void oldCacheVersionFile_data();
void oldCacheVersionFile();
+ void streamVersion_data();
+ void streamVersion();
+
void sync();
void crashWhenParentingCache();
@@ -568,6 +571,74 @@ void tst_QNetworkDiskCache::oldCacheVersionFile()
}
}
+void tst_QNetworkDiskCache::streamVersion_data()
+{
+ QTest::addColumn<int>("version");
+ QTest::newRow("Qt 5.1") << int(QDataStream::Qt_5_1);
+ QDataStream ds;
+ QTest::newRow("current") << ds.version();
+ QTest::newRow("higher than current") << ds.version() + 1;
+}
+
+void tst_QNetworkDiskCache::streamVersion()
+{
+ SubQNetworkDiskCache cache;
+ QUrl url(EXAMPLE_URL);
+ cache.setupWithOne(tempDir.path(), url);
+
+ QString cacheFile;
+ // find the file
+ QStringList files = countFiles(cache.cacheDirectory());
+ foreach (const QString &file, files) {
+ QFileInfo info(file);
+ if (info.isFile()) {
+ cacheFile = file;
+ break;
+ }
+ }
+
+ QFile file(cacheFile);
+ QVERIFY(file.open(QFile::ReadWrite|QIODevice::Truncate));
+ QDataStream out(&file);
+ QFETCH(int, version);
+ if (version < out.version())
+ out.setVersion(version);
+ out << qint32(0xe8); // cache magic
+ // Following code works only for cache file version 8 and should be updated on version change
+ out << qint32(8);
+ out << qint32(version);
+
+ QNetworkCacheMetaData md;
+ md.setUrl(url);
+ QNetworkCacheMetaData::RawHeader header("content-type", "text/html");
+ QNetworkCacheMetaData::RawHeaderList list;
+ list.append(header);
+ md.setRawHeaders(list);
+ md.setLastModified(QDateTime::currentDateTimeUtc().toOffsetFromUtc(3600));
+ out << md;
+
+ bool compressed = true;
+ out << compressed;
+
+ QByteArray data("Hello World!");
+ out << qCompress(data);
+
+ file.close();
+
+ QNetworkCacheMetaData cachedMetaData = cache.call_fileMetaData(cacheFile);
+ if (version > out.version()) {
+ QVERIFY(!cachedMetaData.isValid());
+ QVERIFY(!QFile::exists(cacheFile));
+ } else {
+ QVERIFY(cachedMetaData.isValid());
+ QVERIFY(QFile::exists(cacheFile));
+ QIODevice *dataDevice = cache.data(url);
+ QVERIFY(dataDevice != 0);
+ QByteArray cachedData = dataDevice->readAll();
+ QCOMPARE(cachedData, data);
+ }
+}
+
class Runner : public QThread
{
diff --git a/tests/auto/widgets/dialogs/qdialog/tst_qdialog.cpp b/tests/auto/widgets/dialogs/qdialog/tst_qdialog.cpp
index c3d2c4a9e7..cd9ff28891 100644
--- a/tests/auto/widgets/dialogs/qdialog/tst_qdialog.cpp
+++ b/tests/auto/widgets/dialogs/qdialog/tst_qdialog.cpp
@@ -50,6 +50,7 @@
#include <QVBoxLayout>
#include <QSizeGrip>
#include <QDesktopWidget>
+#include <QWindow>
#include <private/qguiapplication_p.h>
#include <qpa/qplatformtheme.h>
#include <qpa/qplatformtheme_p.h>
@@ -85,6 +86,8 @@ private slots:
void setVisible();
void reject();
void snapToDefaultButton();
+ void transientParent_data();
+ void transientParent();
private:
QDialog *testWidget;
@@ -584,5 +587,34 @@ void tst_QDialog::snapToDefaultButton()
#endif // !QT_NO_CURSOR
}
+void tst_QDialog::transientParent_data()
+{
+ QTest::addColumn<bool>("nativewidgets");
+ QTest::newRow("Non-native") << false;
+ QTest::newRow("Native") << true;
+}
+
+void tst_QDialog::transientParent()
+{
+ QFETCH(bool, nativewidgets);
+ testWidget->hide();
+ QWidget topLevel;
+ topLevel.resize(200, 200);
+ topLevel.move(QGuiApplication::primaryScreen()->availableGeometry().center() - QPoint(100, 100));
+ QVBoxLayout *layout = new QVBoxLayout(&topLevel);
+ QWidget *innerWidget = new QWidget(&topLevel);
+ layout->addWidget(innerWidget);
+ if (nativewidgets)
+ innerWidget->winId();
+ topLevel.show();
+ QVERIFY(QTest::qWaitForWindowExposed(&topLevel));
+ QDialog dialog(innerWidget);
+ dialog.show();
+ QVERIFY(QTest::qWaitForWindowExposed(&dialog));
+ // Transient parent should always be the top level, also when using
+ // native child widgets.
+ QCOMPARE(dialog.windowHandle()->transientParent(), topLevel.windowHandle());
+}
+
QTEST_MAIN(tst_QDialog)
#include "tst_qdialog.moc"
diff --git a/tests/auto/widgets/widgets/qsplitter/tst_qsplitter.cpp b/tests/auto/widgets/widgets/qsplitter/tst_qsplitter.cpp
index 8de3291207..d66a10ae56 100644
--- a/tests/auto/widgets/widgets/qsplitter/tst_qsplitter.cpp
+++ b/tests/auto/widgets/widgets/qsplitter/tst_qsplitter.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the test suite of the Qt Toolkit.
@@ -54,6 +54,8 @@
#include <qtextedit.h>
#include <qtreeview.h>
#include <qlabel.h>
+#include <qdialog.h>
+#include <qscreen.h>
#include <qdebug.h> // for file error messages
QT_FORWARD_DECLARE_CLASS(QSplitter)
@@ -94,6 +96,8 @@ private slots:
void taskQTBUG_4101_ensureOneNonCollapsedWidget_data();
void taskQTBUG_4101_ensureOneNonCollapsedWidget();
void setLayout();
+ void autoAdd();
+
private:
void removeThirdWidget();
void addThirdWidget();
@@ -781,5 +785,28 @@ void tst_QSplitter::setLayout()
QCOMPARE(splitter.layout(), &layout);
}
+void tst_QSplitter::autoAdd()
+{
+ QSplitter splitter;
+ splitter.setWindowTitle("autoAdd");
+ splitter.setMinimumSize(QSize(200, 200));
+ splitter.move(QGuiApplication::primaryScreen()->availableGeometry().center() - QPoint(100, 100));
+ splitter.show();
+ QVERIFY(QTest::qWaitForWindowExposed(&splitter));
+ // Constructing a child widget on the splitter should
+ // automatically add and show it.
+ QWidget *childWidget = new QWidget(&splitter);
+ QCOMPARE(splitter.count(), 1);
+ QTRY_VERIFY(childWidget->isVisible());
+ // Deleting should automatically remove it
+ delete childWidget;
+ QCOMPARE(splitter.count(), 0);
+ // QTBUG-40132, top level windows should not be affected by this.
+ QDialog *dialog = new QDialog(&splitter);
+ QCOMPARE(splitter.count(), 0);
+ QCoreApplication::processEvents();
+ QVERIFY(!dialog->isVisible());
+}
+
QTEST_MAIN(tst_QSplitter)
#include "tst_qsplitter.moc"