summaryrefslogtreecommitdiff
path: root/tests/auto
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@theqtcompany.com>2016-03-21 09:02:57 +0100
committerLiang Qi <liang.qi@theqtcompany.com>2016-03-21 09:02:57 +0100
commit6cb8121a44ee0f94f2c9fcb075d1d3c802d8c5c7 (patch)
tree25822898b71068f820d25a9e8372dfb348190ec1 /tests/auto
parent96740193e1e0f0608f67660811a44b696924ad4c (diff)
parent2e02de165115c9d67ac343ff0960ed80f9c09bc8 (diff)
downloadqtbase-6cb8121a44ee0f94f2c9fcb075d1d3c802d8c5c7.tar.gz
Merge remote-tracking branch 'origin/5.6' into 5.7
Conflicts: src/widgets/styles/qgtkstyle_p.cpp tests/auto/corelib/io/qtextstream/test/test.pro tests/auto/corelib/plugin/plugin.pro Change-Id: I512bc1b36acf3933ed2b96c00f476ee3819c1f4b
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/io/qtextstream/test/test.pro4
-rw-r--r--tests/auto/corelib/io/qtextstream/tst_qtextstream.cpp22
-rw-r--r--tests/auto/corelib/plugin/plugin.pro6
-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/text/qstatictext/qstatictext.pro4
-rw-r--r--tests/auto/gui/text/qstatictext/tst_qstatictext.cpp6
-rw-r--r--tests/auto/gui/text/text.pro1
-rw-r--r--tests/auto/network/socket/qlocalsocket/BLACKLIST2
-rw-r--r--tests/auto/network/socket/qlocalsocket/tst_qlocalsocket.cpp9
-rw-r--r--tests/auto/sql/kernel/qsqlquery/tst_qsqlquery.cpp82
-rw-r--r--tests/auto/widgets/widgets/qdockwidget/BLACKLIST2
-rw-r--r--tests/auto/widgets/widgets/qtabbar/tst_qtabbar.cpp26
19 files changed, 179 insertions, 84 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/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 2852420557..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();
@@ -236,6 +237,9 @@ private:
QTemporaryDir tempDir;
QString testFileName;
+#ifdef BUILTIN_TESTDATA
+ QSharedPointer<QTemporaryDir> m_dataDir;
+#endif
const QString m_rfc3261FilePath;
const QString m_shiftJisFilePath;
};
@@ -262,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
@@ -387,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()
{
@@ -3044,12 +3060,10 @@ void tst_QTextStream::int_write_with_locale()
void tst_QTextStream::textModeOnEmptyRead()
{
- const QString filename("textmodetest.txt");
- QFile::remove(filename); // Remove file if exists
-
+ const QString filename(tempDir.path() + QLatin1String("/textmodetest.txt"));
QFile file(filename);
- QVERIFY(file.open(QIODevice::ReadWrite | QIODevice::Text));
+ 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
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/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/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 096b820004..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;
@@ -811,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;
@@ -847,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/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 ef47b45e9e..123fbfeb2a 100644
--- a/tests/auto/network/socket/qlocalsocket/tst_qlocalsocket.cpp
+++ b/tests/auto/network/socket/qlocalsocket/tst_qlocalsocket.cpp
@@ -517,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);
@@ -540,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()));
@@ -563,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/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/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/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);
}