summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/corelib/global/qlogging/tst_qlogging.cpp16
-rw-r--r--tests/auto/corelib/io/qsettings/tst_qsettings.cpp11
-rw-r--r--tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp40
-rw-r--r--tests/auto/corelib/kernel/qmimedata/tst_qmimedata.cpp2
-rw-r--r--tests/auto/corelib/kernel/qpointer/tst_qpointer.cpp3
-rw-r--r--tests/auto/corelib/statemachine/qstate/tst_qstate.cpp18
-rw-r--r--tests/auto/corelib/thread/qthreadpool/tst_qthreadpool.cpp12
-rw-r--r--tests/auto/corelib/tools/qsharedpointer/tst_qsharedpointer.cpp3
-rw-r--r--tests/auto/corelib/tools/qstringref/tst_qstringref.cpp4
-rw-r--r--tests/auto/gui/kernel/qclipboard/tst_qclipboard.cpp18
-rw-r--r--tests/auto/gui/kernel/qopenglwindow/tst_qopenglwindow.cpp18
-rw-r--r--tests/auto/network/kernel/kernel.pro3
-rw-r--r--tests/auto/network/ssl/qsslcertificate/tst_qsslcertificate.cpp9
-rw-r--r--tests/auto/network/ssl/qsslerror/tst_qsslerror.cpp9
-rw-r--r--tests/auto/other/compiler/tst_compiler.cpp15
-rw-r--r--tests/auto/widgets/itemviews/qtableview/tst_qtableview.cpp159
-rw-r--r--tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp1
-rw-r--r--tests/manual/transientwindow/mainwindow.cpp1
18 files changed, 290 insertions, 52 deletions
diff --git a/tests/auto/corelib/global/qlogging/tst_qlogging.cpp b/tests/auto/corelib/global/qlogging/tst_qlogging.cpp
index f7d8bda1905..35bd518b3aa 100644
--- a/tests/auto/corelib/global/qlogging/tst_qlogging.cpp
+++ b/tests/auto/corelib/global/qlogging/tst_qlogging.cpp
@@ -670,6 +670,22 @@ void tst_qmessagehandler::cleanupFuncinfo_data()
QTest::newRow("gcc_39")
<< "int TestClass1::operator>(int)"
<< "TestClass1::operator>";
+
+ QTest::newRow("objc_1")
+ << "-[SomeClass someMethod:withArguments:]"
+ << "-[SomeClass someMethod:withArguments:]";
+
+ QTest::newRow("objc_2")
+ << "+[SomeClass withClassMethod:withArguments:]"
+ << "+[SomeClass withClassMethod:withArguments:]";
+
+ QTest::newRow("objc_3")
+ << "-[SomeClass someMethodWithoutArguments]"
+ << "-[SomeClass someMethodWithoutArguments]";
+
+ QTest::newRow("objc_4")
+ << "__31-[SomeClass someMethodSchedulingBlock]_block_invoke"
+ << "__31-[SomeClass someMethodSchedulingBlock]_block_invoke";
}
#endif
diff --git a/tests/auto/corelib/io/qsettings/tst_qsettings.cpp b/tests/auto/corelib/io/qsettings/tst_qsettings.cpp
index 77a60997a62..3e68e4859fc 100644
--- a/tests/auto/corelib/io/qsettings/tst_qsettings.cpp
+++ b/tests/auto/corelib/io/qsettings/tst_qsettings.cpp
@@ -118,6 +118,7 @@ private slots:
void testUpdateRequestEvent();
void testThreadSafety();
void testEmptyData();
+ void testEmptyKey();
void testResourceFiles();
void testRegistryShortRootNames();
void trailingWhitespace();
@@ -2025,6 +2026,16 @@ void tst_QSettings::testEmptyData()
QFile::remove(filename);
}
+void tst_QSettings::testEmptyKey()
+{
+ QSettings settings;
+ QTest::ignoreMessage(QtWarningMsg, "QSettings::value: Empty key passed");
+ const QVariant value = settings.value(QString());
+ QCOMPARE(value, QVariant());
+ QTest::ignoreMessage(QtWarningMsg, "QSettings::setValue: Empty key passed");
+ settings.setValue(QString(), value);
+}
+
void tst_QSettings::testResourceFiles()
{
QSettings settings(":/resourcefile.ini", QSettings::IniFormat);
diff --git a/tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp b/tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp
index 05c4066cbdd..a35896283ab 100644
--- a/tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp
+++ b/tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp
@@ -1604,7 +1604,7 @@ void tst_QMetaType::automaticTemplateRegistration()
#endif // Q_COMPILER_VARIADIC_MACROS
-#define TEST_SMARTPOINTER(SMARTPOINTER, ELEMENT_TYPE, FLAG_TEST, FROMVARIANTFUNCTION) \
+#define TEST_OWNING_SMARTPOINTER(SMARTPOINTER, ELEMENT_TYPE, FLAG_TEST, FROMVARIANTFUNCTION) \
{ \
SMARTPOINTER < ELEMENT_TYPE > sp(new ELEMENT_TYPE); \
sp.data()->setObjectName("Test name"); \
@@ -1615,22 +1615,34 @@ void tst_QMetaType::automaticTemplateRegistration()
QCOMPARE(extractedPtr.data()->objectName(), sp.data()->objectName()); \
}
- TEST_SMARTPOINTER(QSharedPointer, QObject, SharedPointerToQObject, qSharedPointerFromVariant)
- TEST_SMARTPOINTER(QSharedPointer, QFile, SharedPointerToQObject, qSharedPointerFromVariant)
- TEST_SMARTPOINTER(QSharedPointer, QTemporaryFile, SharedPointerToQObject, qSharedPointerFromVariant)
- TEST_SMARTPOINTER(QSharedPointer, MyObject, SharedPointerToQObject, qSharedPointerFromVariant)
+ TEST_OWNING_SMARTPOINTER(QSharedPointer, QObject, SharedPointerToQObject, qSharedPointerFromVariant)
+ TEST_OWNING_SMARTPOINTER(QSharedPointer, QFile, SharedPointerToQObject, qSharedPointerFromVariant)
+ TEST_OWNING_SMARTPOINTER(QSharedPointer, QTemporaryFile, SharedPointerToQObject, qSharedPointerFromVariant)
+ TEST_OWNING_SMARTPOINTER(QSharedPointer, MyObject, SharedPointerToQObject, qSharedPointerFromVariant)
+#undef TEST_OWNING_SMARTPOINTER
- TEST_SMARTPOINTER(QWeakPointer, QObject, WeakPointerToQObject, qWeakPointerFromVariant)
- TEST_SMARTPOINTER(QWeakPointer, QFile, WeakPointerToQObject, qWeakPointerFromVariant)
- TEST_SMARTPOINTER(QWeakPointer, QTemporaryFile, WeakPointerToQObject, qWeakPointerFromVariant)
- TEST_SMARTPOINTER(QWeakPointer, MyObject, WeakPointerToQObject, qWeakPointerFromVariant)
+#define TEST_NONOWNING_SMARTPOINTER(SMARTPOINTER, ELEMENT_TYPE, FLAG_TEST, FROMVARIANTFUNCTION) \
+ { \
+ ELEMENT_TYPE elem; \
+ SMARTPOINTER < ELEMENT_TYPE > sp(&elem); \
+ sp.data()->setObjectName("Test name"); \
+ QVariant v = QVariant::fromValue(sp); \
+ QCOMPARE(v.typeName(), #SMARTPOINTER "<" #ELEMENT_TYPE ">"); \
+ QVERIFY(QMetaType::typeFlags(::qMetaTypeId<SMARTPOINTER < ELEMENT_TYPE > >()) & QMetaType::FLAG_TEST); \
+ SMARTPOINTER < QObject > extractedPtr = FROMVARIANTFUNCTION<QObject>(v); \
+ QCOMPARE(extractedPtr.data()->objectName(), sp.data()->objectName()); \
+ }
- TEST_SMARTPOINTER(QPointer, QObject, TrackingPointerToQObject, qPointerFromVariant)
- TEST_SMARTPOINTER(QPointer, QFile, TrackingPointerToQObject, qPointerFromVariant)
- TEST_SMARTPOINTER(QPointer, QTemporaryFile, TrackingPointerToQObject, qPointerFromVariant)
- TEST_SMARTPOINTER(QPointer, MyObject, TrackingPointerToQObject, qPointerFromVariant)
+ TEST_NONOWNING_SMARTPOINTER(QWeakPointer, QObject, WeakPointerToQObject, qWeakPointerFromVariant)
+ TEST_NONOWNING_SMARTPOINTER(QWeakPointer, QFile, WeakPointerToQObject, qWeakPointerFromVariant)
+ TEST_NONOWNING_SMARTPOINTER(QWeakPointer, QTemporaryFile, WeakPointerToQObject, qWeakPointerFromVariant)
+ TEST_NONOWNING_SMARTPOINTER(QWeakPointer, MyObject, WeakPointerToQObject, qWeakPointerFromVariant)
-#undef TEST_SMARTPOINTER
+ TEST_NONOWNING_SMARTPOINTER(QPointer, QObject, TrackingPointerToQObject, qPointerFromVariant)
+ TEST_NONOWNING_SMARTPOINTER(QPointer, QFile, TrackingPointerToQObject, qPointerFromVariant)
+ TEST_NONOWNING_SMARTPOINTER(QPointer, QTemporaryFile, TrackingPointerToQObject, qPointerFromVariant)
+ TEST_NONOWNING_SMARTPOINTER(QPointer, MyObject, TrackingPointerToQObject, qPointerFromVariant)
+#undef TEST_NONOWNING_SMARTPOINTER
}
template <typename T>
diff --git a/tests/auto/corelib/kernel/qmimedata/tst_qmimedata.cpp b/tests/auto/corelib/kernel/qmimedata/tst_qmimedata.cpp
index 1f1777f3b43..f4c267e3210 100644
--- a/tests/auto/corelib/kernel/qmimedata/tst_qmimedata.cpp
+++ b/tests/auto/corelib/kernel/qmimedata/tst_qmimedata.cpp
@@ -327,5 +327,5 @@ void tst_QMimeData::setUrls() const
QCOMPARE(mimeData.hasText(), false);
}
-QTEST_MAIN(tst_QMimeData)
+QTEST_APPLESS_MAIN(tst_QMimeData)
#include "tst_qmimedata.moc"
diff --git a/tests/auto/corelib/kernel/qpointer/tst_qpointer.cpp b/tests/auto/corelib/kernel/qpointer/tst_qpointer.cpp
index 09d5db14751..689b008551e 100644
--- a/tests/auto/corelib/kernel/qpointer/tst_qpointer.cpp
+++ b/tests/auto/corelib/kernel/qpointer/tst_qpointer.cpp
@@ -345,7 +345,8 @@ void tst_QPointer::threadSafety()
void tst_QPointer::qvariantCast()
{
- QPointer<QFile> tracking = new QFile;
+ QFile file;
+ QPointer<QFile> tracking = &file;
tracking->setObjectName("A test name");
QVariant v = QVariant::fromValue(tracking);
diff --git a/tests/auto/corelib/statemachine/qstate/tst_qstate.cpp b/tests/auto/corelib/statemachine/qstate/tst_qstate.cpp
index 182fa8b4611..820039b6a91 100644
--- a/tests/auto/corelib/statemachine/qstate/tst_qstate.cpp
+++ b/tests/auto/corelib/statemachine/qstate/tst_qstate.cpp
@@ -76,35 +76,35 @@ void tst_QState::assignProperty()
{
QStateMachine machine;
- QObject *object = new QObject();
- object->setProperty("fooBar", 10);
+ QObject object;
+ object.setProperty("fooBar", 10);
QState *s1 = new QState(&machine);
- s1->assignProperty(object, "fooBar", 20);
+ s1->assignProperty(&object, "fooBar", 20);
machine.setInitialState(s1);
machine.start();
QCoreApplication::processEvents();
- QCOMPARE(object->property("fooBar").toInt(), 20);
+ QCOMPARE(object.property("fooBar").toInt(), 20);
}
void tst_QState::assignPropertyTwice()
{
QStateMachine machine;
- QObject *object = new QObject();
- object->setProperty("fooBar", 10);
+ QObject object;
+ object.setProperty("fooBar", 10);
QState *s1 = new QState(&machine);
- s1->assignProperty(object, "fooBar", 20);
- s1->assignProperty(object, "fooBar", 30);
+ s1->assignProperty(&object, "fooBar", 20);
+ s1->assignProperty(&object, "fooBar", 30);
machine.setInitialState(s1);
machine.start();
QCoreApplication::processEvents();
- QCOMPARE(object->property("fooBar").toInt(), 30);
+ QCOMPARE(object.property("fooBar").toInt(), 30);
}
class EventTestTransition: public QAbstractTransition
diff --git a/tests/auto/corelib/thread/qthreadpool/tst_qthreadpool.cpp b/tests/auto/corelib/thread/qthreadpool/tst_qthreadpool.cpp
index f6bdb6c53bd..9c2c8bf12a3 100644
--- a/tests/auto/corelib/thread/qthreadpool/tst_qthreadpool.cpp
+++ b/tests/auto/corelib/thread/qthreadpool/tst_qthreadpool.cpp
@@ -906,11 +906,12 @@ void tst_QThreadPool::waitForDone()
void tst_QThreadPool::waitForDoneTimeout()
{
+ QMutex mutex;
class BlockedTask : public QRunnable
{
public:
- QMutex mutex;
- BlockedTask() { setAutoDelete(false); }
+ QMutex &mutex;
+ explicit BlockedTask(QMutex &m) : mutex(m) {}
void run()
{
@@ -922,11 +923,10 @@ void tst_QThreadPool::waitForDoneTimeout()
QThreadPool threadPool;
- BlockedTask *task = new BlockedTask;
- task->mutex.lock();
- threadPool.start(task);
+ mutex.lock();
+ threadPool.start(new BlockedTask(mutex));
QVERIFY(!threadPool.waitForDone(100));
- task->mutex.unlock();
+ mutex.unlock();
QVERIFY(threadPool.waitForDone(400));
}
diff --git a/tests/auto/corelib/tools/qsharedpointer/tst_qsharedpointer.cpp b/tests/auto/corelib/tools/qsharedpointer/tst_qsharedpointer.cpp
index 1fa434395ee..d5a628889cb 100644
--- a/tests/auto/corelib/tools/qsharedpointer/tst_qsharedpointer.cpp
+++ b/tests/auto/corelib/tools/qsharedpointer/tst_qsharedpointer.cpp
@@ -2112,7 +2112,8 @@ void tst_QSharedPointer::qvariantCast()
// Intentionally does not compile.
// QWeakPointer<int> sop = qWeakPointerFromVariant<int>(v);
- QWeakPointer<QFile> tracking = new QFile;
+ QFile file;
+ QWeakPointer<QFile> tracking = &file;
tracking.data()->setObjectName("A test name");
v = QVariant::fromValue(tracking);
diff --git a/tests/auto/corelib/tools/qstringref/tst_qstringref.cpp b/tests/auto/corelib/tools/qstringref/tst_qstringref.cpp
index a38707ef088..3ba901061ca 100644
--- a/tests/auto/corelib/tools/qstringref/tst_qstringref.cpp
+++ b/tests/auto/corelib/tools/qstringref/tst_qstringref.cpp
@@ -1870,9 +1870,9 @@ void tst_QStringRef::right()
QStringRef ref = originalString.rightRef(originalString.size() - 1);
QCOMPARE(ref.toString(), QLatin1String("OrginalString"));
- QCOMPARE(ref.right(ref.size() - 6).toString(), QLatin1String("String"));
+ QCOMPARE(ref.right(6).toString(), QLatin1String("String"));
QCOMPARE(ref.right(ref.size()).toString(), QLatin1String("OrginalString"));
- QCOMPARE(ref.right(0).toString(), QLatin1String("OrginalString"));
+ QCOMPARE(ref.right(0).toString(), QLatin1String(""));
QStringRef nullRef;
QVERIFY(nullRef.isNull());
diff --git a/tests/auto/gui/kernel/qclipboard/tst_qclipboard.cpp b/tests/auto/gui/kernel/qclipboard/tst_qclipboard.cpp
index 167e4b41bc0..a88f41f7b85 100644
--- a/tests/auto/gui/kernel/qclipboard/tst_qclipboard.cpp
+++ b/tests/auto/gui/kernel/qclipboard/tst_qclipboard.cpp
@@ -340,8 +340,10 @@ void tst_QClipboard::setMimeData()
data->setText("foo");
QGuiApplication::clipboard()->setMimeData(data, QClipboard::Clipboard);
- QGuiApplication::clipboard()->setMimeData(data, QClipboard::Selection);
- QGuiApplication::clipboard()->setMimeData(data, QClipboard::FindBuffer);
+ if (QGuiApplication::clipboard()->supportsSelection())
+ QGuiApplication::clipboard()->setMimeData(data, QClipboard::Selection);
+ if (QGuiApplication::clipboard()->supportsFindBuffer())
+ QGuiApplication::clipboard()->setMimeData(data, QClipboard::FindBuffer);
QSignalSpy spySelection(QGuiApplication::clipboard(), SIGNAL(selectionChanged()));
QSignalSpy spyData(QGuiApplication::clipboard(), SIGNAL(dataChanged()));
@@ -373,8 +375,10 @@ void tst_QClipboard::setMimeData()
data->setText("foo");
QGuiApplication::clipboard()->setMimeData(data, QClipboard::Clipboard);
- QGuiApplication::clipboard()->setMimeData(data, QClipboard::Selection);
- QGuiApplication::clipboard()->setMimeData(data, QClipboard::FindBuffer);
+ if (QGuiApplication::clipboard()->supportsSelection())
+ QGuiApplication::clipboard()->setMimeData(data, QClipboard::Selection);
+ if (QGuiApplication::clipboard()->supportsFindBuffer())
+ QGuiApplication::clipboard()->setMimeData(data, QClipboard::FindBuffer);
QMimeData *newData = new QMimeData;
newData->setText("bar");
@@ -385,8 +389,10 @@ void tst_QClipboard::setMimeData()
spyFindBuffer.clear();
QGuiApplication::clipboard()->setMimeData(newData, QClipboard::Clipboard);
- QGuiApplication::clipboard()->setMimeData(newData, QClipboard::Selection); // used to crash on X11
- QGuiApplication::clipboard()->setMimeData(newData, QClipboard::FindBuffer);
+ if (QGuiApplication::clipboard()->supportsSelection())
+ QGuiApplication::clipboard()->setMimeData(newData, QClipboard::Selection); // used to crash on X11
+ if (QGuiApplication::clipboard()->supportsFindBuffer())
+ QGuiApplication::clipboard()->setMimeData(newData, QClipboard::FindBuffer);
if (QGuiApplication::clipboard()->supportsSelection())
QCOMPARE(spySelection.count(), 1);
diff --git a/tests/auto/gui/kernel/qopenglwindow/tst_qopenglwindow.cpp b/tests/auto/gui/kernel/qopenglwindow/tst_qopenglwindow.cpp
index 7f571fba891..02e00afe505 100644
--- a/tests/auto/gui/kernel/qopenglwindow/tst_qopenglwindow.cpp
+++ b/tests/auto/gui/kernel/qopenglwindow/tst_qopenglwindow.cpp
@@ -116,8 +116,8 @@ void tst_QOpenGLWindow::basic()
QVERIFY(w.paintCount >= 1);
// Check that something has been drawn;
- QCOMPARE(w.img.size(), w.size());
- QVERIFY(w.img.pixel(5, 5) == qRgb(255, 0, 0));
+ QCOMPARE(w.img.size(), w.size() * w.devicePixelRatio());
+ QVERIFY(w.img.pixel(QPoint(5, 5) * w.devicePixelRatio()) == qRgb(255, 0, 0));
// Check that the viewport was properly set.
w.makeCurrent();
@@ -168,9 +168,9 @@ void tst_QOpenGLWindow::painter()
w.show();
QTest::qWaitForWindowExposed(&w);
- QCOMPARE(w.img.size(), w.size());
- QVERIFY(w.img.pixel(5, 5) == qRgb(0, 0, 255));
- QVERIFY(w.img.pixel(200, 5) == qRgb(255, 0, 0));
+ QCOMPARE(w.img.size(), w.size() * w.devicePixelRatio());
+ QVERIFY(w.img.pixel(QPoint(5, 5) * w.devicePixelRatio()) == qRgb(0, 0, 255));
+ QVERIFY(w.img.pixel(QPoint(200, 5) * w.devicePixelRatio()) == qRgb(255, 0, 0));
}
class PartialPainterWindow : public QOpenGLWindow
@@ -222,10 +222,10 @@ void tst_QOpenGLWindow::partial()
// Now since the painting went to an extra framebuffer, all the rects should
// be present since everything is preserved between the frames.
QImage img = w.grabFramebuffer();
- QCOMPARE(img.size(), w.size());
- QCOMPARE(img.pixel(5, 5), qRgb(0, 0, 255));
- QCOMPARE(img.pixel(15, 5), qRgb(0, 255, 0));
- QCOMPARE(img.pixel(25, 5), qRgb(0, 0, 255));
+ QCOMPARE(img.size(), w.size() * w.devicePixelRatio());
+ QCOMPARE(img.pixel(QPoint(5, 5) * w.devicePixelRatio()), qRgb(0, 0, 255));
+ QCOMPARE(img.pixel(QPoint(15, 5) * w.devicePixelRatio()), qRgb(0, 255, 0));
+ QCOMPARE(img.pixel(QPoint(25, 5) * w.devicePixelRatio()), qRgb(0, 0, 255));
}
class PaintUnderOverWindow : public QOpenGLWindow
diff --git a/tests/auto/network/kernel/kernel.pro b/tests/auto/network/kernel/kernel.pro
index 8594ad59326..bb13c7dd7d5 100644
--- a/tests/auto/network/kernel/kernel.pro
+++ b/tests/auto/network/kernel/kernel.pro
@@ -14,6 +14,9 @@ winrt: SUBDIRS -= \
qnetworkproxy \
qnetworkproxyfactory \
+osx: SUBDIRS -= \ # QTBUG-41847
+ qhostinfo \
+
!contains(QT_CONFIG, private_tests): SUBDIRS -= \
qauthenticator \
qhostinfo \
diff --git a/tests/auto/network/ssl/qsslcertificate/tst_qsslcertificate.cpp b/tests/auto/network/ssl/qsslcertificate/tst_qsslcertificate.cpp
index 67cbd5059fe..49ff1b48fec 100644
--- a/tests/auto/network/ssl/qsslcertificate/tst_qsslcertificate.cpp
+++ b/tests/auto/network/ssl/qsslcertificate/tst_qsslcertificate.cpp
@@ -70,6 +70,7 @@ public slots:
#ifndef QT_NO_SSL
private slots:
+ void hash();
void emptyConstructor();
void constructor_data();
void constructor();
@@ -164,6 +165,14 @@ void tst_QSslCertificate::cleanupTestCase()
#ifndef QT_NO_SSL
+void tst_QSslCertificate::hash()
+{
+ // mostly a compile-only test, to check that qHash(QSslCertificate) is found.
+ QSet<QSslCertificate> certs;
+ certs << QSslCertificate();
+ QCOMPARE(certs.size(), 1);
+}
+
static QByteArray readFile(const QString &absFilePath)
{
QFile file(absFilePath);
diff --git a/tests/auto/network/ssl/qsslerror/tst_qsslerror.cpp b/tests/auto/network/ssl/qsslerror/tst_qsslerror.cpp
index 58136f9a68f..7fd6dc82338 100644
--- a/tests/auto/network/ssl/qsslerror/tst_qsslerror.cpp
+++ b/tests/auto/network/ssl/qsslerror/tst_qsslerror.cpp
@@ -64,6 +64,7 @@ public:
#ifndef QT_NO_SSL
private slots:
void constructing();
+ void hash();
#endif
private:
@@ -79,6 +80,14 @@ void tst_QSslError::constructing()
QSslError error;
}
+void tst_QSslError::hash()
+{
+ // mostly a compile-only test, to check that qHash(QSslError) is found
+ QSet<QSslError> errors;
+ errors << QSslError();
+ QCOMPARE(errors.size(), 1);
+}
+
#endif // QT_NO_SSL
QTEST_MAIN(tst_QSslError)
diff --git a/tests/auto/other/compiler/tst_compiler.cpp b/tests/auto/other/compiler/tst_compiler.cpp
index 47345bfc438..8253a283f55 100644
--- a/tests/auto/other/compiler/tst_compiler.cpp
+++ b/tests/auto/other/compiler/tst_compiler.cpp
@@ -784,12 +784,19 @@ void tst_Compiler::cxx11_default_members()
#ifndef Q_COMPILER_DEFAULT_MEMBERS
QSKIP("Compiler does not support C++11 feature");
#else
- struct DefaultMembers
+ class DefaultMembers
{
+ protected:
DefaultMembers() = default;
+ public:
DefaultMembers(int) {}
};
- DefaultMembers dm;
+ class DefaultMembersChild: public DefaultMembers
+ {
+ public:
+ DefaultMembersChild():DefaultMembers() {};
+ };
+ DefaultMembersChild dm;
Q_UNUSED(dm);
#endif
}
@@ -799,9 +806,11 @@ void tst_Compiler::cxx11_delete_members()
#ifndef Q_COMPILER_DELETE_MEMBERS
QSKIP("Compiler does not support C++11 feature");
#else
- struct DeleteMembers
+ class DeleteMembers
{
+ protected:
DeleteMembers() = delete;
+ public:
DeleteMembers(const DeleteMembers &) = delete;
~DeleteMembers() = delete;
};
diff --git a/tests/auto/widgets/itemviews/qtableview/tst_qtableview.cpp b/tests/auto/widgets/itemviews/qtableview/tst_qtableview.cpp
index f5dfa5d6176..565eac2cbae 100644
--- a/tests/auto/widgets/itemviews/qtableview/tst_qtableview.cpp
+++ b/tests/auto/widgets/itemviews/qtableview/tst_qtableview.cpp
@@ -117,6 +117,9 @@ private slots:
void selectColumn_data();
void selectColumn();
+ void selectall_data();
+ void selectall();
+
void visualRect_data();
void visualRect();
@@ -1884,6 +1887,162 @@ void tst_QTableView::selectColumn()
QCOMPARE(view.selectionModel()->selectedIndexes().at(i).column(), column);
}
+void tst_QTableView::selectall_data()
+{
+ QTest::addColumn<int>("rowCount");
+ QTest::addColumn<int>("columnCount");
+ QTest::addColumn<int>("row");
+ QTest::addColumn<int>("column");
+ QTest::addColumn<int>("rowSpan");
+ QTest::addColumn<int>("columnSpan");
+ QTest::addColumn<int>("hideRow");
+ QTest::addColumn<int>("hideColumn");
+ QTest::addColumn<int>("moveRowFrom");
+ QTest::addColumn<int>("moveRowTo");
+ QTest::addColumn<int>("moveColumnFrom");
+ QTest::addColumn<int>("moveColumnTo");
+ QTest::addColumn<int>("rowHeight");
+ QTest::addColumn<int>("columnWidth");
+ QTest::addColumn<int>("selectedCount"); // ### make this more detailed
+
+ QTest::newRow("no span, no hidden, no moved")
+ << 10 << 10 // dim
+ << -1 << -1 // pos
+ << 1 << 1 // span
+ << -1 << -1 // hide
+ << -1 << -1 // move row
+ << -1 << -1 // move col
+ << 40 << 40 // cell size
+ << 100; // selected count
+
+ QTest::newRow("row span, no hidden, no moved")
+ << 10 << 10 // dim
+ << 1 << 1 // pos
+ << 2 << 1 // span
+ << -1 << -1 // hide
+ << -1 << -1 // move row
+ << -1 << -1 // move col
+ << 40 << 40 // cell size
+ << 99; // selected count
+
+ QTest::newRow("col span, no hidden, no moved")
+ << 10 << 10 // dim
+ << 1 << 1 // pos
+ << 1 << 2 // span
+ << -1 << -1 // hide
+ << -1 << -1 // move row
+ << -1 << -1 // move col
+ << 40 << 40 // cell size
+ << 99; // selected count
+
+ QTest::newRow("no span, row hidden, no moved")
+ << 10 << 10 // dim
+ << -1 << -1 // pos
+ << 1 << 1 // span
+ << 1 << -1 // hide
+ << -1 << -1 // move row
+ << -1 << -1 // move col
+ << 40 << 40 // cell size
+ << 90; // selected count
+
+ QTest::newRow("no span, col hidden, no moved")
+ << 10 << 10 // dim
+ << -1 << -1 // pos
+ << 1 << 1 // span
+ << -1 << 1 // hide
+ << -1 << -1 // move row
+ << -1 << -1 // move col
+ << 40 << 40 // cell size
+ << 90; // selected count
+
+ QTest::newRow("no span, no hidden, row moved")
+ << 10 << 10 // dim
+ << -1 << -1 // pos
+ << 1 << 1 // span
+ << -1 << -1 // hide
+ << 1 << 3 // move row
+ << -1 << -1 // move col
+ << 40 << 40 // cell size
+ << 100; // selected count
+
+ QTest::newRow("no span, no hidden, col moved")
+ << 10 << 10 // dim
+ << -1 << -1 // pos
+ << 1 << 1 // span
+ << -1 << -1 // hide
+ << -1 << -1 // move row
+ << 1 << 3 // move col
+ << 40 << 40 // cell size
+ << 100; // selected count
+}
+
+void QTest__keySequence(QWidget* widget, QKeySequence ks)
+{
+ for (int i=0; i<ks.count(); ++i)
+ {
+ Qt::Key key = Qt::Key(ks[i] & ~Qt::KeyboardModifierMask);
+ Qt::KeyboardModifiers modifiers = Qt::KeyboardModifiers(ks[i] & Qt::KeyboardModifierMask);
+ QTest::keyClick(widget, key, modifiers);
+ }
+}
+
+void tst_QTableView::selectall()
+{
+ QFETCH(int, rowCount);
+ QFETCH(int, columnCount);
+ QFETCH(int, row);
+ QFETCH(int, column);
+ QFETCH(int, rowSpan);
+ QFETCH(int, columnSpan);
+ QFETCH(int, hideRow);
+ QFETCH(int, hideColumn);
+ QFETCH(int, moveRowFrom);
+ QFETCH(int, moveRowTo);
+ QFETCH(int, moveColumnFrom);
+ QFETCH(int, moveColumnTo);
+ QFETCH(int, rowHeight);
+ QFETCH(int, columnWidth);
+ QFETCH(int, selectedCount);
+
+ QtTestTableModel model(rowCount, columnCount);
+
+ QtTestTableView view;
+ view.show();
+ view.setModel(&model);
+
+ view.setSpan(row, column, rowSpan, columnSpan);
+
+ view.hideRow(hideRow);
+ view.hideColumn(hideColumn);
+
+ view.verticalHeader()->moveSection(moveRowFrom, moveRowTo);
+ view.horizontalHeader()->moveSection(moveColumnFrom, moveColumnTo);
+
+ for (int r = 0; r < rowCount; ++r)
+ view.setRowHeight(r, rowHeight);
+ for (int c = 0; c < columnCount; ++c)
+ view.setColumnWidth(c, columnWidth);
+
+ // try slot first
+ view.clearSelection();
+ QCOMPARE(view.selectedIndexes().count(), 0);
+ view.selectAll();
+ QCOMPARE(view.selectedIndexes().count(), selectedCount);
+
+ // try by key sequence
+ view.clearSelection();
+ QCOMPARE(view.selectedIndexes().count(), 0);
+ QTest__keySequence(&view, QKeySequence(QKeySequence::SelectAll));
+ QCOMPARE(view.selectedIndexes().count(), selectedCount);
+
+ // check again with no selection mode
+ view.clearSelection();
+ view.setSelectionMode(QAbstractItemView::NoSelection);
+ QCOMPARE(view.selectedIndexes().count(), 0);
+ QTest__keySequence(&view, QKeySequence(QKeySequence::SelectAll));
+ QCOMPARE(view.selectedIndexes().count(), 0);
+}
+
void tst_QTableView::visualRect_data()
{
QTest::addColumn<int>("rowCount");
diff --git a/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp b/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp
index 34bb4cfdf64..ec3e8ece6ab 100644
--- a/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp
+++ b/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp
@@ -10274,6 +10274,7 @@ public slots:
QTimer::singleShot(100, this, SLOT(doMouseMoves()));
modal->exec();
delete modal;
+ modal = Q_NULLPTR;
}
void doMouseMoves()
diff --git a/tests/manual/transientwindow/mainwindow.cpp b/tests/manual/transientwindow/mainwindow.cpp
index 62deb14bc42..436e30c5696 100644
--- a/tests/manual/transientwindow/mainwindow.cpp
+++ b/tests/manual/transientwindow/mainwindow.cpp
@@ -53,6 +53,7 @@ void MainWindow::toggleVisible()
m_window->setTransientParent(windowHandle());
m_window->setMinimumSize(QSize(200, 100));
m_window->setTitle("Transient Window");
+ m_window->setFlags(Qt::Dialog);
}
m_window->setVisible(!m_window->isVisible());
}