summaryrefslogtreecommitdiffstats
path: root/tests/auto
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto')
-rw-r--r--tests/auto/cmake/CMakeLists.txt18
-rw-r--r--tests/auto/cmake/test_QFINDTESTDATA/CMakeLists.txt11
-rw-r--r--tests/auto/cmake/test_QFINDTESTDATA/tests/CMakeLists.txt4
-rw-r--r--tests/auto/cmake/test_QFINDTESTDATA/tests/main.cpp55
-rw-r--r--tests/auto/cmake/test_QFINDTESTDATA/tests/testdata.txt1
-rw-r--r--tests/auto/corelib/global/qglobal/tst_qglobal.cpp4
-rw-r--r--tests/auto/corelib/io/qprocess/tst_qprocess.cpp68
-rw-r--r--tests/auto/corelib/io/qtextstream/test/test.pro4
-rw-r--r--tests/auto/corelib/io/qtextstream/tst_qtextstream.cpp31
-rw-r--r--tests/auto/corelib/kernel/qmetaobject/tst_qmetaobject.cpp48
-rw-r--r--tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp2
-rw-r--r--tests/auto/corelib/kernel/qobject/tst_qobject.cpp2
-rw-r--r--tests/auto/corelib/kernel/qsharedmemory/qsharedmemory.pro4
-rw-r--r--tests/auto/corelib/kernel/qsharedmemory/test/tst_qsharedmemory.cpp2
-rw-r--r--tests/auto/corelib/plugin/plugin.pro6
-rw-r--r--tests/auto/corelib/thread/qatomicinteger/tst_qatomicinteger.cpp88
-rw-r--r--tests/auto/corelib/tools/qline/qline.pro2
-rw-r--r--tests/auto/corelib/tools/qrect/tst_qrect.cpp5
-rw-r--r--tests/auto/corelib/tools/qtimezone/tst_qtimezone.cpp2
-rw-r--r--tests/auto/corelib/xml/qxmlstream/tst_qxmlstream.cpp3
-rw-r--r--tests/auto/gui/image/qicon/tst_qicon.cpp27
-rw-r--r--tests/auto/gui/image/qimagewriter/tst_qimagewriter.cpp2
-rw-r--r--tests/auto/gui/kernel/qkeyevent/tst_qkeyevent.cpp2
-rw-r--r--tests/auto/gui/painting/qpathclipper/qpathclipper.pro2
-rw-r--r--tests/auto/gui/painting/qpolygon/qpolygon.pro2
-rw-r--r--tests/auto/gui/painting/qtransform/qtransform.pro2
-rw-r--r--tests/auto/gui/painting/qwmatrix/qwmatrix.pro2
-rw-r--r--tests/auto/gui/text/qstatictext/qstatictext.pro4
-rw-r--r--tests/auto/gui/text/qstatictext/tst_qstatictext.cpp61
-rw-r--r--tests/auto/gui/text/text.pro1
-rw-r--r--tests/auto/network/access/qhttpnetworkreply/tst_qhttpnetworkreply.cpp67
-rw-r--r--tests/auto/network/access/qnetworkreply/BLACKLIST4
-rw-r--r--tests/auto/network/socket/qlocalsocket/BLACKLIST2
-rw-r--r--tests/auto/network/socket/qlocalsocket/tst_qlocalsocket.cpp15
-rw-r--r--tests/auto/network/socket/qtcpsocket/tst_qtcpsocket.cpp51
-rw-r--r--tests/auto/other/qaccessibility/qaccessibility.pro2
-rw-r--r--tests/auto/sql/kernel/qsqlquery/tst_qsqlquery.cpp82
-rw-r--r--tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp11
-rw-r--r--tests/auto/testlib/selftests/expected_cmptest.lightxml62
-rw-r--r--tests/auto/testlib/selftests/expected_cmptest.teamcity57
-rw-r--r--tests/auto/testlib/selftests/expected_cmptest.txt60
-rw-r--r--tests/auto/testlib/selftests/expected_cmptest.xml62
-rw-r--r--tests/auto/testlib/selftests/expected_cmptest.xunitxml7
-rwxr-xr-xtests/auto/testlib/selftests/generate_expected_output.py2
-rw-r--r--tests/auto/tools/moc/tst_moc.cpp50
-rw-r--r--tests/auto/tools/uic/baseline/enumnostdset.ui39
-rw-r--r--tests/auto/tools/uic/baseline/enumnostdset.ui.h55
-rw-r--r--tests/auto/widgets/dialogs/qdialog/tst_qdialog.cpp89
-rw-r--r--tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp48
-rw-r--r--tests/auto/widgets/widgets/qdockwidget/BLACKLIST2
-rw-r--r--tests/auto/widgets/widgets/qmenu/tst_qmenu.cpp48
-rw-r--r--tests/auto/widgets/widgets/qtabbar/tst_qtabbar.cpp26
52 files changed, 981 insertions, 325 deletions
diff --git a/tests/auto/cmake/CMakeLists.txt b/tests/auto/cmake/CMakeLists.txt
index 5248f75a84..1abbef0d68 100644
--- a/tests/auto/cmake/CMakeLists.txt
+++ b/tests/auto/cmake/CMakeLists.txt
@@ -68,6 +68,24 @@ expect_fail(test_wrap_cpp_options)
expect_pass(test_platform_defs_include)
expect_pass(test_qtmainwin_library)
+if (HAVE_NINJA)
+ make_directory("${CMAKE_CURRENT_SOURCE_DIR}/test_QFINDTESTDATA/build")
+ add_test(test_QFINDTESTDATA ${CMAKE_CTEST_COMMAND}
+ --build-and-test
+ "${CMAKE_CURRENT_SOURCE_DIR}/test_QFINDTESTDATA"
+ # Build in a subdir of the source dir.
+ # This causes Ninja to use relative paths.
+ "${CMAKE_CURRENT_SOURCE_DIR}/test_QFINDTESTDATA/build"
+ --build-generator Ninja
+ --build-options "-DCMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH}"
+ )
+ add_test(NAME run_test_QFINDTESTDATA COMMAND sh -c "cd \"${CMAKE_SOURCE_DIR}/test_QFINDTESTDATA/build/tests\" && ./test_QFINDTESTDATA -v2")
+
+ set_property(TEST run_test_QFINDTESTDATA
+ PROPERTY DEPENDS test_QFINDTESTDATA
+ )
+endif()
+
if (NOT NO_DBUS)
expect_pass(test_dbus_module)
endif()
diff --git a/tests/auto/cmake/test_QFINDTESTDATA/CMakeLists.txt b/tests/auto/cmake/test_QFINDTESTDATA/CMakeLists.txt
new file mode 100644
index 0000000000..e56c3c5eb9
--- /dev/null
+++ b/tests/auto/cmake/test_QFINDTESTDATA/CMakeLists.txt
@@ -0,0 +1,11 @@
+
+cmake_minimum_required(VERSION 2.8.11)
+
+project(test_QFINDTESTDATA)
+
+find_package(Qt5Test REQUIRED)
+
+set(CMAKE_AUTOMOC ON)
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+add_subdirectory(tests)
diff --git a/tests/auto/cmake/test_QFINDTESTDATA/tests/CMakeLists.txt b/tests/auto/cmake/test_QFINDTESTDATA/tests/CMakeLists.txt
new file mode 100644
index 0000000000..dfe321982a
--- /dev/null
+++ b/tests/auto/cmake/test_QFINDTESTDATA/tests/CMakeLists.txt
@@ -0,0 +1,4 @@
+
+add_executable(test_QFINDTESTDATA WIN32 main.cpp)
+
+target_link_libraries(test_QFINDTESTDATA Qt5::Test)
diff --git a/tests/auto/cmake/test_QFINDTESTDATA/tests/main.cpp b/tests/auto/cmake/test_QFINDTESTDATA/tests/main.cpp
new file mode 100644
index 0000000000..0a5b6acd32
--- /dev/null
+++ b/tests/auto/cmake/test_QFINDTESTDATA/tests/main.cpp
@@ -0,0 +1,55 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 Stephen Kelly <steveire@gmail,com>
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL21$
+** 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 The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/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 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QCoreApplication>
+#include <QtTest/QTest>
+
+class TestClass : public QObject
+{
+ Q_OBJECT
+public:
+ TestClass(QObject* parent = 0) {}
+
+private slots:
+ void doTest();
+};
+
+void TestClass::doTest()
+{
+ QFile f(QFINDTESTDATA("testdata.txt"));
+ QVERIFY(f.open(QFile::ReadOnly));
+ QCOMPARE(f.readAll().trimmed(), QByteArrayLiteral("This is a test."));
+}
+
+QTEST_MAIN(TestClass)
+#include "main.moc"
diff --git a/tests/auto/cmake/test_QFINDTESTDATA/tests/testdata.txt b/tests/auto/cmake/test_QFINDTESTDATA/tests/testdata.txt
new file mode 100644
index 0000000000..484ba93ef5
--- /dev/null
+++ b/tests/auto/cmake/test_QFINDTESTDATA/tests/testdata.txt
@@ -0,0 +1 @@
+This is a test.
diff --git a/tests/auto/corelib/global/qglobal/tst_qglobal.cpp b/tests/auto/corelib/global/qglobal/tst_qglobal.cpp
index 152906287c..bb4d1f4bf2 100644
--- a/tests/auto/corelib/global/qglobal/tst_qglobal.cpp
+++ b/tests/auto/corelib/global/qglobal/tst_qglobal.cpp
@@ -732,8 +732,8 @@ void tst_QGlobal::testqOverload()
QVERIFY(qOverload<QByteArray>(&freeOverloaded) ==
static_cast<void (*)(QByteArray)>(&freeOverloaded));
- QVERIFY((qOverload<QByteArray, const QString &>(&freeOverloaded)),
- static_cast<void (*)(QByteArray, const QString &)>(&freeOverloaded));
+ QVERIFY((qOverload<QByteArray, const QString &>(&freeOverloaded) ==
+ static_cast<void (*)(QByteArray, const QString &)>(&freeOverloaded)));
// value returning free overloaded functions
QVERIFY(qOverload<>(&freeOverloadedGet) ==
diff --git a/tests/auto/corelib/io/qprocess/tst_qprocess.cpp b/tests/auto/corelib/io/qprocess/tst_qprocess.cpp
index e5195000aa..c47e88b0e6 100644
--- a/tests/auto/corelib/io/qprocess/tst_qprocess.cpp
+++ b/tests/auto/corelib/io/qprocess/tst_qprocess.cpp
@@ -141,6 +141,8 @@ private slots:
void startStopStartStop();
void startStopStartStopBuffers_data();
void startStopStartStopBuffers();
+ void processEventsInAReadyReadSlot_data();
+ void processEventsInAReadyReadSlot();
// keep these at the end, since they use lots of processes and sometimes
// caused obscure failures to occur in tests that followed them (esp. on the Mac)
@@ -153,6 +155,7 @@ private slots:
protected slots:
void readFromProcess();
void exitLoopSlot();
+ void processApplicationEvents();
#ifndef Q_OS_WINCE
void restartProcess();
void waitForReadyReadInAReadyReadSlotSlot();
@@ -471,6 +474,11 @@ void tst_QProcess::exitLoopSlot()
QTestEventLoop::instance().exitLoop();
}
+void tst_QProcess::processApplicationEvents()
+{
+ QCoreApplication::processEvents();
+}
+
#ifndef Q_OS_WINCE
// Reading and writing to a process is not supported on Qt/CE
void tst_QProcess::echoTest2()
@@ -688,11 +696,7 @@ void tst_QProcess::waitForFinished()
process.start("testProcessOutput/testProcessOutput");
-#if !defined(Q_OS_WINCE)
- QVERIFY(process.waitForFinished(5000));
-#else
- QVERIFY(process.waitForFinished(30000));
-#endif
+ QVERIFY(process.waitForFinished());
QCOMPARE(process.exitStatus(), QProcess::NormalExit);
#if defined (Q_OS_WINCE)
@@ -916,12 +920,7 @@ void tst_QProcess::hardExit()
proc.start("testProcessEcho/testProcessEcho");
#endif
-#ifndef Q_OS_WINCE
- QVERIFY(proc.waitForStarted(5000));
-#else
- QVERIFY(proc.waitForStarted(10000));
-#endif
-
+ QVERIFY2(proc.waitForStarted(), qPrintable(proc.errorString()));
proc.kill();
QVERIFY(proc.waitForFinished(5000));
@@ -1417,24 +1416,17 @@ void tst_QProcess::spaceArgsTest()
QString program = programs.at(i);
process.start(program, args);
-#if defined(Q_OS_WINCE)
- const int timeOutMS = 10000;
-#else
- const int timeOutMS = 5000;
-#endif
QByteArray errorMessage;
- bool started = process.waitForStarted(timeOutMS);
+ bool started = process.waitForStarted();
if (!started)
errorMessage = startFailMessage(program, process);
QVERIFY2(started, errorMessage.constData());
- QVERIFY(process.waitForFinished(timeOutMS));
+ QVERIFY(process.waitForFinished());
QCOMPARE(process.exitStatus(), QProcess::NormalExit);
QCOMPARE(process.exitCode(), 0);
#if !defined(Q_OS_WINCE)
QStringList actual = QString::fromLatin1(process.readAll()).split("|");
-#endif
-#if !defined(Q_OS_WINCE)
QVERIFY(!actual.isEmpty());
// not interested in the program name, it might be different.
actual.removeFirst();
@@ -1459,8 +1451,6 @@ void tst_QProcess::spaceArgsTest()
#if !defined(Q_OS_WINCE)
actual = QString::fromLatin1(process.readAll()).split("|");
-#endif
-#if !defined(Q_OS_WINCE)
QVERIFY(!actual.isEmpty());
// not interested in the program name, it might be different.
actual.removeFirst();
@@ -1482,13 +1472,8 @@ void tst_QProcess::nativeArguments()
proc.start(QString::fromLatin1("testProcessSpacesArgs/nospace"), QStringList());
-#if !defined(Q_OS_WINCE)
- QVERIFY(proc.waitForStarted(5000));
- QVERIFY(proc.waitForFinished(5000));
-#else
- QVERIFY(proc.waitForStarted(10000));
- QVERIFY(proc.waitForFinished(10000));
-#endif
+ QVERIFY2(proc.waitForStarted(), qPrintable(proc.errorString()));
+ QVERIFY(proc.waitForFinished());
QCOMPARE(proc.exitStatus(), QProcess::NormalExit);
QCOMPARE(proc.exitCode(), 0);
@@ -2550,6 +2535,31 @@ void tst_QProcess::startStopStartStopBuffers()
}
}
+void tst_QProcess::processEventsInAReadyReadSlot_data()
+{
+ QTest::addColumn<bool>("callWaitForReadyRead");
+
+ QTest::newRow("no waitForReadyRead") << false;
+ QTest::newRow("waitForReadyRead") << true;
+}
+
+void tst_QProcess::processEventsInAReadyReadSlot()
+{
+ // Test whether processing events in a readyReadXXX slot crashes. (QTBUG-48697)
+ QFETCH(bool, callWaitForReadyRead);
+ QProcess process;
+ QObject::connect(&process, &QProcess::readyReadStandardOutput,
+ this, &tst_QProcess::processApplicationEvents);
+ process.start("testProcessEcho/testProcessEcho");
+ QVERIFY(process.waitForStarted());
+ const QByteArray data(156, 'x');
+ process.write(data.constData(), data.size() + 1);
+ if (callWaitForReadyRead)
+ QVERIFY(process.waitForReadyRead());
+ if (process.state() == QProcess::Running)
+ QVERIFY(process.waitForFinished());
+}
+
#endif //QT_NO_PROCESS
QTEST_MAIN(tst_QProcess)
diff --git a/tests/auto/corelib/io/qtextstream/test/test.pro b/tests/auto/corelib/io/qtextstream/test/test.pro
index 93fb6d232f..50335524d3 100644
--- a/tests/auto/corelib/io/qtextstream/test/test.pro
+++ b/tests/auto/corelib/io/qtextstream/test/test.pro
@@ -19,3 +19,7 @@ TESTDATA += \
../qtextstream.qrc \
../tst_qtextstream.cpp \
../resources
+
+builtin_testdata {
+ DEFINES += BUILTIN_TESTDATA
+}
diff --git a/tests/auto/corelib/io/qtextstream/tst_qtextstream.cpp b/tests/auto/corelib/io/qtextstream/tst_qtextstream.cpp
index 439da8b1a3..104873b85e 100644
--- a/tests/auto/corelib/io/qtextstream/tst_qtextstream.cpp
+++ b/tests/auto/corelib/io/qtextstream/tst_qtextstream.cpp
@@ -60,6 +60,7 @@ public:
public slots:
void initTestCase();
void cleanup();
+ void cleanupTestCase();
private slots:
void getSetCheck();
@@ -223,6 +224,8 @@ private slots:
void alignAccountingStyle();
void setCodec();
+ void textModeOnEmptyRead();
+
private:
void generateLineData(bool for_QString);
void generateAllData(bool for_QString);
@@ -234,6 +237,9 @@ private:
QTemporaryDir tempDir;
QString testFileName;
+#ifdef BUILTIN_TESTDATA
+ QSharedPointer<QTemporaryDir> m_dataDir;
+#endif
const QString m_rfc3261FilePath;
const QString m_shiftJisFilePath;
};
@@ -260,9 +266,14 @@ void tst_QTextStream::initTestCase()
testFileName = tempDir.path() + "/testfile";
+#ifdef BUILTIN_TESTDATA
+ m_dataDir = QEXTRACTTESTDATA("/");
+ QVERIFY2(QDir::setCurrent(m_dataDir->path()), qPrintable("Could not chdir to " + m_dataDir->path()));
+#else
// chdir into the testdata dir and refer to our helper apps with relative paths
QString testdata_dir = QFileInfo(QFINDTESTDATA("stdinProcess")).absolutePath();
QVERIFY2(QDir::setCurrent(testdata_dir), qPrintable("Could not chdir to " + testdata_dir));
+#endif
}
// Testing get/set functions
@@ -385,6 +396,13 @@ void tst_QTextStream::cleanup()
QCoreApplication::instance()->processEvents();
}
+void tst_QTextStream::cleanupTestCase()
+{
+#ifdef BUILTIN_TESTDATA
+ QDir::setCurrent(QCoreApplication::applicationDirPath());
+#endif
+}
+
// ------------------------------------------------------------------------------
void tst_QTextStream::construction()
{
@@ -3040,6 +3058,19 @@ void tst_QTextStream::int_write_with_locale()
QCOMPARE(result, output);
}
+void tst_QTextStream::textModeOnEmptyRead()
+{
+ const QString filename(tempDir.path() + QLatin1String("/textmodetest.txt"));
+
+ QFile file(filename);
+ QVERIFY2(file.open(QIODevice::ReadWrite | QIODevice::Text), qPrintable(file.errorString()));
+ QTextStream stream(&file);
+ QVERIFY(file.isTextModeEnabled());
+ QString emptyLine = stream.readLine(); // Text mode flag cleared here
+ QVERIFY(file.isTextModeEnabled());
+}
+
+
// ------------------------------------------------------------------------------
QTEST_MAIN(tst_QTextStream)
diff --git a/tests/auto/corelib/kernel/qmetaobject/tst_qmetaobject.cpp b/tests/auto/corelib/kernel/qmetaobject/tst_qmetaobject.cpp
index 2f954e16cf..fd32dc1ef8 100644
--- a/tests/auto/corelib/kernel/qmetaobject/tst_qmetaobject.cpp
+++ b/tests/auto/corelib/kernel/qmetaobject/tst_qmetaobject.cpp
@@ -131,6 +131,22 @@ namespace MyNamespace {
MyEnum m_enum;
MyFlags m_flags;
};
+
+ // Test inherits
+ class MyClassSubclass : public MyClass
+ {
+ Q_OBJECT
+ };
+
+ class MyClassSubclass2 : public MyClass2
+ {
+ Q_OBJECT
+ };
+
+ class MyClass2Subclass : public MyClass
+ {
+ Q_OBJECT
+ };
}
@@ -222,6 +238,9 @@ private slots:
void signalIndex();
void enumDebugStream();
+ void inherits_data();
+ void inherits();
+
signals:
void value6Changed();
void value7Changed(const QString &);
@@ -1425,5 +1444,34 @@ void tst_QMetaObject::enumDebugStream()
qDebug() << f1 << f2;
}
+void tst_QMetaObject::inherits_data()
+{
+ QTest::addColumn<const QMetaObject *>("derivedMetaObject");
+ QTest::addColumn<const QMetaObject *>("baseMetaObject");
+ QTest::addColumn<bool>("inheritsResult");
+
+ QTest::newRow("MyClass inherits QObject")
+ << &MyNamespace::MyClass::staticMetaObject << &QObject::staticMetaObject << true;
+ QTest::newRow("QObject inherits MyClass")
+ << &QObject::staticMetaObject << &MyNamespace::MyClass::staticMetaObject << false;
+ QTest::newRow("MyClass inherits MyClass")
+ << &MyNamespace::MyClass::staticMetaObject << &MyNamespace::MyClass::staticMetaObject << true;
+ QTest::newRow("MyClassSubclass inherits QObject")
+ << &MyNamespace::MyClassSubclass::staticMetaObject << &QObject::staticMetaObject << true;
+ QTest::newRow("MyClassSubclass2 inherits QObject")
+ << &MyNamespace::MyClassSubclass2::staticMetaObject << &QObject::staticMetaObject << true;
+ QTest::newRow("MyClassSubclass2 inherits MyClass2")
+ << &MyNamespace::MyClassSubclass2::staticMetaObject << &MyNamespace::MyClass2Subclass::staticMetaObject << false;
+}
+
+void tst_QMetaObject::inherits()
+{
+ QFETCH(const QMetaObject *, derivedMetaObject);
+ QFETCH(const QMetaObject *, baseMetaObject);
+ QFETCH(bool, inheritsResult);
+
+ QCOMPARE(derivedMetaObject->inherits(baseMetaObject), inheritsResult);
+}
+
QTEST_MAIN(tst_QMetaObject)
#include "tst_qmetaobject.moc"
diff --git a/tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp b/tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp
index b1ae4292d0..fbb6a30917 100644
--- a/tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp
+++ b/tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp
@@ -1473,7 +1473,7 @@ static QByteArray createTypeName(const char *begin, const char *va)
}
if (tn.endsWith('>'))
tn += ' ';
- tn += ">";
+ tn += '>';
return tn;
}
#endif
diff --git a/tests/auto/corelib/kernel/qobject/tst_qobject.cpp b/tests/auto/corelib/kernel/qobject/tst_qobject.cpp
index 540cd66715..23f8ff5857 100644
--- a/tests/auto/corelib/kernel/qobject/tst_qobject.cpp
+++ b/tests/auto/corelib/kernel/qobject/tst_qobject.cpp
@@ -275,8 +275,10 @@ static void playWithObjects()
void tst_QObject::initTestCase()
{
+#ifndef QT_NO_PROCESS
const QString testDataDir = QFileInfo(QFINDTESTDATA("signalbug")).absolutePath();
QVERIFY2(QDir::setCurrent(testDataDir), qPrintable("Could not chdir to " + testDataDir));
+#endif
}
void tst_QObject::disconnect()
diff --git a/tests/auto/corelib/kernel/qsharedmemory/qsharedmemory.pro b/tests/auto/corelib/kernel/qsharedmemory/qsharedmemory.pro
index a36b15c906..69062a9741 100644
--- a/tests/auto/corelib/kernel/qsharedmemory/qsharedmemory.pro
+++ b/tests/auto/corelib/kernel/qsharedmemory/qsharedmemory.pro
@@ -1,3 +1,5 @@
TEMPLATE = subdirs
-SUBDIRS = sharedmemoryhelper test
+!winrt: SUBDIRS = sharedmemoryhelper
+
+SUBDIRS += test
diff --git a/tests/auto/corelib/kernel/qsharedmemory/test/tst_qsharedmemory.cpp b/tests/auto/corelib/kernel/qsharedmemory/test/tst_qsharedmemory.cpp
index a4c918ed23..b6f6d2a7f3 100644
--- a/tests/auto/corelib/kernel/qsharedmemory/test/tst_qsharedmemory.cpp
+++ b/tests/auto/corelib/kernel/qsharedmemory/test/tst_qsharedmemory.cpp
@@ -133,7 +133,9 @@ tst_QSharedMemory::~tst_QSharedMemory()
void tst_QSharedMemory::initTestCase()
{
+#ifndef QT_NO_PROCESS
QVERIFY2(!m_helperBinary.isEmpty(), "Could not find helper binary");
+#endif
}
void tst_QSharedMemory::init()
diff --git a/tests/auto/corelib/plugin/plugin.pro b/tests/auto/corelib/plugin/plugin.pro
index e6b748e4f4..777e920995 100644
--- a/tests/auto/corelib/plugin/plugin.pro
+++ b/tests/auto/corelib/plugin/plugin.pro
@@ -8,3 +8,9 @@ load(qfeatures)
qpluginloader \
qplugin \
qlibrary
+
+contains(CONFIG, static) {
+ message(Disabling tests requiring shared build of Qt)
+ SUBDIRS -= qfactoryloader \
+ qpluginloader
+}
diff --git a/tests/auto/corelib/thread/qatomicinteger/tst_qatomicinteger.cpp b/tests/auto/corelib/thread/qatomicinteger/tst_qatomicinteger.cpp
index 3bed64a76a..fe465df395 100644
--- a/tests/auto/corelib/thread/qatomicinteger/tst_qatomicinteger.cpp
+++ b/tests/auto/corelib/thread/qatomicinteger/tst_qatomicinteger.cpp
@@ -357,28 +357,46 @@ void tst_QAtomicIntegerXX::loadAcquireStoreRelease()
void tst_QAtomicIntegerXX::refDeref()
{
QFETCH(LargeInt, value);
- T nextValue = T(value + 1);
- T prevValue = T(value - 1);
+ const bool needToPreventOverflow = TypeIsSigned && value == std::numeric_limits<T>::max();
+ const bool needToPreventUnderflow = TypeIsSigned && value == std::numeric_limits<T>::min();
+ T nextValue = T(value);
+ if (!needToPreventOverflow)
+ ++nextValue;
+ T prevValue = T(value);
+ if (!needToPreventUnderflow)
+ --prevValue;
QAtomicInteger<T> atomic(value);
+ if (!needToPreventOverflow) {
QCOMPARE(atomic.ref(), (nextValue != 0));
QCOMPARE(atomic.load(), nextValue);
QCOMPARE(atomic.deref(), (value != 0));
+ }
QCOMPARE(atomic.load(), T(value));
+ if (!needToPreventUnderflow) {
QCOMPARE(atomic.deref(), (prevValue != 0));
QCOMPARE(atomic.load(), prevValue);
QCOMPARE(atomic.ref(), (value != 0));
+ }
QCOMPARE(atomic.load(), T(value));
+ if (!needToPreventOverflow) {
QCOMPARE(++atomic, nextValue);
QCOMPARE(--atomic, T(value));
+ }
+ if (!needToPreventUnderflow) {
QCOMPARE(--atomic, prevValue);
QCOMPARE(++atomic, T(value));
+ }
+ if (!needToPreventOverflow) {
QCOMPARE(atomic++, T(value));
QCOMPARE(atomic--, nextValue);
+ }
+ if (!needToPreventUnderflow) {
QCOMPARE(atomic--, T(value));
QCOMPARE(atomic++, prevValue);
+ }
QCOMPARE(atomic.load(), T(value));
}
@@ -481,53 +499,80 @@ void tst_QAtomicIntegerXX::fetchAndAdd()
QFETCH(LargeInt, value);
QAtomicInteger<T> atomic(value);
- // note: this test has undefined behavior for signed max and min
T parcel1 = 42;
T parcel2 = T(0-parcel1);
- T newValue1 = T(value) + parcel1;
- T newValue2 = T(value) + parcel2;
+ const bool needToPreventOverflow = TypeIsSigned && value > std::numeric_limits<T>::max() + parcel2;
+ const bool needToPreventUnderflow = TypeIsSigned && value < std::numeric_limits<T>::min() + parcel1;
+
+ T newValue1 = T(value);
+ if (!needToPreventOverflow)
+ newValue1 += parcel1;
+ T newValue2 = T(value);
+ if (!needToPreventUnderflow)
+ newValue2 += parcel2;
+
+ if (!needToPreventOverflow) {
QCOMPARE(atomic.fetchAndAddRelaxed(parcel1), T(value));
QCOMPARE(atomic.load(), newValue1);
QCOMPARE(atomic.fetchAndAddRelaxed(parcel2), newValue1);
+ }
QCOMPARE(atomic.load(), T(value));
+ if (!needToPreventUnderflow) {
QCOMPARE(atomic.fetchAndAddRelaxed(parcel2), T(value));
QCOMPARE(atomic.load(), newValue2);
QCOMPARE(atomic.fetchAndAddRelaxed(parcel1), newValue2);
+ }
QCOMPARE(atomic.load(), T(value));
+ if (!needToPreventOverflow) {
QCOMPARE(atomic.fetchAndAddAcquire(parcel1), T(value));
QCOMPARE(atomic.load(), newValue1);
QCOMPARE(atomic.fetchAndAddAcquire(parcel2), newValue1);
+ }
QCOMPARE(atomic.load(), T(value));
+ if (!needToPreventUnderflow) {
QCOMPARE(atomic.fetchAndAddAcquire(parcel2), T(value));
QCOMPARE(atomic.load(), newValue2);
QCOMPARE(atomic.fetchAndAddAcquire(parcel1), newValue2);
+ }
QCOMPARE(atomic.load(), T(value));
+ if (!needToPreventOverflow) {
QCOMPARE(atomic.fetchAndAddRelease(parcel1), T(value));
QCOMPARE(atomic.loadAcquire(), newValue1);
QCOMPARE(atomic.fetchAndAddRelease(parcel2), newValue1);
+ }
QCOMPARE(atomic.loadAcquire(), T(value));
+ if (!needToPreventUnderflow) {
QCOMPARE(atomic.fetchAndAddRelease(parcel2), T(value));
QCOMPARE(atomic.loadAcquire(), newValue2);
QCOMPARE(atomic.fetchAndAddRelease(parcel1), newValue2);
+ }
QCOMPARE(atomic.loadAcquire(), T(value));
+ if (!needToPreventOverflow) {
QCOMPARE(atomic.fetchAndAddOrdered(parcel1), T(value));
QCOMPARE(atomic.loadAcquire(), newValue1);
QCOMPARE(atomic.fetchAndAddOrdered(parcel2), newValue1);
+ }
QCOMPARE(atomic.loadAcquire(), T(value));
+ if (!needToPreventUnderflow) {
QCOMPARE(atomic.fetchAndAddOrdered(parcel2), T(value));
QCOMPARE(atomic.loadAcquire(), newValue2);
QCOMPARE(atomic.fetchAndAddOrdered(parcel1), newValue2);
+ }
QCOMPARE(atomic.loadAcquire(), T(value));
// operator+=
+ if (!needToPreventOverflow) {
QCOMPARE(atomic += parcel1, newValue1);
QCOMPARE(atomic += parcel2, T(value));
+ }
+ if (!needToPreventUnderflow) {
QCOMPARE(atomic += parcel2, newValue2);
QCOMPARE(atomic += parcel1, T(value));
+ }
}
void tst_QAtomicIntegerXX::fetchAndSub()
@@ -535,53 +580,80 @@ void tst_QAtomicIntegerXX::fetchAndSub()
QFETCH(LargeInt, value);
QAtomicInteger<T> atomic(value);
- // note: this test has undefined behavior for signed max and min
T parcel1 = 42;
T parcel2 = T(0-parcel1);
- T newValue1 = T(value) - parcel1;
- T newValue2 = T(value) - parcel2;
+ const bool needToPreventOverflow = TypeIsSigned && value > std::numeric_limits<T>::max() - parcel1;
+ const bool needToPreventUnderflow = TypeIsSigned && value < std::numeric_limits<T>::min() - parcel2;
+
+ T newValue1 = T(value);
+ if (!needToPreventUnderflow)
+ newValue1 -= parcel1;
+ T newValue2 = T(value);
+ if (!needToPreventOverflow)
+ newValue2 -= parcel2;
+
+ if (!needToPreventUnderflow) {
QCOMPARE(atomic.fetchAndSubRelaxed(parcel1), T(value));
QCOMPARE(atomic.load(), newValue1);
QCOMPARE(atomic.fetchAndSubRelaxed(parcel2), newValue1);
+ }
QCOMPARE(atomic.load(), T(value));
+ if (!needToPreventOverflow) {
QCOMPARE(atomic.fetchAndSubRelaxed(parcel2), T(value));
QCOMPARE(atomic.load(), newValue2);
QCOMPARE(atomic.fetchAndSubRelaxed(parcel1), newValue2);
+ }
QCOMPARE(atomic.load(), T(value));
+ if (!needToPreventUnderflow) {
QCOMPARE(atomic.fetchAndSubAcquire(parcel1), T(value));
QCOMPARE(atomic.load(), newValue1);
QCOMPARE(atomic.fetchAndSubAcquire(parcel2), newValue1);
+ }
QCOMPARE(atomic.load(), T(value));
+ if (!needToPreventOverflow) {
QCOMPARE(atomic.fetchAndSubAcquire(parcel2), T(value));
QCOMPARE(atomic.load(), newValue2);
QCOMPARE(atomic.fetchAndSubAcquire(parcel1), newValue2);
+ }
QCOMPARE(atomic.load(), T(value));
+ if (!needToPreventUnderflow) {
QCOMPARE(atomic.fetchAndSubRelease(parcel1), T(value));
QCOMPARE(atomic.loadAcquire(), newValue1);
QCOMPARE(atomic.fetchAndSubRelease(parcel2), newValue1);
+ }
QCOMPARE(atomic.loadAcquire(), T(value));
+ if (!needToPreventOverflow) {
QCOMPARE(atomic.fetchAndSubRelease(parcel2), T(value));
QCOMPARE(atomic.loadAcquire(), newValue2);
QCOMPARE(atomic.fetchAndSubRelease(parcel1), newValue2);
+ }
QCOMPARE(atomic.loadAcquire(), T(value));
+ if (!needToPreventUnderflow) {
QCOMPARE(atomic.fetchAndSubOrdered(parcel1), T(value));
QCOMPARE(atomic.loadAcquire(), newValue1);
QCOMPARE(atomic.fetchAndSubOrdered(parcel2), newValue1);
+ }
QCOMPARE(atomic.loadAcquire(), T(value));
+ if (!needToPreventOverflow) {
QCOMPARE(atomic.fetchAndSubOrdered(parcel2), T(value));
QCOMPARE(atomic.loadAcquire(), newValue2);
QCOMPARE(atomic.fetchAndSubOrdered(parcel1), newValue2);
+ }
QCOMPARE(atomic.loadAcquire(), T(value));
// operator-=
+ if (!needToPreventUnderflow) {
QCOMPARE(atomic -= parcel1, newValue1);
QCOMPARE(atomic -= parcel2, T(value));
+ }
+ if (!needToPreventOverflow) {
QCOMPARE(atomic -= parcel2, newValue2);
QCOMPARE(atomic -= parcel1, T(value));
+ }
}
void tst_QAtomicIntegerXX::addSub()
diff --git a/tests/auto/corelib/tools/qline/qline.pro b/tests/auto/corelib/tools/qline/qline.pro
index c66df2cd68..81e2f17118 100644
--- a/tests/auto/corelib/tools/qline/qline.pro
+++ b/tests/auto/corelib/tools/qline/qline.pro
@@ -2,4 +2,4 @@ CONFIG += testcase
TARGET = tst_qline
QT = core testlib
SOURCES = tst_qline.cpp
-unix:!mac:!vxworks:!haiku:LIBS+=-lm
+unix:!darwin:!vxworks:!haiku:!integrity: LIBS+=-lm
diff --git a/tests/auto/corelib/tools/qrect/tst_qrect.cpp b/tests/auto/corelib/tools/qrect/tst_qrect.cpp
index 9b35cdec30..d3c6412b0d 100644
--- a/tests/auto/corelib/tools/qrect/tst_qrect.cpp
+++ b/tests/auto/corelib/tools/qrect/tst_qrect.cpp
@@ -2347,7 +2347,7 @@ void tst_QRect::center_data()
QTest::newRow( "SmallestQRect" ) << getQRectCase( SmallestQRect ) << QPoint(1,1);
QTest::newRow( "MiddleQRect" ) << getQRectCase( MiddleQRect ) << QPoint(0,0);
QTest::newRow( "LargestQRect" ) << getQRectCase( LargestQRect ) << QPoint(INT_MAX/2,INT_MAX/2);
- QTest::newRow( "SmallestCoordQRect" ) << getQRectCase( SmallestCoordQRect ) << QPoint(0,0);
+ QTest::newRow( "SmallestCoordQRect" ) << getQRectCase( SmallestCoordQRect ) << QPoint(INT_MIN, INT_MIN);
QTest::newRow( "LargestCoordQRect" ) << getQRectCase( LargestCoordQRect ) << QPoint(0,0);
QTest::newRow( "RandomQRect" ) << getQRectCase( RandomQRect ) << QPoint(105,207);
QTest::newRow( "NegativeSizeQRect" ) << getQRectCase( NegativeSizeQRect ) << QPoint(-4,-4);
@@ -3169,8 +3169,7 @@ void tst_QRect::newMoveTopLeft_data()
}
{
- QTest::newRow("LargestCoordQRect_NullQPoint") << getQRectCase(LargestCoordQRect) << getQPointCase(NullQPoint)
- << QRect(QPoint(0,0), QPoint(INT_MAX+(0-INT_MIN),INT_MAX+(0-INT_MIN)));
+ // QTest::newRow("LargestCoordQRect_NullQPoint") -- Not tested as it would cause an overflow
QTest::newRow("LargestCoordQRect_SmallestCoordQPoint") << getQRectCase(LargestCoordQRect) << getQPointCase(SmallestCoordQPoint)
<< QRect(QPoint(INT_MIN,INT_MIN), QPoint(INT_MAX,INT_MAX));
// QTest::newRow("LargestCoordQRect_MiddleNegCoordQPoint") -- Not tested as it would cause an overflow
diff --git a/tests/auto/corelib/tools/qtimezone/tst_qtimezone.cpp b/tests/auto/corelib/tools/qtimezone/tst_qtimezone.cpp
index 1879543581..077a6a20f1 100644
--- a/tests/auto/corelib/tools/qtimezone/tst_qtimezone.cpp
+++ b/tests/auto/corelib/tools/qtimezone/tst_qtimezone.cpp
@@ -893,7 +893,7 @@ void tst_QTimeZone::macTest()
void tst_QTimeZone::winTest()
{
-#if defined(QT_BUILD_INTERNAL) && defined(Q_OS_WIN) && !defined(Q_OS_WINRT)
+#if defined(QT_BUILD_INTERNAL) && defined(Q_OS_WIN)
// Known datetimes
qint64 std = QDateTime(QDate(2012, 1, 1), QTime(0, 0, 0), Qt::UTC).toMSecsSinceEpoch();
qint64 dst = QDateTime(QDate(2012, 6, 1), QTime(0, 0, 0), Qt::UTC).toMSecsSinceEpoch();
diff --git a/tests/auto/corelib/xml/qxmlstream/tst_qxmlstream.cpp b/tests/auto/corelib/xml/qxmlstream/tst_qxmlstream.cpp
index b889bcc6a9..8a153a4599 100644
--- a/tests/auto/corelib/xml/qxmlstream/tst_qxmlstream.cpp
+++ b/tests/auto/corelib/xml/qxmlstream/tst_qxmlstream.cpp
@@ -902,7 +902,8 @@ void tst_QXmlStream::testFalsePrematureError() const
// Regression test for crash due to using empty QStack.
void tst_QXmlStream::writerHangs() const
{
- QFile file("test.xml");
+ QTemporaryDir dir(QDir::tempPath() + QLatin1String("/tst_qxmlstream.XXXXXX"));
+ QFile file(dir.path() + "/test.xml");
QVERIFY(file.open(QIODevice::WriteOnly));
diff --git a/tests/auto/gui/image/qicon/tst_qicon.cpp b/tests/auto/gui/image/qicon/tst_qicon.cpp
index 079b14a64e..3c4610a892 100644
--- a/tests/auto/gui/image/qicon/tst_qicon.cpp
+++ b/tests/auto/gui/image/qicon/tst_qicon.cpp
@@ -31,6 +31,7 @@
#include <QImageReader>
#include <qicon.h>
#include <qiconengine.h>
+#include <QtCore/QStandardPaths>
#include <algorithm>
@@ -648,9 +649,20 @@ void tst_QIcon::fromTheme()
QVERIFY(!fullPathIcon.isNull());
}
+static inline QString findGtkUpdateIconCache()
+{
+ QString binary = QLatin1String("gtk-update-icon-cache");
+#ifdef Q_OS_WIN
+ binary += QLatin1String(".exe");
+#endif
+ return QStandardPaths::findExecutable(binary);
+}
+
void tst_QIcon::fromThemeCache()
{
QTemporaryDir dir;
+ QVERIFY2(dir.isValid(), qPrintable(dir.errorString()));
+
QVERIFY(QDir().mkpath(dir.path() + QLatin1String("/testcache/16x16/actions")));
QVERIFY(QFile(QStringLiteral(":/styles/commonstyle/images/standardbutton-open-16.png"))
.copy( dir.path() + QLatin1String("/testcache/16x16/actions/button-open.png")));
@@ -700,11 +712,20 @@ void tst_QIcon::fromThemeCache()
QVERIFY(!QIcon::fromTheme("button-open").isNull());
// Try to run the actual gtk-update-icon-cache and make sure that icons are still found
+ const QString gtkUpdateIconCache = findGtkUpdateIconCache();
+ if (gtkUpdateIconCache.isEmpty()) {
+ QIcon::setThemeSearchPaths(QStringList());
+ QSKIP("gtk-update-icon-cache not run (binary not found)");
+ }
QProcess process;
- process.start(QStringLiteral("gtk-update-icon-cache"),
+ process.start(gtkUpdateIconCache,
QStringList() << QStringLiteral("-f") << QStringLiteral("-t") << (dir.path() + QLatin1String("/testcache")));
- if (!process.waitForFinished())
- QSKIP("gtk-update-icon-cache not run");
+ QVERIFY2(process.waitForStarted(), qPrintable(QLatin1String("Unable to start: ")
+ + gtkUpdateIconCache + QLatin1String(": ")
+ + process.errorString()));
+ QVERIFY(process.waitForFinished());
+ QCOMPARE(process.exitStatus(), QProcess::NormalExit);
+ QCOMPARE(process.exitCode(), 0);
QVERIFY(QFileInfo(cacheName).lastModified() >= QFileInfo(dir.path() + QLatin1String("/testcache/16x16/actions")).lastModified());
QIcon::setThemeSearchPaths(QStringList() << dir.path()); // reload themes
QVERIFY(!QIcon::fromTheme("button-open").isNull());
diff --git a/tests/auto/gui/image/qimagewriter/tst_qimagewriter.cpp b/tests/auto/gui/image/qimagewriter/tst_qimagewriter.cpp
index ba5cfd1757..c12c8a9cf4 100644
--- a/tests/auto/gui/image/qimagewriter/tst_qimagewriter.cpp
+++ b/tests/auto/gui/image/qimagewriter/tst_qimagewriter.cpp
@@ -109,7 +109,7 @@ void tst_QImageWriter::initTestCase()
prefix = QFINDTESTDATA("images/");
if (prefix.isEmpty())
QFAIL("Can't find images directory!");
- writePrefix = m_temporaryDir.path();
+ writePrefix = m_temporaryDir.path() + QLatin1Char('/');
}
// Testing get/set functions
diff --git a/tests/auto/gui/kernel/qkeyevent/tst_qkeyevent.cpp b/tests/auto/gui/kernel/qkeyevent/tst_qkeyevent.cpp
index bd68400047..db0bfaf622 100644
--- a/tests/auto/gui/kernel/qkeyevent/tst_qkeyevent.cpp
+++ b/tests/auto/gui/kernel/qkeyevent/tst_qkeyevent.cpp
@@ -137,7 +137,7 @@ void tst_QKeyEvent::modifiers_data()
for (quint64 bitmask = 1; bitmask < (1 << kNumModifiers) ; ++bitmask) {
QVector<int> modifierCombination;
for (quint64 modifier = 0; modifier < kNumModifiers; ++modifier) {
- if (bitmask & (1 << modifier))
+ if (bitmask & (quint64(1) << modifier))
modifierCombination.append(modifier);
}
modifierCombinations.append(modifierCombination);
diff --git a/tests/auto/gui/painting/qpathclipper/qpathclipper.pro b/tests/auto/gui/painting/qpathclipper/qpathclipper.pro
index 2536cb24c0..e153460bf2 100644
--- a/tests/auto/gui/painting/qpathclipper/qpathclipper.pro
+++ b/tests/auto/gui/painting/qpathclipper/qpathclipper.pro
@@ -7,4 +7,4 @@ QT += gui-private testlib
requires(contains(QT_CONFIG,private_tests))
-unix:!mac:!haiku:LIBS+=-lm
+unix:!darwin:!haiku:!integrity: LIBS += -lm
diff --git a/tests/auto/gui/painting/qpolygon/qpolygon.pro b/tests/auto/gui/painting/qpolygon/qpolygon.pro
index 9385b6458d..6bda0f8709 100644
--- a/tests/auto/gui/painting/qpolygon/qpolygon.pro
+++ b/tests/auto/gui/painting/qpolygon/qpolygon.pro
@@ -3,6 +3,6 @@ TARGET = tst_qpolygon
QT += testlib
SOURCES += tst_qpolygon.cpp
-unix:!mac:!haiku:LIBS+=-lm
+unix:!darwin:!haiku:!integrity: LIBS += -lm
diff --git a/tests/auto/gui/painting/qtransform/qtransform.pro b/tests/auto/gui/painting/qtransform/qtransform.pro
index 62c7518da0..6af8485628 100644
--- a/tests/auto/gui/painting/qtransform/qtransform.pro
+++ b/tests/auto/gui/painting/qtransform/qtransform.pro
@@ -3,4 +3,4 @@ TARGET = tst_qtransform
SOURCES += tst_qtransform.cpp
QT += testlib
-unix:!mac:!haiku:LIBS+=-lm
+unix:!darwin:!haiku:!integrity: LIBS += -lm
diff --git a/tests/auto/gui/painting/qwmatrix/qwmatrix.pro b/tests/auto/gui/painting/qwmatrix/qwmatrix.pro
index efa2963091..de6454025c 100644
--- a/tests/auto/gui/painting/qwmatrix/qwmatrix.pro
+++ b/tests/auto/gui/painting/qwmatrix/qwmatrix.pro
@@ -3,4 +3,4 @@ TARGET = tst_qwmatrix
SOURCES += tst_qwmatrix.cpp
QT += testlib
-unix:!mac:!haiku:LIBS+=-lm
+unix:!darwin:!haiku:!integrity: LIBS += -lm
diff --git a/tests/auto/gui/text/qstatictext/qstatictext.pro b/tests/auto/gui/text/qstatictext/qstatictext.pro
index 002cead51d..0f4906ce4d 100644
--- a/tests/auto/gui/text/qstatictext/qstatictext.pro
+++ b/tests/auto/gui/text/qstatictext/qstatictext.pro
@@ -1,5 +1,7 @@
CONFIG += testcase
TARGET = tst_qstatictext
QT += testlib
-QT += core-private gui-private
+
SOURCES += tst_qstatictext.cpp
+
+contains(QT_CONFIG, private_tests): QT += core-private gui-private
diff --git a/tests/auto/gui/text/qstatictext/tst_qstatictext.cpp b/tests/auto/gui/text/qstatictext/tst_qstatictext.cpp
index 7f4a11c5a5..ec30cc8b67 100644
--- a/tests/auto/gui/text/qstatictext/tst_qstatictext.cpp
+++ b/tests/auto/gui/text/qstatictext/tst_qstatictext.cpp
@@ -34,7 +34,9 @@
#include <qstatictext.h>
#include <qpaintengine.h>
+#ifdef QT_BUILD_INTERNAL
#include <private/qstatictext_p.h>
+#endif
// #define DEBUG_SAVE_IMAGE
@@ -89,8 +91,10 @@ private slots:
void unprintableCharacter_qtbug12614();
+#ifdef QT_BUILD_INTERNAL
void underlinedColor_qtbug20159();
void textDocumentColor();
+#endif
private:
bool supportsTransformations() const;
@@ -592,6 +596,29 @@ void tst_QStaticText::plainTextVsRichText()
QCOMPARE(imagePlainText, imageRichText);
}
+static bool checkPixels(const QImage &image,
+ Qt::GlobalColor expectedColor1, Qt::GlobalColor expectedColor2,
+ QByteArray *errorMessage)
+{
+ const QRgb expectedRgb1 = QColor(expectedColor1).rgba();
+ const QRgb expectedRgb2 = QColor(expectedColor2).rgba();
+
+ for (int x = 0, w = image.width(); x < w; ++x) {
+ for (int y = 0, h = image.height(); y < h; ++y) {
+ const QRgb pixel = image.pixel(x, y);
+ if (pixel != expectedRgb1 && pixel != expectedRgb2) {
+ QString message;
+ QDebug(&message) << "Color mismatch in image" << image
+ << "at" << x << ',' << y << ':' << showbase << hex << pixel
+ << "(expected: " << expectedRgb1 << ',' << expectedRgb2 << ')';
+ *errorMessage = message.toLocal8Bit();
+ return false;
+ }
+ }
+ }
+ return true;
+}
+
void tst_QStaticText::setPenPlainText_data()
{
QTest::addColumn<QImage::Format>("format");
@@ -622,13 +649,9 @@ void tst_QStaticText::setPenPlainText()
p.drawStaticText(0, 0, staticText);
}
- for (int x=0; x<image.width(); ++x) {
- for (int y=0; y<image.height(); ++y) {
- QRgb pixel = image.pixel(x, y);
- QVERIFY(pixel == QColor(Qt::white).rgba()
- || pixel == QColor(Qt::yellow).rgba());
- }
- }
+ QByteArray errorMessage;
+ QVERIFY2(checkPixels(image, Qt::yellow, Qt::white, &errorMessage),
+ errorMessage.constData());
}
void tst_QStaticText::setPenRichText()
@@ -650,14 +673,9 @@ void tst_QStaticText::setPenRichText()
p.drawStaticText(0, 0, staticText);
}
- QImage img = image.toImage();
- for (int x=0; x<img.width(); ++x) {
- for (int y=0; y<img.height(); ++y) {
- QRgb pixel = img.pixel(x, y);
- QVERIFY(pixel == QColor(Qt::white).rgba()
- || pixel == QColor(Qt::green).rgba());
- }
- }
+ QByteArray errorMessage;
+ QVERIFY2(checkPixels(image.toImage(), Qt::green, Qt::white, &errorMessage),
+ errorMessage.constData());
}
void tst_QStaticText::richTextOverridesPen()
@@ -679,14 +697,9 @@ void tst_QStaticText::richTextOverridesPen()
p.drawStaticText(0, 0, staticText);
}
- QImage img = image.toImage();
- for (int x=0; x<img.width(); ++x) {
- for (int y=0; y<img.height(); ++y) {
- QRgb pixel = img.pixel(x, y);
- QVERIFY(pixel == QColor(Qt::white).rgba()
- || pixel == QColor(Qt::red).rgba());
- }
- }
+ QByteArray errorMessage;
+ QVERIFY2(checkPixels(image.toImage(), Qt::red, Qt::white, &errorMessage),
+ errorMessage.constData());
}
void tst_QStaticText::drawStruckOutText()
@@ -802,6 +815,7 @@ void tst_QStaticText::unprintableCharacter_qtbug12614()
QVERIFY(staticText.size().isValid()); // Force layout. Should not crash.
}
+#ifdef QT_BUILD_INTERNAL
void tst_QStaticText::underlinedColor_qtbug20159()
{
QString multiScriptText;
@@ -838,6 +852,7 @@ void tst_QStaticText::textDocumentColor()
QCOMPARE(d->items[1].color, QColor(Qt::red));
}
+#endif
QTEST_MAIN(tst_QStaticText)
#include "tst_qstatictext.moc"
diff --git a/tests/auto/gui/text/text.pro b/tests/auto/gui/text/text.pro
index 6c0def4d63..dc67794a98 100644
--- a/tests/auto/gui/text/text.pro
+++ b/tests/auto/gui/text/text.pro
@@ -30,6 +30,5 @@ win32:SUBDIRS -= qtextpiecetable
!contains(QT_CONFIG, private_tests): SUBDIRS -= \
qfontcache \
qcssparser \
- qstatictext \
qtextlayout \
qtextpiecetable \
diff --git a/tests/auto/network/access/qhttpnetworkreply/tst_qhttpnetworkreply.cpp b/tests/auto/network/access/qhttpnetworkreply/tst_qhttpnetworkreply.cpp
index 3373324c19..ec965a61b2 100644
--- a/tests/auto/network/access/qhttpnetworkreply/tst_qhttpnetworkreply.cpp
+++ b/tests/auto/network/access/qhttpnetworkreply/tst_qhttpnetworkreply.cpp
@@ -28,6 +28,9 @@
#include <QtTest/QtTest>
+#include <QtCore/QBuffer>
+#include <QtCore/QByteArray>
+
#include "private/qhttpnetworkconnection_p.h"
class tst_QHttpNetworkReply: public QObject
@@ -36,6 +39,9 @@ class tst_QHttpNetworkReply: public QObject
private Q_SLOTS:
void parseHeader_data();
void parseHeader();
+
+ void parseEndOfHeader_data();
+ void parseEndOfHeader();
};
void tst_QHttpNetworkReply::parseHeader_data()
@@ -95,5 +101,66 @@ void tst_QHttpNetworkReply::parseHeader()
}
}
+class TestHeaderSocket : public QAbstractSocket
+{
+public:
+ explicit TestHeaderSocket(const QByteArray &input) : QAbstractSocket(QAbstractSocket::TcpSocket, Q_NULLPTR)
+ {
+ inputBuffer.setData(input);
+ inputBuffer.open(QIODevice::ReadOnly | QIODevice::Unbuffered);
+ open(QIODevice::ReadOnly | QIODevice::Unbuffered);
+ }
+
+ qint64 readData(char *data, qint64 maxlen) { return inputBuffer.read(data, maxlen); }
+
+ QBuffer inputBuffer;
+};
+
+class TestHeaderReply : public QHttpNetworkReply
+{
+public:
+ QHttpNetworkReplyPrivate *replyPrivate() { return static_cast<QHttpNetworkReplyPrivate *>(d_ptr.data()); }
+};
+
+void tst_QHttpNetworkReply::parseEndOfHeader_data()
+{
+ QTest::addColumn<QByteArray>("headers");
+ QTest::addColumn<qint64>("lengths");
+
+ QTest::newRow("CRLFCRLF") << QByteArray("Content-Type: text/html; charset=utf-8\r\n"
+ "Content-Length:\r\n 1024\r\n"
+ "Content-Encoding: gzip\r\n\r\nHTTPBODY")
+ << qint64(90);
+
+ QTest::newRow("CRLFLF") << QByteArray("Content-Type: text/html; charset=utf-8\r\n"
+ "Content-Length:\r\n 1024\r\n"
+ "Content-Encoding: gzip\r\n\nHTTPBODY")
+ << qint64(89);
+
+ QTest::newRow("LFCRLF") << QByteArray("Content-Type: text/html; charset=utf-8\r\n"
+ "Content-Length:\r\n 1024\r\n"
+ "Content-Encoding: gzip\n\r\nHTTPBODY")
+ << qint64(89);
+
+ QTest::newRow("LFLF") << QByteArray("Content-Type: text/html; charset=utf-8\r\n"
+ "Content-Length:\r\n 1024\r\n"
+ "Content-Encoding: gzip\n\nHTTPBODY")
+ << qint64(88);
+}
+
+void tst_QHttpNetworkReply::parseEndOfHeader()
+{
+ QFETCH(QByteArray, headers);
+ QFETCH(qint64, lengths);
+
+ TestHeaderSocket socket(headers);
+
+ TestHeaderReply reply;
+
+ QHttpNetworkReplyPrivate *replyPrivate = reply.replyPrivate();
+ qint64 headerBytes = replyPrivate->readHeader(&socket);
+ QCOMPARE(headerBytes, lengths);
+}
+
QTEST_MAIN(tst_QHttpNetworkReply)
#include "tst_qhttpnetworkreply.moc"
diff --git a/tests/auto/network/access/qnetworkreply/BLACKLIST b/tests/auto/network/access/qnetworkreply/BLACKLIST
index 3ec580ddde..0605677e29 100644
--- a/tests/auto/network/access/qnetworkreply/BLACKLIST
+++ b/tests/auto/network/access/qnetworkreply/BLACKLIST
@@ -7,3 +7,7 @@ ubuntu-14.04
*
[backgroundRequestInterruption:ftp, bg, nobg]
*
+[authenticationCacheAfterCancel:http+socksauth]
+rhel-7.1
+[authenticationCacheAfterCancel:https+socksauth]
+rhel-7.1
diff --git a/tests/auto/network/socket/qlocalsocket/BLACKLIST b/tests/auto/network/socket/qlocalsocket/BLACKLIST
deleted file mode 100644
index 11ddef30a5..0000000000
--- a/tests/auto/network/socket/qlocalsocket/BLACKLIST
+++ /dev/null
@@ -1,2 +0,0 @@
-[processConnection:1 client]
-windows
diff --git a/tests/auto/network/socket/qlocalsocket/tst_qlocalsocket.cpp b/tests/auto/network/socket/qlocalsocket/tst_qlocalsocket.cpp
index d037826410..123fbfeb2a 100644
--- a/tests/auto/network/socket/qlocalsocket/tst_qlocalsocket.cpp
+++ b/tests/auto/network/socket/qlocalsocket/tst_qlocalsocket.cpp
@@ -490,7 +490,11 @@ void tst_QLocalSocket::connectWithOldOpen()
void tst_QLocalSocket::sendData_data()
{
- listenAndConnect_data();
+ QTest::addColumn<QString>("name");
+ QTest::addColumn<bool>("canListen");
+
+ QTest::newRow("null") << QString() << false;
+ QTest::newRow("tst_localsocket") << "tst_localsocket" << true;
}
void tst_QLocalSocket::sendData()
@@ -513,6 +517,7 @@ void tst_QLocalSocket::sendData()
// test creating a connection
socket.connectToServer(name);
bool timedOut = true;
+ int expectedReadyReadSignals = 0;
QCOMPARE(server.waitForNewConnection(3000, &timedOut), canListen);
@@ -536,15 +541,17 @@ void tst_QLocalSocket::sendData()
out << testLine << endl;
bool wrote = serverSocket->waitForBytesWritten(3000);
- if (!socket.canReadLine())
+ if (!socket.canReadLine()) {
+ expectedReadyReadSignals = 1;
QVERIFY(socket.waitForReadyRead());
+ }
QVERIFY(socket.bytesAvailable() >= 0);
QCOMPARE(socket.bytesToWrite(), (qint64)0);
QCOMPARE(socket.flush(), false);
QCOMPARE(socket.isValid(), canListen);
QCOMPARE(socket.readBufferSize(), (qint64)0);
- QCOMPARE(spyReadyRead.count(), 1);
+ QCOMPARE(spyReadyRead.count(), expectedReadyReadSignals);
QVERIFY(testLine.startsWith(in.readLine()));
@@ -559,7 +566,7 @@ void tst_QLocalSocket::sendData()
QCOMPARE(spyDisconnected.count(), canListen ? 1 : 0);
QCOMPARE(spyError.count(), canListen ? 0 : 1);
QCOMPARE(spyStateChanged.count(), canListen ? 4 : 2);
- QCOMPARE(spyReadyRead.count(), canListen ? 1 : 0);
+ QCOMPARE(spyReadyRead.count(), canListen ? expectedReadyReadSignals : 0);
server.close();
diff --git a/tests/auto/network/socket/qtcpsocket/tst_qtcpsocket.cpp b/tests/auto/network/socket/qtcpsocket/tst_qtcpsocket.cpp
index 904b26ac73..7565097942 100644
--- a/tests/auto/network/socket/qtcpsocket/tst_qtcpsocket.cpp
+++ b/tests/auto/network/socket/qtcpsocket/tst_qtcpsocket.cpp
@@ -197,6 +197,7 @@ private slots:
void clientSendDataOnDelayedDisconnect();
void serverDisconnectWithBuffered();
void socketDiscardDataInWriteMode();
+ void writeOnReadBufferOverflow();
void readNotificationsAfterBind();
protected slots:
@@ -478,6 +479,8 @@ void tst_QTcpSocket::constructing()
QCOMPARE(socket->localAddress(), QHostAddress());
QCOMPARE((int) socket->peerPort(), 0);
QCOMPARE(socket->peerAddress(), QHostAddress());
+ QCOMPARE(socket->readChannelCount(), 0);
+ QCOMPARE(socket->writeChannelCount(), 0);
QCOMPARE(socket->error(), QTcpSocket::UnknownSocketError);
QCOMPARE(socket->errorString(), QString("Unknown error"));
@@ -594,6 +597,8 @@ void tst_QTcpSocket::bind()
} while (randomPort && attemptsLeft);
QCOMPARE(socket->state(), QAbstractSocket::BoundState);
+ QCOMPARE(socket->readChannelCount(), 0);
+ QCOMPARE(socket->writeChannelCount(), 0);
boundPort = socket->localPort();
if (port)
QCOMPARE(int(boundPort), port);
@@ -729,6 +734,8 @@ void tst_QTcpSocket::setSocketDescriptor()
QCOMPARE(socket->socketDescriptor(), (qintptr)sock);
QVERIFY(socket->waitForConnected(10000));
QCOMPARE(socket->socketDescriptor(), (qintptr)sock);
+ QCOMPARE(socket->readChannelCount(), 1);
+ QCOMPARE(socket->writeChannelCount(), 1);
delete socket;
#ifdef Q_OS_WIN
delete dummy;
@@ -764,6 +771,8 @@ void tst_QTcpSocket::blockingIMAP()
QVERIFY(socket->waitForConnected(10000));
QCOMPARE(socket->state(), QTcpSocket::ConnectedState);
QVERIFY(socket->isValid());
+ QCOMPARE(socket->readChannelCount(), 1);
+ QCOMPARE(socket->writeChannelCount(), 1);
// Read greeting
QVERIFY(socket->waitForReadyRead(5000));
@@ -820,6 +829,8 @@ void tst_QTcpSocket::blockingIMAP()
// Check that it's closed
QCOMPARE(socket->state(), QTcpSocket::UnconnectedState);
+ QCOMPARE(socket->readChannelCount(), 0);
+ QCOMPARE(socket->writeChannelCount(), 0);
delete socket;
}
@@ -860,6 +871,8 @@ void tst_QTcpSocket::timeoutConnect()
QVERIFY(!socket->waitForConnected(1000)); //200ms is too short when using SOCKS proxy authentication
QCOMPARE(socket->state(), QTcpSocket::UnconnectedState);
QCOMPARE(int(socket->error()), int(QTcpSocket::SocketTimeoutError));
+ QCOMPARE(socket->readChannelCount(), 0);
+ QCOMPARE(socket->writeChannelCount(), 0);
timer.start();
socket->connectToHost(address, 1357);
@@ -906,6 +919,8 @@ void tst_QTcpSocket::nonBlockingIMAP()
}
QCOMPARE(socket->state(), QTcpSocket::ConnectedState);
+ QCOMPARE(socket->readChannelCount(), 1);
+ QCOMPARE(socket->writeChannelCount(), 1);
enterLoop(30);
if (timeout()) {
@@ -971,6 +986,8 @@ void tst_QTcpSocket::nonBlockingIMAP()
// Check that it's closed
QCOMPARE(socket->state(), QTcpSocket::UnconnectedState);
+ QCOMPARE(socket->readChannelCount(), 0);
+ QCOMPARE(socket->writeChannelCount(), 0);
delete socket;
}
@@ -3051,6 +3068,40 @@ void tst_QTcpSocket::socketDiscardDataInWriteMode()
delete socket;
}
+// Test waitForBytesWritten() does not fail on read buffer overflow
+void tst_QTcpSocket::writeOnReadBufferOverflow()
+{
+ QFETCH_GLOBAL(bool, setProxy);
+ if (setProxy)
+ return;
+
+ QTcpServer tcpServer;
+ QTcpSocket *socket = newSocket();
+
+ QVERIFY(tcpServer.listen(QHostAddress::LocalHost));
+ socket->setReadBufferSize(1);
+ socket->connectToHost(tcpServer.serverAddress(), tcpServer.serverPort());
+ QVERIFY(socket->waitForConnected(5000));
+ QCOMPARE(socket->state(), QAbstractSocket::ConnectedState);
+
+ // Accept connection on server side
+ QVERIFY2(tcpServer.waitForNewConnection(5000), "Network timeout");
+ QTcpSocket *newConnection = tcpServer.nextPendingConnection();
+ QVERIFY(newConnection != nullptr);
+ QCOMPARE(newConnection->write("1", 2), Q_INT64_C(2));
+ QVERIFY(newConnection->flush());
+
+ // Wait for buffer overflow
+ QVERIFY(socket->waitForReadyRead(5000));
+ QCOMPARE(socket->bytesAvailable(), Q_INT64_C(1));
+ // Write data and wait for successful send
+ QVERIFY(socket->putChar(0));
+ QVERIFY(socket->waitForBytesWritten(5000));
+
+ delete newConnection;
+ delete socket;
+}
+
// Test that the socket does not enable the read notifications in bind()
void tst_QTcpSocket::readNotificationsAfterBind()
{
diff --git a/tests/auto/other/qaccessibility/qaccessibility.pro b/tests/auto/other/qaccessibility/qaccessibility.pro
index ef3b469ba1..7b3173798d 100644
--- a/tests/auto/other/qaccessibility/qaccessibility.pro
+++ b/tests/auto/other/qaccessibility/qaccessibility.pro
@@ -5,7 +5,7 @@ QT += testlib core-private gui-private widgets-private
SOURCES += tst_qaccessibility.cpp
HEADERS += accessiblewidgets.h
-unix:!mac:!haiku:LIBS+=-lm
+unix:!darwin:!haiku:!integity: LIBS += -lm
wince {
accessneeded.files = $$QT_BUILD_TREE\\plugins\\accessible\\*.dll
diff --git a/tests/auto/sql/kernel/qsqlquery/tst_qsqlquery.cpp b/tests/auto/sql/kernel/qsqlquery/tst_qsqlquery.cpp
index 64e123309d..be3a86f4de 100644
--- a/tests/auto/sql/kernel/qsqlquery/tst_qsqlquery.cpp
+++ b/tests/auto/sql/kernel/qsqlquery/tst_qsqlquery.cpp
@@ -1748,24 +1748,6 @@ void tst_QSqlQuery::synonyms()
QCOMPARE( rec.field( 2 ).name().toLower(), QString( "t_varchar" ) );
}
-// This class is used to test protected QSqlResult methods
-class ResultHelper: public QSqlResult
-{
-
-public:
- ResultHelper(): QSqlResult( 0 ) {} // don't call, it's only for stupid compilers
-
- bool execBatch( bool bindArray = false )
- {
- return QSqlResult::execBatch( bindArray );
- }
-
- QString boundValueName( int pos ) const
- {
- return QSqlResult::boundValueName( pos );
- }
-};
-
// It doesn't make sense to split this into several tests
void tst_QSqlQuery::prepare_bind_exec()
{
@@ -1890,81 +1872,81 @@ void tst_QSqlQuery::prepare_bind_exec()
q.bindValue( 0, 0 );
q.bindValue( 1, values[ 0 ] );
QCOMPARE( q.boundValues().size(), 2 );
- QCOMPARE( q.boundValues()[ ((ResultHelper*)q.result())->boundValueName(0) ].toInt(), 0 );
- QCOMPARE( q.boundValues()[ ((ResultHelper*)q.result())->boundValueName(1) ].toString(), values[0] );
+ QCOMPARE(q.boundValues()[q.result()->boundValueName(0)].toInt(), 0);
+ QCOMPARE(q.boundValues()[q.result()->boundValueName(1)].toString(), values[0]);
QVERIFY_SQL( q, exec() );
QCOMPARE( q.boundValues().size(), 2 );
- QCOMPARE( q.boundValues()[ ((ResultHelper*)q.result())->boundValueName(0) ].toInt(), 0 );
- QCOMPARE( q.boundValues()[ ((ResultHelper*)q.result())->boundValueName(1) ].toString(), values[0] );
+ QCOMPARE(q.boundValues()[q.result()->boundValueName(0)].toInt(), 0);
+ QCOMPARE(q.boundValues()[q.result()->boundValueName(1)].toString(), values[0]);
q.addBindValue( 1 );
q.addBindValue( values[ 1 ] );
QCOMPARE( q.boundValues().size(), 2 );
- QCOMPARE( q.boundValues()[ ((ResultHelper*)q.result())->boundValueName(0) ].toInt(), 1 );
- QCOMPARE( q.boundValues()[ ((ResultHelper*)q.result())->boundValueName(1) ].toString(), values[1] );
+ QCOMPARE(q.boundValues()[q.result()->boundValueName(0)].toInt(), 1);
+ QCOMPARE(q.boundValues()[q.result()->boundValueName(1)].toString(), values[1]);
QVERIFY_SQL( q, exec() );
QCOMPARE( q.boundValues().size(), 2 );
- QCOMPARE( q.boundValues()[ ((ResultHelper*)q.result())->boundValueName(0) ].toInt(), 1 );
- QCOMPARE( q.boundValues()[ ((ResultHelper*)q.result())->boundValueName(1) ].toString(), values[1] );
+ QCOMPARE(q.boundValues()[q.result()->boundValueName(0)].toInt(), 1);
+ QCOMPARE(q.boundValues()[q.result()->boundValueName(1)].toString(), values[1]);
q.addBindValue( 2 );
q.addBindValue( values[ 2 ] );
QCOMPARE( q.boundValues().size(), 2 );
- QCOMPARE( q.boundValues()[ ((ResultHelper*)q.result())->boundValueName(0) ].toInt(), 2 );
- QCOMPARE( q.boundValues()[ ((ResultHelper*)q.result())->boundValueName(1) ].toString(), values[2] );
+ QCOMPARE(q.boundValues()[q.result()->boundValueName(0)].toInt(), 2);
+ QCOMPARE(q.boundValues()[q.result()->boundValueName(1)].toString(), values[2]);
QVERIFY_SQL( q, exec() );
QCOMPARE( q.boundValues().size(), 2 );
- QCOMPARE( q.boundValues()[ ((ResultHelper*)q.result())->boundValueName(0) ].toInt(), 2 );
- QCOMPARE( q.boundValues()[ ((ResultHelper*)q.result())->boundValueName(1) ].toString(), values[2] );
+ QCOMPARE(q.boundValues()[q.result()->boundValueName(0)].toInt(), 2);
+ QCOMPARE(q.boundValues()[q.result()->boundValueName(1)].toString(), values[2]);
q.addBindValue( 3 );
q.addBindValue( values[ 3 ] );
QCOMPARE( q.boundValues().size(), 2 );
- QCOMPARE( q.boundValues()[ ((ResultHelper*)q.result())->boundValueName(0) ].toInt(), 3 );
- QCOMPARE( q.boundValues()[ ((ResultHelper*)q.result())->boundValueName(1) ].toString(), values[3] );
+ QCOMPARE(q.boundValues()[q.result()->boundValueName(0)].toInt(), 3);
+ QCOMPARE(q.boundValues()[q.result()->boundValueName(1)].toString(), values[3]);
QVERIFY_SQL( q, exec() );
QCOMPARE( q.boundValues().size(), 2 );
- QCOMPARE( q.boundValues()[ ((ResultHelper*)q.result())->boundValueName(0) ].toInt(), 3 );
- QCOMPARE( q.boundValues()[ ((ResultHelper*)q.result())->boundValueName(1) ].toString(), values[3] );
+ QCOMPARE(q.boundValues()[q.result()->boundValueName(0)].toInt(), 3);
+ QCOMPARE(q.boundValues()[q.result()->boundValueName(1)].toString(), values[3]);
q.addBindValue( 4 );
q.addBindValue( values[ 4 ] );
QCOMPARE( q.boundValues().size(), 2 );
- QCOMPARE( q.boundValues()[ ((ResultHelper*)q.result())->boundValueName(0) ].toInt(), 4 );
- QCOMPARE( q.boundValues()[ ((ResultHelper*)q.result())->boundValueName(1) ].toString(), values[4] );
+ QCOMPARE(q.boundValues()[q.result()->boundValueName(0)].toInt(), 4);
+ QCOMPARE(q.boundValues()[q.result()->boundValueName(1)].toString(), values[4]);
QVERIFY_SQL( q, exec() );
QCOMPARE( q.boundValues().size(), 2 );
- QCOMPARE( q.boundValues()[ ((ResultHelper*)q.result())->boundValueName(0) ].toInt(), 4 );
- QCOMPARE( q.boundValues()[ ((ResultHelper*)q.result())->boundValueName(1) ].toString(), values[4] );
+ QCOMPARE(q.boundValues()[q.result()->boundValueName(0)].toInt(), 4);
+ QCOMPARE(q.boundValues()[q.result()->boundValueName(1)].toString(), values[4]);
q.bindValue( 1, values[ 5 ] );
q.bindValue( 0, 5 );
QCOMPARE( q.boundValues().size(), 2 );
- QCOMPARE( q.boundValues()[ ((ResultHelper*)q.result())->boundValueName(0) ].toInt(), 5 );
- QCOMPARE( q.boundValues()[ ((ResultHelper*)q.result())->boundValueName(1) ].toString(), values[5] );
+ QCOMPARE(q.boundValues()[q.result()->boundValueName(0)].toInt(), 5);
+ QCOMPARE(q.boundValues()[q.result()->boundValueName(1)].toString(), values[5]);
QVERIFY_SQL( q, exec() );
QCOMPARE( q.boundValues().size(), 2 );
- QCOMPARE( q.boundValues()[ ((ResultHelper*)q.result())->boundValueName(0) ].toInt(), 5 );
- QCOMPARE( q.boundValues()[ ((ResultHelper*)q.result())->boundValueName(1) ].toString(), values[5] );
+ QCOMPARE(q.boundValues()[q.result()->boundValueName(0)].toInt(), 5);
+ QCOMPARE(q.boundValues()[q.result()->boundValueName(1)].toString(), values[5]);
q.bindValue( 0, 6 );
q.bindValue( 1, QString() );
QCOMPARE( q.boundValues().size(), 2 );
- QCOMPARE( q.boundValues()[ ((ResultHelper*)q.result())->boundValueName(0) ].toInt(), 6 );
- QCOMPARE( q.boundValues()[ ((ResultHelper*)q.result())->boundValueName(1) ].toString(), QString() );
+ QCOMPARE(q.boundValues()[q.result()->boundValueName(0)].toInt(), 6);
+ QCOMPARE(q.boundValues()[q.result()->boundValueName(1)].toString(), QString());
QVERIFY_SQL( q, exec() );
QCOMPARE( q.boundValues().size(), 2 );
- QCOMPARE( q.boundValues()[ ((ResultHelper*)q.result())->boundValueName(0) ].toInt(), 6 );
- QCOMPARE( q.boundValues()[ ((ResultHelper*)q.result())->boundValueName(1) ].toString(), QString() );
+ QCOMPARE(q.boundValues()[q.result()->boundValueName(0)].toInt(), 6);
+ QCOMPARE(q.boundValues()[q.result()->boundValueName(1)].toString(), QString());
if ( db.driver()->hasFeature( QSqlDriver::Unicode ) ) {
q.bindValue( 0, 7 );
q.bindValue( 1, utf8str );
- QCOMPARE( q.boundValues()[ ((ResultHelper*)q.result())->boundValueName(0) ].toInt(), 7 );
- QCOMPARE( q.boundValues()[ ((ResultHelper*)q.result())->boundValueName(1) ].toString(), utf8str );
+ QCOMPARE(q.boundValues()[q.result()->boundValueName(0)].toInt(), 7);
+ QCOMPARE(q.boundValues()[q.result()->boundValueName(1)].toString(), utf8str);
QVERIFY_SQL( q, exec() );
- QCOMPARE( q.boundValues()[ ((ResultHelper*)q.result())->boundValueName(0) ].toInt(), 7 );
- QCOMPARE( q.boundValues()[ ((ResultHelper*)q.result())->boundValueName(1) ].toString(), utf8str );
+ QCOMPARE(q.boundValues()[q.result()->boundValueName(0)].toInt(), 7);
+ QCOMPARE(q.boundValues()[q.result()->boundValueName(1)].toString(), utf8str);
}
QVERIFY_SQL( q, exec( "SELECT * FROM " + qtest_prepare + " order by id" ) );
diff --git a/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp b/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp
index 78bb2247cb..204758f68a 100644
--- a/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp
+++ b/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp
@@ -30,6 +30,7 @@
#include <QtCore/QCoreApplication>
#include <QtTest/QtTest>
#ifdef QT_GUI_LIB
+#include <QtGui/QColor>
#include <QtGui/QImage>
#include <QtGui/QPixmap>
#endif
@@ -135,6 +136,7 @@ private slots:
void compareQListInt();
void compareQListDouble();
#ifdef QT_GUI_LIB
+ void compareQColor();
void compareQPixmaps();
void compareQPixmaps_data();
void compareQImages();
@@ -346,6 +348,15 @@ void tst_Cmptest::compareQListDouble()
}
#ifdef QT_GUI_LIB
+void tst_Cmptest::compareQColor()
+{
+ const QColor yellow(Qt::yellow);
+ const QColor yellowFromName(QStringLiteral("yellow"));
+ const QColor green(Qt::green);
+ QCOMPARE(yellow, yellowFromName);
+ QCOMPARE(yellow, green);
+}
+
void tst_Cmptest::compareQPixmaps_data()
{
QTest::addColumn<QPixmap>("opA");
diff --git a/tests/auto/testlib/selftests/expected_cmptest.lightxml b/tests/auto/testlib/selftests/expected_cmptest.lightxml
index 1719d2a79d..440429e430 100644
--- a/tests/auto/testlib/selftests/expected_cmptest.lightxml
+++ b/tests/auto/testlib/selftests/expected_cmptest.lightxml
@@ -8,13 +8,13 @@
<Duration msecs="0"/>
</TestFunction>
<TestFunction name="compare_unregistered_enums">
-<Incident type="fail" file="tst_cmptest.cpp" line="159">
+<Incident type="fail" file="tst_cmptest.cpp" line="156">
<Description><![CDATA[Compared values are not the same]]></Description>
</Incident>
<Duration msecs="0"/>
</TestFunction>
<TestFunction name="compare_registered_enums">
-<Incident type="fail" file="tst_cmptest.cpp" line="165">
+<Incident type="fail" file="tst_cmptest.cpp" line="162">
<Description><![CDATA[Compared values are not the same
Actual (Qt::ArrowCursor): ArrowCursor
Expected (Qt::BusyCursor) : BusyCursor]]></Description>
@@ -22,7 +22,7 @@
<Duration msecs="0"/>
</TestFunction>
<TestFunction name="compare_class_enums">
-<Incident type="fail" file="tst_cmptest.cpp" line="171">
+<Incident type="fail" file="tst_cmptest.cpp" line="168">
<Description><![CDATA[Compared values are not the same
Actual (MyClassEnum::MyClassEnumValue1): MyClassEnumValue1
Expected (MyClassEnum::MyClassEnumValue2): MyClassEnumValue2]]></Description>
@@ -38,7 +38,7 @@
<Duration msecs="0"/>
</TestFunction>
<TestFunction name="compare_tostring">
-<Incident type="fail" file="tst_cmptest.cpp" line="242">
+<Incident type="fail" file="tst_cmptest.cpp" line="239">
<DataTag><![CDATA[int, string]]></DataTag>
<Description><![CDATA[Compared values are not the same
Actual (actual) : QVariant(int,123)
@@ -47,19 +47,19 @@
<Incident type="pass" file="" line="0">
<DataTag><![CDATA[both invalid]]></DataTag>
</Incident>
-<Incident type="fail" file="tst_cmptest.cpp" line="242">
+<Incident type="fail" file="tst_cmptest.cpp" line="239">
<DataTag><![CDATA[null hash, invalid]]></DataTag>
<Description><![CDATA[Compared values are not the same
Actual (actual) : QVariant(QVariantHash)
Expected (expected): QVariant()]]></Description>
</Incident>
-<Incident type="fail" file="tst_cmptest.cpp" line="242">
+<Incident type="fail" file="tst_cmptest.cpp" line="239">
<DataTag><![CDATA[string, null user type]]></DataTag>
<Description><![CDATA[Compared values are not the same
Actual (actual) : QVariant(QString,A simple string)
Expected (expected): QVariant(PhonyClass)]]></Description>
</Incident>
-<Incident type="fail" file="tst_cmptest.cpp" line="242">
+<Incident type="fail" file="tst_cmptest.cpp" line="239">
<DataTag><![CDATA[both non-null user type]]></DataTag>
<Description><![CDATA[Compared values are not the same
Actual (actual) : QVariant(PhonyClass,<value not representable as string>)
@@ -74,31 +74,31 @@
<Incident type="pass" file="" line="0">
<DataTag><![CDATA[equal lists]]></DataTag>
</Incident>
-<Incident type="fail" file="tst_cmptest.cpp" line="336">
+<Incident type="fail" file="tst_cmptest.cpp" line="333">
<DataTag><![CDATA[last item different]]></DataTag>
<Description><![CDATA[Compared lists differ at index 2.
Actual (opA): "string3"
Expected (opB): "DIFFERS"]]></Description>
</Incident>
-<Incident type="fail" file="tst_cmptest.cpp" line="336">
+<Incident type="fail" file="tst_cmptest.cpp" line="333">
<DataTag><![CDATA[second-last item different]]></DataTag>
<Description><![CDATA[Compared lists differ at index 2.
Actual (opA): "string3"
Expected (opB): "DIFFERS"]]></Description>
</Incident>
-<Incident type="fail" file="tst_cmptest.cpp" line="336">
+<Incident type="fail" file="tst_cmptest.cpp" line="333">
<DataTag><![CDATA[prefix]]></DataTag>
<Description><![CDATA[Compared lists have different sizes.
Actual (opA) size: 2
Expected (opB) size: 1]]></Description>
</Incident>
-<Incident type="fail" file="tst_cmptest.cpp" line="336">
+<Incident type="fail" file="tst_cmptest.cpp" line="333">
<DataTag><![CDATA[short list second]]></DataTag>
<Description><![CDATA[Compared lists have different sizes.
Actual (opA) size: 12
Expected (opB) size: 1]]></Description>
</Incident>
-<Incident type="fail" file="tst_cmptest.cpp" line="336">
+<Incident type="fail" file="tst_cmptest.cpp" line="333">
<DataTag><![CDATA[short list first]]></DataTag>
<Description><![CDATA[Compared lists have different sizes.
Actual (opA) size: 1
@@ -107,7 +107,7 @@
<Duration msecs="0"/>
</TestFunction>
<TestFunction name="compareQListInt">
-<Incident type="fail" file="tst_cmptest.cpp" line="343">
+<Incident type="fail" file="tst_cmptest.cpp" line="340">
<Description><![CDATA[Compared lists differ at index 2.
Actual (int1): 3
Expected (int2): 4]]></Description>
@@ -115,24 +115,32 @@
<Duration msecs="0"/>
</TestFunction>
<TestFunction name="compareQListDouble">
-<Incident type="fail" file="tst_cmptest.cpp" line="350">
+<Incident type="fail" file="tst_cmptest.cpp" line="347">
<Description><![CDATA[Compared lists differ at index 0.
Actual (double1): 1.5
Expected (double2): 1]]></Description>
</Incident>
<Duration msecs="0"/>
</TestFunction>
+<TestFunction name="compareQColor">
+<Incident type="fail" file="tst_cmptest.cpp" line="357">
+ <Description><![CDATA[Compared values are not the same
+ Actual (yellow): #ffff00
+ Expected (green) : #00ff00]]></Description>
+</Incident>
+ <Duration msecs="0"/>
+</TestFunction>
<TestFunction name="compareQPixmaps">
<Incident type="pass" file="" line="0">
<DataTag><![CDATA[both null]]></DataTag>
</Incident>
-<Incident type="fail" file="tst_cmptest.cpp" line="376">
+<Incident type="fail" file="tst_cmptest.cpp" line="382">
<DataTag><![CDATA[one null]]></DataTag>
<Description><![CDATA[Compared QPixmaps differ.
Actual (opA).isNull(): 1
Expected (opB).isNull(): 0]]></Description>
</Incident>
-<Incident type="fail" file="tst_cmptest.cpp" line="376">
+<Incident type="fail" file="tst_cmptest.cpp" line="382">
<DataTag><![CDATA[other null]]></DataTag>
<Description><![CDATA[Compared QPixmaps differ.
Actual (opA).isNull(): 0
@@ -141,13 +149,13 @@
<Incident type="pass" file="" line="0">
<DataTag><![CDATA[equal]]></DataTag>
</Incident>
-<Incident type="fail" file="tst_cmptest.cpp" line="376">
+<Incident type="fail" file="tst_cmptest.cpp" line="382">
<DataTag><![CDATA[different size]]></DataTag>
<Description><![CDATA[Compared QPixmaps differ in size.
Actual (opA): 11x20
Expected (opB): 20x20]]></Description>
</Incident>
-<Incident type="fail" file="tst_cmptest.cpp" line="376">
+<Incident type="fail" file="tst_cmptest.cpp" line="382">
<DataTag><![CDATA[different pixels]]></DataTag>
<Description><![CDATA[Compared values are not the same]]></Description>
</Incident>
@@ -157,13 +165,13 @@
<Incident type="pass" file="" line="0">
<DataTag><![CDATA[both null]]></DataTag>
</Incident>
-<Incident type="fail" file="tst_cmptest.cpp" line="403">
+<Incident type="fail" file="tst_cmptest.cpp" line="409">
<DataTag><![CDATA[one null]]></DataTag>
<Description><![CDATA[Compared QImages differ.
Actual (opA).isNull(): 1
Expected (opB).isNull(): 0]]></Description>
</Incident>
-<Incident type="fail" file="tst_cmptest.cpp" line="403">
+<Incident type="fail" file="tst_cmptest.cpp" line="409">
<DataTag><![CDATA[other null]]></DataTag>
<Description><![CDATA[Compared QImages differ.
Actual (opA).isNull(): 0
@@ -172,44 +180,44 @@
<Incident type="pass" file="" line="0">
<DataTag><![CDATA[equal]]></DataTag>
</Incident>
-<Incident type="fail" file="tst_cmptest.cpp" line="403">
+<Incident type="fail" file="tst_cmptest.cpp" line="409">
<DataTag><![CDATA[different size]]></DataTag>
<Description><![CDATA[Compared QImages differ in size.
Actual (opA): 11x20
Expected (opB): 20x20]]></Description>
</Incident>
-<Incident type="fail" file="tst_cmptest.cpp" line="403">
+<Incident type="fail" file="tst_cmptest.cpp" line="409">
<DataTag><![CDATA[different format]]></DataTag>
<Description><![CDATA[Compared QImages differ in format.
Actual (opA): 6
Expected (opB): 3]]></Description>
</Incident>
-<Incident type="fail" file="tst_cmptest.cpp" line="403">
+<Incident type="fail" file="tst_cmptest.cpp" line="409">
<DataTag><![CDATA[different pixels]]></DataTag>
<Description><![CDATA[Compared values are not the same]]></Description>
</Incident>
<Duration msecs="0"/>
</TestFunction>
<TestFunction name="verify">
-<Incident type="fail" file="tst_cmptest.cpp" line="415">
+<Incident type="fail" file="tst_cmptest.cpp" line="421">
<Description><![CDATA['opaqueFunc() < 2' returned FALSE. ()]]></Description>
</Incident>
<Duration msecs="0"/>
</TestFunction>
<TestFunction name="verify2">
-<Incident type="fail" file="tst_cmptest.cpp" line="421">
+<Incident type="fail" file="tst_cmptest.cpp" line="427">
<Description><![CDATA['opaqueFunc() < 2' returned FALSE. (42)]]></Description>
</Incident>
<Duration msecs="0"/>
</TestFunction>
<TestFunction name="tryVerify">
-<Incident type="fail" file="tst_cmptest.cpp" line="427">
+<Incident type="fail" file="tst_cmptest.cpp" line="433">
<Description><![CDATA['opaqueFunc() < 2' returned FALSE. ()]]></Description>
</Incident>
<Duration msecs="0"/>
</TestFunction>
<TestFunction name="tryVerify2">
-<Incident type="fail" file="tst_cmptest.cpp" line="433">
+<Incident type="fail" file="tst_cmptest.cpp" line="439">
<Description><![CDATA['opaqueFunc() < 2' returned FALSE. (42)]]></Description>
</Incident>
<Duration msecs="0"/>
diff --git a/tests/auto/testlib/selftests/expected_cmptest.teamcity b/tests/auto/testlib/selftests/expected_cmptest.teamcity
index 4d3491403c..dea19b60b4 100644
--- a/tests/auto/testlib/selftests/expected_cmptest.teamcity
+++ b/tests/auto/testlib/selftests/expected_cmptest.teamcity
@@ -2,103 +2,106 @@
##teamcity[testStarted name='initTestCase()']
##teamcity[testFinished name='initTestCase()']
##teamcity[testStarted name='compare_unregistered_enums()']
-##teamcity[testFailed name='compare_unregistered_enums()' message='Failure! |[Loc: tst_cmptest.cpp(159)|]' details='Compared values are not the same']
+##teamcity[testFailed name='compare_unregistered_enums()' message='Failure! |[Loc: tst_cmptest.cpp(156)|]' details='Compared values are not the same']
##teamcity[testFinished name='compare_unregistered_enums()']
##teamcity[testStarted name='compare_registered_enums()']
-##teamcity[testFailed name='compare_registered_enums()' message='Failure! |[Loc: tst_cmptest.cpp(165)|]' details='Compared values are not the same|n Actual (Qt::ArrowCursor): ArrowCursor|n Expected (Qt::BusyCursor) : BusyCursor']
+##teamcity[testFailed name='compare_registered_enums()' message='Failure! |[Loc: tst_cmptest.cpp(162)|]' details='Compared values are not the same|n Actual (Qt::ArrowCursor): ArrowCursor|n Expected (Qt::BusyCursor) : BusyCursor']
##teamcity[testFinished name='compare_registered_enums()']
##teamcity[testStarted name='compare_class_enums()']
-##teamcity[testFailed name='compare_class_enums()' message='Failure! |[Loc: tst_cmptest.cpp(171)|]' details='Compared values are not the same|n Actual (MyClassEnum::MyClassEnumValue1): MyClassEnumValue1|n Expected (MyClassEnum::MyClassEnumValue2): MyClassEnumValue2']
+##teamcity[testFailed name='compare_class_enums()' message='Failure! |[Loc: tst_cmptest.cpp(168)|]' details='Compared values are not the same|n Actual (MyClassEnum::MyClassEnumValue1): MyClassEnumValue1|n Expected (MyClassEnum::MyClassEnumValue2): MyClassEnumValue2']
##teamcity[testFinished name='compare_class_enums()']
##teamcity[testStarted name='compare_boolfuncs()']
##teamcity[testFinished name='compare_boolfuncs()']
##teamcity[testStarted name='compare_pointerfuncs()']
##teamcity[testFinished name='compare_pointerfuncs()']
##teamcity[testStarted name='compare_tostring(int, string)']
-##teamcity[testFailed name='compare_tostring(int, string)' message='Failure! |[Loc: tst_cmptest.cpp(242)|]' details='Compared values are not the same|n Actual (actual) : QVariant(int,123)|n Expected (expected): QVariant(QString,hi)']
+##teamcity[testFailed name='compare_tostring(int, string)' message='Failure! |[Loc: tst_cmptest.cpp(239)|]' details='Compared values are not the same|n Actual (actual) : QVariant(int,123)|n Expected (expected): QVariant(QString,hi)']
##teamcity[testFinished name='compare_tostring(int, string)']
##teamcity[testStarted name='compare_tostring(both invalid)']
##teamcity[testFinished name='compare_tostring(both invalid)']
##teamcity[testStarted name='compare_tostring(null hash, invalid)']
-##teamcity[testFailed name='compare_tostring(null hash, invalid)' message='Failure! |[Loc: tst_cmptest.cpp(242)|]' details='Compared values are not the same|n Actual (actual) : QVariant(QVariantHash)|n Expected (expected): QVariant()']
+##teamcity[testFailed name='compare_tostring(null hash, invalid)' message='Failure! |[Loc: tst_cmptest.cpp(239)|]' details='Compared values are not the same|n Actual (actual) : QVariant(QVariantHash)|n Expected (expected): QVariant()']
##teamcity[testFinished name='compare_tostring(null hash, invalid)']
##teamcity[testStarted name='compare_tostring(string, null user type)']
-##teamcity[testFailed name='compare_tostring(string, null user type)' message='Failure! |[Loc: tst_cmptest.cpp(242)|]' details='Compared values are not the same|n Actual (actual) : QVariant(QString,A simple string)|n Expected (expected): QVariant(PhonyClass)']
+##teamcity[testFailed name='compare_tostring(string, null user type)' message='Failure! |[Loc: tst_cmptest.cpp(239)|]' details='Compared values are not the same|n Actual (actual) : QVariant(QString,A simple string)|n Expected (expected): QVariant(PhonyClass)']
##teamcity[testFinished name='compare_tostring(string, null user type)']
##teamcity[testStarted name='compare_tostring(both non-null user type)']
-##teamcity[testFailed name='compare_tostring(both non-null user type)' message='Failure! |[Loc: tst_cmptest.cpp(242)|]' details='Compared values are not the same|n Actual (actual) : QVariant(PhonyClass,<value not representable as string>)|n Expected (expected): QVariant(PhonyClass,<value not representable as string>)']
+##teamcity[testFailed name='compare_tostring(both non-null user type)' message='Failure! |[Loc: tst_cmptest.cpp(239)|]' details='Compared values are not the same|n Actual (actual) : QVariant(PhonyClass,<value not representable as string>)|n Expected (expected): QVariant(PhonyClass,<value not representable as string>)']
##teamcity[testFinished name='compare_tostring(both non-null user type)']
##teamcity[testStarted name='compareQStringLists(empty lists)']
##teamcity[testFinished name='compareQStringLists(empty lists)']
##teamcity[testStarted name='compareQStringLists(equal lists)']
##teamcity[testFinished name='compareQStringLists(equal lists)']
##teamcity[testStarted name='compareQStringLists(last item different)']
-##teamcity[testFailed name='compareQStringLists(last item different)' message='Failure! |[Loc: tst_cmptest.cpp(336)|]' details='Compared lists differ at index 2.|n Actual (opA): "string3"|n Expected (opB): "DIFFERS"']
+##teamcity[testFailed name='compareQStringLists(last item different)' message='Failure! |[Loc: tst_cmptest.cpp(333)|]' details='Compared lists differ at index 2.|n Actual (opA): "string3"|n Expected (opB): "DIFFERS"']
##teamcity[testFinished name='compareQStringLists(last item different)']
##teamcity[testStarted name='compareQStringLists(second-last item different)']
-##teamcity[testFailed name='compareQStringLists(second-last item different)' message='Failure! |[Loc: tst_cmptest.cpp(336)|]' details='Compared lists differ at index 2.|n Actual (opA): "string3"|n Expected (opB): "DIFFERS"']
+##teamcity[testFailed name='compareQStringLists(second-last item different)' message='Failure! |[Loc: tst_cmptest.cpp(333)|]' details='Compared lists differ at index 2.|n Actual (opA): "string3"|n Expected (opB): "DIFFERS"']
##teamcity[testFinished name='compareQStringLists(second-last item different)']
##teamcity[testStarted name='compareQStringLists(prefix)']
-##teamcity[testFailed name='compareQStringLists(prefix)' message='Failure! |[Loc: tst_cmptest.cpp(336)|]' details='Compared lists have different sizes.|n Actual (opA) size: 2|n Expected (opB) size: 1']
+##teamcity[testFailed name='compareQStringLists(prefix)' message='Failure! |[Loc: tst_cmptest.cpp(333)|]' details='Compared lists have different sizes.|n Actual (opA) size: 2|n Expected (opB) size: 1']
##teamcity[testFinished name='compareQStringLists(prefix)']
##teamcity[testStarted name='compareQStringLists(short list second)']
-##teamcity[testFailed name='compareQStringLists(short list second)' message='Failure! |[Loc: tst_cmptest.cpp(336)|]' details='Compared lists have different sizes.|n Actual (opA) size: 12|n Expected (opB) size: 1']
+##teamcity[testFailed name='compareQStringLists(short list second)' message='Failure! |[Loc: tst_cmptest.cpp(333)|]' details='Compared lists have different sizes.|n Actual (opA) size: 12|n Expected (opB) size: 1']
##teamcity[testFinished name='compareQStringLists(short list second)']
##teamcity[testStarted name='compareQStringLists(short list first)']
-##teamcity[testFailed name='compareQStringLists(short list first)' message='Failure! |[Loc: tst_cmptest.cpp(336)|]' details='Compared lists have different sizes.|n Actual (opA) size: 1|n Expected (opB) size: 12']
+##teamcity[testFailed name='compareQStringLists(short list first)' message='Failure! |[Loc: tst_cmptest.cpp(333)|]' details='Compared lists have different sizes.|n Actual (opA) size: 1|n Expected (opB) size: 12']
##teamcity[testFinished name='compareQStringLists(short list first)']
##teamcity[testStarted name='compareQListInt()']
-##teamcity[testFailed name='compareQListInt()' message='Failure! |[Loc: tst_cmptest.cpp(343)|]' details='Compared lists differ at index 2.|n Actual (int1): 3|n Expected (int2): 4']
+##teamcity[testFailed name='compareQListInt()' message='Failure! |[Loc: tst_cmptest.cpp(340)|]' details='Compared lists differ at index 2.|n Actual (int1): 3|n Expected (int2): 4']
##teamcity[testFinished name='compareQListInt()']
##teamcity[testStarted name='compareQListDouble()']
-##teamcity[testFailed name='compareQListDouble()' message='Failure! |[Loc: tst_cmptest.cpp(350)|]' details='Compared lists differ at index 0.|n Actual (double1): 1.5|n Expected (double2): 1']
+##teamcity[testFailed name='compareQListDouble()' message='Failure! |[Loc: tst_cmptest.cpp(347)|]' details='Compared lists differ at index 0.|n Actual (double1): 1.5|n Expected (double2): 1']
##teamcity[testFinished name='compareQListDouble()']
+##teamcity[testStarted name='compareQColor()']
+##teamcity[testFailed name='compareQColor()' message='Failure! |[Loc: tst_cmptest.cpp(357)|]' details='Compared values are not the same|n Actual (yellow): #ffff00|n Expected (green) : #00ff00']
+##teamcity[testFinished name='compareQColor()']
##teamcity[testStarted name='compareQPixmaps(both null)']
##teamcity[testFinished name='compareQPixmaps(both null)']
##teamcity[testStarted name='compareQPixmaps(one null)']
-##teamcity[testFailed name='compareQPixmaps(one null)' message='Failure! |[Loc: tst_cmptest.cpp(376)|]' details='Compared QPixmaps differ.|n Actual (opA).isNull(): 1|n Expected (opB).isNull(): 0']
+##teamcity[testFailed name='compareQPixmaps(one null)' message='Failure! |[Loc: tst_cmptest.cpp(382)|]' details='Compared QPixmaps differ.|n Actual (opA).isNull(): 1|n Expected (opB).isNull(): 0']
##teamcity[testFinished name='compareQPixmaps(one null)']
##teamcity[testStarted name='compareQPixmaps(other null)']
-##teamcity[testFailed name='compareQPixmaps(other null)' message='Failure! |[Loc: tst_cmptest.cpp(376)|]' details='Compared QPixmaps differ.|n Actual (opA).isNull(): 0|n Expected (opB).isNull(): 1']
+##teamcity[testFailed name='compareQPixmaps(other null)' message='Failure! |[Loc: tst_cmptest.cpp(382)|]' details='Compared QPixmaps differ.|n Actual (opA).isNull(): 0|n Expected (opB).isNull(): 1']
##teamcity[testFinished name='compareQPixmaps(other null)']
##teamcity[testStarted name='compareQPixmaps(equal)']
##teamcity[testFinished name='compareQPixmaps(equal)']
##teamcity[testStarted name='compareQPixmaps(different size)']
-##teamcity[testFailed name='compareQPixmaps(different size)' message='Failure! |[Loc: tst_cmptest.cpp(376)|]' details='Compared QPixmaps differ in size.|n Actual (opA): 11x20|n Expected (opB): 20x20']
+##teamcity[testFailed name='compareQPixmaps(different size)' message='Failure! |[Loc: tst_cmptest.cpp(382)|]' details='Compared QPixmaps differ in size.|n Actual (opA): 11x20|n Expected (opB): 20x20']
##teamcity[testFinished name='compareQPixmaps(different size)']
##teamcity[testStarted name='compareQPixmaps(different pixels)']
-##teamcity[testFailed name='compareQPixmaps(different pixels)' message='Failure! |[Loc: tst_cmptest.cpp(376)|]' details='Compared values are not the same']
+##teamcity[testFailed name='compareQPixmaps(different pixels)' message='Failure! |[Loc: tst_cmptest.cpp(382)|]' details='Compared values are not the same']
##teamcity[testFinished name='compareQPixmaps(different pixels)']
##teamcity[testStarted name='compareQImages(both null)']
##teamcity[testFinished name='compareQImages(both null)']
##teamcity[testStarted name='compareQImages(one null)']
-##teamcity[testFailed name='compareQImages(one null)' message='Failure! |[Loc: tst_cmptest.cpp(403)|]' details='Compared QImages differ.|n Actual (opA).isNull(): 1|n Expected (opB).isNull(): 0']
+##teamcity[testFailed name='compareQImages(one null)' message='Failure! |[Loc: tst_cmptest.cpp(409)|]' details='Compared QImages differ.|n Actual (opA).isNull(): 1|n Expected (opB).isNull(): 0']
##teamcity[testFinished name='compareQImages(one null)']
##teamcity[testStarted name='compareQImages(other null)']
-##teamcity[testFailed name='compareQImages(other null)' message='Failure! |[Loc: tst_cmptest.cpp(403)|]' details='Compared QImages differ.|n Actual (opA).isNull(): 0|n Expected (opB).isNull(): 1']
+##teamcity[testFailed name='compareQImages(other null)' message='Failure! |[Loc: tst_cmptest.cpp(409)|]' details='Compared QImages differ.|n Actual (opA).isNull(): 0|n Expected (opB).isNull(): 1']
##teamcity[testFinished name='compareQImages(other null)']
##teamcity[testStarted name='compareQImages(equal)']
##teamcity[testFinished name='compareQImages(equal)']
##teamcity[testStarted name='compareQImages(different size)']
-##teamcity[testFailed name='compareQImages(different size)' message='Failure! |[Loc: tst_cmptest.cpp(403)|]' details='Compared QImages differ in size.|n Actual (opA): 11x20|n Expected (opB): 20x20']
+##teamcity[testFailed name='compareQImages(different size)' message='Failure! |[Loc: tst_cmptest.cpp(409)|]' details='Compared QImages differ in size.|n Actual (opA): 11x20|n Expected (opB): 20x20']
##teamcity[testFinished name='compareQImages(different size)']
##teamcity[testStarted name='compareQImages(different format)']
-##teamcity[testFailed name='compareQImages(different format)' message='Failure! |[Loc: tst_cmptest.cpp(403)|]' details='Compared QImages differ in format.|n Actual (opA): 6|n Expected (opB): 3']
+##teamcity[testFailed name='compareQImages(different format)' message='Failure! |[Loc: tst_cmptest.cpp(409)|]' details='Compared QImages differ in format.|n Actual (opA): 6|n Expected (opB): 3']
##teamcity[testFinished name='compareQImages(different format)']
##teamcity[testStarted name='compareQImages(different pixels)']
-##teamcity[testFailed name='compareQImages(different pixels)' message='Failure! |[Loc: tst_cmptest.cpp(403)|]' details='Compared values are not the same']
+##teamcity[testFailed name='compareQImages(different pixels)' message='Failure! |[Loc: tst_cmptest.cpp(409)|]' details='Compared values are not the same']
##teamcity[testFinished name='compareQImages(different pixels)']
##teamcity[testStarted name='verify()']
-##teamcity[testFailed name='verify()' message='Failure! |[Loc: tst_cmptest.cpp(415)|]' details='|'opaqueFunc() < 2|' returned FALSE. ()']
+##teamcity[testFailed name='verify()' message='Failure! |[Loc: tst_cmptest.cpp(421)|]' details='|'opaqueFunc() < 2|' returned FALSE. ()']
##teamcity[testFinished name='verify()']
##teamcity[testStarted name='verify2()']
-##teamcity[testFailed name='verify2()' message='Failure! |[Loc: tst_cmptest.cpp(421)|]' details='|'opaqueFunc() < 2|' returned FALSE. (42)']
+##teamcity[testFailed name='verify2()' message='Failure! |[Loc: tst_cmptest.cpp(427)|]' details='|'opaqueFunc() < 2|' returned FALSE. (42)']
##teamcity[testFinished name='verify2()']
##teamcity[testStarted name='tryVerify()']
-##teamcity[testFailed name='tryVerify()' message='Failure! |[Loc: tst_cmptest.cpp(427)|]' details='|'opaqueFunc() < 2|' returned FALSE. ()']
+##teamcity[testFailed name='tryVerify()' message='Failure! |[Loc: tst_cmptest.cpp(433)|]' details='|'opaqueFunc() < 2|' returned FALSE. ()']
##teamcity[testFinished name='tryVerify()']
##teamcity[testStarted name='tryVerify2()']
-##teamcity[testFailed name='tryVerify2()' message='Failure! |[Loc: tst_cmptest.cpp(433)|]' details='|'opaqueFunc() < 2|' returned FALSE. (42)']
+##teamcity[testFailed name='tryVerify2()' message='Failure! |[Loc: tst_cmptest.cpp(439)|]' details='|'opaqueFunc() < 2|' returned FALSE. (42)']
##teamcity[testFinished name='tryVerify2()']
##teamcity[testStarted name='cleanupTestCase()']
##teamcity[testFinished name='cleanupTestCase()']
diff --git a/tests/auto/testlib/selftests/expected_cmptest.txt b/tests/auto/testlib/selftests/expected_cmptest.txt
index d4e50faaf0..100fd5e8ef 100644
--- a/tests/auto/testlib/selftests/expected_cmptest.txt
+++ b/tests/auto/testlib/selftests/expected_cmptest.txt
@@ -2,108 +2,112 @@
Config: Using QtTest library
PASS : tst_Cmptest::initTestCase()
FAIL! : tst_Cmptest::compare_unregistered_enums() Compared values are not the same
- Loc: [tst_cmptest.cpp(159)]
+ Loc: [tst_cmptest.cpp(156)]
FAIL! : tst_Cmptest::compare_registered_enums() Compared values are not the same
Actual (Qt::ArrowCursor): ArrowCursor
Expected (Qt::BusyCursor) : BusyCursor
- Loc: [tst_cmptest.cpp(165)]
+ Loc: [tst_cmptest.cpp(162)]
FAIL! : tst_Cmptest::compare_class_enums() Compared values are not the same
Actual (MyClassEnum::MyClassEnumValue1): MyClassEnumValue1
Expected (MyClassEnum::MyClassEnumValue2): MyClassEnumValue2
- Loc: [tst_cmptest.cpp(171)]
+ Loc: [tst_cmptest.cpp(168)]
PASS : tst_Cmptest::compare_boolfuncs()
PASS : tst_Cmptest::compare_pointerfuncs()
FAIL! : tst_Cmptest::compare_tostring(int, string) Compared values are not the same
Actual (actual) : QVariant(int,123)
Expected (expected): QVariant(QString,hi)
- Loc: [tst_cmptest.cpp(242)]
+ Loc: [tst_cmptest.cpp(239)]
PASS : tst_Cmptest::compare_tostring(both invalid)
FAIL! : tst_Cmptest::compare_tostring(null hash, invalid) Compared values are not the same
Actual (actual) : QVariant(QVariantHash)
Expected (expected): QVariant()
- Loc: [tst_cmptest.cpp(242)]
+ Loc: [tst_cmptest.cpp(239)]
FAIL! : tst_Cmptest::compare_tostring(string, null user type) Compared values are not the same
Actual (actual) : QVariant(QString,A simple string)
Expected (expected): QVariant(PhonyClass)
- Loc: [tst_cmptest.cpp(242)]
+ Loc: [tst_cmptest.cpp(239)]
FAIL! : tst_Cmptest::compare_tostring(both non-null user type) Compared values are not the same
Actual (actual) : QVariant(PhonyClass,<value not representable as string>)
Expected (expected): QVariant(PhonyClass,<value not representable as string>)
- Loc: [tst_cmptest.cpp(242)]
+ Loc: [tst_cmptest.cpp(239)]
PASS : tst_Cmptest::compareQStringLists(empty lists)
PASS : tst_Cmptest::compareQStringLists(equal lists)
FAIL! : tst_Cmptest::compareQStringLists(last item different) Compared lists differ at index 2.
Actual (opA): "string3"
Expected (opB): "DIFFERS"
- Loc: [tst_cmptest.cpp(336)]
+ Loc: [tst_cmptest.cpp(333)]
FAIL! : tst_Cmptest::compareQStringLists(second-last item different) Compared lists differ at index 2.
Actual (opA): "string3"
Expected (opB): "DIFFERS"
- Loc: [tst_cmptest.cpp(336)]
+ Loc: [tst_cmptest.cpp(333)]
FAIL! : tst_Cmptest::compareQStringLists(prefix) Compared lists have different sizes.
Actual (opA) size: 2
Expected (opB) size: 1
- Loc: [tst_cmptest.cpp(336)]
+ Loc: [tst_cmptest.cpp(333)]
FAIL! : tst_Cmptest::compareQStringLists(short list second) Compared lists have different sizes.
Actual (opA) size: 12
Expected (opB) size: 1
- Loc: [tst_cmptest.cpp(336)]
+ Loc: [tst_cmptest.cpp(333)]
FAIL! : tst_Cmptest::compareQStringLists(short list first) Compared lists have different sizes.
Actual (opA) size: 1
Expected (opB) size: 12
- Loc: [tst_cmptest.cpp(336)]
+ Loc: [tst_cmptest.cpp(333)]
FAIL! : tst_Cmptest::compareQListInt() Compared lists differ at index 2.
Actual (int1): 3
Expected (int2): 4
- Loc: [tst_cmptest.cpp(343)]
+ Loc: [tst_cmptest.cpp(340)]
FAIL! : tst_Cmptest::compareQListDouble() Compared lists differ at index 0.
Actual (double1): 1.5
Expected (double2): 1
- Loc: [tst_cmptest.cpp(350)]
+ Loc: [tst_cmptest.cpp(347)]
+FAIL! : tst_Cmptest::compareQColor() Compared values are not the same
+ Actual (yellow): #ffff00
+ Expected (green) : #00ff00
+ Loc: [tst_cmptest.cpp(357)]
PASS : tst_Cmptest::compareQPixmaps(both null)
FAIL! : tst_Cmptest::compareQPixmaps(one null) Compared QPixmaps differ.
Actual (opA).isNull(): 1
Expected (opB).isNull(): 0
- Loc: [tst_cmptest.cpp(376)]
+ Loc: [tst_cmptest.cpp(382)]
FAIL! : tst_Cmptest::compareQPixmaps(other null) Compared QPixmaps differ.
Actual (opA).isNull(): 0
Expected (opB).isNull(): 1
- Loc: [tst_cmptest.cpp(376)]
+ Loc: [tst_cmptest.cpp(382)]
PASS : tst_Cmptest::compareQPixmaps(equal)
FAIL! : tst_Cmptest::compareQPixmaps(different size) Compared QPixmaps differ in size.
Actual (opA): 11x20
Expected (opB): 20x20
- Loc: [tst_cmptest.cpp(376)]
+ Loc: [tst_cmptest.cpp(382)]
FAIL! : tst_Cmptest::compareQPixmaps(different pixels) Compared values are not the same
- Loc: [tst_cmptest.cpp(376)]
+ Loc: [tst_cmptest.cpp(382)]
PASS : tst_Cmptest::compareQImages(both null)
FAIL! : tst_Cmptest::compareQImages(one null) Compared QImages differ.
Actual (opA).isNull(): 1
Expected (opB).isNull(): 0
- Loc: [tst_cmptest.cpp(403)]
+ Loc: [tst_cmptest.cpp(409)]
FAIL! : tst_Cmptest::compareQImages(other null) Compared QImages differ.
Actual (opA).isNull(): 0
Expected (opB).isNull(): 1
- Loc: [tst_cmptest.cpp(403)]
+ Loc: [tst_cmptest.cpp(409)]
PASS : tst_Cmptest::compareQImages(equal)
FAIL! : tst_Cmptest::compareQImages(different size) Compared QImages differ in size.
Actual (opA): 11x20
Expected (opB): 20x20
- Loc: [tst_cmptest.cpp(403)]
+ Loc: [tst_cmptest.cpp(409)]
FAIL! : tst_Cmptest::compareQImages(different format) Compared QImages differ in format.
Actual (opA): 6
Expected (opB): 3
- Loc: [tst_cmptest.cpp(403)]
+ Loc: [tst_cmptest.cpp(409)]
FAIL! : tst_Cmptest::compareQImages(different pixels) Compared values are not the same
- Loc: [tst_cmptest.cpp(403)]
+ Loc: [tst_cmptest.cpp(409)]
FAIL! : tst_Cmptest::verify() 'opaqueFunc() < 2' returned FALSE. ()
- Loc: [tst_cmptest.cpp(415)]
-FAIL! : tst_Cmptest::verify2() 'opaqueFunc() < 2' returned FALSE. (42)
Loc: [tst_cmptest.cpp(421)]
-FAIL! : tst_Cmptest::tryVerify() 'opaqueFunc() < 2' returned FALSE. ()
+FAIL! : tst_Cmptest::verify2() 'opaqueFunc() < 2' returned FALSE. (42)
Loc: [tst_cmptest.cpp(427)]
-FAIL! : tst_Cmptest::tryVerify2() 'opaqueFunc() < 2' returned FALSE. (42)
+FAIL! : tst_Cmptest::tryVerify() 'opaqueFunc() < 2' returned FALSE. ()
Loc: [tst_cmptest.cpp(433)]
+FAIL! : tst_Cmptest::tryVerify2() 'opaqueFunc() < 2' returned FALSE. (42)
+ Loc: [tst_cmptest.cpp(439)]
PASS : tst_Cmptest::cleanupTestCase()
-Totals: 11 passed, 27 failed, 0 skipped, 0 blacklisted
+Totals: 11 passed, 28 failed, 0 skipped, 0 blacklisted, 247ms
********* Finished testing of tst_Cmptest *********
diff --git a/tests/auto/testlib/selftests/expected_cmptest.xml b/tests/auto/testlib/selftests/expected_cmptest.xml
index d9a68e0bd1..f45d9ba1da 100644
--- a/tests/auto/testlib/selftests/expected_cmptest.xml
+++ b/tests/auto/testlib/selftests/expected_cmptest.xml
@@ -10,13 +10,13 @@
<Duration msecs="0"/>
</TestFunction>
<TestFunction name="compare_unregistered_enums">
-<Incident type="fail" file="tst_cmptest.cpp" line="159">
+<Incident type="fail" file="tst_cmptest.cpp" line="156">
<Description><![CDATA[Compared values are not the same]]></Description>
</Incident>
<Duration msecs="0"/>
</TestFunction>
<TestFunction name="compare_registered_enums">
-<Incident type="fail" file="tst_cmptest.cpp" line="165">
+<Incident type="fail" file="tst_cmptest.cpp" line="162">
<Description><![CDATA[Compared values are not the same
Actual (Qt::ArrowCursor): ArrowCursor
Expected (Qt::BusyCursor) : BusyCursor]]></Description>
@@ -24,7 +24,7 @@
<Duration msecs="0"/>
</TestFunction>
<TestFunction name="compare_class_enums">
-<Incident type="fail" file="tst_cmptest.cpp" line="171">
+<Incident type="fail" file="tst_cmptest.cpp" line="168">
<Description><![CDATA[Compared values are not the same
Actual (MyClassEnum::MyClassEnumValue1): MyClassEnumValue1
Expected (MyClassEnum::MyClassEnumValue2): MyClassEnumValue2]]></Description>
@@ -40,7 +40,7 @@
<Duration msecs="0"/>
</TestFunction>
<TestFunction name="compare_tostring">
-<Incident type="fail" file="tst_cmptest.cpp" line="242">
+<Incident type="fail" file="tst_cmptest.cpp" line="239">
<DataTag><![CDATA[int, string]]></DataTag>
<Description><![CDATA[Compared values are not the same
Actual (actual) : QVariant(int,123)
@@ -49,19 +49,19 @@
<Incident type="pass" file="" line="0">
<DataTag><![CDATA[both invalid]]></DataTag>
</Incident>
-<Incident type="fail" file="tst_cmptest.cpp" line="242">
+<Incident type="fail" file="tst_cmptest.cpp" line="239">
<DataTag><![CDATA[null hash, invalid]]></DataTag>
<Description><![CDATA[Compared values are not the same
Actual (actual) : QVariant(QVariantHash)
Expected (expected): QVariant()]]></Description>
</Incident>
-<Incident type="fail" file="tst_cmptest.cpp" line="242">
+<Incident type="fail" file="tst_cmptest.cpp" line="239">
<DataTag><![CDATA[string, null user type]]></DataTag>
<Description><![CDATA[Compared values are not the same
Actual (actual) : QVariant(QString,A simple string)
Expected (expected): QVariant(PhonyClass)]]></Description>
</Incident>
-<Incident type="fail" file="tst_cmptest.cpp" line="242">
+<Incident type="fail" file="tst_cmptest.cpp" line="239">
<DataTag><![CDATA[both non-null user type]]></DataTag>
<Description><![CDATA[Compared values are not the same
Actual (actual) : QVariant(PhonyClass,<value not representable as string>)
@@ -76,31 +76,31 @@
<Incident type="pass" file="" line="0">
<DataTag><![CDATA[equal lists]]></DataTag>
</Incident>
-<Incident type="fail" file="tst_cmptest.cpp" line="336">
+<Incident type="fail" file="tst_cmptest.cpp" line="333">
<DataTag><![CDATA[last item different]]></DataTag>
<Description><![CDATA[Compared lists differ at index 2.
Actual (opA): "string3"
Expected (opB): "DIFFERS"]]></Description>
</Incident>
-<Incident type="fail" file="tst_cmptest.cpp" line="336">
+<Incident type="fail" file="tst_cmptest.cpp" line="333">
<DataTag><![CDATA[second-last item different]]></DataTag>
<Description><![CDATA[Compared lists differ at index 2.
Actual (opA): "string3"
Expected (opB): "DIFFERS"]]></Description>
</Incident>
-<Incident type="fail" file="tst_cmptest.cpp" line="336">
+<Incident type="fail" file="tst_cmptest.cpp" line="333">
<DataTag><![CDATA[prefix]]></DataTag>
<Description><![CDATA[Compared lists have different sizes.
Actual (opA) size: 2
Expected (opB) size: 1]]></Description>
</Incident>
-<Incident type="fail" file="tst_cmptest.cpp" line="336">
+<Incident type="fail" file="tst_cmptest.cpp" line="333">
<DataTag><![CDATA[short list second]]></DataTag>
<Description><![CDATA[Compared lists have different sizes.
Actual (opA) size: 12
Expected (opB) size: 1]]></Description>
</Incident>
-<Incident type="fail" file="tst_cmptest.cpp" line="336">
+<Incident type="fail" file="tst_cmptest.cpp" line="333">
<DataTag><![CDATA[short list first]]></DataTag>
<Description><![CDATA[Compared lists have different sizes.
Actual (opA) size: 1
@@ -109,7 +109,7 @@
<Duration msecs="0"/>
</TestFunction>
<TestFunction name="compareQListInt">
-<Incident type="fail" file="tst_cmptest.cpp" line="343">
+<Incident type="fail" file="tst_cmptest.cpp" line="340">
<Description><![CDATA[Compared lists differ at index 2.
Actual (int1): 3
Expected (int2): 4]]></Description>
@@ -117,24 +117,32 @@
<Duration msecs="0"/>
</TestFunction>
<TestFunction name="compareQListDouble">
-<Incident type="fail" file="tst_cmptest.cpp" line="350">
+<Incident type="fail" file="tst_cmptest.cpp" line="347">
<Description><![CDATA[Compared lists differ at index 0.
Actual (double1): 1.5
Expected (double2): 1]]></Description>
</Incident>
<Duration msecs="0"/>
</TestFunction>
+<TestFunction name="compareQColor">
+<Incident type="fail" file="tst_cmptest.cpp" line="357">
+ <Description><![CDATA[Compared values are not the same
+ Actual (yellow): #ffff00
+ Expected (green) : #00ff00]]></Description>
+</Incident>
+ <Duration msecs="0"/>
+</TestFunction>
<TestFunction name="compareQPixmaps">
<Incident type="pass" file="" line="0">
<DataTag><![CDATA[both null]]></DataTag>
</Incident>
-<Incident type="fail" file="tst_cmptest.cpp" line="376">
+<Incident type="fail" file="tst_cmptest.cpp" line="382">
<DataTag><![CDATA[one null]]></DataTag>
<Description><![CDATA[Compared QPixmaps differ.
Actual (opA).isNull(): 1
Expected (opB).isNull(): 0]]></Description>
</Incident>
-<Incident type="fail" file="tst_cmptest.cpp" line="376">
+<Incident type="fail" file="tst_cmptest.cpp" line="382">
<DataTag><![CDATA[other null]]></DataTag>
<Description><![CDATA[Compared QPixmaps differ.
Actual (opA).isNull(): 0
@@ -143,13 +151,13 @@
<Incident type="pass" file="" line="0">
<DataTag><![CDATA[equal]]></DataTag>
</Incident>
-<Incident type="fail" file="tst_cmptest.cpp" line="376">
+<Incident type="fail" file="tst_cmptest.cpp" line="382">
<DataTag><![CDATA[different size]]></DataTag>
<Description><![CDATA[Compared QPixmaps differ in size.
Actual (opA): 11x20
Expected (opB): 20x20]]></Description>
</Incident>
-<Incident type="fail" file="tst_cmptest.cpp" line="376">
+<Incident type="fail" file="tst_cmptest.cpp" line="382">
<DataTag><![CDATA[different pixels]]></DataTag>
<Description><![CDATA[Compared values are not the same]]></Description>
</Incident>
@@ -159,13 +167,13 @@
<Incident type="pass" file="" line="0">
<DataTag><![CDATA[both null]]></DataTag>
</Incident>
-<Incident type="fail" file="tst_cmptest.cpp" line="403">
+<Incident type="fail" file="tst_cmptest.cpp" line="409">
<DataTag><![CDATA[one null]]></DataTag>
<Description><![CDATA[Compared QImages differ.
Actual (opA).isNull(): 1
Expected (opB).isNull(): 0]]></Description>
</Incident>
-<Incident type="fail" file="tst_cmptest.cpp" line="403">
+<Incident type="fail" file="tst_cmptest.cpp" line="409">
<DataTag><![CDATA[other null]]></DataTag>
<Description><![CDATA[Compared QImages differ.
Actual (opA).isNull(): 0
@@ -174,44 +182,44 @@
<Incident type="pass" file="" line="0">
<DataTag><![CDATA[equal]]></DataTag>
</Incident>
-<Incident type="fail" file="tst_cmptest.cpp" line="403">
+<Incident type="fail" file="tst_cmptest.cpp" line="409">
<DataTag><![CDATA[different size]]></DataTag>
<Description><![CDATA[Compared QImages differ in size.
Actual (opA): 11x20
Expected (opB): 20x20]]></Description>
</Incident>
-<Incident type="fail" file="tst_cmptest.cpp" line="403">
+<Incident type="fail" file="tst_cmptest.cpp" line="409">
<DataTag><![CDATA[different format]]></DataTag>
<Description><![CDATA[Compared QImages differ in format.
Actual (opA): 6
Expected (opB): 3]]></Description>
</Incident>
-<Incident type="fail" file="tst_cmptest.cpp" line="403">
+<Incident type="fail" file="tst_cmptest.cpp" line="409">
<DataTag><![CDATA[different pixels]]></DataTag>
<Description><![CDATA[Compared values are not the same]]></Description>
</Incident>
<Duration msecs="0"/>
</TestFunction>
<TestFunction name="verify">
-<Incident type="fail" file="tst_cmptest.cpp" line="415">
+<Incident type="fail" file="tst_cmptest.cpp" line="421">
<Description><![CDATA['opaqueFunc() < 2' returned FALSE. ()]]></Description>
</Incident>
<Duration msecs="0"/>
</TestFunction>
<TestFunction name="verify2">
-<Incident type="fail" file="tst_cmptest.cpp" line="421">
+<Incident type="fail" file="tst_cmptest.cpp" line="427">
<Description><![CDATA['opaqueFunc() < 2' returned FALSE. (42)]]></Description>
</Incident>
<Duration msecs="0"/>
</TestFunction>
<TestFunction name="tryVerify">
-<Incident type="fail" file="tst_cmptest.cpp" line="427">
+<Incident type="fail" file="tst_cmptest.cpp" line="433">
<Description><![CDATA['opaqueFunc() < 2' returned FALSE. ()]]></Description>
</Incident>
<Duration msecs="0"/>
</TestFunction>
<TestFunction name="tryVerify2">
-<Incident type="fail" file="tst_cmptest.cpp" line="433">
+<Incident type="fail" file="tst_cmptest.cpp" line="439">
<Description><![CDATA['opaqueFunc() < 2' returned FALSE. (42)]]></Description>
</Incident>
<Duration msecs="0"/>
diff --git a/tests/auto/testlib/selftests/expected_cmptest.xunitxml b/tests/auto/testlib/selftests/expected_cmptest.xunitxml
index 10918ce921..ec2c3f023c 100644
--- a/tests/auto/testlib/selftests/expected_cmptest.xunitxml
+++ b/tests/auto/testlib/selftests/expected_cmptest.xunitxml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<testsuite errors="0" failures="27" tests="17" name="tst_Cmptest">
+<testsuite errors="0" failures="28" tests="18" name="tst_Cmptest">
<properties>
<property value="@INSERT_QT_VERSION_HERE@" name="QTestVersion"/>
<property value="@INSERT_QT_VERSION_HERE@" name="QtVersion"/>
@@ -62,6 +62,11 @@
Actual (double1): 1.5
Expected (double2): 1" result="fail"/>
</testcase>
+ <testcase result="fail" name="compareQColor">
+ <failure message="Compared values are not the same
+ Actual (yellow): #ffff00
+ Expected (green) : #00ff00" result="fail"/>
+ </testcase>
<testcase result="fail" name="compareQPixmaps">
<failure tag="one null" message="Compared QPixmaps differ.
Actual (opA).isNull(): 1
diff --git a/tests/auto/testlib/selftests/generate_expected_output.py b/tests/auto/testlib/selftests/generate_expected_output.py
index 3aa8cdc984..aed8829ed6 100755
--- a/tests/auto/testlib/selftests/generate_expected_output.py
+++ b/tests/auto/testlib/selftests/generate_expected_output.py
@@ -34,7 +34,7 @@ import sys
import subprocess
import re
-formats = ['xml', 'txt', 'xunitxml', 'lightxml']
+formats = ['xml', 'txt', 'xunitxml', 'lightxml', 'teamcity']
qtver = subprocess.check_output(['qmake', '-query', 'QT_VERSION']).strip().decode('utf-8')
rootPath = os.getcwd()
diff --git a/tests/auto/tools/moc/tst_moc.cpp b/tests/auto/tools/moc/tst_moc.cpp
index 8895c652a5..5154351bb1 100644
--- a/tests/auto/tools/moc/tst_moc.cpp
+++ b/tests/auto/tools/moc/tst_moc.cpp
@@ -126,6 +126,33 @@ typedef struct {
int doNotConfuseMoc;
} OldStyleCStruct;
+namespace {
+
+ class GadgetInUnnamedNS
+ {
+ Q_GADGET
+ Q_PROPERTY(int x READ x WRITE setX)
+ Q_PROPERTY(int y READ y WRITE setY)
+ public:
+ explicit GadgetInUnnamedNS(int x, int y) : m_x(x), m_y(y) {}
+ int x() const { return m_x; }
+ int y() const { return m_y; }
+ void setX(int x) { m_x = x; }
+ void setY(int y) { m_y = y; }
+
+ private:
+ int m_x, m_y;
+ };
+
+ class ObjectInUnnamedNS : public QObject
+ {
+ Q_OBJECT
+ public:
+ explicit ObjectInUnnamedNS(QObject *parent = Q_NULLPTR) : QObject(parent) {}
+ };
+
+}
+
class Sender : public QObject
{
Q_OBJECT
@@ -592,6 +619,7 @@ private slots:
void relatedMetaObjectsNameConflict_data();
void relatedMetaObjectsNameConflict();
void strignLiteralsInMacroExtension();
+ void unnamedNamespaceObjectsAndGadgets();
void veryLongStringData();
void gadgetHierarchy();
@@ -3417,6 +3445,28 @@ class VeryLongStringData : public QObject
#undef repeat65534
};
+void tst_Moc::unnamedNamespaceObjectsAndGadgets()
+{
+ // these just test very basic functionality of gadgets and objects
+ // defined in unnamed namespaces.
+ {
+ GadgetInUnnamedNS gadget(21, 42);
+ QCOMPARE(gadget.x(), 21);
+ QCOMPARE(gadget.y(), 42);
+ gadget.staticMetaObject.property(0).writeOnGadget(&gadget, 12);
+ gadget.staticMetaObject.property(1).writeOnGadget(&gadget, 24);
+ QCOMPARE(gadget.x(), 12);
+ QCOMPARE(gadget.y(), 24);
+ }
+
+ {
+ ObjectInUnnamedNS object;
+ QObject *qObject = &object;
+ QCOMPARE(static_cast<ObjectInUnnamedNS *>(qObject),
+ qobject_cast<ObjectInUnnamedNS *>(qObject));
+ }
+}
+
void tst_Moc::veryLongStringData()
{
const QMetaObject *mobj = &VeryLongStringData::staticMetaObject;
diff --git a/tests/auto/tools/uic/baseline/enumnostdset.ui b/tests/auto/tools/uic/baseline/enumnostdset.ui
new file mode 100644
index 0000000000..59e27b1be3
--- /dev/null
+++ b/tests/auto/tools/uic/baseline/enumnostdset.ui
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>Form</class>
+ <widget class="QWidget" name="Form">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>400</width>
+ <height>300</height>
+ </rect>
+ </property>
+ <property name="windowTitle">
+ <string>Form</string>
+ </property>
+ <widget class="WorldTimeClock" name="worldTimeClock">
+ <property name="geometry">
+ <rect>
+ <x>100</x>
+ <y>100</y>
+ <width>100</width>
+ <height>100</height>
+ </rect>
+ </property>
+ <property name="penStyle" stdset="0">
+ <enum>Qt::DashDotLine</enum>
+ </property>
+ </widget>
+ </widget>
+ <customwidgets>
+ <customwidget>
+ <class>WorldTimeClock</class>
+ <extends>QWidget</extends>
+ <header>worldtimeclock.h</header>
+ </customwidget>
+ </customwidgets>
+ <resources/>
+ <connections/>
+</ui>
diff --git a/tests/auto/tools/uic/baseline/enumnostdset.ui.h b/tests/auto/tools/uic/baseline/enumnostdset.ui.h
new file mode 100644
index 0000000000..89a8411b4a
--- /dev/null
+++ b/tests/auto/tools/uic/baseline/enumnostdset.ui.h
@@ -0,0 +1,55 @@
+/********************************************************************************
+** Form generated from reading UI file 'enumnostdset.ui'
+**
+** Created by: Qt User Interface Compiler version 5.6.1
+**
+** WARNING! All changes made in this file will be lost when recompiling UI file!
+********************************************************************************/
+
+#ifndef ENUMNOSTDSET_H
+#define ENUMNOSTDSET_H
+
+#include <QtCore/QVariant>
+#include <QtWidgets/QAction>
+#include <QtWidgets/QApplication>
+#include <QtWidgets/QButtonGroup>
+#include <QtWidgets/QHeaderView>
+#include <QtWidgets/QWidget>
+#include "worldtimeclock.h"
+
+QT_BEGIN_NAMESPACE
+
+class Ui_Form
+{
+public:
+ WorldTimeClock *worldTimeClock;
+
+ void setupUi(QWidget *Form)
+ {
+ if (Form->objectName().isEmpty())
+ Form->setObjectName(QStringLiteral("Form"));
+ Form->resize(400, 300);
+ worldTimeClock = new WorldTimeClock(Form);
+ worldTimeClock->setObjectName(QStringLiteral("worldTimeClock"));
+ worldTimeClock->setGeometry(QRect(100, 100, 100, 100));
+ worldTimeClock->setProperty("penStyle", QVariant::fromValue(Qt::DashDotLine));
+
+ retranslateUi(Form);
+
+ QMetaObject::connectSlotsByName(Form);
+ } // setupUi
+
+ void retranslateUi(QWidget *Form)
+ {
+ Form->setWindowTitle(QApplication::translate("Form", "Form", 0));
+ } // retranslateUi
+
+};
+
+namespace Ui {
+ class Form: public Ui_Form {};
+} // namespace Ui
+
+QT_END_NAMESPACE
+
+#endif // ENUMNOSTDSET_H
diff --git a/tests/auto/widgets/dialogs/qdialog/tst_qdialog.cpp b/tests/auto/widgets/dialogs/qdialog/tst_qdialog.cpp
index 6528c24c1a..e6a0c5e86b 100644
--- a/tests/auto/widgets/dialogs/qdialog/tst_qdialog.cpp
+++ b/tests/auto/widgets/dialogs/qdialog/tst_qdialog.cpp
@@ -50,7 +50,7 @@ QT_FORWARD_DECLARE_CLASS(QDialog)
class DummyDialog : public QDialog
{
public:
- DummyDialog(): QDialog(0, Qt::X11BypassWindowManagerHint) {}
+ DummyDialog(): QDialog() {}
using QDialog::showExtension;
};
@@ -60,10 +60,8 @@ class tst_QDialog : public QObject
public:
tst_QDialog();
-public slots:
- void initTestCase();
- void cleanupTestCase();
private slots:
+ void cleanup();
void getSetCheck();
void showExtension_data();
void showExtension();
@@ -86,9 +84,6 @@ private slots:
void transientParent_data();
void transientParent();
void dialogInGraphicsView();
-
-private:
- DummyDialog *testWidget;
};
// Testing get/set functions
@@ -144,25 +139,12 @@ private:
};
tst_QDialog::tst_QDialog()
-
{
}
-void tst_QDialog::initTestCase()
+void tst_QDialog::cleanup()
{
- // Create the test class
- testWidget = new DummyDialog;
- testWidget->resize(200,200);
- testWidget->show();
- qApp->setActiveWindow(testWidget);
-}
-
-void tst_QDialog::cleanupTestCase()
-{
- if (testWidget) {
- delete testWidget;
- testWidget = 0;
- }
+ QVERIFY(QApplication::topLevelWidgets().isEmpty());
}
void tst_QDialog::showExtension_data()
@@ -185,44 +167,52 @@ void tst_QDialog::showExtension()
QFETCH( QSize, extSize );
QFETCH( bool, horizontal );
- // set geometry of main dialog and extension widget
- testWidget->setFixedSize( dlgSize );
- QWidget *ext = new QWidget( testWidget );
+ DummyDialog testWidget;
+ testWidget.resize(200, 200);
+ testWidget.setWindowTitle(QLatin1String(QTest::currentTestFunction()) + QLatin1Char(':')
+ + QLatin1String(QTest::currentDataTag()));
+ testWidget.show();
+ QVERIFY(QTest::qWaitForWindowExposed(&testWidget));
+
+ testWidget.setFixedSize( dlgSize );
+ QWidget *ext = new QWidget( &testWidget );
ext->setFixedSize( extSize );
- testWidget->setExtension( ext );
- testWidget->setOrientation( horizontal ? Qt::Horizontal : Qt::Vertical );
+ testWidget.setExtension( ext );
+ testWidget.setOrientation( horizontal ? Qt::Horizontal : Qt::Vertical );
- QCOMPARE( testWidget->size(), dlgSize );
- QPoint oldPosition = testWidget->pos();
+ QCOMPARE( testWidget.size(), dlgSize );
+ QPoint oldPosition = testWidget.pos();
// show
- testWidget->showExtension( true );
+ testWidget.showExtension( true );
// while ( testWidget->size() == dlgSize )
// qApp->processEvents();
- QTEST( testWidget->size(), "result" );
+ QTEST( testWidget.size(), "result" );
- QCOMPARE(testWidget->pos(), oldPosition);
+ QCOMPARE(testWidget.pos(), oldPosition);
// hide extension. back to old size ?
- testWidget->showExtension( false );
- QCOMPARE( testWidget->size(), dlgSize );
+ testWidget.showExtension( false );
+ QCOMPARE( testWidget.size(), dlgSize );
- testWidget->setExtension( 0 );
+ testWidget.setExtension( 0 );
}
void tst_QDialog::defaultButtons()
{
- QLineEdit *lineEdit = new QLineEdit(testWidget);
- QPushButton *push = new QPushButton("Button 1", testWidget);
- QPushButton *pushTwo = new QPushButton("Button 2", testWidget);
- QPushButton *pushThree = new QPushButton("Button 3", testWidget);
+ DummyDialog testWidget;
+ testWidget.resize(200, 200);
+ testWidget.setWindowTitle(QTest::currentTestFunction());
+ QLineEdit *lineEdit = new QLineEdit(&testWidget);
+ QPushButton *push = new QPushButton("Button 1", &testWidget);
+ QPushButton *pushTwo = new QPushButton("Button 2", &testWidget);
+ QPushButton *pushThree = new QPushButton("Button 3", &testWidget);
pushThree->setAutoDefault(false);
- //we need to show the buttons. Otherwise they won't get the focus
- push->show();
- pushTwo->show();
- pushThree->show();
+ testWidget.show();
+ QApplication::setActiveWindow(&testWidget);
+ QVERIFY(QTest::qWaitForWindowActive(&testWidget));
push->setDefault(true);
QVERIFY(push->isDefault());
@@ -375,11 +365,15 @@ void tst_QDialog::showAsTool()
#if defined(Q_OS_UNIX)
QSKIP("Qt/X11: Skipped since activeWindow() is not respected by all window managers");
#endif
- ToolDialog dialog(testWidget);
- testWidget->activateWindow();
+ DummyDialog testWidget;
+ testWidget.resize(200, 200);
+ testWidget.setWindowTitle(QTest::currentTestFunction());
+ ToolDialog dialog(&testWidget);
+ testWidget.show();
+ testWidget.activateWindow();
+ QVERIFY(QTest::qWaitForWindowActive(&testWidget));
dialog.exec();
- QTest::qWait(100);
- if (testWidget->style()->styleHint(QStyle::SH_Widget_ShareActivation, 0, testWidget)) {
+ if (testWidget.style()->styleHint(QStyle::SH_Widget_ShareActivation, 0, &testWidget)) {
QCOMPARE(dialog.wasActive(), true);
} else {
QCOMPARE(dialog.wasActive(), false);
@@ -602,7 +596,6 @@ void tst_QDialog::transientParent_data()
void tst_QDialog::transientParent()
{
QFETCH(bool, nativewidgets);
- testWidget->hide();
QWidget topLevel;
topLevel.resize(200, 200);
topLevel.move(QGuiApplication::primaryScreen()->availableGeometry().center() - QPoint(100, 100));
diff --git a/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp b/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp
index 515ddf480f..ae48445363 100644
--- a/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp
+++ b/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp
@@ -442,6 +442,7 @@ private slots:
void touchEventSynthesizedMouseEvent();
void touchUpdateOnNewTouch();
+ void touchEventsForGesturePendingWidgets();
void styleSheetPropagation();
@@ -9783,6 +9784,7 @@ public:
m_touchUpdateCount(0),
m_touchEndCount(0),
m_touchEventCount(0),
+ m_gestureEventCount(0),
m_acceptTouch(false),
m_mouseEventCount(0),
m_acceptMouse(true)
@@ -9820,6 +9822,9 @@ protected:
else
e->ignore();
return true;
+ case QEvent::Gesture:
+ ++m_gestureEventCount;
+ return true;
case QEvent::MouseButtonPress:
case QEvent::MouseMove:
@@ -9842,6 +9847,7 @@ public:
int m_touchUpdateCount;
int m_touchEndCount;
int m_touchEventCount;
+ int m_gestureEventCount;
bool m_acceptTouch;
int m_mouseEventCount;
bool m_acceptMouse;
@@ -9997,6 +10003,48 @@ void tst_QWidget::touchUpdateOnNewTouch()
QCOMPARE(widget.m_touchEndCount, 1);
}
+void tst_QWidget::touchEventsForGesturePendingWidgets()
+{
+ QTouchDevice *device = new QTouchDevice;
+ device->setType(QTouchDevice::TouchScreen);
+ QWindowSystemInterface::registerTouchDevice(device);
+
+ TouchMouseWidget parent;
+ TouchMouseWidget child(&parent);
+ parent.grabGesture(Qt::TapAndHoldGesture);
+ parent.show();
+
+ QWindow* window = parent.windowHandle();
+ QVERIFY(QTest::qWaitForWindowExposed(window));
+ QTest::qWait(500); // needed for QApplication::topLevelAt(), which is used by QGestureManager
+ QCOMPARE(child.m_touchEventCount, 0);
+ QCOMPARE(child.m_gestureEventCount, 0);
+ QCOMPARE(parent.m_touchEventCount, 0);
+ QCOMPARE(parent.m_gestureEventCount, 0);
+ QTest::touchEvent(window, device).press(0, QPoint(20, 20), window);
+ QCOMPARE(child.m_touchEventCount, 0);
+ QCOMPARE(child.m_gestureEventCount, 0);
+ QCOMPARE(parent.m_touchBeginCount, 1); // QTapAndHoldGestureRecognizer::create() sets Qt::WA_AcceptTouchEvents
+ QCOMPARE(parent.m_touchUpdateCount, 0);
+ QCOMPARE(parent.m_touchEndCount, 0);
+ QCOMPARE(parent.m_gestureEventCount, 0);
+ QTest::touchEvent(window, device).move(0, QPoint(25, 25), window);
+ QCOMPARE(child.m_touchEventCount, 0);
+ QCOMPARE(child.m_gestureEventCount, 0);
+ QCOMPARE(parent.m_touchBeginCount, 1);
+ QCOMPARE(parent.m_touchUpdateCount, 0);
+ QCOMPARE(parent.m_touchEndCount, 0);
+ QCOMPARE(parent.m_gestureEventCount, 0);
+ QTest::qWait(1000);
+ QTest::touchEvent(window, device).release(0, QPoint(25, 25), window);
+ QCOMPARE(child.m_touchEventCount, 0);
+ QCOMPARE(child.m_gestureEventCount, 0);
+ QCOMPARE(parent.m_touchBeginCount, 1);
+ QCOMPARE(parent.m_touchUpdateCount, 0);
+ QCOMPARE(parent.m_touchEndCount, 0);
+ QVERIFY(parent.m_gestureEventCount > 0);
+}
+
void tst_QWidget::styleSheetPropagation()
{
QTableView tw;
diff --git a/tests/auto/widgets/widgets/qdockwidget/BLACKLIST b/tests/auto/widgets/widgets/qdockwidget/BLACKLIST
deleted file mode 100644
index 60adfb9f4b..0000000000
--- a/tests/auto/widgets/widgets/qdockwidget/BLACKLIST
+++ /dev/null
@@ -1,2 +0,0 @@
-[restoreDockWidget]
-ubuntu-14.04
diff --git a/tests/auto/widgets/widgets/qmenu/tst_qmenu.cpp b/tests/auto/widgets/widgets/qmenu/tst_qmenu.cpp
index 17efc05f59..c3b432788b 100644
--- a/tests/auto/widgets/widgets/qmenu/tst_qmenu.cpp
+++ b/tests/auto/widgets/widgets/qmenu/tst_qmenu.cpp
@@ -591,10 +591,19 @@ void tst_QMenu::widgetActionFocus()
QCOMPARE(m.activeAction(), (QAction *)wa);
}
+static QMenu *getTornOffMenu()
+{
+ foreach (QWidget *w, QApplication::allWidgets()) {
+ if (w->isVisible() && w->inherits("QTornOffMenu"))
+ return static_cast<QMenu *>(w);
+ }
+ return Q_NULLPTR;
+}
+
void tst_QMenu::tearOff()
{
QWidget widget;
- QMenu *menu = new QMenu(&widget);
+ QScopedPointer<QMenu> menu(new QMenu(&widget));
QVERIFY(!menu->isTearOffEnabled()); //default value
menu->setTearOffEnabled(true);
menu->addAction("aaa");
@@ -607,24 +616,43 @@ void tst_QMenu::tearOff()
widget.activateWindow();
QVERIFY(QTest::qWaitForWindowActive(&widget));
menu->popup(widget.geometry().topRight() + QPoint(50, 0));
- QVERIFY(QTest::qWaitForWindowActive(menu));
+ QVERIFY(QTest::qWaitForWindowActive(menu.data()));
QVERIFY(!menu->isTearOffMenuVisible());
- QTest::mouseClick(menu, Qt::LeftButton, 0, QPoint(3, 3), 10);
+ QTest::mouseClick(menu.data(), Qt::LeftButton, 0, QPoint(3, 3), 10);
QTRY_VERIFY(menu->isTearOffMenuVisible());
- QPointer<QMenu> torn = 0;
- foreach (QWidget *w, QApplication::allWidgets()) {
- if (w->inherits("QTornOffMenu")) {
- torn = static_cast<QMenu *>(w);
- break;
- }
- }
+ QPointer<QMenu> torn = getTornOffMenu();
+ QVERIFY(torn);
+ QVERIFY(torn->isVisible());
+
+ menu->hideTearOffMenu();
+ QVERIFY(!menu->isTearOffMenuVisible());
+ QVERIFY(!torn->isVisible());
+
+#ifndef QT_NO_CURSOR
+ // Test under-mouse positioning
+ menu->showTearOffMenu();
+ torn = getTornOffMenu();
QVERIFY(torn);
QVERIFY(torn->isVisible());
+ QVERIFY(menu->isTearOffMenuVisible());
+ // Some platforms include the window title bar in its geometry.
+ QTRY_COMPARE(torn->windowHandle()->position(), QCursor::pos());
menu->hideTearOffMenu();
QVERIFY(!menu->isTearOffMenuVisible());
QVERIFY(!torn->isVisible());
+
+ // Test custom positioning
+ const QPoint &pos = QCursor::pos() / 2 + QPoint(10, 10);
+ menu->showTearOffMenu(pos);
+ torn = getTornOffMenu();
+ QVERIFY(torn);
+ QVERIFY(torn->isVisible());
+ QVERIFY(menu->isTearOffMenuVisible());
+ // Some platforms include the window title bar in its geometry.
+ QTRY_COMPARE(torn->windowHandle()->position(), pos);
+#endif // QT_NO_CURSOR
}
void tst_QMenu::layoutDirection()
diff --git a/tests/auto/widgets/widgets/qtabbar/tst_qtabbar.cpp b/tests/auto/widgets/widgets/qtabbar/tst_qtabbar.cpp
index 947c251590..550cca8145 100644
--- a/tests/auto/widgets/widgets/qtabbar/tst_qtabbar.cpp
+++ b/tests/auto/widgets/widgets/qtabbar/tst_qtabbar.cpp
@@ -274,36 +274,30 @@ void tst_QTabBar::sizeHints()
{
QTabBar tabBar;
tabBar.setFont(QFont("Arial", 10));
- tabBar.addTab("tab 01");
- tabBar.addTab("tab 02");
- tabBar.addTab("tab 03");
- tabBar.addTab("tab 04");
- tabBar.addTab("tab 05");
- tabBar.addTab("tab 06");
- tabBar.addTab("This is tab7");
- tabBar.addTab("This is tab8");
- tabBar.addTab("This is tab9 with a very long title");
// No eliding and no scrolling -> tabbar becomes very wide
tabBar.setUsesScrollButtons(false);
tabBar.setElideMode(Qt::ElideNone);
-// qDebug() << tabBar.minimumSizeHint() << tabBar.sizeHint();
-#ifdef Q_OS_MAC
- QEXPECT_FAIL("", "QTBUG-27230", Abort);
-#endif
+ tabBar.addTab("tab 01");
+
+ // Fetch the minimum size hint width and make sure that we create enough
+ // tabs.
+ int minimumSizeHintWidth = tabBar.minimumSizeHint().width();
+ for (int i = 0; i <= 700 / minimumSizeHintWidth; ++i)
+ tabBar.addTab(QString("tab 0%1").arg(i+2));
+
+ //qDebug() << tabBar.minimumSizeHint() << tabBar.sizeHint();
QVERIFY(tabBar.minimumSizeHint().width() > 700);
QVERIFY(tabBar.sizeHint().width() > 700);
// Scrolling enabled -> no reason to become very wide
tabBar.setUsesScrollButtons(true);
- // qDebug() << tabBar.minimumSizeHint() << tabBar.sizeHint();
QVERIFY(tabBar.minimumSizeHint().width() < 200);
QVERIFY(tabBar.sizeHint().width() > 700); // unchanged
// Eliding enabled -> no reason to become very wide
tabBar.setUsesScrollButtons(false);
tabBar.setElideMode(Qt::ElideRight);
-// qDebug() << tabBar.minimumSizeHint() << tabBar.sizeHint();
// The sizeHint is very much dependent on the screen DPI value
// so we can not really predict it.
@@ -312,7 +306,7 @@ void tst_QTabBar::sizeHints()
QVERIFY(tabBarMinSizeHintWidth < tabBarSizeHintWidth);
QVERIFY(tabBarSizeHintWidth > 700); // unchanged
- tabBar.addTab("This is tab10 with a very long title");
+ tabBar.addTab("This is tab with a very long title");
QVERIFY(tabBar.minimumSizeHint().width() > tabBarMinSizeHintWidth);
QVERIFY(tabBar.sizeHint().width() > tabBarSizeHintWidth);
}