summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorFrederik Gladhorn <frederik.gladhorn@digia.com>2013-11-18 12:27:03 +0100
committerFrederik Gladhorn <frederik.gladhorn@digia.com>2013-11-18 12:27:04 +0100
commit72ea7900858a31c1c6b93e6fed9f2f4dc30291e4 (patch)
tree89c4dd69ad88dde8ec506dbf1a2fae79ef454914 /tests
parentaafbd7392ead765c2038a1ac6b569d083effb81d (diff)
parenteb122a6fe4de5b95acb287f92c6ca5e81864b1c6 (diff)
Merge remote-tracking branch 'origin/release' into stable
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/corelib/io/qfileselector/platforms/+android/test2 (renamed from tests/auto/corelib/io/qfileselector/platforms/+generic_unix/test)0
-rw-r--r--tests/auto/corelib/io/qfileselector/platforms/+blackberry/test20
-rw-r--r--tests/auto/corelib/io/qfileselector/platforms/+ios/test20
-rw-r--r--tests/auto/corelib/io/qfileselector/platforms/+linux/test20
-rw-r--r--tests/auto/corelib/io/qfileselector/platforms/+mac/test0
-rw-r--r--tests/auto/corelib/io/qfileselector/platforms/+mac/test20
-rw-r--r--tests/auto/corelib/io/qfileselector/platforms/+unix/+android/test0
-rw-r--r--tests/auto/corelib/io/qfileselector/platforms/+unix/+blackberry/test0
-rw-r--r--tests/auto/corelib/io/qfileselector/platforms/+unix/+ios/test0
-rw-r--r--tests/auto/corelib/io/qfileselector/platforms/+unix/+linux/test0
-rw-r--r--tests/auto/corelib/io/qfileselector/platforms/+unix/+mac/test0
-rw-r--r--tests/auto/corelib/io/qfileselector/platforms/+unix/test0
-rw-r--r--tests/auto/corelib/io/qfileselector/platforms/+wince/test20
-rw-r--r--tests/auto/corelib/io/qfileselector/platforms/+windows/+wince/test0
-rw-r--r--tests/auto/corelib/io/qfileselector/platforms/+windows/test20
-rw-r--r--tests/auto/corelib/io/qfileselector/platforms/test20
-rw-r--r--tests/auto/corelib/io/qfileselector/qfileselector.qrc22
-rw-r--r--tests/auto/corelib/io/qfileselector/tst_qfileselector.cpp30
-rw-r--r--tests/auto/corelib/plugin/quuid/tst_quuid.cpp12
-rw-r--r--tests/auto/corelib/tools/qalgorithms/tst_qalgorithms.cpp2
-rw-r--r--tests/auto/corelib/tools/qcollator/qcollator.pro7
-rw-r--r--tests/auto/corelib/tools/qcollator/tst_qcollator.cpp92
-rw-r--r--tests/auto/corelib/tools/tools.pro1
-rw-r--r--tests/auto/printsupport/kernel/qprinter/tst_qprinter.cpp79
-rw-r--r--tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp6
-rw-r--r--tests/auto/widgets/itemviews/qtreeview/tst_qtreeview.cpp30
-rw-r--r--tests/auto/xml/sax/qxmlsimplereader/tst_qxmlsimplereader.cpp2
27 files changed, 272 insertions, 11 deletions
diff --git a/tests/auto/corelib/io/qfileselector/platforms/+generic_unix/test b/tests/auto/corelib/io/qfileselector/platforms/+android/test2
index e69de29bb2..e69de29bb2 100644
--- a/tests/auto/corelib/io/qfileselector/platforms/+generic_unix/test
+++ b/tests/auto/corelib/io/qfileselector/platforms/+android/test2
diff --git a/tests/auto/corelib/io/qfileselector/platforms/+blackberry/test2 b/tests/auto/corelib/io/qfileselector/platforms/+blackberry/test2
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/tests/auto/corelib/io/qfileselector/platforms/+blackberry/test2
diff --git a/tests/auto/corelib/io/qfileselector/platforms/+ios/test2 b/tests/auto/corelib/io/qfileselector/platforms/+ios/test2
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/tests/auto/corelib/io/qfileselector/platforms/+ios/test2
diff --git a/tests/auto/corelib/io/qfileselector/platforms/+linux/test2 b/tests/auto/corelib/io/qfileselector/platforms/+linux/test2
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/tests/auto/corelib/io/qfileselector/platforms/+linux/test2
diff --git a/tests/auto/corelib/io/qfileselector/platforms/+mac/test b/tests/auto/corelib/io/qfileselector/platforms/+mac/test
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/tests/auto/corelib/io/qfileselector/platforms/+mac/test
diff --git a/tests/auto/corelib/io/qfileselector/platforms/+mac/test2 b/tests/auto/corelib/io/qfileselector/platforms/+mac/test2
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/tests/auto/corelib/io/qfileselector/platforms/+mac/test2
diff --git a/tests/auto/corelib/io/qfileselector/platforms/+unix/+android/test b/tests/auto/corelib/io/qfileselector/platforms/+unix/+android/test
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/tests/auto/corelib/io/qfileselector/platforms/+unix/+android/test
diff --git a/tests/auto/corelib/io/qfileselector/platforms/+unix/+blackberry/test b/tests/auto/corelib/io/qfileselector/platforms/+unix/+blackberry/test
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/tests/auto/corelib/io/qfileselector/platforms/+unix/+blackberry/test
diff --git a/tests/auto/corelib/io/qfileselector/platforms/+unix/+ios/test b/tests/auto/corelib/io/qfileselector/platforms/+unix/+ios/test
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/tests/auto/corelib/io/qfileselector/platforms/+unix/+ios/test
diff --git a/tests/auto/corelib/io/qfileselector/platforms/+unix/+linux/test b/tests/auto/corelib/io/qfileselector/platforms/+unix/+linux/test
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/tests/auto/corelib/io/qfileselector/platforms/+unix/+linux/test
diff --git a/tests/auto/corelib/io/qfileselector/platforms/+unix/+mac/test b/tests/auto/corelib/io/qfileselector/platforms/+unix/+mac/test
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/tests/auto/corelib/io/qfileselector/platforms/+unix/+mac/test
diff --git a/tests/auto/corelib/io/qfileselector/platforms/+unix/test b/tests/auto/corelib/io/qfileselector/platforms/+unix/test
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/tests/auto/corelib/io/qfileselector/platforms/+unix/test
diff --git a/tests/auto/corelib/io/qfileselector/platforms/+wince/test2 b/tests/auto/corelib/io/qfileselector/platforms/+wince/test2
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/tests/auto/corelib/io/qfileselector/platforms/+wince/test2
diff --git a/tests/auto/corelib/io/qfileselector/platforms/+windows/+wince/test b/tests/auto/corelib/io/qfileselector/platforms/+windows/+wince/test
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/tests/auto/corelib/io/qfileselector/platforms/+windows/+wince/test
diff --git a/tests/auto/corelib/io/qfileselector/platforms/+windows/test2 b/tests/auto/corelib/io/qfileselector/platforms/+windows/test2
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/tests/auto/corelib/io/qfileselector/platforms/+windows/test2
diff --git a/tests/auto/corelib/io/qfileselector/platforms/test2 b/tests/auto/corelib/io/qfileselector/platforms/test2
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/tests/auto/corelib/io/qfileselector/platforms/test2
diff --git a/tests/auto/corelib/io/qfileselector/qfileselector.qrc b/tests/auto/corelib/io/qfileselector/qfileselector.qrc
index c644e41107..abfead2a55 100644
--- a/tests/auto/corelib/io/qfileselector/qfileselector.qrc
+++ b/tests/auto/corelib/io/qfileselector/qfileselector.qrc
@@ -11,13 +11,27 @@
<file>extras/+custom3/+custom5/test</file>
<file>extras/+custom5/+custom3/test</file>
<file>platforms/test</file>
+ <file>platforms/+unix/+android/test</file>
+ <file>platforms/+unix/+blackberry/test</file>
+ <file>platforms/+unix/+ios/test</file>
+ <file>platforms/+unix/+mac/test</file>
+ <file>platforms/+windows/+wince/test</file>
+ <file>platforms/+windows/test</file>
+ <file>platforms/+windows/test2</file>
+ <file>platforms/+unix/+linux/test</file>
+ <file>platforms/+unix/test</file>
+ <file>platforms/test2</file>
+ <file>platforms/+android/test2</file>
+ <file>platforms/+blackberry/test2</file>
+ <file>platforms/+ios/test2</file>
+ <file>platforms/+mac/test2</file>
+ <file>platforms/+linux/test2</file>
+ <file>platforms/+wince/test2</file>
<file>platforms/+android/test</file>
<file>platforms/+blackberry/test</file>
<file>platforms/+ios/test</file>
- <file>platforms/+osx/test</file>
- <file>platforms/+wince/test</file>
- <file>platforms/+windows/test</file>
+ <file>platforms/+mac/test</file>
<file>platforms/+linux/test</file>
- <file>platforms/+generic_unix/test</file>
+ <file>platforms/+wince/test</file>
</qresource>
</RCC>
diff --git a/tests/auto/corelib/io/qfileselector/tst_qfileselector.cpp b/tests/auto/corelib/io/qfileselector/tst_qfileselector.cpp
index 2baebd0296..d6461c3aba 100644
--- a/tests/auto/corelib/io/qfileselector/tst_qfileselector.cpp
+++ b/tests/auto/corelib/io/qfileselector/tst_qfileselector.cpp
@@ -91,9 +91,33 @@ void tst_QFileSelector::basicTest_data()
QTest::addColumn<QString>("expectedPath");
QString test("/test");// '/' is here so dir string can also be selector string
- QTest::newRow("platform") << QString(":/platforms/test") << QStringList()
- << QString(":/platforms/") + QLatin1Char(selectorIndicator)
- + QFileSelectorPrivate::platformSelectors().first() + test;
+ QString test2("/test2");
+ QString expectedPlatform1File(":/platforms");
+ QString expectedPlatform2File(""); //Only the last selector
+#if defined(Q_OS_UNIX) && !defined(Q_OS_ANDROID) && !defined(Q_OS_BLACKBERRY) && !defined(Q_OS_IOS) && !defined(Q_OS_LINUX) && !defined(Q_OS_MAC)
+ /* We are only aware of specific unixes, and do not have test files for any of the others.
+ However those unixes can get a selector added from the result of a uname call, so this will
+ lead to a case where we don't have that file so we can't expect the concatenation of platform
+ selectors to work. It should just find the +unix/test file.*/
+ expectedPlatform1File = QString(":/platforms/") + QLatin1Char(selectorIndicator)
+ + QString("unix/test");
+ expectedPlatform2File = QString(":/platforms/test2");
+#else
+ foreach (const QString &selector, QFileSelectorPrivate::platformSelectors()) {
+ expectedPlatform1File = expectedPlatform1File + QLatin1Char('/') + QLatin1Char(selectorIndicator)
+ + selector;
+ expectedPlatform2File = selector;
+ }
+ expectedPlatform1File += test;
+ expectedPlatform2File = QLatin1String(":/platforms/") + QLatin1Char(selectorIndicator)
+ + expectedPlatform2File + test2;
+#endif
+
+ QTest::newRow("platform1") << QString(":/platforms/test") << QStringList()
+ << expectedPlatform1File;
+
+ QTest::newRow("platform2") << QString(":/platforms/test2") << QStringList()
+ << expectedPlatform2File;
QString resourceTestPath(":/extras/test");
QString custom1("custom1");
diff --git a/tests/auto/corelib/plugin/quuid/tst_quuid.cpp b/tests/auto/corelib/plugin/quuid/tst_quuid.cpp
index 197d56359f..227351485d 100644
--- a/tests/auto/corelib/plugin/quuid/tst_quuid.cpp
+++ b/tests/auto/corelib/plugin/quuid/tst_quuid.cpp
@@ -64,6 +64,7 @@ private slots:
void isNull();
void equal();
void notEqual();
+ void cpp11();
// Only in Qt > 3.2.x
void generate();
@@ -245,6 +246,17 @@ void tst_QUuid::notEqual()
QVERIFY( uuidA != uuidB );
}
+void tst_QUuid::cpp11() {
+#ifdef Q_COMPILER_UNIFORM_INIT
+ // "{fc69b59e-cc34-4436-a43c-ee95d128b8c5}" cf, initTestCase
+ Q_DECL_CONSTEXPR QUuid u1{0xfc69b59e, 0xcc34, 0x4436, 0xa4, 0x3c, 0xee, 0x95, 0xd1, 0x28, 0xb8, 0xc5};
+ Q_DECL_CONSTEXPR QUuid u2 = {0xfc69b59e, 0xcc34, 0x4436, 0xa4, 0x3c, 0xee, 0x95, 0xd1, 0x28, 0xb8, 0xc5};
+ Q_UNUSED(u1);
+ Q_UNUSED(u2);
+#else
+ QSKIP("This compiler is not in C++11 mode or it doesn't support uniform initialization");
+#endif
+}
void tst_QUuid::generate()
{
diff --git a/tests/auto/corelib/tools/qalgorithms/tst_qalgorithms.cpp b/tests/auto/corelib/tools/qalgorithms/tst_qalgorithms.cpp
index 144bc62b1b..64eb91b7b6 100644
--- a/tests/auto/corelib/tools/qalgorithms/tst_qalgorithms.cpp
+++ b/tests/auto/corelib/tools/qalgorithms/tst_qalgorithms.cpp
@@ -1027,7 +1027,7 @@ void tst_QAlgorithms::binaryFindOnLargeContainer() const
}
// alternative implementation of qPopulationCount for comparison:
-static const uint bitsSetInNibble[] = {
+static Q_DECL_CONSTEXPR const uint bitsSetInNibble[] = {
0, 1, 1, 2, 1, 2, 2, 3,
1, 2, 2, 3, 2, 3, 3, 4,
};
diff --git a/tests/auto/corelib/tools/qcollator/qcollator.pro b/tests/auto/corelib/tools/qcollator/qcollator.pro
new file mode 100644
index 0000000000..3c5987ffa0
--- /dev/null
+++ b/tests/auto/corelib/tools/qcollator/qcollator.pro
@@ -0,0 +1,7 @@
+CONFIG += testcase parallel_test
+TARGET = tst_qcollator
+QT = core testlib
+SOURCES = tst_qcollator.cpp
+DEFINES += QT_NO_CAST_TO_ASCII
+contains(QT_CONFIG,icu):DEFINES += QT_USE_ICU
+DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
diff --git a/tests/auto/corelib/tools/qcollator/tst_qcollator.cpp b/tests/auto/corelib/tools/qcollator/tst_qcollator.cpp
new file mode 100644
index 0000000000..3df8422a34
--- /dev/null
+++ b/tests/auto/corelib/tools/qcollator/tst_qcollator.cpp
@@ -0,0 +1,92 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 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.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtTest/QtTest>
+
+#include <qlocale.h>
+#include <qcollator.h>
+
+#include <cstring>
+
+class tst_QCollator : public QObject
+{
+ Q_OBJECT
+
+private Q_SLOTS:
+ void moveSemantics();
+};
+
+#ifdef Q_COMPILER_RVALUE_REFS
+static bool dpointer_is_null(QCollator &c)
+{
+ char mem[sizeof c];
+ using namespace std;
+ memcpy(mem, &c, sizeof c);
+ for (size_t i = 0; i < sizeof c; ++i)
+ if (mem[i])
+ return false;
+ return true;
+}
+#endif
+
+void tst_QCollator::moveSemantics()
+{
+#ifdef Q_COMPILER_RVALUE_REFS
+ const QLocale de_AT(QLocale::German, QLocale::Austria);
+
+ QCollator c1(de_AT);
+ QCOMPARE(c1.locale(), de_AT);
+
+ QCollator c2(std::move(c1));
+ QCOMPARE(c2.locale(), de_AT);
+ QVERIFY(dpointer_is_null(c1));
+
+ c1 = std::move(c2);
+ QCOMPARE(c1.locale(), de_AT);
+ QVERIFY(dpointer_is_null(c2));
+#else
+ QSKIP("The compiler is not in C++11 mode or does not support move semantics.");
+#endif
+}
+
+QTEST_APPLESS_MAIN(tst_QCollator)
+
+#include "tst_qcollator.moc"
diff --git a/tests/auto/corelib/tools/tools.pro b/tests/auto/corelib/tools/tools.pro
index e920813db2..286afdfd18 100644
--- a/tests/auto/corelib/tools/tools.pro
+++ b/tests/auto/corelib/tools/tools.pro
@@ -8,6 +8,7 @@ SUBDIRS=\
qbytedatabuffer \
qcache \
qchar \
+ qcollator \
qcommandlineparser \
qcontiguouscache \
qcryptographichash \
diff --git a/tests/auto/printsupport/kernel/qprinter/tst_qprinter.cpp b/tests/auto/printsupport/kernel/qprinter/tst_qprinter.cpp
index 7251cca528..644cd33e5c 100644
--- a/tests/auto/printsupport/kernel/qprinter/tst_qprinter.cpp
+++ b/tests/auto/printsupport/kernel/qprinter/tst_qprinter.cpp
@@ -113,6 +113,8 @@ private slots:
void testCustomPageSizes();
void customPaperSizeAndMargins_data();
void customPaperSizeAndMargins();
+ void customPaperNameSettingBySize();
+ void customPaperNameSettingByName();
#if !defined(QT_NO_COMPLETER) && !defined(QT_NO_FILEDIALOG)
void printDialogCompleter();
#endif
@@ -967,6 +969,13 @@ void tst_QPrinter::errorReporting()
painter.end();
}
+static QByteArray msgSizeMismatch(const QSizeF &actual, const QSizeF &expected)
+{
+ QString result;
+ QDebug(&result) << "Paper size mismatch" << actual << "!=" << expected;
+ return result.toLocal8Bit();
+}
+
void tst_QPrinter::testCustomPageSizes()
{
QPrinter p;
@@ -975,12 +984,16 @@ void tst_QPrinter::testCustomPageSizes()
p.setPaperSize(customSize, QPrinter::Inch);
QSizeF paperSize = p.paperSize(QPrinter::Inch);
- QCOMPARE(paperSize, customSize);
+ // Due to the different calculations, the sizes may be off by a fraction so we have to check it manually
+ // instead of relying on QSizeF comparison
+ QVERIFY2(sqrt(pow(paperSize.width() - customSize.width(), 2.0) + pow(paperSize.height() - customSize.height(), 2.0)) < 0.01,
+ msgSizeMismatch(paperSize, customSize));
QPrinter p2(QPrinter::HighResolution);
p2.setPaperSize(customSize, QPrinter::Inch);
paperSize = p.paperSize(QPrinter::Inch);
- QCOMPARE(paperSize, customSize);
+ QVERIFY2(sqrt(pow(paperSize.width() - customSize.width(), 2.0) + pow(paperSize.height() - customSize.height(), 2.0)) < 0.01,
+ msgSizeMismatch(paperSize, customSize));
}
void tst_QPrinter::customPaperSizeAndMargins_data()
@@ -1193,6 +1206,68 @@ void tst_QPrinter::testPageMetrics()
QCOMPARE(printer.pageSizeMM(), QSizeF(widthMMf, heightMMf));
}
+void tst_QPrinter::customPaperNameSettingBySize()
+{
+#ifndef Q_OS_WIN
+ QSKIP("Currently this triggers a problem on non Windows platforms, this will be fixed separately - QTBUG-34521");
+#endif
+ QPrinter printer(QPrinter::HighResolution);
+ QPrinterInfo info(printer);
+ QList<QPair<QString, QSizeF> > sizes = info.supportedSizesWithNames();
+ if (sizes.size() == 0)
+ QSKIP("No printers installed on this machine");
+ for (int i=0; i<sizes.size(); i++) {
+ printer.setPaperSize(sizes.at(i).second, QPrinter::Millimeter);
+ QCOMPARE(sizes.at(i).second, printer.paperSize(QPrinter::Millimeter));
+ // Some printers have the same size under different names which can cause a problem for the test
+ // So we iterate up to the current position to check
+ QSizeF paperSize = sizes.at(i).second;
+ QString paperName = printer.paperName();
+ bool paperNameFound = (sizes.at(i).first == paperName);
+ if (!paperNameFound) {
+ for (int j=0; j<i; j++) {
+ if (sizes.at(j).second == paperSize && sizes.at(j).first == paperName) {
+ paperNameFound = true;
+ break;
+ }
+ }
+ }
+ // Fail with the original values
+ if (!paperNameFound)
+ QCOMPARE(sizes.at(i).first, printer.paperName());
+ }
+
+ // Check setting a custom size after setting a standard one works
+ QSizeF customSize(200, 200);
+ printer.setPaperSize(customSize, QPrinter::Millimeter);
+ QCOMPARE(printer.paperSize(QPrinter::Millimeter), customSize);
+ QCOMPARE(printer.paperSize(), QPrinter::Custom);
+
+ // Finally check setting a standard size after a custom one works
+ printer.setPaperSize(sizes.at(0).second, QPrinter::Millimeter);
+ QCOMPARE(printer.paperName(), sizes.at(0).first);
+ QCOMPARE(printer.paperSize(QPrinter::Millimeter), sizes.at(0).second);
+}
+
+void tst_QPrinter::customPaperNameSettingByName()
+{
+#ifndef Q_OS_WIN
+ QSKIP("Currently this triggers a problem on non Windows platforms, this will be fixed separately - QTBUG-34521");
+#endif
+ QPrinter printer(QPrinter::HighResolution);
+ QPrinterInfo info(printer);
+ QList<QPair<QString, QSizeF> > sizes = info.supportedSizesWithNames();
+ if (sizes.size() == 0)
+ QSKIP("No printers installed on this machine");
+ for (int i=0; i<sizes.size(); i++) {
+ printer.setPaperName(sizes.at(i).first);
+ QCOMPARE(sizes.at(i).first, printer.paperName());
+ QSizeF paperSize = printer.paperSize(QPrinter::Millimeter);
+ QVERIFY2(sqrt(pow(sizes.at(i).second.width() - paperSize.width(), 2.0) + pow(sizes.at(i).second.height() - paperSize.height(), 2.0)) < 0.01,
+ msgSizeMismatch(sizes.at(i).second, paperSize));
+ }
+}
+
#endif // QT_NO_PRINTER
QTEST_MAIN(tst_QPrinter)
diff --git a/tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp b/tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp
index b45ce88c83..6c26ddb293 100644
--- a/tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp
+++ b/tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp
@@ -6458,6 +6458,12 @@ public:
void tst_QGraphicsItem::ensureUpdateOnTextItem()
{
+#ifdef Q_OS_MAC
+ if (QSysInfo::MacintoshVersion == QSysInfo::MV_10_7) {
+ QSKIP("This test is unstable on 10.7 in CI");
+ }
+#endif
+
QGraphicsScene scene;
QGraphicsView view(&scene);
view.show();
diff --git a/tests/auto/widgets/itemviews/qtreeview/tst_qtreeview.cpp b/tests/auto/widgets/itemviews/qtreeview/tst_qtreeview.cpp
index 8d31fcdf13..ccdce1fe0c 100644
--- a/tests/auto/widgets/itemviews/qtreeview/tst_qtreeview.cpp
+++ b/tests/auto/widgets/itemviews/qtreeview/tst_qtreeview.cpp
@@ -259,6 +259,7 @@ private slots:
void taskQTBUG_25333_adjustViewOptionsForIndex();
void taskQTBUG_18539_emitLayoutChanged();
void taskQTBUG_8176_emitOnExpandAll();
+ void taskQTBUG_34717_collapseAtBottom();
void testInitialFocus();
};
@@ -4240,6 +4241,35 @@ void tst_QTreeView::taskQTBUG_8176_emitOnExpandAll()
QCOMPARE(spy2.size(), 1); // item2 is collapsed
}
+// From QTBUG_34717 (QTreeWidget crashes when scrolling to the end
+// of an expanded tree, then collapse all)
+// The test passes simply if it doesn't crash.
+void tst_QTreeView::taskQTBUG_34717_collapseAtBottom()
+{
+ QTreeWidget treeWidget;
+ treeWidget.header()->setSectionResizeMode(QHeaderView::ResizeToContents);
+ treeWidget.setColumnCount(2);
+ QTreeWidgetItem *mainItem = new QTreeWidgetItem(&treeWidget, QStringList() << "Root");
+ for (int i = 0; i < 200; ++i) {
+ QTreeWidgetItem *item = new QTreeWidgetItem(mainItem, QStringList(QString("Item")));
+ new QTreeWidgetItem(item, QStringList() << "Child" << "1");
+ new QTreeWidgetItem(item, QStringList() << "Child" << "2");
+ new QTreeWidgetItem(item, QStringList() << "Child" << "3");
+ }
+ treeWidget.show();
+ treeWidget.expandAll();
+ treeWidget.scrollToBottom();
+ treeWidget.collapseAll();
+
+ treeWidget.setAnimated(true);
+ treeWidget.expandAll();
+ treeWidget.scrollToBottom();
+ mainItem->setExpanded(false);
+
+ PublicView *pview = (PublicView*) &treeWidget;
+ QVERIFY(pview->sizeHintForColumn(1) >= 0);
+}
+
void tst_QTreeView::testInitialFocus()
{
QTreeWidget treeWidget;
diff --git a/tests/auto/xml/sax/qxmlsimplereader/tst_qxmlsimplereader.cpp b/tests/auto/xml/sax/qxmlsimplereader/tst_qxmlsimplereader.cpp
index 57d078ba65..ed909946e6 100644
--- a/tests/auto/xml/sax/qxmlsimplereader/tst_qxmlsimplereader.cpp
+++ b/tests/auto/xml/sax/qxmlsimplereader/tst_qxmlsimplereader.cpp
@@ -809,7 +809,7 @@ void tst_QXmlSimpleReader::dtdRecursionLimit()
xmlReader.setDeclHandler(&handler);
xmlReader.setErrorHandler(&handler);
QVERIFY(!xmlReader.parse(source));
- QVERIFY(handler.recursionCount == 1);
+ QCOMPARE(handler.recursionCount, 2);
}
}