summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorKent Hansen <kent.hansen@nokia.com>2012-03-16 10:01:29 +0100
committerKent Hansen <kent.hansen@nokia.com>2012-03-16 10:01:29 +0100
commit440f452aa3a5609e5f6006a03ac36d41462d5908 (patch)
tree598d682291945055e4f6feb08a228212648482c1 /tests
parentcd1e62ffc121cc68c5a133a8095d431f04d966ce (diff)
parentd4959fa6376255ab4adf8adaeb2ee47ae6b679d2 (diff)
Merge master into api_changes
Conflicts: src/corelib/kernel/qmetatype.cpp src/gui/kernel/qplatformsurface_qpa.cpp tests/auto/corelib/tools/qtimeline/qtimeline.pro Change-Id: Iff3fff34eeeb06f02369767ddfce44cfde505178
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/auto.pro4
-rw-r--r--tests/auto/concurrent/qtconcurrentmap/tst_qtconcurrentmap.cpp9
-rw-r--r--tests/auto/corelib/codecs/utf8/tst_utf8.cpp10
-rw-r--r--tests/auto/corelib/io/qresourceengine/tst_qresourceengine.cpp2
-rw-r--r--tests/auto/corelib/io/qsettings/tst_qsettings.cpp163
-rw-r--r--tests/auto/corelib/json/tst_qtjson.cpp13
-rw-r--r--tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp48
-rw-r--r--tests/auto/corelib/tools/qsharedpointer/externaltests.cpp13
-rw-r--r--tests/auto/corelib/tools/qsharedpointer/qsharedpointer.pro2
-rw-r--r--tests/auto/corelib/tools/qtimeline/qtimeline.pro3
-rw-r--r--tests/auto/gui/kernel/kernel.pro1
-rw-r--r--tests/auto/network/kernel/qdnslookup/tst_qdnslookup.cpp10
-rw-r--r--tests/auto/other/headersclean/headersclean.pri6
-rw-r--r--tests/auto/other/other.pro4
-rw-r--r--tests/auto/other/qaccessibility/tst_qaccessibility.cpp96
-rw-r--r--tests/auto/other/qmultiscreen/.gitignore1
-rw-r--r--tests/auto/other/qmultiscreen/qmultiscreen.pro7
-rw-r--r--tests/auto/other/qmultiscreen/tst_qmultiscreen.cpp163
-rw-r--r--tests/auto/sql/models/qsqlrelationaltablemodel/tst_qsqlrelationaltablemodel.cpp2
-rw-r--r--tests/auto/sql/models/qsqltablemodel/tst_qsqltablemodel.cpp263
-rw-r--r--tests/auto/widgets/dialogs/qfilesystemmodel/tst_qfilesystemmodel.cpp2
-rw-r--r--tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp3
-rw-r--r--tests/auto/widgets/graphicsview/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp3
-rw-r--r--tests/auto/widgets/itemviews/qheaderview/tst_qheaderview.cpp60
-rw-r--r--tests/auto/widgets/itemviews/qtableview/tst_qtableview.cpp27
-rw-r--r--tests/auto/widgets/kernel/kernel.pro1
-rw-r--r--tests/auto/widgets/kernel/qshortcut/.gitignore (renamed from tests/auto/gui/kernel/qshortcut/.gitignore)0
-rw-r--r--tests/auto/widgets/kernel/qshortcut/qshortcut.pro (renamed from tests/auto/gui/kernel/qshortcut/qshortcut.pro)0
-rw-r--r--tests/auto/widgets/kernel/qshortcut/tst_qshortcut.cpp (renamed from tests/auto/gui/kernel/qshortcut/tst_qshortcut.cpp)0
-rw-r--r--tests/auto/widgets/kernel/qtooltip/tst_qtooltip.cpp17
-rw-r--r--tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp3
-rw-r--r--tests/auto/widgets/widgets/qdockwidget/tst_qdockwidget.cpp3
32 files changed, 506 insertions, 433 deletions
diff --git a/tests/auto/auto.pro b/tests/auto/auto.pro
index 124af19799..a23c3d672a 100644
--- a/tests/auto/auto.pro
+++ b/tests/auto/auto.pro
@@ -19,8 +19,8 @@ cross_compile: SUBDIRS -= tools
!contains(QT_CONFIG, opengl): SUBDIRS -= opengl
!unix|embedded|!contains(QT_CONFIG, dbus): SUBDIRS -= dbus
-# disable 'make check' on Mac OS X and Windows for the following subdirs for the time being
-mac|win32 {
+# disable 'make check' on Mac OS X for the following subdirs for the time being
+mac {
network.CONFIG += no_check_target
}
diff --git a/tests/auto/concurrent/qtconcurrentmap/tst_qtconcurrentmap.cpp b/tests/auto/concurrent/qtconcurrentmap/tst_qtconcurrentmap.cpp
index 35ee0be326..d0609d00ef 100644
--- a/tests/auto/concurrent/qtconcurrentmap/tst_qtconcurrentmap.cpp
+++ b/tests/auto/concurrent/qtconcurrentmap/tst_qtconcurrentmap.cpp
@@ -2115,15 +2115,6 @@ void tst_QtConcurrentMap::functionOverloads()
QtConcurrent::blockingMapped<QList<QString> >(constIntList, changeTypeConst);
QtConcurrent::blockingMapped<QList<QString> >(classList, &MemFnTester::changeTypeConst);
QtConcurrent::blockingMapped<QList<QString> >(constMemFnTesterList, &MemFnTester::changeTypeConst);
-
- QStringList stringList;
- const QStringList constStringList;
- // QtConcurrent::map(stringList, changeTypeQStringListConst);
- // QtConcurrent::map(intList, changeTypeNonConst);
- // QList<QString>(QtConcurrent::map(constStringList, changeTypeQStringList));
- // QtConcurrent::map(classList, &MemFnTester::changeType);
- // QtConcurrent::map(classList, &MemFnTester::changeTypeConst);
- // QtConcurrent::map(constMemFnTesterList, &MemFnTester::changeTypeConst);
}
QAtomicInt currentInstanceCount;
diff --git a/tests/auto/corelib/codecs/utf8/tst_utf8.cpp b/tests/auto/corelib/codecs/utf8/tst_utf8.cpp
index e07b7cb239..dd6774e101 100644
--- a/tests/auto/corelib/codecs/utf8/tst_utf8.cpp
+++ b/tests/auto/corelib/codecs/utf8/tst_utf8.cpp
@@ -322,7 +322,7 @@ void tst_Utf8::nonCharacters_data()
// U+FDD0 through U+FDEF
for (int i = 0; i < 16; ++i) {
- char utf8[] = { 0357, 0267, 0220 + i, 0 };
+ char utf8[] = { char(0357), char(0267), char(0220 + i), 0 };
QString utf16 = QChar(0xfdd0 + i);
QTest::newRow(qPrintable(QString::number(0xfdd0 + i, 16))) << QByteArray(utf8) << utf16;
}
@@ -331,10 +331,10 @@ void tst_Utf8::nonCharacters_data()
for (uint plane = 1; plane <= 16; ++plane) {
for (uint lower = 0xfffe; lower < 0x10000; ++lower) {
uint ucs4 = (plane << 16) | lower;
- char utf8[] = { 0xf0 | uchar(ucs4 >> 18),
- 0x80 | (uchar(ucs4 >> 12) & 0x3f),
- 0x80 | (uchar(ucs4 >> 6) & 0x3f),
- 0x80 | (uchar(ucs4) & 0x3f),
+ char utf8[] = { char(0xf0 | uchar(ucs4 >> 18)),
+ char(0x80 | (uchar(ucs4 >> 12) & 0x3f)),
+ char(0x80 | (uchar(ucs4 >> 6) & 0x3f)),
+ char(0x80 | (uchar(ucs4) & 0x3f)),
0 };
ushort utf16[] = { QChar::highSurrogate(ucs4), QChar::lowSurrogate(ucs4), 0 };
diff --git a/tests/auto/corelib/io/qresourceengine/tst_qresourceengine.cpp b/tests/auto/corelib/io/qresourceengine/tst_qresourceengine.cpp
index 796282d6d8..990841dc87 100644
--- a/tests/auto/corelib/io/qresourceengine/tst_qresourceengine.cpp
+++ b/tests/auto/corelib/io/qresourceengine/tst_qresourceengine.cpp
@@ -311,7 +311,7 @@ void tst_QResourceEngine::checkStructure()
QVERIFY(fileInfo.exists());
QCOMPARE(fileInfo.isDir(), directory);
QCOMPARE(fileInfo.size(), contentsSize);
- //QVERIFY(fileInfo.isReadable());
+ QVERIFY(fileInfo.isReadable());
QVERIFY(!fileInfo.isWritable());
QVERIFY(!fileInfo.isExecutable());
diff --git a/tests/auto/corelib/io/qsettings/tst_qsettings.cpp b/tests/auto/corelib/io/qsettings/tst_qsettings.cpp
index df8e97ab9c..d294eec248 100644
--- a/tests/auto/corelib/io/qsettings/tst_qsettings.cpp
+++ b/tests/auto/corelib/io/qsettings/tst_qsettings.cpp
@@ -40,7 +40,6 @@
****************************************************************************/
-#include <qdebug.h>
#include <QtTest/QtTest>
#include <QtCore/QSettings>
@@ -48,11 +47,13 @@
#include <QtCore/QCoreApplication>
#include <QtCore/QtGlobal>
#include <QtCore/QMetaType>
-#include <QtCore/QtDebug>
#include <QtCore/QString>
+#include <QtCore/QDir>
+#include <QtCore/QThread>
#include <QtGui/QKeySequence>
#include <cctype>
+#include <stdlib.h>
#if defined(Q_OS_WIN) && defined(Q_CC_GNU)
// need for unlink on mingw
#include <io.h>
@@ -60,14 +61,17 @@
#if defined(Q_OS_WIN)
#include <QtCore/qt_windows.h>
+#else
+#include <unistd.h>
#endif
+Q_DECLARE_METATYPE(QSettings::Format)
+
#ifndef QSETTINGS_P_H_VERSION
#define QSETTINGS_P_H_VERSION 1
#endif
QT_FORWARD_DECLARE_CLASS(QSettings)
-QT_FORWARD_DECLARE_CLASS(QSettings)
class tst_QSettings : public QObject
{
@@ -136,12 +140,6 @@ private slots:
void testByteArray_data();
void testByteArray();
-
-private:
- void oldWriteEntry_data();
- void oldReadEntry_data();
- void oldWriteEntryHelper(QSettings &settings);
- void oldReadEntryHelper(QSettings &settings);
};
// Testing get/set functions
@@ -156,20 +154,6 @@ void tst_QSettings::getSetCheck()
QCOMPARE(true, obj1.fallbacksEnabled());
}
-//using namespace std;
-
-//#include <qapplication.h>
-#include <qcoreapplication.h>
-#include <qdir.h>
-#include <qregexp.h>
-#include <qthread.h>
-#include <stdlib.h>
-#ifndef Q_OS_WIN
-#include <unistd.h>
-#endif
-
-Q_DECLARE_METATYPE(QSettings::Format)
-
#if defined(Q_OS_WINCE)
static void removePath(const QString& _path)
{
@@ -194,7 +178,7 @@ static void removePath(const QString& _path)
static QString settingsPath(const char *path = "")
{
- // Temporary path for files that are specified explictly in the constructor.
+ // Temporary path for files that are specified explicitly in the constructor.
QString tempPath = QDir::tempPath();
if (tempPath.endsWith("/"))
tempPath.truncate(tempPath.size() - 1);
@@ -896,8 +880,10 @@ void tst_QSettings::beginGroup()
QCOMPARE(settings1.value("geometry").toInt(), 777);
// endGroup() should do nothing if group() is empty
- for (int i = 0; i < 10; ++i)
+ for (int i = 0; i < 10; ++i) {
+ QTest::ignoreMessage(QtWarningMsg, "QSettings::endGroup: No matching beginGroup()");
settings2.endGroup();
+ }
QCOMPARE(settings2.value("geometry").toInt(), 5);
QCOMPARE(settings2.value("alpha/geometry").toInt(), 66);
QCOMPARE(settings2.value("alpha/beta/geometry").toInt(), 777);
@@ -971,6 +957,8 @@ void tst_QSettings::setValue()
QCOMPARE(settings.value("key 2").toBool(), true);
settings.setValue("key 2", QString("false"));
QCOMPARE(settings.value("key 2", true).toBool(), false);
+
+ // The following block should not compile.
/*
settings.setValue("key 2", "true");
QCOMPARE(settings.value("key 2").toBool(), true);
@@ -984,8 +972,8 @@ void tst_QSettings::setValue()
QCOMPARE(settings.value("key 2", true).toBool(), true);
settings.setValue("key 2", "0.000e-00");
QCOMPARE(settings.value("key 2", false).toBool(), false);
-
*/
+
settings.setValue("key 2", QStringList());
QCOMPARE(settings.value("key 2").toStringList(), QStringList());
settings.setValue("key 2", QStringList(""));
@@ -1963,43 +1951,43 @@ void tst_QSettings::setIniCodec()
QByteArray actualContents4, actualContents5;
{
- QFile inFile(":/resourcefile4.ini");
- inFile.open(QIODevice::ReadOnly);
- expeContents4 = inFile.readAll();
- inFile.close();
+ QFile inFile(":/resourcefile4.ini");
+ inFile.open(QIODevice::ReadOnly);
+ expeContents4 = inFile.readAll();
+ inFile.close();
}
{
- QFile inFile(":/resourcefile5.ini");
- inFile.open(QIODevice::ReadOnly);
- expeContents5 = inFile.readAll();
- inFile.close();
+ QFile inFile(":/resourcefile5.ini");
+ inFile.open(QIODevice::ReadOnly);
+ expeContents5 = inFile.readAll();
+ inFile.close();
}
{
- QSettings settings4(QSettings::IniFormat, QSettings::UserScope, "software.org", "KillerAPP");
- settings4.setIniCodec("UTF-8");
- settings4.setValue(QLatin1String("Fa\xe7" "ade/QU\xc9" "BEC"), QLatin1String("Fa\xe7" "ade/QU\xc9" "BEC"));
- settings4.sync();
-
- QSettings settings5(QSettings::IniFormat, QSettings::UserScope, "other.software.org", "KillerAPP");
- settings5.setIniCodec("ISO 8859-1");
- settings5.setValue(QLatin1String("Fa\xe7" "ade/QU\xc9" "BEC"), QLatin1String("Fa\xe7" "ade/QU\xc9" "BEC"));
- settings5.sync();
-
- {
- QFile inFile(settings4.fileName());
- inFile.open(QIODevice::ReadOnly);
- actualContents4 = inFile.readAll();
- inFile.close();
- }
+ QSettings settings4(QSettings::IniFormat, QSettings::UserScope, "software.org", "KillerAPP");
+ settings4.setIniCodec("UTF-8");
+ settings4.setValue(QLatin1String("Fa\xe7" "ade/QU\xc9" "BEC"), QLatin1String("Fa\xe7" "ade/QU\xc9" "BEC"));
+ settings4.sync();
+
+ QSettings settings5(QSettings::IniFormat, QSettings::UserScope, "other.software.org", "KillerAPP");
+ settings5.setIniCodec("ISO 8859-1");
+ settings5.setValue(QLatin1String("Fa\xe7" "ade/QU\xc9" "BEC"), QLatin1String("Fa\xe7" "ade/QU\xc9" "BEC"));
+ settings5.sync();
+
+ {
+ QFile inFile(settings4.fileName());
+ inFile.open(QIODevice::ReadOnly);
+ actualContents4 = inFile.readAll();
+ inFile.close();
+ }
- {
- QFile inFile(settings5.fileName());
- inFile.open(QIODevice::ReadOnly);
- actualContents5 = inFile.readAll();
- inFile.close();
- }
+ {
+ QFile inFile(settings5.fileName());
+ inFile.open(QIODevice::ReadOnly);
+ actualContents5 = inFile.readAll();
+ inFile.close();
+ }
}
QConfFile::clearCache();
@@ -2181,6 +2169,16 @@ void tst_QSettings::testArrays()
endArray() and vice versa. This is not documented, but this
is the behavior that we have chosen.
*/
+ QTest::ignoreMessage(QtWarningMsg, "QSettings::setArrayIndex: Missing beginArray()");
+ QTest::ignoreMessage(QtWarningMsg, "QSettings::setArrayIndex: Missing beginArray()");
+ QTest::ignoreMessage(QtWarningMsg, "QSettings::setArrayIndex: Missing beginArray()");
+ QTest::ignoreMessage(QtWarningMsg, "QSettings::setArrayIndex: Missing beginArray()");
+ QTest::ignoreMessage(QtWarningMsg, "QSettings::setArrayIndex: Missing beginArray()");
+ QTest::ignoreMessage(QtWarningMsg, "QSettings::endArray: Expected endGroup() instead");
+ QTest::ignoreMessage(QtWarningMsg, "QSettings::endGroup: Expected endArray() instead");
+ QTest::ignoreMessage(QtWarningMsg, "QSettings::endArray: Expected endGroup() instead");
+ QTest::ignoreMessage(QtWarningMsg, "QSettings::endGroup: No matching beginGroup()");
+
QSettings settings1(format, QSettings::UserScope, "software.org", "KillerAPP");
settings1.clear();
settings1.beginGroup("/alpha");
@@ -2231,7 +2229,6 @@ void tst_QSettings::testArrays()
QCOMPARE(settings1.group(), QString());
settings1.endGroup();
QCOMPARE(settings1.group(), QString());
-
/*
Now, let's make sure that things work well if an array
is spread across multiple files.
@@ -2901,10 +2898,10 @@ void tst_QSettings::registerFormat()
f.close();
{
- QSettings settings(settingsPath("someDir/someSettings.custom3"), QSettings::CustomFormat3);
- QCOMPARE(settings.status(), QSettings::NoError);
- QCOMPARE(settings.value("retval").toString(), QString("OK"));
- QVERIFY(settings.isWritable());
+ QSettings settings(settingsPath("someDir/someSettings.custom3"), QSettings::CustomFormat3);
+ QCOMPARE(settings.status(), QSettings::NoError);
+ QCOMPARE(settings.value("retval").toString(), QString("OK"));
+ QVERIFY(settings.isWritable());
}
QVERIFY(f.open(QFile::WriteOnly));
@@ -2912,10 +2909,10 @@ void tst_QSettings::registerFormat()
f.close();
{
- QSettings settings(settingsPath("someDir/someSettings.custom3"), QSettings::CustomFormat3);
- QCOMPARE(settings.status(), QSettings::FormatError);
- QCOMPARE(settings.value("retval").toString(), QString());
- QVERIFY(settings.isWritable());
+ QSettings settings(settingsPath("someDir/someSettings.custom3"), QSettings::CustomFormat3);
+ QCOMPARE(settings.status(), QSettings::FormatError);
+ QCOMPARE(settings.value("retval").toString(), QString());
+ QVERIFY(settings.isWritable());
}
QVERIFY(f.open(QFile::WriteOnly));
@@ -2923,24 +2920,24 @@ void tst_QSettings::registerFormat()
f.close();
{
- QSettings settings(settingsPath("someDir/someSettings.custom3"), QSettings::CustomFormat3);
- QCOMPARE(settings.status(), QSettings::NoError);
- settings.setValue("zzz", "bar");
- settings.sync();
- QCOMPARE(settings.status(), QSettings::NoError);
+ QSettings settings(settingsPath("someDir/someSettings.custom3"), QSettings::CustomFormat3);
+ QCOMPARE(settings.status(), QSettings::NoError);
+ settings.setValue("zzz", "bar");
+ settings.sync();
+ QCOMPARE(settings.status(), QSettings::NoError);
- settings.setValue("retval", "NotOK");
- settings.sync();
- QCOMPARE(settings.status(), QSettings::AccessError);
+ settings.setValue("retval", "NotOK");
+ settings.sync();
+ QCOMPARE(settings.status(), QSettings::AccessError);
- QCOMPARE(settings.value("retval").toString(), QString("NotOK"));
- QVERIFY(settings.isWritable());
+ QCOMPARE(settings.value("retval").toString(), QString("NotOK"));
+ QVERIFY(settings.isWritable());
}
{
- QSettings settings(settingsPath("someDir/someSettings.custom3"), QSettings::CustomFormat4);
- QCOMPARE(settings.status(), QSettings::AccessError);
- QVERIFY(!settings.isWritable());
+ QSettings settings(settingsPath("someDir/someSettings.custom3"), QSettings::CustomFormat4);
+ QCOMPARE(settings.status(), QSettings::AccessError);
+ QVERIFY(!settings.isWritable());
}
}
@@ -3168,16 +3165,6 @@ void tst_QSettings::consistentRegistryStorage()
}
}
#endif
-/*
-// Not tested at the moment.
-void tst_QSettings::oldSubkeyList()
-{
- QVERIFY( true );
-}
-*/
QTEST_MAIN(tst_QSettings)
#include "tst_qsettings.moc"
-
-
-// foo
diff --git a/tests/auto/corelib/json/tst_qtjson.cpp b/tests/auto/corelib/json/tst_qtjson.cpp
index 079ff6e76b..87820d2e78 100644
--- a/tests/auto/corelib/json/tst_qtjson.cpp
+++ b/tests/auto/corelib/json/tst_qtjson.cpp
@@ -120,6 +120,8 @@ private Q_SLOTS:
void assignObjects();
void assignArrays();
+
+ void testTrailingComma();
private:
QString testDataDir;
};
@@ -1807,5 +1809,16 @@ void TestQtJson::assignArrays()
QCOMPARE(inner.at(0).toDouble(), 2.);
}
+void TestQtJson::testTrailingComma()
+{
+ const char *jsons[] = { "{ \"Key\": 1, }", "[ { \"Key\": 1 }, ]" };
+
+ for (unsigned i = 0; i < sizeof(jsons)/sizeof(jsons[0]); ++i) {
+ QJsonParseError error;
+ QJsonDocument doc = QJsonDocument::fromJson(jsons[i], &error);
+ QCOMPARE(error.error, QJsonParseError::MissingObject);
+ }
+}
+
QTEST_MAIN(TestQtJson)
#include "tst_qtjson.moc"
diff --git a/tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp b/tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp
index 7fcf2ff4eb..96c391d582 100644
--- a/tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp
+++ b/tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp
@@ -747,39 +747,47 @@ Q_DECLARE_METATYPE(QPairPC)
Q_DECLARE_METATYPE(QPairPM)
Q_DECLARE_METATYPE(QPairPP)
+enum FlagsDataEnum {};
+Q_DECLARE_METATYPE(FlagsDataEnum);
+
void tst_QMetaType::flags_data()
{
QTest::addColumn<int>("type");
QTest::addColumn<bool>("isMovable");
QTest::addColumn<bool>("isComplex");
QTest::addColumn<bool>("isPointerToQObject");
+ QTest::addColumn<bool>("isEnum");
#define ADD_METATYPE_TEST_ROW(MetaTypeName, MetaTypeId, RealType) \
- QTest::newRow(#RealType) << MetaTypeId << bool(!QTypeInfo<RealType>::isStatic) << bool(QTypeInfo<RealType>::isComplex) << bool(QtPrivate::IsPointerToTypeDerivedFromQObject<RealType>::Value);
+ QTest::newRow(#RealType) << MetaTypeId \
+ << bool(!QTypeInfo<RealType>::isStatic) \
+ << bool(QTypeInfo<RealType>::isComplex) \
+ << bool(QtPrivate::IsPointerToTypeDerivedFromQObject<RealType>::Value) \
+ << bool(Q_IS_ENUM(RealType));
QT_FOR_EACH_STATIC_CORE_CLASS(ADD_METATYPE_TEST_ROW)
QT_FOR_EACH_STATIC_PRIMITIVE_POINTER(ADD_METATYPE_TEST_ROW)
QT_FOR_EACH_STATIC_CORE_POINTER(ADD_METATYPE_TEST_ROW)
#undef ADD_METATYPE_TEST_ROW
- QTest::newRow("TestSpace::Foo") << ::qMetaTypeId<TestSpace::Foo>() << false << true << false;
- QTest::newRow("Whity<double>") << ::qMetaTypeId<Whity<double> >() << false << true << false;
- QTest::newRow("CustomMovable") << ::qMetaTypeId<CustomMovable>() << true << true << false;
- QTest::newRow("CustomObject*") << ::qMetaTypeId<CustomObject*>() << true << false << true;
- QTest::newRow("CustomMultiInheritanceObject*") << ::qMetaTypeId<CustomMultiInheritanceObject*>() << true << false << true;
- QTest::newRow("QPair<C,C>") << ::qMetaTypeId<QPair<C,C> >() << false << true << false;
- QTest::newRow("QPair<C,M>") << ::qMetaTypeId<QPair<C,M> >() << false << true << false;
- QTest::newRow("QPair<C,P>") << ::qMetaTypeId<QPair<C,P> >() << false << true << false;
- QTest::newRow("QPair<M,C>") << ::qMetaTypeId<QPair<M,C> >() << false << true << false;
- QTest::newRow("QPair<M,M>") << ::qMetaTypeId<QPair<M,M> >() << true << true << false;
- QTest::newRow("QPair<M,P>") << ::qMetaTypeId<QPair<M,P> >() << true << true << false;
- QTest::newRow("QPair<P,C>") << ::qMetaTypeId<QPair<P,C> >() << false << true << false;
- QTest::newRow("QPair<P,M>") << ::qMetaTypeId<QPair<P,M> >() << true << true << false;
- QTest::newRow("QPair<P,P>") << ::qMetaTypeId<QPair<P,P> >() << true << false << false;
+ QTest::newRow("TestSpace::Foo") << ::qMetaTypeId<TestSpace::Foo>() << false << true << false << false;
+ QTest::newRow("Whity<double>") << ::qMetaTypeId<Whity<double> >() << false << true << false << false;
+ QTest::newRow("CustomMovable") << ::qMetaTypeId<CustomMovable>() << true << true << false << false;
+ QTest::newRow("CustomObject*") << ::qMetaTypeId<CustomObject*>() << true << false << true << false;
+ QTest::newRow("CustomMultiInheritanceObject*") << ::qMetaTypeId<CustomMultiInheritanceObject*>() << true << false << true << false;
+ QTest::newRow("QPair<C,C>") << ::qMetaTypeId<QPair<C,C> >() << false << true << false << false;
+ QTest::newRow("QPair<C,M>") << ::qMetaTypeId<QPair<C,M> >() << false << true << false << false;
+ QTest::newRow("QPair<C,P>") << ::qMetaTypeId<QPair<C,P> >() << false << true << false << false;
+ QTest::newRow("QPair<M,C>") << ::qMetaTypeId<QPair<M,C> >() << false << true << false << false;
+ QTest::newRow("QPair<M,M>") << ::qMetaTypeId<QPair<M,M> >() << true << true << false << false;
+ QTest::newRow("QPair<M,P>") << ::qMetaTypeId<QPair<M,P> >() << true << true << false << false;
+ QTest::newRow("QPair<P,C>") << ::qMetaTypeId<QPair<P,C> >() << false << true << false << false;
+ QTest::newRow("QPair<P,M>") << ::qMetaTypeId<QPair<P,M> >() << true << true << false << false;
+ QTest::newRow("QPair<P,P>") << ::qMetaTypeId<QPair<P,P> >() << true << false << false << false;
+ QTest::newRow("FlagsDataEnum") << ::qMetaTypeId<FlagsDataEnum>() << false << true << false << true;
// invalid ids.
- QTest::newRow("-1") << -1 << false << false << false;
- QTest::newRow("-124125534") << -124125534 << false << false << false;
- QTest::newRow("124125534") << 124125534 << false << false << false;
-
+ QTest::newRow("-1") << -1 << false << false << false << false;
+ QTest::newRow("-124125534") << -124125534 << false << false << false << false;
+ QTest::newRow("124125534") << 124125534 << false << false << false << false;
}
void tst_QMetaType::flags()
@@ -788,11 +796,13 @@ void tst_QMetaType::flags()
QFETCH(bool, isMovable);
QFETCH(bool, isComplex);
QFETCH(bool, isPointerToQObject);
+ QFETCH(bool, isEnum);
QCOMPARE(bool(QMetaType::typeFlags(type) & QMetaType::NeedsConstruction), isComplex);
QCOMPARE(bool(QMetaType::typeFlags(type) & QMetaType::NeedsDestruction), isComplex);
QCOMPARE(bool(QMetaType::typeFlags(type) & QMetaType::MovableType), isMovable);
QCOMPARE(bool(QMetaType::typeFlags(type) & QMetaType::PointerToQObject), isPointerToQObject);
+ QCOMPARE(bool(QMetaType::typeFlags(type) & QMetaType::IsEnumeration), isEnum);
}
void tst_QMetaType::flagsStaticLess_data()
diff --git a/tests/auto/corelib/tools/qsharedpointer/externaltests.cpp b/tests/auto/corelib/tools/qsharedpointer/externaltests.cpp
index fb946d9ca1..0e7e2fad70 100644
--- a/tests/auto/corelib/tools/qsharedpointer/externaltests.cpp
+++ b/tests/auto/corelib/tools/qsharedpointer/externaltests.cpp
@@ -353,15 +353,25 @@ namespace QTest {
"\n"
"#ifdef Q_OS_WIN\n"
"#include <windows.h>\n"
+ "#if defined(Q_CC_MSVC) && !defined(Q_OS_WINCE)\n"
+ "#include <crtdbg.h>\n"
+ "#endif\n"
"static void q_test_setup()\n"
"{\n"
" SetErrorMode(SEM_FAILCRITICALERRORS | SEM_NOGPFAULTERRORBOX | SEM_NOOPENFILEERRORBOX);\n"
"}\n"
+ "static int __cdecl CrtDbgHook(int /*reportType*/, char * /*message*/, int * /*returnValue*/)\n"
+ "{\n"
+ " return TRUE;\n"
+ "}\n"
"#else\n"
"static void q_test_setup() { }\n"
"#endif\n"
"int main(int argc, char **argv)\n"
- "{\n";
+ "{\n"
+ "#if defined(Q_CC_MSVC) && defined(QT_DEBUG) && defined(_DEBUG) && defined(_CRT_ERROR) && !defined(Q_OS_WINCE)\n"
+ " _CrtSetReportHook2(_CRT_RPTHOOK_INSTALL, CrtDbgHook);\n"
+ "#endif\n";
switch (appType) {
applicationless:
@@ -456,6 +466,7 @@ namespace QTest {
"TARGET = externaltest\n"
"CONFIG -= app_bundle\n" // for the Mac
"CONFIG -= debug_and_release\n"
+ "CONFIG += console\n"
"DESTDIR = .\n"
"OBJECTS_DIR = .\n"
"UI_DIR = .\n"
diff --git a/tests/auto/corelib/tools/qsharedpointer/qsharedpointer.pro b/tests/auto/corelib/tools/qsharedpointer/qsharedpointer.pro
index 1b227109b3..b1cd309293 100644
--- a/tests/auto/corelib/tools/qsharedpointer/qsharedpointer.pro
+++ b/tests/auto/corelib/tools/qsharedpointer/qsharedpointer.pro
@@ -13,5 +13,3 @@ HEADERS = forwarddeclared.h \
TESTDATA += forwarddeclared.cpp forwarddeclared.h
include(externaltests.pri)
-
-win32:CONFIG += insignificant_test # QTBUG-24160
diff --git a/tests/auto/corelib/tools/qtimeline/qtimeline.pro b/tests/auto/corelib/tools/qtimeline/qtimeline.pro
index 430b61b103..cac8074038 100644
--- a/tests/auto/corelib/tools/qtimeline/qtimeline.pro
+++ b/tests/auto/corelib/tools/qtimeline/qtimeline.pro
@@ -2,5 +2,4 @@ CONFIG += testcase parallel_test
TARGET = tst_qtimeline
QT = core testlib
SOURCES = tst_qtimeline.cpp
-
-win32:CONFIG+=insignificant_test # This has been blacklisted in the past
+win32:CONFIG+=insignificant_test # unstable, QTBUG-24796
diff --git a/tests/auto/gui/kernel/kernel.pro b/tests/auto/gui/kernel/kernel.pro
index 116e9dd1f1..48d94b9bf8 100644
--- a/tests/auto/gui/kernel/kernel.pro
+++ b/tests/auto/gui/kernel/kernel.pro
@@ -13,7 +13,6 @@ SUBDIRS=\
qmouseevent_modal \
qpalette \
qscreen \
- qshortcut \
qtouchevent \
qwindow \
qguiapplication \
diff --git a/tests/auto/network/kernel/qdnslookup/tst_qdnslookup.cpp b/tests/auto/network/kernel/qdnslookup/tst_qdnslookup.cpp
index 249ccd3d75..c1400b82af 100644
--- a/tests/auto/network/kernel/qdnslookup/tst_qdnslookup.cpp
+++ b/tests/auto/network/kernel/qdnslookup/tst_qdnslookup.cpp
@@ -159,8 +159,9 @@ void tst_QDnsLookup::lookup()
const QString hostName = cname.isEmpty() ? domain : cname;
QStringList addresses;
foreach (const QDnsHostAddressRecord &record, lookup.hostAddressRecords()) {
- QCOMPARE(record.name(), hostName);
- addresses << record.value().toString().toLower();
+ //reply may include A & AAAA records for nameservers, ignore them and only look at records matching the query
+ if (record.name() == hostName)
+ addresses << record.value().toString().toLower();
}
addresses.sort();
QCOMPARE(addresses.join(" "), host);
@@ -176,8 +177,9 @@ void tst_QDnsLookup::lookup()
// name servers
QStringList nameServers;
foreach (const QDnsDomainNameRecord &record, lookup.nameServerRecords()) {
- QCOMPARE(record.name(), domain);
- nameServers << record.value();
+ //reply may include NS records for authoritative nameservers, ignore them and only look at records matching the query
+ if (record.name() == domain)
+ nameServers << record.value();
}
nameServers.sort();
QCOMPARE(nameServers.join(" "), ns);
diff --git a/tests/auto/other/headersclean/headersclean.pri b/tests/auto/other/headersclean/headersclean.pri
index 163ef6d409..c95380e3b9 100644
--- a/tests/auto/other/headersclean/headersclean.pri
+++ b/tests/auto/other/headersclean/headersclean.pri
@@ -18,8 +18,10 @@
# Enable pedantic mode, but accept variadic macros and 'long long' usage.
*-g++*: QMAKE_CXXFLAGS += -Wno-long-long -Wno-variadic-macros -pedantic-errors
-# There are outstanding alignment issues on ARM in some container classes.
-contains(QT_ARCH,arm):*-g++*:QMAKE_CXXFLAGS -= -Wcast-align
+contains(QT_ARCH,arm)|contains(QT_ARCH,mips) {
+ # There are outstanding alignment issues in some container classes.
+ *-g++*:QMAKE_CXXFLAGS -= -Wcast-align
+}
QMAKE_CXXFLAGS += -DQT_NO_CAST_TO_ASCII \
-DQT_NO_CAST_FROM_ASCII \
diff --git a/tests/auto/other/other.pro b/tests/auto/other/other.pro
index 6c708baa6b..2a6dc1d662 100644
--- a/tests/auto/other/other.pro
+++ b/tests/auto/other/other.pro
@@ -18,7 +18,6 @@ SUBDIRS=\
qaccessibility \
qcomplextext \
qfocusevent \
- qmultiscreen \
qnetworkaccessmanager_and_qprogressdialog \
qobjectperformance \
qobjectrace \
@@ -40,8 +39,7 @@ wince*|!contains(QT_CONFIG, accessibility):SUBDIRS -= qaccessibility
macplist
!embedded|wince*: SUBDIRS -= \
- qdirectpainter \
- qmultiscreen \
+ qdirectpainter
!linux*-g++*:SUBDIRS -= exceptionsafety_objects
diff --git a/tests/auto/other/qaccessibility/tst_qaccessibility.cpp b/tests/auto/other/qaccessibility/tst_qaccessibility.cpp
index 0edda96f2a..c984fedc86 100644
--- a/tests/auto/other/qaccessibility/tst_qaccessibility.cpp
+++ b/tests/auto/other/qaccessibility/tst_qaccessibility.cpp
@@ -278,52 +278,6 @@ private:
const double Q_PI = 3.14159265358979323846;
-QString eventName(const int ev)
-{
- switch(ev) {
- case 0x0001: return "SoundPlayed";
- case 0x0002: return "Alert";
- case 0x0003: return "ForegroundChanged";
- case 0x0004: return "MenuStart";
- case 0x0005: return "MenuEnd";
- case 0x0006: return "PopupMenuStart";
- case 0x0007: return "PopupMenuEnd";
- case 0x000C: return "ContextHelpStart";
- case 0x000D: return "ContextHelpEnd";
- case 0x000E: return "DragDropStart";
- case 0x000F: return "DragDropEnd";
- case 0x0010: return "DialogStart";
- case 0x0011: return "DialogEnd";
- case 0x0012: return "ScrollingStart";
- case 0x0013: return "ScrollingEnd";
- case 0x0018: return "MenuCommand";
-
- case 0x0116: return "TableModelChanged";
- case 0x011B: return "TextCaretMoved";
-
- case 0x8000: return "ObjectCreated";
- case 0x8001: return "ObjectDestroyed";
- case 0x8002: return "ObjectShow";
- case 0x8003: return "ObjectHide";
- case 0x8004: return "ObjectReorder";
- case 0x8005: return "Focus";
- case 0x8006: return "Selection";
- case 0x8007: return "SelectionAdd";
- case 0x8008: return "SelectionRemove";
- case 0x8009: return "SelectionWithin";
- case 0x800A: return "StateChanged";
- case 0x800B: return "LocationChanged";
- case 0x800C: return "NameChanged";
- case 0x800D: return "DescriptionChanged";
- case 0x800E: return "ValueChanged";
- case 0x800F: return "ParentChanged";
- case 0x80A0: return "HelpChanged";
- case 0x80B0: return "DefaultActionChanged";
- case 0x80C0: return "AcceleratorChanged";
- default: return "Unknown Event";
- }
-}
-
QAccessible::State state(QWidget * const widget)
{
QAccessibleInterface *iface = QAccessible::queryAccessibleInterface(widget);
@@ -403,8 +357,8 @@ void tst_QAccessibility::cleanup()
qWarning("%d accessibility event(s) were not handled in testfunction '%s':", list.count(),
QString(QTest::currentTestFunction()).toAscii().constData());
for (int i = 0; i < list.count(); ++i)
- qWarning(" %d: Object: %p Event: '%s' Child: %d", i + 1, list.at(i).object(),
- eventName(list.at(i).type()).toAscii().constData(), list.at(i).child());
+ qWarning(" %d: Object: %p Event: '%s' Child: %d", i + 1, list.at(i)->object(),
+ qAccessibleEventString(list.at(i)->type()), list.at(i)->child());
}
QTestAccessibility::clearEvents();
}
@@ -730,16 +684,16 @@ void tst_QAccessibility::hideShowTest()
window->show();
QVERIFY(!state(window).invisible);
QVERIFY(!state(child).invisible);
- QVERIFY(QTestAccessibility::events().contains(QAccessibleEvent(QAccessible::ObjectShow, window)));
- QVERIFY(QTestAccessibility::events().contains(QAccessibleEvent(QAccessible::ObjectShow, child)));
+ QVERIFY(QTestAccessibility::containsEvent(QAccessibleEvent(QAccessible::ObjectShow, window)));
+ QVERIFY(QTestAccessibility::containsEvent(QAccessibleEvent(QAccessible::ObjectShow, child)));
QTestAccessibility::clearEvents();
// hide() and veryfy that both window and child are invisible and get ObjectHide events.
window->hide();
QVERIFY(state(window).invisible);
QVERIFY(state(child).invisible);
- QVERIFY(QTestAccessibility::events().contains(QAccessibleEvent(QAccessible::ObjectHide, window)));
- QVERIFY(QTestAccessibility::events().contains(QAccessibleEvent(QAccessible::ObjectHide, child)));
+ QVERIFY(QTestAccessibility::containsEvent(QAccessibleEvent(QAccessible::ObjectHide, window)));
+ QVERIFY(QTestAccessibility::containsEvent(QAccessibleEvent(QAccessible::ObjectHide, child)));
QTestAccessibility::clearEvents();
delete window;
@@ -963,6 +917,9 @@ void tst_QAccessibility::buttonTest()
delete menu;
}
+
+ QTestAccessibility::clearEvents();
+ {
// test check box
interface = QAccessible::queryAccessibleInterface(&checkBox);
actionInterface = interface->actionInterface();
@@ -970,12 +927,20 @@ void tst_QAccessibility::buttonTest()
QCOMPARE(actionInterface->actionNames(), QStringList() << QAccessibleActionInterface::checkAction() << QAccessibleActionInterface::setFocusAction());
QVERIFY(!interface->state().checked);
actionInterface->doAction(QAccessibleActionInterface::checkAction());
+
QTest::qWait(500);
QCOMPARE(actionInterface->actionNames(), QStringList() << QAccessibleActionInterface::uncheckAction() << QAccessibleActionInterface::setFocusAction());
QVERIFY(interface->state().checked);
QVERIFY(checkBox.isChecked());
+ QAccessible::State st;
+ st.checked = true;
+ QVERIFY_EVENT(QAccessibleStateChangeEvent(st, &checkBox));
+ checkBox.setChecked(false);
+ QVERIFY_EVENT(QAccessibleStateChangeEvent(st, &checkBox));
delete interface;
+ }
+ {
// test radiobutton
interface = QAccessible::queryAccessibleInterface(&radio);
actionInterface = interface->actionInterface();
@@ -986,8 +951,12 @@ void tst_QAccessibility::buttonTest()
QTest::qWait(500);
QCOMPARE(actionInterface->actionNames(), QStringList() << QAccessibleActionInterface::checkAction() << QAccessibleActionInterface::setFocusAction());
QVERIFY(interface->state().checked);
- QVERIFY(checkBox.isChecked());
+ QVERIFY(radio.isChecked());
+ QAccessible::State st;
+ st.checked = true;
+ QVERIFY_EVENT(QAccessibleStateChangeEvent(st, &radio));
delete interface;
+ }
// // test standard toolbutton
// QVERIFY(QAccessible::queryAccessibleInterface(&toolbutton, &test));
@@ -1037,8 +1006,6 @@ void tst_QAccessibility::buttonTest()
// QCOMPARE(test->actionText(test->defaultAction(2), QAccessible::Name, 2), QString("Open"));
// QCOMPARE(test->state(2), (int)QAccessible::HasPopup);
// test->release();
-
- QTestAccessibility::clearEvents();
}
void tst_QAccessibility::scrollBarTest()
@@ -1050,12 +1017,12 @@ void tst_QAccessibility::scrollBarTest()
scrollBar->resize(200, 50);
scrollBar->show();
QVERIFY(!scrollBarInterface->state().invisible);
- QVERIFY(QTestAccessibility::events().contains(QAccessibleEvent(QAccessible::ObjectShow, scrollBar)));
+ QVERIFY(QTestAccessibility::containsEvent(QAccessibleEvent(QAccessible::ObjectShow, scrollBar)));
QTestAccessibility::clearEvents();
scrollBar->hide();
QVERIFY(scrollBarInterface->state().invisible);
- QVERIFY(QTestAccessibility::events().contains(QAccessibleEvent(QAccessible::ObjectHide, scrollBar)));
+ QVERIFY(QTestAccessibility::containsEvent(QAccessibleEvent(QAccessible::ObjectHide, scrollBar)));
QTestAccessibility::clearEvents();
// Test that the left/right subcontrols are set to unavailable when the scrollBar is at the minimum/maximum.
@@ -1495,9 +1462,8 @@ void tst_QAccessibility::spinBoxTest()
QTestAccessibility::clearEvents();
QTest::keyPress(spinBox, Qt::Key_Up);
QTest::qWait(200);
- EventList events = QTestAccessibility::events();
QAccessibleEvent expectedEvent(QAccessible::ValueChanged, spinBox);
- QVERIFY(events.contains(expectedEvent));
+ QVERIFY(QTestAccessibility::containsEvent(expectedEvent));
delete spinBox;
QTestAccessibility::clearEvents();
}
@@ -1767,7 +1733,7 @@ void tst_QAccessibility::lineEditTest()
le->setFocus(Qt::TabFocusReason);
QTestAccessibility::clearEvents();
le2->setFocus(Qt::TabFocusReason);
- QTRY_VERIFY(QTestAccessibility::events().contains(QAccessibleEvent(QAccessible::Focus, le2)));
+ QTRY_VERIFY(QTestAccessibility::containsEvent(QAccessibleEvent(QAccessible::Focus, le2)));
le->setText(QLatin1String("500"));
le->setValidator(new QIntValidator());
@@ -1787,7 +1753,7 @@ void tst_QAccessibility::lineEditTest()
le3->deselect();
le3->setCursorPosition(3);
QCOMPARE(textIface->cursorPosition(), 3);
- QTRY_VERIFY(QTestAccessibility::events().contains(QAccessibleEvent(QAccessible::TextCaretMoved, le3)));
+ QTRY_VERIFY(QTestAccessibility::containsEvent(QAccessibleEvent(QAccessible::TextCaretMoved, le3)));
QCOMPARE(textIface->selectionCount(), 0);
QTestAccessibility::clearEvents();
@@ -2158,11 +2124,11 @@ void tst_QAccessibility::listTest()
// Check for events
QTest::mouseClick(listView->viewport(), Qt::LeftButton, 0, listView->visualItemRect(listView->item(1)).center());
- QVERIFY(QTestAccessibility::events().contains(QAccessibleEvent(QAccessible::Selection, listView, 2)));
- QVERIFY(QTestAccessibility::events().contains(QAccessibleEvent(QAccessible::Focus, listView, 2)));
+ QVERIFY(QTestAccessibility::containsEvent(QAccessibleEvent(QAccessible::Selection, listView, 2)));
+ QVERIFY(QTestAccessibility::containsEvent(QAccessibleEvent(QAccessible::Focus, listView, 2)));
QTest::mouseClick(listView->viewport(), Qt::LeftButton, 0, listView->visualItemRect(listView->item(2)).center());
- QVERIFY(QTestAccessibility::events().contains(QAccessibleEvent(QAccessible::Selection, listView, 3)));
- QVERIFY(QTestAccessibility::events().contains(QAccessibleEvent(QAccessible::Focus, listView, 3)));
+ QVERIFY(QTestAccessibility::containsEvent(QAccessibleEvent(QAccessible::Selection, listView, 3)));
+ QVERIFY(QTestAccessibility::containsEvent(QAccessibleEvent(QAccessible::Focus, listView, 3)));
listView->addItem("Munich");
QCOMPARE(iface->childCount(), 4);
diff --git a/tests/auto/other/qmultiscreen/.gitignore b/tests/auto/other/qmultiscreen/.gitignore
deleted file mode 100644
index 82e8d449ad..0000000000
--- a/tests/auto/other/qmultiscreen/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-tst_qmultiscreen
diff --git a/tests/auto/other/qmultiscreen/qmultiscreen.pro b/tests/auto/other/qmultiscreen/qmultiscreen.pro
deleted file mode 100644
index 28373823bf..0000000000
--- a/tests/auto/other/qmultiscreen/qmultiscreen.pro
+++ /dev/null
@@ -1,7 +0,0 @@
-CONFIG += testcase
-TARGET = tst_qmultiscreen
-QT += widgets testlib
-SOURCES += tst_qmultiscreen.cpp
-
-requires(embedded)
-
diff --git a/tests/auto/other/qmultiscreen/tst_qmultiscreen.cpp b/tests/auto/other/qmultiscreen/tst_qmultiscreen.cpp
deleted file mode 100644
index 9beb0666eb..0000000000
--- a/tests/auto/other/qmultiscreen/tst_qmultiscreen.cpp
+++ /dev/null
@@ -1,163 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/
-**
-** This file is part of the test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-
-#include <QtTest/QtTest>
-
-#include <qdesktopwidget.h>
-#include <qscreen_qws.h>
-#include <qscreendriverfactory_qws.h>
-#include <qlabel.h>
-
-class tst_QMultiScreen : public QObject
-{
- Q_OBJECT
-
-public:
- tst_QMultiScreen() : screen(0), oldScreen(0) {}
- ~tst_QMultiScreen() {}
-
-private slots:
- void initTestCase();
- void cleanupTestCase();
- void widgetSetFixedSize();
- void grabWindow();
-
-private:
- QScreen *screen;
- QScreen *oldScreen;
-};
-
-void tst_QMultiScreen::cleanupTestCase()
-{
- screen->shutdownDevice();
- screen->disconnect();
- delete screen;
- screen = 0;
-
- qt_screen = oldScreen;
-}
-
-void tst_QMultiScreen::initTestCase()
-{
- oldScreen = qt_screen;
-
- QVERIFY(QScreenDriverFactory::keys().contains(QLatin1String("Multi")));
- QVERIFY(QScreenDriverFactory::keys().contains(QLatin1String("VNC")));
-
- const int id = 10;
- screen = QScreenDriverFactory::create("Multi", id);
- QVERIFY(screen);
- QVERIFY(screen->connect(QString("Multi: "
- "VNC:size=640x480:depth=32:offset=0,0:%1 "
- "VNC:size=640x480:depth=32:offset=640,0:%2 "
- "VNC:size=640x480:depth=16:offset=0,480:%3 "
- ":%4")
- .arg(id+1).arg(id+2).arg(id+3).arg(id)));
- QVERIFY(screen->initDevice());
-
- QDesktopWidget desktop;
- QCOMPARE(desktop.numScreens(), 3);
-}
-
-void tst_QMultiScreen::widgetSetFixedSize()
-{
- QDesktopWidget desktop;
- QRect maxRect;
- for (int i = 0; i < desktop.numScreens(); ++i)
- maxRect |= desktop.availableGeometry(i);
-
- maxRect = maxRect.adjusted(50, 50, -50, -50);
-
- // make sure we can set a size larger than a single screen (task 166368)
- QWidget w;
- w.setFixedSize(maxRect.size());
- w.show();
- QApplication::processEvents();
- QCOMPARE(w.geometry().size(), maxRect.size());
-}
-
-void tst_QMultiScreen::grabWindow()
-{
- QDesktopWidget desktop;
-
- QVERIFY(desktop.numScreens() >= 2);
-
- const QRect r0 = desktop.availableGeometry(0).adjusted(50, 50, -50, -50);
- const QRect r1 = desktop.availableGeometry(1).adjusted(60, 60, -60, -60);
-
- QWidget w;
- w.setGeometry(r0);
- w.show();
-
- QLabel l("hi there");
- l.setGeometry(r1);
- l.show();
-
- QApplication::processEvents();
- QApplication::sendPostedEvents(); // workaround for glib event loop
- QVERIFY(desktop.screenNumber(&w) == 0);
- QVERIFY(desktop.screenNumber(&l) == 1);
-
- const QPixmap p0 = QPixmap::grabWindow(w.winId());
- const QPixmap p1 = QPixmap::grabWindow(l.winId());
-
-// p0.save("w.png", "PNG");
-// p1.save("l.png", "PNG");
- QCOMPARE(p0.size(), w.size());
- QCOMPARE(p1.size(), l.size());
-
- const QImage img0 = p0.toImage();
- const QImage img1 = p1.toImage();
-
-// QPixmap::grabWidget(&w).toImage().convertToFormat(img0.format()).save("w_img.png", "PNG");
-// QPixmap::grabWidget(&l).toImage().convertToFormat(img1.format()).save("l_img.png", "PNG");
-
- QImage::Format format = QImage::Format_RGB16;
- QCOMPARE(img0.convertToFormat(format),
- QPixmap::grabWidget(&w).toImage().convertToFormat(format));
- QCOMPARE(img1.convertToFormat(format),
- QPixmap::grabWidget(&l).toImage().convertToFormat(format));
-}
-
-QTEST_MAIN(tst_QMultiScreen)
-
-#include "tst_qmultiscreen.moc"
diff --git a/tests/auto/sql/models/qsqlrelationaltablemodel/tst_qsqlrelationaltablemodel.cpp b/tests/auto/sql/models/qsqlrelationaltablemodel/tst_qsqlrelationaltablemodel.cpp
index ce0d8db1fd..05d84383ae 100644
--- a/tests/auto/sql/models/qsqlrelationaltablemodel/tst_qsqlrelationaltablemodel.cpp
+++ b/tests/auto/sql/models/qsqlrelationaltablemodel/tst_qsqlrelationaltablemodel.cpp
@@ -1537,7 +1537,9 @@ void tst_QSqlRelationalTableModel::relationOnFirstColumn()
//modify the model data
QVERIFY_SQL(model, setData(model.index(0, 0), 40));
+ QVERIFY_SQL(model, submit());
QVERIFY_SQL(model, setData(model.index(1, 0), 50));
+ QVERIFY_SQL(model, submit());
QVERIFY_SQL(model, setData(model.index(2, 0), 30));
//verify the data after modificaiton
diff --git a/tests/auto/sql/models/qsqltablemodel/tst_qsqltablemodel.cpp b/tests/auto/sql/models/qsqltablemodel/tst_qsqltablemodel.cpp
index 448111cd9f..afe2c59144 100644
--- a/tests/auto/sql/models/qsqltablemodel/tst_qsqltablemodel.cpp
+++ b/tests/auto/sql/models/qsqltablemodel/tst_qsqltablemodel.cpp
@@ -83,6 +83,8 @@ private slots:
void setRecord();
void insertRow_data() { generic_data_with_strategies(); }
void insertRow();
+ void insertRowFailure_data() { generic_data_with_strategies(); }
+ void insertRowFailure();
void insertRecord_data() { generic_data(); }
void insertRecord();
void insertMultiRecords_data() { generic_data(); }
@@ -95,6 +97,8 @@ private slots:
void removeInsertedRow();
void removeInsertedRows_data() { generic_data(); }
void removeInsertedRows();
+ void isDirty_data() { generic_data_with_strategies(); }
+ void isDirty();
void setFilter_data() { generic_data(); }
void setFilter();
void setInvalidFilter_data() { generic_data(); }
@@ -159,7 +163,8 @@ void tst_QSqlTableModel::dropTestTables()
<< qTableName("test4", __FILE__)
<< qTableName("emptytable", __FILE__)
<< qTableName("bigtable", __FILE__)
- << qTableName("foo", __FILE__);
+ << qTableName("foo", __FILE__)
+ << qTableName("pktest", __FILE__);
if (testWhiteSpaceNames(db.driverName()))
tableNames << qTableName("qtestw hitespace", db.driver());
@@ -195,6 +200,8 @@ void tst_QSqlTableModel::createTestTables()
QString qry = "create table " + qTableName("qtestw hitespace", db.driver()) + " ("+ db.driver()->escapeIdentifier("a field", QSqlDriver::FieldName) + " int)";
QVERIFY_SQL( q, exec(qry));
}
+
+ QVERIFY_SQL( q, exec("create table "+qTableName("pktest", __FILE__)+"(id int not null primary key, a varchar(20))"));
}
}
@@ -412,7 +419,7 @@ void tst_QSqlTableModel::setRecord()
model.submit();
else {
// dataChanged() emitted by selectRow() as well as setRecord()
- if ((QSqlTableModel::EditStrategy)submitpolicy == QSqlTableModel::OnFieldChange)
+ if ((QSqlTableModel::EditStrategy)submitpolicy != QSqlTableModel::OnManualSubmit)
QCOMPARE(spy.count(), 2);
else
QCOMPARE(spy.count(), 1);
@@ -539,6 +546,73 @@ void tst_QSqlTableModel::insertRow()
QCOMPARE(model.data(model.index(3, 2)).toInt(), 2);
}
+void tst_QSqlTableModel::insertRowFailure()
+{
+ QFETCH(QString, dbName);
+ QSqlDatabase db = QSqlDatabase::database(dbName);
+ QFETCH(int, submitpolicy_i);
+ QSqlTableModel::EditStrategy submitpolicy = (QSqlTableModel::EditStrategy) submitpolicy_i;
+ CHECK_DATABASE(db);
+
+ QSqlTableModel model(0, db);
+ model.setTable(qTableName("pktest", __FILE__));
+ model.setEditStrategy(submitpolicy);
+
+ QSqlRecord values = model.record();
+ values.setValue(0, 42);
+ values.setGenerated(0, true);
+ values.setValue(1, QString("blah"));
+ values.setGenerated(1, true);
+
+ // populate 1 row
+ QVERIFY_SQL(model, insertRecord(0, values));
+ QVERIFY_SQL(model, submitAll());
+ QVERIFY_SQL(model, select());
+ QCOMPARE(model.rowCount(), 1);
+ QCOMPARE(model.data(model.index(0, 0)).toInt(), 42);
+ QCOMPARE(model.data(model.index(0, 1)).toString(), QString("blah"));
+
+ // primary key conflict will succeed in model but fail in database
+ QVERIFY_SQL(model, insertRow(0));
+ QVERIFY_SQL(model, setData(model.index(0, 0), 42));
+ QVERIFY_SQL(model, setData(model.index(0, 1), "conflict"));
+ QFAIL_SQL(model, submitAll());
+
+ // failed insert is still cached
+ QCOMPARE(model.rowCount(), 2);
+ QCOMPARE(model.data(model.index(0, 1)).toString(), QString("conflict"));
+ QCOMPARE(model.data(model.index(1, 1)).toString(), QString("blah"));
+
+ // cached insert affects subsequent operations
+ values.setValue(1, QString("spam"));
+ if (submitpolicy != QSqlTableModel::OnManualSubmit) {
+ QFAIL_SQL(model, setData(model.index(1, 1), QString("eggs")));
+ QCOMPARE(model.data(model.index(1, 1)).toString(), QString("blah"));
+ QFAIL_SQL(model, setRecord(1, values));
+ QCOMPARE(model.data(model.index(1, 1)).toString(), QString("blah"));
+ QFAIL_SQL(model, insertRow(2));
+ QCOMPARE(model.rowCount(), 2);
+ QFAIL_SQL(model, removeRow(1));
+ QCOMPARE(model.rowCount(), 2);
+ } else {
+ QVERIFY_SQL(model, setData(model.index(1, 1), QString("eggs")));
+ QCOMPARE(model.data(model.index(1, 1)).toString(), QString("eggs"));
+ QVERIFY_SQL(model, setRecord(1, values));
+ QCOMPARE(model.data(model.index(1, 1)).toString(), QString("spam"));
+ QVERIFY_SQL(model, insertRow(2));
+ QCOMPARE(model.rowCount(), 3);
+ QVERIFY_SQL(model, removeRow(1));
+ QCOMPARE(model.rowCount(), 3);
+ }
+
+ // restore empty table
+ model.revertAll();
+ QVERIFY_SQL(model, removeRow(0));
+ QVERIFY_SQL(model, submitAll());
+ QVERIFY_SQL(model, select());
+ QCOMPARE(model.rowCount(), 0);
+}
+
void tst_QSqlTableModel::insertRecord()
{
QFETCH(QString, dbName);
@@ -725,8 +799,10 @@ void tst_QSqlTableModel::removeRows()
QVERIFY(!model.removeRows(1, 0)); // zero count
QVERIFY(!model.removeRows(5, 1)); // past end (DOESN'T causes a beforeDelete to be emitted)
QVERIFY(!model.removeRows(1, 0, model.index(2, 0))); // can't pass a valid modelindex
+ QFAIL_SQL(model, removeRows(0, 2)); // more than 1 row on OnFieldChange
- QVERIFY_SQL(model, removeRows(0, 2));
+ QVERIFY_SQL(model, removeRows(0, 1));
+ QVERIFY_SQL(model, removeRows(1, 1));
QCOMPARE(beforeDeleteSpy.count(), 2);
QVERIFY(beforeDeleteSpy.at(0).at(0).toInt() == 0);
QVERIFY(beforeDeleteSpy.at(1).at(0).toInt() == 1);
@@ -956,6 +1032,187 @@ void tst_QSqlTableModel::removeInsertedRows()
QCOMPARE(model.data(model.index(1, 1)).toString(), QString("vohi"));
}
+void tst_QSqlTableModel::isDirty()
+{
+ QFETCH(QString, dbName);
+ QFETCH(int, submitpolicy_i);
+ QSqlTableModel::EditStrategy submitpolicy = (QSqlTableModel::EditStrategy) submitpolicy_i;
+ QSqlDatabase db = QSqlDatabase::database(dbName);
+ CHECK_DATABASE(db);
+
+ QSqlTableModel model(0, db);
+ model.setEditStrategy(submitpolicy);
+ model.setTable(test);
+ QFAIL_SQL(model, isDirty());
+
+ model.setSort(0, Qt::AscendingOrder);
+ QVERIFY_SQL(model, select());
+ QFAIL_SQL(model, isDirty());
+
+ if (submitpolicy != QSqlTableModel::OnFieldChange) {
+ // setData() followed by revertAll()
+ QCOMPARE(model.data(model.index(0, 1)).toString(), QString("harry"));
+ QVERIFY_SQL(model, setData(model.index(0, 1), QString("sam i am")));
+ QCOMPARE(model.data(model.index(0, 1)).toString(), QString("sam i am"));
+ QVERIFY_SQL(model, isDirty());
+ QVERIFY_SQL(model, isDirty(model.index(0, 1)));
+ model.revertAll();
+ QCOMPARE(model.data(model.index(0, 1)).toString(), QString("harry"));
+ QFAIL_SQL(model, isDirty());
+ QFAIL_SQL(model, isDirty(model.index(0, 1)));
+
+ // setData() followed by select(), which clears changes
+ QCOMPARE(model.data(model.index(0, 1)).toString(), QString("harry"));
+ QVERIFY_SQL(model, setData(model.index(0, 1), QString("sam i am")));
+ QCOMPARE(model.data(model.index(0, 1)).toString(), QString("sam i am"));
+ QVERIFY_SQL(model, isDirty());
+ QVERIFY_SQL(model, isDirty(model.index(0, 1)));
+ QVERIFY_SQL(model, select());
+ QCOMPARE(model.data(model.index(0, 1)).toString(), QString("harry"));
+ QFAIL_SQL(model, isDirty());
+ QFAIL_SQL(model, isDirty(model.index(0, 1)));
+ }
+
+ if (submitpolicy == QSqlTableModel::OnRowChange) {
+ // dirty row must block change on other rows
+ QCOMPARE(model.data(model.index(0, 1)).toString(), QString("harry"));
+ QVERIFY(model.rowCount() > 1);
+ QVERIFY_SQL(model, setData(model.index(0, 1), QString("sam i am")));
+ QCOMPARE(model.data(model.index(0, 1)).toString(), QString("sam i am"));
+ QVERIFY_SQL(model, isDirty());
+ QVERIFY_SQL(model, isDirty(model.index(0, 1)));
+ QVERIFY(!(model.flags(model.index(1, 1)) & Qt::ItemIsEditable));
+ QFAIL_SQL(model, setData(model.index(1, 1), QString("sam i am")));
+ QFAIL_SQL(model, setRecord(1, model.record(1)));
+ QFAIL_SQL(model, insertRow(1));
+ QFAIL_SQL(model, removeRow(1));
+ QFAIL_SQL(model, isDirty(model.index(1, 1)));
+
+ model.revertAll();
+ QCOMPARE(model.data(model.index(0, 1)).toString(), QString("harry"));
+ QFAIL_SQL(model, isDirty());
+ QFAIL_SQL(model, isDirty(model.index(0, 1)));
+ }
+
+ // setData() followed by submitAll()
+ QCOMPARE(model.data(model.index(0, 1)).toString(), QString("harry"));
+ QVERIFY_SQL(model, setData(model.index(0, 1), QString("sam i am")));
+ QCOMPARE(model.data(model.index(0, 1)).toString(), QString("sam i am"));
+ if (submitpolicy != QSqlTableModel::OnFieldChange) {
+ QVERIFY_SQL(model, isDirty());
+ QVERIFY_SQL(model, isDirty(model.index(0, 1)));
+ }
+ QVERIFY_SQL(model, submitAll());
+ QCOMPARE(model.data(model.index(0, 1)).toString(), QString("sam i am"));
+ QFAIL_SQL(model, isDirty());
+ QFAIL_SQL(model, isDirty(model.index(0, 1)));
+ // check status after refreshing underlying query
+ QVERIFY_SQL(model, select());
+ QCOMPARE(model.data(model.index(0, 1)).toString(), QString("sam i am"));
+ QFAIL_SQL(model, isDirty());
+ QFAIL_SQL(model, isDirty(model.index(0, 1)));
+ //restore original state
+ QVERIFY_SQL(model, setData(model.index(0, 1), QString("harry")));
+ QVERIFY_SQL(model, submitAll());
+ QVERIFY_SQL(model, select());
+ QFAIL_SQL(model, isDirty());
+ QFAIL_SQL(model, isDirty(model.index(0, 1)));
+
+ QSqlRecord newvals = model.record(0);
+ newvals.setValue(1, QString("sam i am"));
+ newvals.setGenerated(1, true);
+ if (submitpolicy == QSqlTableModel::OnManualSubmit) {
+ // setRecord() followed by revertAll()
+ QCOMPARE(model.data(model.index(0, 1)).toString(), QString("harry"));
+ QVERIFY_SQL(model, setRecord(0, newvals));
+ QCOMPARE(model.data(model.index(0, 1)).toString(), QString("sam i am"));
+ QVERIFY_SQL(model, isDirty());
+ QVERIFY_SQL(model, isDirty(model.index(0, 1)));
+ model.revertAll();
+ QCOMPARE(model.data(model.index(0, 1)).toString(), QString("harry"));
+ QFAIL_SQL(model, isDirty());
+ QFAIL_SQL(model, isDirty(model.index(0, 1)));
+
+ // setRecord() followed by select(), which clears changes
+ QCOMPARE(model.data(model.index(0, 1)).toString(), QString("harry"));
+ QVERIFY_SQL(model, setRecord(0, newvals));
+ QCOMPARE(model.data(model.index(0, 1)).toString(), QString("sam i am"));
+ QVERIFY_SQL(model, isDirty());
+ QVERIFY_SQL(model, isDirty(model.index(0, 1)));
+ QVERIFY_SQL(model, select());
+ QCOMPARE(model.data(model.index(0, 1)).toString(), QString("harry"));
+ QFAIL_SQL(model, isDirty());
+ QFAIL_SQL(model, isDirty(model.index(0, 1)));
+ }
+
+ // setRecord() followed by submitAll()
+ QCOMPARE(model.data(model.index(0, 1)).toString(), QString("harry"));
+ QVERIFY_SQL(model, setRecord(0, newvals));
+ QCOMPARE(model.data(model.index(0, 1)).toString(), QString("sam i am"));
+ if (submitpolicy == QSqlTableModel::OnManualSubmit) {
+ QVERIFY_SQL(model, isDirty());
+ QVERIFY_SQL(model, isDirty(model.index(0, 1)));
+ }
+ QVERIFY_SQL(model, submitAll());
+ QCOMPARE(model.data(model.index(0, 1)).toString(), QString("sam i am"));
+ QFAIL_SQL(model, isDirty());
+ QFAIL_SQL(model, isDirty(model.index(0, 1)));
+ // check status after refreshing underlying query
+ QVERIFY_SQL(model, select());
+ QCOMPARE(model.data(model.index(0, 1)).toString(), QString("sam i am"));
+ QFAIL_SQL(model, isDirty());
+ QFAIL_SQL(model, isDirty(model.index(0, 1)));
+ //restore original state
+ QVERIFY_SQL(model, setData(model.index(0, 1), QString("harry")));
+ QVERIFY_SQL(model, submitAll());
+ QVERIFY_SQL(model, select());
+ QFAIL_SQL(model, isDirty());
+ QFAIL_SQL(model, isDirty(model.index(0, 1)));
+
+ // insertRow()
+ QVERIFY_SQL(model, insertRow(0));
+ QVERIFY_SQL(model, isDirty());
+ QVERIFY_SQL(model, isDirty(model.index(0, 1)));
+ model.revertAll();
+ QFAIL_SQL(model, isDirty());
+ QFAIL_SQL(model, isDirty(model.index(0, 1)));
+ QVERIFY_SQL(model, select());
+ QCOMPARE(model.data(model.index(0, 1)).toString(), QString("harry"));
+ QFAIL_SQL(model, isDirty());
+ QFAIL_SQL(model, isDirty(model.index(0, 1)));
+
+ // removeRow()
+ QSqlRecord saved_rec = model.record(0);
+ QVERIFY_SQL(model, removeRow(0));
+ if (submitpolicy == QSqlTableModel::OnManualSubmit) {
+ QVERIFY_SQL(model, isDirty());
+ QVERIFY_SQL(model, isDirty(model.index(0, 1)));
+ }
+ QVERIFY_SQL(model, submitAll());
+ QFAIL_SQL(model, isDirty());
+ QFAIL_SQL(model, isDirty(model.index(0, 1)));
+ QVERIFY_SQL(model, select());
+ QFAIL_SQL(model, isDirty());
+ QFAIL_SQL(model, isDirty(model.index(0, 1)));
+ QCOMPARE(model.data(model.index(0, 1)).toString(), QString("trond"));
+
+ // insertRecord(), put back the removed row
+ for (int i = saved_rec.count() - 1; i >= 0; --i)
+ saved_rec.setGenerated(i, true);
+ QVERIFY_SQL(model, insertRecord(0, saved_rec));
+ if (submitpolicy == QSqlTableModel::OnManualSubmit) {
+ QVERIFY_SQL(model, isDirty());
+ QVERIFY_SQL(model, isDirty(model.index(0, 1)));
+ }
+ QVERIFY_SQL(model, submitAll());
+ QFAIL_SQL(model, isDirty());
+ QFAIL_SQL(model, isDirty(model.index(0, 1)));
+ QVERIFY_SQL(model, select());
+ QFAIL_SQL(model, isDirty());
+ QFAIL_SQL(model, isDirty(model.index(0, 1)));
+ QCOMPARE(model.data(model.index(0, 1)).toString(), QString("harry"));
+}
+
void tst_QSqlTableModel::emptyTable()
{
QFETCH(QString, dbName);
diff --git a/tests/auto/widgets/dialogs/qfilesystemmodel/tst_qfilesystemmodel.cpp b/tests/auto/widgets/dialogs/qfilesystemmodel/tst_qfilesystemmodel.cpp
index fe374b1e8d..1a3d083864 100644
--- a/tests/auto/widgets/dialogs/qfilesystemmodel/tst_qfilesystemmodel.cpp
+++ b/tests/auto/widgets/dialogs/qfilesystemmodel/tst_qfilesystemmodel.cpp
@@ -847,7 +847,7 @@ void tst_QFileSystemModel::sort()
tree->resize(800, 800);
QTest::qWait(500);
tree->header()->setSortIndicator(1,Qt::DescendingOrder);
- tree->header()->setResizeMode(0, QHeaderView::ResizeToContents);
+ tree->header()->setSectionResizeMode(0, QHeaderView::ResizeToContents);
QStringList dirsToOpen;
do
{
diff --git a/tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp b/tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp
index 5c99e48388..98c3866dd2 100644
--- a/tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp
+++ b/tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp
@@ -1069,9 +1069,6 @@ void tst_QGraphicsItem::toolTip()
foundTipLabel = true;
}
QVERIFY(foundView);
-#ifdef Q_OS_MAC
- QEXPECT_FAIL("", "QTBUG-23707", Continue);
-#endif
QVERIFY(foundTipLabel);
}
diff --git a/tests/auto/widgets/graphicsview/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp b/tests/auto/widgets/graphicsview/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp
index 843b584ce5..fef21c19f7 100644
--- a/tests/auto/widgets/graphicsview/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp
+++ b/tests/auto/widgets/graphicsview/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp
@@ -2640,9 +2640,6 @@ void tst_QGraphicsProxyWidget::tooltip_basic()
foundTipLabel = true;
}
QVERIFY(foundView);
-#ifdef Q_OS_MAC
- QEXPECT_FAIL("", "QTBUG-23707", Continue);
-#endif
QVERIFY(foundTipLabel);
}
}
diff --git a/tests/auto/widgets/itemviews/qheaderview/tst_qheaderview.cpp b/tests/auto/widgets/itemviews/qheaderview/tst_qheaderview.cpp
index 3edc125b5a..9ad71771c5 100644
--- a/tests/auto/widgets/itemviews/qheaderview/tst_qheaderview.cpp
+++ b/tests/auto/widgets/itemviews/qheaderview/tst_qheaderview.cpp
@@ -502,20 +502,20 @@ void tst_QHeaderView::removeCols()
void tst_QHeaderView::movable()
{
- QCOMPARE(view->isMovable(), false);
- view->setMovable(false);
- QCOMPARE(view->isMovable(), false);
- view->setMovable(true);
- QCOMPARE(view->isMovable(), true);
+ QCOMPARE(view->sectionsMovable(), false);
+ view->setSectionsMovable(false);
+ QCOMPARE(view->sectionsMovable(), false);
+ view->setSectionsMovable(true);
+ QCOMPARE(view->sectionsMovable(), true);
}
void tst_QHeaderView::clickable()
{
- QCOMPARE(view->isClickable(), false);
- view->setClickable(false);
- QCOMPARE(view->isClickable(), false);
- view->setClickable(true);
- QCOMPARE(view->isClickable(), true);
+ QCOMPARE(view->sectionsClickable(), false);
+ view->setSectionsClickable(false);
+ QCOMPARE(view->sectionsClickable(), false);
+ view->setSectionsClickable(true);
+ QCOMPARE(view->sectionsClickable(), true);
}
void tst_QHeaderView::hidden()
@@ -1108,7 +1108,7 @@ void tst_QHeaderView::resizeWithResizeModes()
view->setStretchLastSection(false);
for (int i = 0; i < sections.count(); ++i) {
view->resizeSection(i, sections.at(i));
- view->setResizeMode(i, (QHeaderView::ResizeMode)modes.at(i));
+ view->setSectionResizeMode(i, (QHeaderView::ResizeMode)modes.at(i));
}
topLevel->show();
view->resize(size, size);
@@ -1150,27 +1150,27 @@ void tst_QHeaderView::resizeMode()
// resizeMode must not be called with an invalid index
int last = view->count() - 1;
view->setResizeMode(QHeaderView::Interactive);
- QCOMPARE(view->resizeMode(last), QHeaderView::Interactive);
- QCOMPARE(view->resizeMode(1), QHeaderView::Interactive);
+ QCOMPARE(view->sectionResizeMode(last), QHeaderView::Interactive);
+ QCOMPARE(view->sectionResizeMode(1), QHeaderView::Interactive);
view->setResizeMode(QHeaderView::Stretch);
- QCOMPARE(view->resizeMode(last), QHeaderView::Stretch);
- QCOMPARE(view->resizeMode(1), QHeaderView::Stretch);
+ QCOMPARE(view->sectionResizeMode(last), QHeaderView::Stretch);
+ QCOMPARE(view->sectionResizeMode(1), QHeaderView::Stretch);
view->setResizeMode(QHeaderView::Custom);
- QCOMPARE(view->resizeMode(last), QHeaderView::Custom);
- QCOMPARE(view->resizeMode(1), QHeaderView::Custom);
+ QCOMPARE(view->sectionResizeMode(last), QHeaderView::Custom);
+ QCOMPARE(view->sectionResizeMode(1), QHeaderView::Custom);
// test when sections have been moved
view->setStretchLastSection(false);
for (int i=0; i < (view->count() - 1); ++i)
- view->setResizeMode(i, QHeaderView::Interactive);
+ view->setSectionResizeMode(i, QHeaderView::Interactive);
int logicalIndex = view->count() / 2;
- view->setResizeMode(logicalIndex, QHeaderView::Stretch);
+ view->setSectionResizeMode(logicalIndex, QHeaderView::Stretch);
view->moveSection(view->visualIndex(logicalIndex), 0);
for (int i=0; i < (view->count() - 1); ++i) {
if (i == logicalIndex)
- QCOMPARE(view->resizeMode(i), QHeaderView::Stretch);
+ QCOMPARE(view->sectionResizeMode(i), QHeaderView::Stretch);
else
- QCOMPARE(view->resizeMode(i), QHeaderView::Interactive);
+ QCOMPARE(view->sectionResizeMode(i), QHeaderView::Interactive);
}
}
@@ -1209,12 +1209,12 @@ void tst_QHeaderView::resizeSection()
view->resize(400, 400);
topLevel->show();
- view->setMovable(true);
+ view->setSectionsMovable(true);
view->setStretchLastSection(false);
for (int i = 0; i < logical.count(); ++i)
if (logical.at(i) > -1 && logical.at(i) < view->count()) // for now
- view->setResizeMode(logical.at(i), (QHeaderView::ResizeMode)mode.at(i));
+ view->setSectionResizeMode(logical.at(i), (QHeaderView::ResizeMode)mode.at(i));
for (int j = 0; j < logical.count(); ++j)
view->resizeSection(logical.at(j), initial);
@@ -1447,7 +1447,7 @@ void tst_QHeaderView::stretchSectionCount()
view->setStretchLastSection(true);
QCOMPARE(view->stretchSectionCount(), 0);
- view->setResizeMode(0, QHeaderView::Stretch);
+ view->setSectionResizeMode(0, QHeaderView::Stretch);
QCOMPARE(view->stretchSectionCount(), 1);
}
@@ -1693,7 +1693,7 @@ void tst_QHeaderView::globalResizeMode()
h.setResizeMode((QHeaderView::ResizeMode)mode);
m.insertRow(insert);
for (int i = 0; i < h.count(); ++i)
- QCOMPARE(h.resizeMode(i), (QHeaderView::ResizeMode)mode);
+ QCOMPARE(h.sectionResizeMode(i), (QHeaderView::ResizeMode)mode);
}
@@ -1725,7 +1725,7 @@ void tst_QHeaderView::sectionPressedSignal()
h.setModel(&m);
h.show();
- h.setClickable(clickable);
+ h.setSectionsClickable(clickable);
QSignalSpy spy(&h, SIGNAL(sectionPressed(int)));
@@ -1745,7 +1745,7 @@ void tst_QHeaderView::sectionClickedSignal()
h.setModel(&m);
h.show();
- h.setClickable(clickable);
+ h.setSectionsClickable(clickable);
h.setSortIndicatorShown(true);
QSignalSpy spy(&h, SIGNAL(sectionClicked(int)));
@@ -1869,7 +1869,7 @@ void tst_QHeaderView::preserveHiddenSectionWidth()
view.resizeSection(0, 100);
view.resizeSection(1, 10);
view.resizeSection(2, 50);
- view.setResizeMode(3, QHeaderView::Stretch);
+ view.setSectionResizeMode(3, QHeaderView::Stretch);
view.show();
view.hideSection(2);
@@ -2066,7 +2066,7 @@ void tst_QHeaderView::QTBUG7833_sectionClicked()
tv.setSortingEnabled(true);
tv.horizontalHeader()->setSortIndicatorShown(true);
- tv.horizontalHeader()->setClickable(true);
+ tv.horizontalHeader()->setSectionsClickable(true);
tv.horizontalHeader()->setStretchLastSection(true);
tv.horizontalHeader()->setResizeMode(QHeaderView::Interactive);
@@ -2126,7 +2126,7 @@ void tst_QHeaderView::QTBUG12268_hiddenMovedSectionSorting()
for (int j = 0; j< model->columnCount(); ++j)
model->setData(model->index(i,j), QString("item [%1,%2]").arg(i).arg(j));
view.setModel(model);
- view.horizontalHeader()->setMovable(true);
+ view.horizontalHeader()->setSectionsMovable(true);
view.setSortingEnabled(true);
view.sortByColumn(1, Qt::AscendingOrder);
view.horizontalHeader()->moveSection(0,2);
diff --git a/tests/auto/widgets/itemviews/qtableview/tst_qtableview.cpp b/tests/auto/widgets/itemviews/qtableview/tst_qtableview.cpp
index 9144a023d7..0c396aac60 100644
--- a/tests/auto/widgets/itemviews/qtableview/tst_qtableview.cpp
+++ b/tests/auto/widgets/itemviews/qtableview/tst_qtableview.cpp
@@ -175,6 +175,7 @@ private slots:
void tabFocus();
void bigModel();
void selectionSignal();
+ void setCurrentIndex();
// task-specific tests:
void task173773_updateVerticalHeader();
@@ -254,11 +255,15 @@ class QtTestTableModel: public QAbstractTableModel
signals:
void invalidIndexEncountered() const;
+public slots:
+ bool submit() { ++submit_count; return QAbstractTableModel::submit(); }
+
public:
QtTestTableModel(int rows = 0, int columns = 0, QObject *parent = 0)
: QAbstractTableModel(parent),
row_count(rows),
column_count(columns),
+ submit_count(0),
can_fetch_more(false),
fetch_more_count(0),
disabled_rows(),
@@ -400,6 +405,7 @@ public:
int row_count;
int column_count;
+ int submit_count;
bool can_fetch_more;
int fetch_more_count;
QSet<int> disabled_rows;
@@ -3480,6 +3486,27 @@ void tst_QTableView::selectionSignal()
QTest::mouseClick(view.viewport(), Qt::LeftButton, 0, view.visualRect(model.index(2, 0)).center());
}
+void tst_QTableView::setCurrentIndex()
+{
+ QtTestTableModel model(4, 4);
+ QtTestTableView view;
+ view.setModel(&model);
+
+ // submit() slot should be called in model when current row changes
+ view.setCurrentIndex(model.index(0,0));
+ QCOMPARE(model.submit_count, 1);
+ view.setCurrentIndex(model.index(0,2));
+ QCOMPARE(model.submit_count, 1);
+ view.setCurrentIndex(model.index(1,0));
+ QCOMPARE(model.submit_count, 2);
+ view.setCurrentIndex(model.index(3,3));
+ QCOMPARE(model.submit_count, 3);
+ view.setCurrentIndex(model.index(0,1));
+ QCOMPARE(model.submit_count, 4);
+ view.setCurrentIndex(model.index(0,0));
+ QCOMPARE(model.submit_count, 4);
+}
+
class task173773_EventFilter : public QObject
{
int paintEventCount_;
diff --git a/tests/auto/widgets/kernel/kernel.pro b/tests/auto/widgets/kernel/kernel.pro
index 3a00300ac3..cf909b7e87 100644
--- a/tests/auto/widgets/kernel/kernel.pro
+++ b/tests/auto/widgets/kernel/kernel.pro
@@ -14,6 +14,7 @@ SUBDIRS=\
qwidget_window \
qwidgetaction \
qicon \
+ qshortcut \
SUBDIRS -= qsound
diff --git a/tests/auto/gui/kernel/qshortcut/.gitignore b/tests/auto/widgets/kernel/qshortcut/.gitignore
index 3a17eb18e3..3a17eb18e3 100644
--- a/tests/auto/gui/kernel/qshortcut/.gitignore
+++ b/tests/auto/widgets/kernel/qshortcut/.gitignore
diff --git a/tests/auto/gui/kernel/qshortcut/qshortcut.pro b/tests/auto/widgets/kernel/qshortcut/qshortcut.pro
index 7ac1dd2c9d..7ac1dd2c9d 100644
--- a/tests/auto/gui/kernel/qshortcut/qshortcut.pro
+++ b/tests/auto/widgets/kernel/qshortcut/qshortcut.pro
diff --git a/tests/auto/gui/kernel/qshortcut/tst_qshortcut.cpp b/tests/auto/widgets/kernel/qshortcut/tst_qshortcut.cpp
index 61efb6e3f3..61efb6e3f3 100644
--- a/tests/auto/gui/kernel/qshortcut/tst_qshortcut.cpp
+++ b/tests/auto/widgets/kernel/qshortcut/tst_qshortcut.cpp
diff --git a/tests/auto/widgets/kernel/qtooltip/tst_qtooltip.cpp b/tests/auto/widgets/kernel/qtooltip/tst_qtooltip.cpp
index b47ef659be..e20111c652 100644
--- a/tests/auto/widgets/kernel/qtooltip/tst_qtooltip.cpp
+++ b/tests/auto/widgets/kernel/qtooltip/tst_qtooltip.cpp
@@ -90,12 +90,8 @@ void tst_QToolTip::task183679_data()
{
QTest::addColumn<Qt::Key>("key");
QTest::addColumn<bool>("visible");
-#ifdef Q_OS_MAC
- const bool visibleAfterNonModifier = false;
-#else
- const bool visibleAfterNonModifier = true;
-#endif
- QTest::newRow("non-modifier") << Qt::Key_A << visibleAfterNonModifier;
+
+ QTest::newRow("non-modifier") << Qt::Key_A << true;
QTest::newRow("Shift") << Qt::Key_Shift << true;
QTest::newRow("Control") << Qt::Key_Control << true;
QTest::newRow("Alt") << Qt::Key_Alt << true;
@@ -116,9 +112,6 @@ void tst_QToolTip::task183679()
widget.showDelayedToolTip(100);
QTest::qWait(300);
-#ifdef Q_OS_MAC
- QEXPECT_FAIL("", "QTBUG-23707", Continue);
-#endif
QTRY_VERIFY(QToolTip::isVisible());
QTest::keyPress(&widget, key);
@@ -128,12 +121,6 @@ void tst_QToolTip::task183679()
// auto-close timeout (currently 10000 msecs)
QTest::qWait(1500);
-#ifdef Q_OS_MAC
- QEXPECT_FAIL("Shift", "QTBUG-23707", Continue);
- QEXPECT_FAIL("Control", "QTBUG-23707", Continue);
- QEXPECT_FAIL("Alt", "QTBUG-23707", Continue);
- QEXPECT_FAIL("Meta", "QTBUG-23707", Continue);
-#endif
QCOMPARE(QToolTip::isVisible(), visible);
}
diff --git a/tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp b/tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp
index f9eb8b6159..4730d7d556 100644
--- a/tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp
+++ b/tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp
@@ -909,9 +909,6 @@ void tst_QComboBox::hide()
QTRY_VERIFY(testWidget->view()->isVisible());
testWidget->hidePopup();
//allow combobox effect to complete
-#ifdef Q_OS_MAC
- QEXPECT_FAIL("", "QTBUG-23678", Continue);
-#endif
QTRY_VERIFY(!testWidget->view()->isVisible());
testWidget->hide();
QVERIFY(!testWidget->isVisible());
diff --git a/tests/auto/widgets/widgets/qdockwidget/tst_qdockwidget.cpp b/tests/auto/widgets/widgets/qdockwidget/tst_qdockwidget.cpp
index 43c0022c25..7e7b049166 100644
--- a/tests/auto/widgets/widgets/qdockwidget/tst_qdockwidget.cpp
+++ b/tests/auto/widgets/widgets/qdockwidget/tst_qdockwidget.cpp
@@ -764,6 +764,9 @@ void tst_QDockWidget::task169808_setFloating()
qt_x11_wait_for_window_manager(&mw);
#endif
+#ifdef Q_OS_MAC
+ QEXPECT_FAIL("", "Window handling: QTBUG-24774", Abort);
+#endif
QCOMPARE(dw->widget()->size(), dw->widget()->sizeHint());
//and now we try to test if the contents margin is taken into account